webstaff: serials Receiving Template selector
authorJason Etheridge <jason@esilibrary.com>
Tue, 16 May 2017 13:15:28 +0000 (09:15 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 30 May 2017 16:06:46 +0000 (12:06 -0400)
under Manage Subscriptions

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/src/templates/staff/serials/t_subscription_manager.tt2
Open-ILS/web/js/ui/default/staff/serials/directives/subscription_manager.js
Open-ILS/web/js/ui/default/staff/serials/services/core.js

index d0f2c28..b0dcbf8 100644 (file)
           <option value="chron">[% l('Chronological') %]</option>
           <option value="enum" >[% l('Enumeration') %]</option>
         </select>
+        <label>[% l('Receiving Template') %]</label>
+        <select ng-model="sdist.receive_unit_template"
+            ng-options="t.id() as t.name() for t in receiving_templates[sdist.holding_lib.id()]">
+            <option value=""></option>
+        </select>
       </div>
       <div class="col-md-2">
         <button class="btn btn-sm btn-info" ng-click="add_stream(sdist)">[% l('Add copy stream') %]</button>
@@ -67,8 +72,6 @@
     grid-controls="distStreamGridControls"
     persist-key="serials.dist_stream_grid">
 
-    <eg-grid-action handler="apply_receiving_template"
-      label="[% l('Apply Receiving Template') %]"></eg-grid-action>
     <eg-grid-action handler="apply_binding_template"
       label="[% l('Apply Binding Template') %]"></eg-grid-action>
     <eg-grid-action handler="additional_routing" disabled="need_one_selected"
     <eg-grid-field label="[% l('End Date') %]" path="end_date" datatype="timestamp" visible></eg-grid-field>
     <eg-grid-field label="[% l('Route To') %]" path="sstr.routing_label" visible></eg-grid-field>
     <eg-grid-field label="[% l('Additional Routing') %]" path="sstr.additional_routing" visible></eg-grid-field>
-    <eg-grid-field label="[% l('Receiving Template') %]" path="sdist.receive_unit_template.name" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Receiving Template') %]" path="sdist.receive_unit_template"></eg-grid-field>
     <eg-grid-field label="[% l('MFHD ID') %]" path="sdist.record_entry" visible></eg-grid-field>
     <eg-grid-field label="[% l('Summary Display') %]" path="sdist.summary_method" visible></eg-grid-field>
     <eg-grid-field label="[% l('Receiving Call Number') %]" path="sdist.receive_call_number.label"></eg-grid-field>
     <eg-grid-field label="[% l('Binding Call Number') %]" path="sdist.bind_call_number.label"></eg-grid-field>
-    <eg-grid-field label="[% l('Binding Template') %]" path="sdist.bind_unit_template.name"></eg-grid-field>
+    <eg-grid-field label="[% l('Binding Template') %]" path="sdist.bind_unit_template"></eg-grid-field>
     <eg-grid-field label="[% l('Unit Label Prefix') %]" path="sdist.unit_label_prefix"></eg-grid-field>
     <eg-grid-field label="[% l('Unit Label Suffix') %]" path="sdist.unit_label_suffix"></eg-grid-field>
     <eg-grid-field label="[% l('Display Grouping') %]" path="sdist.display_grouping"></eg-grid-field>
index b7f8868..50464f4 100644 (file)
@@ -39,6 +39,19 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
         return true;
     };
 
+    $scope.receiving_templates = {};
+    var promises = [];
+    angular.forEach(egCore.org.list(), function(org) {
+        promises.push(
+            egSerialsCoreSvc.fetch_templates(org.id()).then(function(list){
+                $scope.receiving_templates[org.id()] = list;
+            })
+        );
+    });
+    $q.all(promises).then(function() {
+        //console.log('finis',$scope.receiving_templates);
+    });
+
     $scope.add_subscription = function() {
         var new_ssub = egCore.idl.toTypedHash(new egCore.idl.ssub());
         new_ssub._isnew = true;
index ca36f81..073fd3a 100644 (file)
@@ -109,8 +109,8 @@ function(egCore , orderByFilter , $q , $filter , $uibModal) {
                 flesh_fields : {
                     'ssub'  : ['owning_lib','distributions', 'scaps', 'notes'],
                     'sdist' : [ 'record_entry','holding_lib',
-                                'receive_call_number','receive_unit_template',
-                                'bind_call_number','bind_unit_template',
+                                'receive_call_number',
+                                'bind_call_number',
                                 'streams','notes'],
                     'sstr'  : ['routing_list_users']
                 }
@@ -542,5 +542,12 @@ function(egCore , orderByFilter , $q , $filter , $uibModal) {
         });
     }
 
+    service.fetch_templates = function(org) {
+        return egCore.pcrud.search('act',
+            {owning_lib : egCore.org.fullPath(org, true)},
+            {order_by : { act : 'name' }}, {atomic : true}
+        );
+    };
+
     return service;
 }]);