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>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
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);
}