[open-ils-commits] r11667 - in branches/rel_1_4/Open-ILS: src/perlmods/OpenILS/Application xul/staff_client/chrome/content/main xul/staff_client/server/patron
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Dec 23 14:41:13 EST 2008
Author: phasefx
Date: 2008-12-23 14:41:09 -0500 (Tue, 23 Dec 2008)
New Revision: 11667
Modified:
branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/constants.js
branches/rel_1_4/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul
Log:
in patron retrieval interface for checkouts, replace the barcode.exist call with one that returns the user id or an event on failure
Modified: branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-12-23 19:15:08 UTC (rev 11666)
+++ branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-12-23 19:41:09 UTC (rev 11667)
@@ -2947,5 +2947,41 @@
}
+__PACKAGE__->register_method (
+ method => 'retrieve_usr_id_via_barcode_or_usrname',
+ api_name => "open-ils.actor.user.retrieve_id_by_barcode_or_username",
+ signature => q/
+ Given a barcode or username returns the id for the user or
+ a failure event.
+ /
+);
+
+sub retrieve_usr_id_via_barcode_or_usrname {
+ my($self, $conn, $auth, $barcode, $username) = @_;
+ my $e = new_editor(authtoken => $auth);
+ return $e->die_event unless $e->checkauth;
+ my $user;
+ my $user_by_barcode;
+ my $user_by_username;
+ if($barcode) {
+ my $card = $e->search_actor_card([
+ {barcode => $barcode},
+ {flesh => 1, flesh_fields => {ac => ['usr']}}])->[0] or return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' );
+ $user_by_barcode = $card->usr;
+ $user = $user_by_barcode;
+ }
+ if ($username) {
+ $user_by_username = $e->search_actor_user({usrname => $username})->[0] or return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' );
+
+ $user = $user_by_username;
+ }
+ return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ) if (!$user);
+ return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ) if ($user_by_username && $user_by_barcode && $user_by_username->id != $user_by_barcode->id);
+ return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);
+ return $user->id;
+}
+
+
+
1;
Modified: branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2008-12-23 19:15:08 UTC (rev 11666)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2008-12-23 19:41:09 UTC (rev 11667)
@@ -115,6 +115,7 @@
'FM_ATC_VOID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.abort' },
'FM_ATC_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.retrieve', 'secure' : false },
'FM_ATC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.retrieve_by_lib', 'secure' : false },
+ 'FM_AU_ID_RETRIEVE_VIA_BARCODE_OR_USERNAME' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve_id_by_barcode_or_username' },
'FM_AU_IDS_RETRIEVE_VIA_HASH' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.search.advanced' },
'FM_AU_LIST_RETRIEVE_VIA_GROUP' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.members.retrieve' },
'FM_AU_LIST_RETRIEVE_VIA_GROUP.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.members.retrieve.authoritative' },
Modified: branches/rel_1_4/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul 2008-12-23 19:15:08 UTC (rev 11666)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul 2008-12-23 19:41:09 UTC (rev 11667)
@@ -94,19 +94,21 @@
tb.disabled = true;
document.getElementById('progress').setAttribute('hidden','false');
- net.simple_request('PATRON_BARCODE_EXISTS.authoritative',[ ses(), barcode ],
+ net.simple_request('FM_AU_ID_RETRIEVE_VIA_BARCODE_OR_USERNAME',[ ses(), barcode, null ],
function(req) {
document.getElementById('progress').setAttribute('hidden','true');
tb.disabled = false; tb.select(); tb.focus(); ;
var robj = req.getResultObject();
if (typeof robj.ilsevent != 'undefined') {
sound.bad();
- add_msg($("patronStrings").getFormattedString('staff.patron.barcode_entry.barcode_retrieval_problem', [barcode, js2JSON(robj)]));
+ switch(Number(robj.ilsevent)) {
+ case 1002 /* ACTOR_USER_NOT_FOUND */:
+ add_msg($("patronStrings").getFormattedString('staff.patron.barcode_entry.barcode_not_found', [barcode]));
+ break;
+ default:
+ add_msg($("patronStrings").getFormattedString('staff.patron.barcode_entry.barcode_retrieval_problem', [barcode, js2JSON(robj)]));
+ }
return;
- } else if (robj == 0) {
- sound.bad();
- add_msg($("patronStrings").getFormattedString('staff.patron.barcode_entry.barcode_not_found', [barcode]));
- return;
}
if (g.data.user_org_unit_opt_in_enabled) {
More information about the open-ils-commits
mailing list