// event types manually overridden, which should always be
// overridden for checkouts to this patron for this instance of
// the interface.
- checkout_overrides : {},
+ checkout_overrides : {},
+ //holds the searched barcode
+ search_barcode : null,
};
// when we change the default patron, we need to clear out any
service.alertsShown = false;
service.patronExpired = false;
service.patronExpiresSoon = false;
- service.retrievedWithInactive = false;
service.invalidAddresses = false;
}
service.resetPatronLists(); // initialize
return $q.when(fail);
}
-
+ //resolves to true if the patron was fetched with an inactive card
+ service.fetchedWithInactiveCard = function() {
+ var bc = service.search_barcode
+ var cards = service.current.cards();
+ var card = cards.filter(function(c) { return c.barcode() == bc })[0];
+ return (card && card.active() == 'f');
+ }
// resolves to true if there is any aspect of the patron account
// which should produce a message in the alerts panel
service.checkAlerts = function() {
}
// see if the user was retrieved with an inactive card
- if (bc = $location.search().card) {
- var card = p.cards().filter(
- function(c) { return c.barcode() == bc })[0];
-
- if (card && card.active() == 'f') {
- service.hasAlerts = true;
- service.retrievedWithInactive = true;
- }
+ if(service.fetchedWithInactiveCard()){
+ service.hasAlerts = true;
}
// regardless of whether we know of alerts, we still need
$location
.path('/circ/patron/' + user_id + '/checkout')
.search('card', $scope.args.barcode);
+ patronSvc.search_barcode = $scope.args.barcode;
}
// create an opt-in=yes response for the loaded user
delete patronSvc.urlSearch;
} else {
-
+ patronSvc.search_barcode = $scope.searchArgs.card;
+
var search = compileSearch($scope.searchArgs);
if (Object.keys(search) == 0) return $q.when();
.then(function() {
$scope.patronExpired = patronSvc.patronExpired;
$scope.patronExpiresSoon = patronSvc.patronExpiresSoon;
- $scope.retrievedWithInactive = patronSvc.retrievedWithInactive;
+ $scope.retrievedWithInactive = patronSvc.fetchedWithInactiveCard();
$scope.invalidAddresses = patronSvc.invalidAddresses;
});