From e1de36fbb94c8e4046f564b200a1e8180df5bfcf Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 10 Dec 2012 08:54:24 -0500 Subject: [PATCH] Bug 9252 - Add option to send patron's home branch in AF field This patch gives you the option of sending a patrons home branch code in an AF field for patron status requests. It is controlled at the account login level, so it can be enable on a per-sip-login basis. Test Plan: 1) Apply patch 2) Edit SIPconfig.xml, add the parameter 'send_patron_home_library_in_af="1"' to the login you will be using to test. 3) Start your SIP2 server. 4) Connect to it via telnet ( something like: '9300CNterm1|COterm1|CPCPL|' ) 5) Send a patron status request ( like: '2300120121110 82925AOCPL|AA23529000035676|ACterm1|ADletmein' ) 6) Examine reponse you should see something like this: "24 00120121210 085332AEHenry Acevedo|AA23529000035676|BLY|CQN|AFGreetings from Koha. |AFMPL|AO|" Note the second AF field with the value MPL. Signed-off-by: George Williams Signed-off-by: Christopher Brannon Signed-off-by: Chris Cormack Signed-off-by: Galen Charlton --- C4/SIP/Sip/MsgType.pm | 15 +++++++++++---- etc/SIPconfig.xml | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 6d7ff6f354..efb3ca4067 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -431,7 +431,8 @@ sub handle { # information will be returned to the terminal. # sub build_patron_status { - my ($patron, $lang, $fields)= @_; + my ($patron, $lang, $fields, $server)= @_; + my $patron_pwd = $fields->{(FID_PATRON_PWD)}; my $resp = (PATRON_STATUS_RESP); @@ -451,7 +452,10 @@ sub build_patron_status { $resp .= maybe_add(FID_FEE_AMT, $patron->fee_amount); } - $resp .= maybe_add(FID_SCREEN_MSG, $patron->screen_msg); + $resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg ); + $resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode} ) + if ( $server->{account}->{send_patron_home_library_in_af} ); + $resp .= maybe_add(FID_PRINT_LINE, $patron->print_line); } else { # Invalid patron id. Report that the user has no privs., @@ -485,7 +489,7 @@ sub handle_patron_status { #warn $fields->{(FID_INST_ID)}; $ils->check_inst_id($fields->{(FID_INST_ID)}, "handle_patron_status"); $patron = $ils->find_patron($fields->{(FID_PATRON_ID)}); - $resp = build_patron_status($patron, $lang, $fields); + $resp = build_patron_status($patron, $lang, $fields, $server ); $self->write_msg($resp,undef,$server->{account}->{terminator}); return (PATRON_STATUS_REQ); } @@ -993,7 +997,10 @@ sub handle_patron_info { # Custom protocol extension to report patron internet privileges $resp .= maybe_add(FID_INET_PROFILE, $patron->inet_privileges); - $resp .= maybe_add(FID_SCREEN_MSG, $patron->screen_msg); + $resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg ); + $resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode} ) + if ( $server->{account}->{send_patron_home_library_in_af} ); + $resp .= maybe_add(FID_PRINT_LINE, $patron->print_line); } else { # Invalid patron ID: diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml index 37ce187c3b..bd464e2dac 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -41,7 +41,8 @@ + delimiter="|" error-detect="enabled" institution="LPL" + send_patron_home_library_in_af="1" />