webstaff: fix Owning Lib for new Serials Templates
authorJason Etheridge <jason@esilibrary.com>
Thu, 18 May 2017 18:06:08 +0000 (14:06 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 30 May 2017 16:06:46 +0000 (12:06 -0400)
instead of using the workstation lib, use the library from the list filter

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/web/js/ui/default/staff/admin/serials/app.js

index a1f67ad..1837a33 100644 (file)
@@ -33,9 +33,9 @@ function(egCore , $q , $uibModal , ngToast ) {
     var service = {
     };
 
-    service.create_or_edit_template = function(id,cb) {
+    service.create_or_edit_template = function(id,ou,cb) {
         $uibModal.open({
-            template: '<eg-serials-template template_id="' + id + '"></eg-serials-template>',
+            template: '<eg-serials-template template_id="' + id + '" owning_lib="' + ou + '"></eg-serials-template>',
             controller:
                    ['sharedScope','$uibModalInstance',
             function(sharedScope , $uibModalInstance ) {
@@ -196,10 +196,10 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
 
     $scope.grid_actions = {
         create_template : function() {
-            templateSvc.create_or_edit_template(null,refresh_page);
+            templateSvc.create_or_edit_template(null,$scope.context_ou.id(),refresh_page);
         },
         edit_template : function(items) {
-            templateSvc.create_or_edit_template(items[0].id,refresh_page);
+            templateSvc.create_or_edit_template(items[0].id,$scope.context_ou.id(),refresh_page);
         },
         delete_template : function(items) {
             var promises = [];
@@ -213,7 +213,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
     }
     $scope.grid_controls = {
         activateItem : function(item) {
-            templateSvc.create_or_edit_template(item.id,refresh_page);
+            templateSvc.create_or_edit_template(item.id,$scope.context_ou.id(),refresh_page);
         },
         setQuery : function(x) { return x || current_query(); },
         setSort : function() { return ['name','id'] }
@@ -246,6 +246,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
         template: '<div ng-include="'+"'/eg/staff/admin/serials/t_attr_edit'"+'"></div>',
         scope: {
             templateId: '=',
+             owningLib: '='
         },
         controller : ['$scope','$q','$window','itemSvc','egCore','ngToast','sharedScope',
             function ( $scope , $q , $window , itemSvc , egCore , ngToast , sharedScope ) {
@@ -392,7 +393,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                         console.log('create');
                         act_obj.isnew('t');
                         act_obj.creator( egCore.auth.user().id() );
-                        act_obj.owning_lib( egCore.auth.user().ws_ou() );
+                        act_obj.owning_lib( $scope.owningLib );
                         act_obj.create_date( new Date() );
                     }
                     var some_failure = false;