[open-ils-commits] r11658 - in trunk/Open-ILS: src/perlmods/OpenILS/Application web/opac/locale/en-US xul/staff_client/chrome/content/auth xul/staff_client/chrome/content/main
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Dec 22 16:59:32 EST 2008
Author: phasefx
Date: 2008-12-22 16:59:28 -0500 (Mon, 22 Dec 2008)
New Revision: 11658
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
trunk/Open-ILS/xul/staff_client/chrome/content/auth/verify_credentials.js
trunk/Open-ILS/xul/staff_client/chrome/content/auth/verify_credentials.xul
trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
Log:
retrieve patron button on verify credentials interface
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-12-22 21:43:24 UTC (rev 11657)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-12-22 21:59:28 UTC (rev 11658)
@@ -3009,8 +3009,41 @@
return 0;
}
+__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;
+}
+
+
__PACKAGE__->register_method (
method => 'merge_users',
api_name => 'open-ils.actor.user.merge',
Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2008-12-22 21:43:24 UTC (rev 11657)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2008-12-22 21:59:28 UTC (rev 11658)
@@ -190,6 +190,8 @@
<!ENTITY staff.auth.verify.caption "Verify Credentials">
<!ENTITY staff.auth.verify.submit.label "Verify">
<!ENTITY staff.auth.verify.submit.accesskey "V">
+<!ENTITY staff.auth.verify.retrieve.label "Retrieve">
+<!ENTITY staff.auth.verify.retrieve.accesskey "R">
<!ENTITY staff.bills_current_payment_label "Current Payment">
<!ENTITY staff.bills_information "Information">
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/auth/verify_credentials.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/auth/verify_credentials.js 2008-12-22 21:43:24 UTC (rev 11657)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/auth/verify_credentials.js 2008-12-22 21:59:28 UTC (rev 11658)
@@ -72,6 +72,29 @@
},
false
);
+ document.getElementById('cmd_retrieve').addEventListener(
+ 'command',
+ function() {
+ var barcode = document.getElementById('barcode_prompt').value;
+ var name = document.getElementById('name_prompt').value;
+ var req = net.simple_request(
+ 'FM_AU_ID_RETRIEVE_VIA_BARCODE_OR_USERNAME',
+ [
+ ses(),
+ barcode,
+ name
+ ]
+ );
+ if (typeof req.ilsevent != 'undefined') {
+ alert (req.desc);
+ document.getElementById('name_prompt').focus();
+ } else {
+ var url = xulG.url_prefix( urls.XUL_PATRON_DISPLAY );
+ xulG.set_tab( url, {}, { 'id' : req } );
+ }
+ },
+ false
+ );
document.getElementById('name_prompt').focus();
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/auth/verify_credentials.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/auth/verify_credentials.xul 2008-12-22 21:43:24 UTC (rev 11657)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/auth/verify_credentials.xul 2008-12-22 21:59:28 UTC (rev 11658)
@@ -40,6 +40,7 @@
<commandset id="verify_cmds">
<command id="cmd_verify" />
+ <command id="cmd_retrieve" />
</commandset>
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
@@ -65,6 +66,7 @@
<spacer />
<hbox>
<button id="submit_button" command="cmd_verify" label="&staff.auth.verify.submit.label;" accesskey="&staff.auth.verify.submit.accesskey;" />
+ <button id="retrieve_button" command="cmd_retrieve" label="&staff.auth.verify.retrieve.label;" accesskey="&staff.auth.verify.retrieve.accesskey;" />
</hbox>
</row>
</rows>
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2008-12-22 21:43:24 UTC (rev 11657)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2008-12-22 21:59:28 UTC (rev 11658)
@@ -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' },
More information about the open-ils-commits
mailing list