[open-ils-commits] [GIT] Evergreen ILS branch rel_3_0 updated. afb1cc861077980655df372ec84975d7dff98b1e

Evergreen Git git at git.evergreen-ils.org
Wed Sep 5 14:19:39 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, rel_3_0 has been updated
       via  afb1cc861077980655df372ec84975d7dff98b1e (commit)
      from  8a8597148b8574e357472f5ef259300b0023ff79 (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 afb1cc861077980655df372ec84975d7dff98b1e
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 a504861..9238155 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
@@ -671,7 +671,7 @@ angular.module('egCoreMod')
             card.active = card.active == 't';
             if (card.id == patron.card.id) {
                 patron.card = card;
-                card._primary = 'on';
+                card._primary = true;
             }
         });
 
@@ -719,7 +719,7 @@ angular.module('egCoreMod')
             id : service.virt_id--,
             isnew : true,
             active : true,
-            _primary : 'on'
+            _primary : true
         };
 
         var user = {
@@ -827,7 +827,7 @@ angular.module('egCoreMod')
                 barcode : cuser.cards[0].barcode(),
                 isnew : true,
                 active : true,
-                _primary : 'on'
+                _primary : true
             };
 
             user.cards.push(user.card);
@@ -1514,10 +1514,15 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
         $uibModal.open({
             templateUrl: './circ/patron/t_patron_cards_dialog',
             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() }
@@ -1529,15 +1534,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