From d4658f524ad19d6be34a6871821be1366be9f75e Mon Sep 17 00:00:00 2001 From: Mason James Date: Mon, 23 Mar 2015 14:30:26 +1300 Subject: [PATCH] Bug 13871 - perltidy build_patron_status perltidy build_patron_status() sub --- C4/SIP/Sip/MsgType.pm | 74 +++++++++++++++++++++++++----------------------- 1 files changed, 39 insertions(+), 35 deletions(-) diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 5ef7465..4739c2f 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -431,47 +431,51 @@ sub handle { # information will be returned to the terminal. # sub build_patron_status { - my ($patron, $lang, $fields, $server)= @_; + my ( $patron, $lang, $fields, $server ) = @_; - my $patron_pwd = $fields->{(FID_PATRON_PWD)}; + my $patron_pwd = $fields->{ (FID_PATRON_PWD) }; my $resp = (PATRON_STATUS_RESP); if ($patron) { - $resp .= patron_status_string($patron); - $resp .= $lang . timestamp(); - $resp .= add_field(FID_PERSONAL_NAME, $patron->name); + $resp .= patron_status_string($patron); + $resp .= $lang . Sip::timestamp(); + $resp .= add_field( FID_PERSONAL_NAME, $patron->name ); - # while the patron ID we got from the SC is valid, let's - # use the one returned from the ILS, just in case... - $resp .= add_field(FID_PATRON_ID, $patron->id); - if ($protocol_version >= 2) { - $resp .= add_field(FID_VALID_PATRON, 'Y'); - # Patron password is a required field. - $resp .= add_field(FID_VALID_PATRON_PWD, sipbool($patron->check_password($patron_pwd))); - $resp .= maybe_add(FID_CURRENCY, $patron->currency); - $resp .= maybe_add(FID_FEE_AMT, $patron->fee_amount); - } + # while the patron ID we got from the SC is valid, let's + # use the one returned from the ILS, just in case... + $resp .= add_field( FID_PATRON_ID, $patron->id ); + if ( $protocol_version >= 2 ) { + $resp .= add_field( FID_VALID_PATRON, 'Y' ); + + # Patron password is a required field. + $resp .= + add_field( FID_VALID_PATRON_PWD, + sipbool( $patron->check_password($patron_pwd) ) ); + $resp .= maybe_add( FID_CURRENCY, $patron->currency ); + $resp .= maybe_add( FID_FEE_AMT, $patron->fee_amount ); + } - $resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg, $server ); - $resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode}, $server ) - if ( $server->{account}->{send_patron_home_library_in_af} ); + $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., - # no personal name, and is invalid (if we're using 2.00) - $resp .= 'YYYY' . (' ' x 10) . $lang . timestamp(); - $resp .= add_field(FID_PERSONAL_NAME, ''); + $resp .= maybe_add( FID_PRINT_LINE, $patron->print_line ); + } + else { + # Invalid patron id. Report that the user has no privs., + # no personal name, and is invalid (if we're using 2.00) + $resp .= 'YYYY' . ( ' ' x 10 ) . $lang . Sip::timestamp(); + $resp .= add_field( FID_PERSONAL_NAME, '' ); - # the patron ID is invalid, but it's a required field, so - # just echo it back - $resp .= add_field(FID_PATRON_ID, $fields->{(FID_PATRON_ID)}); + # the patron ID is invalid, but it's a required field, so + # just echo it back + $resp .= add_field( FID_PATRON_ID, $fields->{ (FID_PATRON_ID) } ); - ($protocol_version >= 2) and - $resp .= add_field(FID_VALID_PATRON, 'N'); + ( $protocol_version >= 2 ) + and $resp .= add_field( FID_VALID_PATRON, 'N' ); } - $resp .= add_field(FID_INST_ID, $fields->{(FID_INST_ID)}); + $resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); return $resp; } -- 1.7.2.5