[open-ils-commits] [GIT] Evergreen ILS branch master updated. 05dcc80a8a66ada38cba56704c6bca6f34708914

Evergreen Git git at git.evergreen-ils.org
Mon Jun 19 10:22:06 EDT 2017


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  05dcc80a8a66ada38cba56704c6bca6f34708914 (commit)
      from  c1ecb3515503eef49debfe6e30e5df2548cb254a (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 05dcc80a8a66ada38cba56704c6bca6f34708914
Author: Jason Etheridge <jason at equinoxinitiative.org>
Date:   Fri Jun 2 12:59:24 2017 -0400

    LP#1616980 webstaff: protect "magic statuses" when editing copies
    
    This patch fixes a bug where the web staff volume/copy editor
    could be used to put items in or out of the following status:
    
    1 - Checked out
    3 - Lost
    6 - In transit
    8 - On holds shelf
    16 - Long Overdue
    18 - Canceled Transit
    
    To test
    -------
    1. Choose to "Edit Items" on an Available copy.
    2. Status field is fully editable. Click to open the dropdown
    3. Click "Checked out"
    4. Click "Save & Exit"
    5. Result is that the item status changes to 'checked out',
       which should not happen.
    6. Choose to "Edit Items" on an Checked out copy.
    7. Status field is fully editable. Click to open the dropdown
    8. Click "Available"
    9. Click "Save & Exit"
    10. Result is that the item status changes to 'available'.
    11. Apply the patch and repeat steps 1-10. This time, the magic
        status are marked as disabled in the copy status selector.
        If the item is already in one of the magic statuses, if the
        user attempts to change the status, the interface will appear
        to allow it, but the change will be silently ignored.
    
    Signed-off-by: Jason Etheridge <jason at equinoxinitiative.org>
    Signed-off-by: Andrea Neiman <abneiman at equinoxinitiative.org>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
index e96d543..0d61a68 100644
--- a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
+++ b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
@@ -116,7 +116,7 @@
                 <div class="col-md-6" ng-class="{'bg-success': working.status !== undefined}">
                     <select class="form-control"
                         ng-disabled="!defaults.attributes.status" ng-model="working.status"
-                        ng-options="s.id() as s.name() for s in status_list">
+                        ng-options="s.id() as s.name() disable when magic_status_list.indexOf(s.id(),0) > -1 for s in status_list">
                     </select>
                 </div>
             </div>
diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js
index 23bd2e8..def7cdc 100644
--- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js
+++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js
@@ -151,6 +151,18 @@ function(egCore , $q) {
 
     };
 
+    service.get_magic_statuses = function() {
+        /* TODO: make these more configurable per lp1616170 */
+        return $q.when([
+             1  /* Checked out */
+            ,3  /* Lost */
+            ,6  /* In transit */
+            ,8  /* On holds shelf */
+            ,16 /* Long overdue */
+            ,18 /* Canceled Transit */
+        ]);
+    }
+
     service.get_statuses = function() {
         if (egCore.env.ccs)
             return $q.when(egCore.env.ccs.list);
@@ -925,7 +937,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
         return true;
     }
 
-    createSimpleUpdateWatcher = function (field) {
+    createSimpleUpdateWatcher = function (field,exclude_copies_with_one_of_these_values) {
         return $scope.$watch('working.' + field, function () {
             var newval = $scope.working[field];
 
@@ -944,6 +956,10 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                     angular.forEach(
                         $scope.workingGridControls.selectedItems(),
                         function (cp) {
+                            if (exclude_copies_with_one_of_these_values
+                                && exclude_copies_with_one_of_these_values.indexOf(cp[field](),0) > -1) {
+                                return;
+                            }
                             if (cp[field]() !== newval) {
                                 cp[field](newval);
                                 cp.ischanged(1);
@@ -1478,10 +1494,13 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
         createSimpleUpdateWatcher('location');
 
         $scope.status_list = [];
+        itemSvc.get_magic_statuses().then(function(list){
+            $scope.magic_status_list = list;
+            createSimpleUpdateWatcher('status',$scope.magic_status_list);
+        });
         itemSvc.get_statuses().then(function(list){
             $scope.status_list = list;
         });
-        createSimpleUpdateWatcher('status');
 
         $scope.circ_modifier_list = [];
         itemSvc.get_circ_mods().then(function(list){
@@ -1909,6 +1928,9 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                 });
             
                 $scope.status_list = [];
+                itemSvc.get_magic_statuses().then(function(list){
+                    $scope.magic_status_list = list;
+                });
                 itemSvc.get_statuses().then(function(list){
                     $scope.status_list = list;
                 });

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

Summary of changes:
 .../templates/staff/cat/volcopy/t_attr_edit.tt2    |    2 +-
 .../web/js/ui/default/staff/cat/volcopy/app.js     |   26 ++++++++++++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list