[open-ils-commits] [GIT] Evergreen ILS branch master updated. 90c716e3bd4be9c449a9e5d71849abd8d4f07e4f

Evergreen Git git at git.evergreen-ils.org
Wed Sep 5 14:17:48 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  90c716e3bd4be9c449a9e5d71849abd8d4f07e4f (commit)
      from  55f5d3cd9e7bffbad8856b7328280b23eae0a0b8 (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 90c716e3bd4be9c449a9e5d71849abd8d4f07e4f
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Wed Sep 5 10:56:43 2018 -0400

    LP#1781235: fix changing primary user barcode in web client
    
    This patch fixes a bug where the patron card dialog would
    not allow the user to change the primary barcode under certain
    circumstances. The fix is to ensure that the radio buttons
    controlling the selection of the primary card are bound to
    exactly one scope variable; otherwise, the /last/ barcode in the
    list that had a primary value set after user interaction would
    be the winner.
    
    To test
    -------
    [1] Use the 'replace barcode' feature in the patron editor to
        create a test patron with 3 barcodes:
    
        - barcode A
        - barcode B
        - barcode C (which as last created, would be primary)
    
    [2] Attempt to make barcode A the primary barcode again using
        the 'See All' patron card dialog in the patron editor.
    [3] Note that the change of primary barcode doesn't stick
        upon saving the patron record.
    [4] Apply the patch and repeat steps 1-3. This time, the
        primary barcode should be changed as expected.
    [5] Verify that other patron edit actions and registering a
        new patron record continue to work as expected.
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: John Amundson <jamundson at cwmars.org>
    Signed-off-by: Jason Stephenson <jason at sigio.com>

diff --git a/Open-ILS/src/templates/staff/circ/patron/t_patron_cards_dialog.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_patron_cards_dialog.tt2
index 5ba4652..b171d71 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_patron_cards_dialog.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_patron_cards_dialog.tt2
@@ -23,8 +23,9 @@
             ng-disabled="!perms.UPDATE_PATRON_ACTIVE_CARD"/>
         </div>
         <div class="col-md-4">
-          <input type='radio' name='primary' value='on' 
-            ng-model='card._primary'
+          <input type='radio' name='primary'
+            ng-model='args.primary_barcode'
+            ng-value='card.id'
             ng-disabled="!perms.UPDATE_PATRON_PRIMARY_CARD"/>
         </div>
       </div>
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index 9f6dbeb..30f2a63 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -754,7 +754,7 @@ angular.module('egCoreMod')
             card.active = card.active == 't';
             if (card.id == patron.card.id) {
                 patron.card = card;
-                card._primary = 'on';
+                card._primary = true;
             }
         });
 
@@ -802,7 +802,7 @@ angular.module('egCoreMod')
             id : service.virt_id--,
             isnew : true,
             active : true,
-            _primary : 'on'
+            _primary : true
         };
 
         var user = {
@@ -910,7 +910,7 @@ angular.module('egCoreMod')
                 barcode : cuser.cards[0].barcode(),
                 isnew : true,
                 active : true,
-                _primary : 'on'
+                _primary : true
             };
 
             user.cards.push(user.card);
@@ -1625,10 +1625,15 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
             templateUrl: './circ/patron/t_patron_cards_dialog',
             backdrop: 'static',
             controller: 
-                   ['$scope','$uibModalInstance','cards','perms',
-            function($scope , $uibModalInstance , cards , perms) {
+                   ['$scope','$uibModalInstance','cards','perms','patron',
+            function($scope , $uibModalInstance , cards , perms , patron) {
                 // scope here is the modal-level scope
-                $scope.args = {cards : cards};
+                $scope.args = {cards : cards, primary_barcode : null};
+                angular.forEach(cards, function(card) {
+                    if (card.id == patron.card.id) {
+                        $scope.args.primary_barcode = card.id;
+                    }
+                });
                 $scope.perms = perms;
                 $scope.ok = function() { $uibModalInstance.close($scope.args) }
                 $scope.cancel = function () { $uibModalInstance.dismiss() }
@@ -1640,15 +1645,20 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
                 },
                 perms : function() {
                     return $scope.perms;
+                },
+                patron : function() {
+                    return $scope.patron;
                 }
             }
         }).result.then(
             function(args) {
                 angular.forEach(args.cards, function(card) {
                     card.ischanged = true; // assume cards need updating, OK?
-                    if (card._primary == 'on' && 
-                        card.id != $scope.patron.card.id) {
+                    if (card.id == args.primary_barcode) {
                         $scope.patron.card = card;
+                        card._primary = true;
+                    } else {
+                        card._primary = false;
                     }
                 });
             }

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

Summary of changes:
 .../staff/circ/patron/t_patron_cards_dialog.tt2    |    5 ++-
 .../web/js/ui/default/staff/circ/patron/regctl.js  |   26 +++++++++++++------
 2 files changed, 21 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list