From 043f17ac6a603b20d1ccaccf0378cfb5e93a6d6b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 11 Feb 2016 04:29:55 +0000 Subject: [PATCH] Bug 15479 [QA Followup] - Tidy sub to remove tabs causing qa script to fail Signed-off-by: Kyle M Hall --- C4/SIP/ILS.pm | 77 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 26cd411..7a40777 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -126,48 +126,57 @@ sub offline_ok { # the response. # sub checkout { - my ($self, $patron_id, $item_id, $sc_renew, $fee_ack) = @_; - my ($patron, $item, $circ); + my ( $self, $patron_id, $item_id, $sc_renew, $fee_ack ) = @_; + my ( $patron, $item, $circ ); $circ = C4::SIP::ILS::Transaction::Checkout->new(); + # BEGIN TRANSACTION - $circ->patron($patron = C4::SIP::ILS::Patron->new( $patron_id)); - $circ->item($item = C4::SIP::ILS::Item->new( $item_id)); + $circ->patron( $patron = C4::SIP::ILS::Patron->new($patron_id) ); + $circ->item( $item = C4::SIP::ILS::Item->new($item_id) ); if ($fee_ack) { $circ->fee_ack($fee_ack); } - if (!$patron) { - $circ->screen_msg("Invalid Patron"); - } elsif (!$patron->charge_ok) { - $circ->screen_msg("Patron Blocked"); - } elsif (!$item) { - $circ->screen_msg("Invalid Item"); - # holds checked inside do_checkout - # } elsif ($item->hold_queue && @{$item->hold_queue} && ! $item->barcode_is_borrowernumber($patron_id, $item->hold_queue->[0]->{borrowernumber})) { - # $circ->screen_msg("Item on Hold for Another User"); - } elsif ($item->{patron} && !_ci_cardnumber_cmp($item->{patron},$patron_id)) { - $circ->screen_msg("Item checked out to another patron"); - } else { - $circ->do_checkout(); - if ($circ->ok){ - $debug and warn "circ is ok"; - # If the item is already associated with this patron, then - # we're renewing it. - $circ->renew_ok($item->{patron} && _ci_cardnumber_cmp($item->{patron}, $patron_id)); - - $item->{patron} = $patron_id; - $item->{due_date} = $circ->{due}; - push(@{$patron->{items}}, $item_id); - $circ->desensitize(!$item->magnetic_media); - - syslog("LOG_DEBUG", "ILS::Checkout: patron %s has checked out %s", - $patron_id, join(', ', @{$patron->{items}})); - } - else { - syslog("LOG_ERR", "ILS::Checkout Issue failed"); - } + if ( !$patron ) { + $circ->screen_msg("Invalid Patron"); + } + elsif ( !$patron->charge_ok ) { + $circ->screen_msg("Patron Blocked"); + } + elsif ( !$item ) { + $circ->screen_msg("Invalid Item"); } + elsif ( $item->{patron} + && !_ci_cardnumber_cmp( $item->{patron}, $patron_id ) ) + { + $circ->screen_msg("Item checked out to another patron"); + } + else { + $circ->do_checkout(); + if ( $circ->ok ) { + $debug and warn "circ is ok"; + + # If the item is already associated with this patron, then + # we're renewing it. + $circ->renew_ok( $item->{patron} + && _ci_cardnumber_cmp( $item->{patron}, $patron_id ) ); + + $item->{patron} = $patron_id; + $item->{due_date} = $circ->{due}; + push( @{ $patron->{items} }, $item_id ); + $circ->desensitize( !$item->magnetic_media ); + + syslog( + "LOG_DEBUG", "ILS::Checkout: patron %s has checked out %s", + $patron_id, join( ', ', @{ $patron->{items} } ) + ); + } + else { + syslog( "LOG_ERR", "ILS::Checkout Issue failed" ); + } + } + # END TRANSACTION return $circ; -- 2.1.4