From 1fef8b497b65f30fcb111cbc1cf0abd583c6bb0c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 18 Jul 2012 10:10:59 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 8455 - Followup - perltidy renewscript.pl Content-Type: text/plain; charset="utf-8" Signed-off-by: David Cook --- reserve/renewscript.pl | 88 +++++++++++++++++++++++++---------------------- 1 files changed, 47 insertions(+), 41 deletions(-) diff --git a/reserve/renewscript.pl b/reserve/renewscript.pl index c7e021c..d13ced3 100755 --- a/reserve/renewscript.pl +++ b/reserve/renewscript.pl @@ -1,10 +1,8 @@ #!/usr/bin/perl - #written 18/1/2000 by chris@katipo.co.nz #script to renew items from the web - # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -51,7 +49,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( # my @data; -if ($input->param('renew_all')) { +if ( $input->param('renew_all') ) { @data = $input->param('all_items[]'); } else { @@ -59,76 +57,84 @@ else { } my @barcodes; -if ($input->param('return_all')) { +if ( $input->param('return_all') ) { @barcodes = $input->param('all_barcodes[]'); -} else { +} +else { @barcodes = $input->param('barcodes[]'); } -my $branch=$input->param('branch'); +my $branch = $input->param('branch'); my $datedue; -if ($input->param('newduedate')){ - $datedue = dt_from_string($input->param('newduedate')); +if ( $input->param('newduedate') ) { + $datedue = dt_from_string( $input->param('newduedate') ); } # warn "barcodes : @barcodes"; # # renew items # -my $cardnumber = $input->param("cardnumber"); +my $cardnumber = $input->param("cardnumber"); my $borrowernumber = $input->param("borrowernumber"); -my $exemptfine = $input->param("exemptfine") || 0; +my $exemptfine = $input->param("exemptfine") || 0; my $override_limit = $input->param("override_limit") || 0; -my $failedrenews = q{}; +my $failedrenews = q{}; foreach my $itemno (@data) { + # check status before renewing issue - my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno,$override_limit); - if ($renewokay){ - AddRenewal($borrowernumber,$itemno,$branch,$datedue); + my ( $renewokay, $error ) = + CanBookBeRenewed( $borrowernumber, $itemno, $override_limit ); + if ($renewokay) { + AddRenewal( $borrowernumber, $itemno, $branch, $datedue ); + } + else { + $failedrenews .= "&failedrenew=$itemno"; } - else { - $failedrenews.="&failedrenew=$itemno"; - } } my $failedreturn = q{}; foreach my $barcode (@barcodes) { + # check status before renewing issue #System Preference Handling During Check-in In Patron Module - my $itemnumber; - $itemnumber = GetItemnumberFromBarcode($barcode); + my $itemnumber; + $itemnumber = GetItemnumberFromBarcode($barcode); if ($itemnumber) { - if ( C4::Context->preference("InProcessingToShelvingCart") ) { - my $item = GetItem( $itemnumber ); - if ( $item->{'location'} eq 'PROC' ) { - $item->{'location'} = 'CART'; - ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); - } - } + if ( C4::Context->preference("InProcessingToShelvingCart") ) { + my $item = GetItem($itemnumber); + if ( $item->{'location'} eq 'PROC' ) { + $item->{'location'} = 'CART'; + ModItem( $item, $item->{'biblionumber'}, + $item->{'itemnumber'} ); + } + } - if ( C4::Context->preference("ReturnToShelvingCart") ) { - my $item = GetItem( $itemnumber ); - $item->{'location'} = 'CART'; - ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); - } - } + if ( C4::Context->preference("ReturnToShelvingCart") ) { + my $item = GetItem($itemnumber); + $item->{'location'} = 'CART'; + ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); + } + } - my ( $returned, $messages, $issueinformation, $borrower ) = - AddReturn($barcode, $branch, $exemptfine); - $failedreturn.="&failedreturn=$barcode" unless ($returned); + my ( $returned, $messages, $issueinformation, $borrower ) = + AddReturn( $barcode, $branch, $exemptfine ); + $failedreturn .= "&failedreturn=$barcode" unless ($returned); } # # redirection to the referrer page # -if ($input->param('destination') eq "circ"){ +if ( $input->param('destination') eq "circ" ) { $cardnumber = uri_escape($cardnumber); - print $input->redirect( - '/cgi-bin/koha/circ/circulation.pl?findborrower='.$cardnumber.$failedrenews.$failedreturn - ); + print $input->redirect( '/cgi-bin/koha/circ/circulation.pl?findborrower=' + . $cardnumber + . $failedrenews + . $failedreturn ); } else { print $input->redirect( - '/cgi-bin/koha/members/moremember.pl?borrowernumber='.$borrowernumber.$failedrenews.$failedreturn - ); + '/cgi-bin/koha/members/moremember.pl?borrowernumber=' + . $borrowernumber + . $failedrenews + . $failedreturn ); } -- 1.7.7.4