From d2d4840bf05037bdd5e5cc730ef50316228e091e Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 2 Jun 2017 17:10:54 -0400 Subject: [PATCH] webstaff: make iss holding_type and adhoc orthogonal concepts Signed-off-by: Galen Charlton --- .../src/templates/staff/serials/t_holding_code_dialog.tt2 | 14 +++++++++++--- .../ui/default/staff/serials/directives/view-items-grid.js | 8 ++++---- Open-ILS/web/js/ui/default/staff/serials/services/core.js | 14 ++++++++++---- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/templates/staff/serials/t_holding_code_dialog.tt2 b/Open-ILS/src/templates/staff/serials/t_holding_code_dialog.tt2 index 60bd63671f..f792a9c404 100644 --- a/Open-ILS/src/templates/staff/serials/t_holding_code_dialog.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_holding_code_dialog.tt2 @@ -20,13 +20,21 @@ +
+
+ [% l('Ad hoc issue?') %] +
+
+ +
+
-
+
[% l('Issuance Label') %] @@ -37,7 +45,7 @@
-
+

[% l('Enumeration labels') %]

diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js b/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js index 9273beb688..d7250fc6f2 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js @@ -96,9 +96,9 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , orderByF title : egCore.strings.SERIALS_EDIT_SISS_HC, curr_iss : egCore.idl.fromHash('siss',item.issuance), label : item.issuance.label, - type : item.issuance.type ? item.issuance.type : 'adhoc' + type : item.issuance.type ? item.issuance.type : 'basic' }).then(function(result) { - if (result.type != 'adhoc') { + if (result.adhoc) { item.issuance.holding_code = JSON.stringify(result.holding_code); item.issuance.holding_type = result.type; } else { @@ -171,16 +171,16 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , orderByF $scope.following_issuance = function (items) { return egSerialsCoreSvc.new_holding_code({ title : egCore.strings.SERIALS_ISSUANCE_ADD, - type : 'adhoc', prev_iss : egCore.idl.fromHash('siss',items[0].issuance) }).then(function(hc) { - if (hc.type == 'adhoc') { + if (hc.adhoc) { var new_iss = new egCore.idl.siss(); new_iss.creator( egCore.auth.user().id() ); new_iss.editor( egCore.auth.user().id() ); new_iss.date_published( hc.date.toISOString() ); new_iss.subscription( $scope.ssubId ); new_iss.label( hc.label ); + new_iss.holding_type( hc.type ); return egCore.pcrud.create(new_iss).then(function(issuance) { var new_item = new egCore.idl.sitem(); diff --git a/Open-ILS/web/js/ui/default/staff/serials/services/core.js b/Open-ILS/web/js/ui/default/staff/serials/services/core.js index c3ecdfaf24..82c6e1c51c 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/services/core.js +++ b/Open-ILS/web/js/ui/default/staff/serials/services/core.js @@ -296,13 +296,14 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm var date = args.date; var prev_iss = args.prev_iss; var curr_iss = args.curr_iss; + var adhoc = false; var link = '1.1'; var sub = service.get_ssub(service.subId); if (!sub) return args; var scap; - if (prev_iss) { // we're predicting + if (prev_iss && prev_iss.holding_code()) { // we're predicting var old_link_parts = JSON.parse(prev_iss.holding_code())[3].split('.'); var olink = old_link_parts[0]; var oseq = parseInt(old_link_parts[1]) + 1; @@ -329,6 +330,9 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm }); if (angular.isArray(tmp) && tmp[0]) scap = tmp[0]; } + if (!curr_iss.holding_code()) { + adhoc = true; + } date = new Date(curr_iss.date_published()); } else { @@ -418,7 +422,8 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm enums : enums, chrons : chrons, others : others, - freq : freq + freq : freq, + adhoc : adhoc }; } @@ -442,7 +447,8 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm $scope.save_label = options.save_label; $scope.pubdate = options.date; $scope.type = options.type || 'basic'; - $scope.args = {}; + $scope.args = { adhoc : false }; + if (options.adhoc) $scope.args.adhoc = true; function refresh (n,o) { if (n && o && n !== o) { @@ -450,7 +456,7 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm type : $scope.type, date : $scope.pubdate, prev_iss : options.prev_iss, - curr_iss : options.curr_iss + curr_iss : options.curr_iss, }); if ($scope.args.type && $scope.type != $scope.args.type) -- 2.11.0