[open-ils-commits] [GIT] Evergreen ILS branch master updated. 1c3b4a9fac28e1e49234837debb275a8665abb40

Evergreen Git git at git.evergreen-ils.org
Fri Sep 21 11:18:57 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  1c3b4a9fac28e1e49234837debb275a8665abb40 (commit)
      from  437e7f826a9a36be2db65f96ad6862c9bea1094d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1c3b4a9fac28e1e49234837debb275a8665abb40
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Thu Sep 20 18:26:47 2018 -0400

    LP#1745427: account for change in prediction patterns
    
    This patch fixes a bug in the web staff client where changing
    the active prediction pattern for a subscription would not
    reset the base issue when predicting the next run of issues.
    
    To test
    -------
    1. Set up a subscription in the web staff client with a prediction
       pattern (e.g., monthly).  Predict some issues.
    2. Create/select a new prediction pattern for a new publishing schedule,
       e.g., quarterly.
    3. Activate the new pattern and deactivate the old pattern.
    4. Click Predict New Issues.
    5. Enter in the new publication date/enumerations/chronology as needed.
    6. Enter a prediction count and select Save. Note that new issues
       appear to be based on the previous pattern.
    7. Apply the patch, delete the issues created in step 6, then repeat
       steps 4-6.  This time, new issues should be created using the new
       prediction pattern.
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

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 ccbcbb5..42e76dc 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
@@ -316,6 +316,7 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm
         if (!sub) return args;
 
         var scap;
+        var pattern_changed = false;
         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];
@@ -327,9 +328,14 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm
 
             if (prev_iss.caption_and_pattern()) {
                 var tmp = sub.scaps().filter(function (s) {
-                    return (s.id() == prev_iss.caption_and_pattern());
+                    return (s.id() == prev_iss.caption_and_pattern() && s.active() == 't');
                 });
-                if (angular.isArray(tmp) && tmp[0]) scap = tmp[0];
+                if (angular.isArray(tmp) && tmp[0]) {
+                    scap = tmp[0];
+                } else {
+                    // pattern associated with last issue must no longer be active
+                    pattern_changed = true;
+                }
             }
 
             date = new Date(prev_iss.date_published());
@@ -379,7 +385,7 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm
         var freq_index = pat.indexOf('w');
         if (freq_index > -1) {
             freq = pat[freq_index + 1];
-            if (prev_iss) {
+            if (prev_iss && !args.pattern_changed) {
                 date = new Date(
                     date.getTime() + service.freq_offset[freq]
                 );
@@ -448,7 +454,8 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm
             chrons       : chrons,
             others       : others,
             freq         : freq,
-            adhoc        : adhoc
+            adhoc        : adhoc,
+            pattern_changed : pattern_changed
         };
     }
 
@@ -1173,7 +1180,9 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm
             }).then(function(hc) {
     
                 var base_iss;
-                if (!lastItem) {
+                var include_base_iss = 0;
+                if (!lastItem || hc.pattern_changed) {
+                    include_base_iss = 1;
                     base_iss = new egCore.idl.siss();
                     base_iss.creator( egCore.auth.user().id() );
                     base_iss.editor( egCore.auth.user().id() );
@@ -1183,7 +1192,7 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm
                     base_iss.holding_code( JSON.stringify(hc.holding_code) );
                     base_iss.holding_type( hc.type );
                 }
-    
+
                 // if we're predicting without a preexisting holding, reduce the count
                 if (!lastItem) hc.count--;
     
@@ -1192,7 +1201,7 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm
                     'open-ils.serial.make_predictions',
                     egCore.auth.token(),
                     { ssub_id : mySsubId,
-                      include_base_issuance : lastItem ? 0 : 1,
+                      include_base_issuance : include_base_iss,
                       num_to_predict : hc.count,
                       base_issuance : base_iss || lastItem
                     }

-----------------------------------------------------------------------

Summary of changes:
 .../js/ui/default/staff/serials/services/core.js   |   23 +++++++++++++------
 1 files changed, 16 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list