LP#1743608 Replace barcode discards NULL/accidental entries
authorBill Erickson <berickxx@gmail.com>
Tue, 23 Jan 2018 22:56:51 +0000 (17:56 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 24 Jan 2018 00:30:40 +0000 (19:30 -0500)
When replacing a patron's barcode in the patron editor, discard any
previous replacement attempts done in the current edit session.  This
prevents cases where secondary, etc. replacement cards are accidentally
created or NULL cards that result in ugly error messages.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js

index 6b9780f..4a00507 100644 (file)
@@ -1458,6 +1458,11 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
         new_card.active = true;
         new_card._primary = 'on';
         $scope.patron.card = new_card;
+
+        // Remove any previous attempts to replace the card, since they
+        // may be incomplete or created by accident.
+        $scope.patron.cards =
+            $scope.patron.cards.filter(function(c) {return !c.isnew})
         $scope.patron.cards.push(new_card);
     }