return egCore.org.settings([
'opac.barcode_regex',
'circ.selfcheck.patron_login_timeout',
- 'circ.selfcheck.auto_override_checkout_events',
+ 'circ.selfcheck.auto_override_checkout_events', // TODO
'circ.selfcheck.patron_password_required',
- 'circ.checkout_auto_renew_age',
- 'circ.selfcheck.workstation_required',
- 'circ.selfcheck.alert.popup',
- 'circ.selfcheck.alert.sound',
- 'credit.payments.allow',
- 'circ.selfcheck.block_checkout_on_copy_status'
+ 'circ.checkout_auto_renew_age', // TODO
+ // TODO: Document workstations universally required
+ // 'circ.selfcheck.workstation_required',
+ 'circ.selfcheck.alert.popup', // TODO
+ 'circ.selfcheck.alert.sound', // TODO
+ 'credit.payments.allow', // TODO
+ // TODO: should hiding negative fines affect the "total owed" display?
+ 'circ.selfcheck.hide_negatve_fines',
+ 'circ.selfcheck.block_checkout_on_copy_status' // TODO
]).then(function(settings) {
egCore.env.aous = settings;
});
total_circ_count : 0,
ready_hold_count : 0,
total_hold_count : 0,
+ total_owed_count : 0
};
- service.get_counts = function() {
+ // patron_id is set in cases where the patron has not yet been fetched.
+ service.set_user_stats = function(patron_id) {
+ if (!patron_id) patron_id = service.patron.id();
+ return egCore.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.user.opac.vital_stats.authoritative',
+ egCore.auth.token(), patron_id
+ ).then(
+ function(stats) {
+ service.ready_hold_count = Number(stats.holds.ready);
+ service.total_hold_count = Number(stats.holds.total);
+ service.total_owed_count = Number(stats.fines.balance_owed);
+ service.total_circ_count = Number(stats.checkouts.overdue) +
+ Number(stats.checkouts.out);
+ }
+ );
}
// called with each path load
// If the patron choses no action from the above dialog,
// force a logout after the configured amount of time.
+ var timeout = egCore.env.aous['circ.selfcheck.patron_login_timeout'];
service.login_warning_timer = $timeout(
service.logout_patron, service.login_timeout_warning
);
}
service.start_login_timer = function() {
+ var timeout = egCore.env.aous['circ.selfcheck.patron_login_timeout'];
+ if (timeout) service.login_timeout = timeout;
service.login_timer = $timeout(
service.show_timeout_warning, service.login_timeout
);
- console.debug('starting patron login timer');
}
service.reset_login_timer = function() {
service.login_warning_timer = null;
}
service.start_login_timer();
- console.debug('reset patron login timer');
}
-
service.fetch_patron = function(username, barcode) {
var evt;
return $q.reject(evt);
}
+ // Retrieve user stats in parallel with user retrieval.
+ // No need to inspect the response.
+ service.set_user_stats(patron_id);
+
return egCore.net.request(
'open-ils.actor',
'open-ils.actor.user.fleshed.retrieve.authoritative',
return $q.reject(evt);
}
+ if (barcode) {
+ // Confirm the patron was retrieved with an active card.
+ var card = patron.cards().filter(
+ function(c) { return c.barcode() == barcode })[0];
+
+ if (card && card.active() == 'f') {
+ console.warn("Patron used inactive card: " + barcode);
+ return $q.reject();
+ }
+ }
+
service.patron = patron;
service.start_login_timer();
});
}
);
}
+
+ if ($location.search().username) {
+ // Allow passing the username via the URL for testing purposes.
+ // This only works when circ.selfcheck.patron_password_required
+ // is false/unset.
+ $scope.login({username : $location.search().username});
+ }
+
}])
.controller('CheckoutCtrl',
$scope.xacts = [];
scSvc.get_fines().then(function(xacts) {
- console.log('here with ' + xacts.length)
$scope.xacts = xacts;
});
}])
+