Bugzilla – Attachment 108498 Details for
Bug 23258
Batch tool for placing and cancelling holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23258: (follow-up) QA fixes: perltidy the script
Bug-23258-follow-up-QA-fixes-perltidy-the-script.patch (text/plain), 8.77 KB, created by
Matthias Meusburger
on 2020-08-18 12:59:29 UTC
(
hide
)
Description:
Bug 23258: (follow-up) QA fixes: perltidy the script
Filename:
MIME Type:
Creator:
Matthias Meusburger
Created:
2020-08-18 12:59:29 UTC
Size:
8.77 KB
patch
obsolete
>From 107ebe3f112c6fac5e4f4f03606f6c08ec98c428 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Tue, 18 Aug 2020 14:58:26 +0200 >Subject: [PATCH] Bug 23258: (follow-up) QA fixes: perltidy the script > >--- > circ/batch_holding.pl | 153 +++++++++++++++++++++++++++----------------------- > 1 file changed, 84 insertions(+), 69 deletions(-) > >diff --git a/circ/batch_holding.pl b/circ/batch_holding.pl >index 72f63e2..1e273f8 100755 >--- a/circ/batch_holding.pl >+++ b/circ/batch_holding.pl >@@ -26,7 +26,6 @@ use Koha::Items; > use C4::Reserves; > use List::MoreUtils qw/uniq/; > >- > my $input = new CGI; > my $op = $input->param('op') // ''; > my @itemnumbers; >@@ -40,39 +39,42 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >-if ($op eq "show"){ >- my $filefh = $input->upload('uploadfile'); >- my $filecontent = $input->param('filecontent'); >+if ( $op eq "show" ) { >+ my $filefh = $input->upload('uploadfile'); >+ my $filecontent = $input->param('filecontent'); > my $borrowernumber = $input->param('borrowernumber'); >- my $branch = $input->param('branch'); >- my $action = $input->param('action'); >+ my $branch = $input->param('branch'); >+ my $action = $input->param('action'); > my @notfoundbarcodes; > > my @contentlist; >- if ($filefh){ >- while (my $content=<$filefh>){ >+ if ($filefh) { >+ while ( my $content = <$filefh> ) { > $content =~ s/[\r\n]*$//; > push @contentlist, $content if $content; > } > > foreach my $barcode (@contentlist) { >- my $item = Koha::Items->find({ barcode => $barcode }); >+ my $item = Koha::Items->find( { barcode => $barcode } ); > if ($item) { >- push @itemnumbers,$item->itemnumber; >- } else { >+ push @itemnumbers, $item->itemnumber; >+ } >+ else { > push @notfoundbarcodes, $barcode; > } > } >- } else { >- if ( my $list=$input->param('barcodelist')){ >- push my @barcodelist, uniq( split(/\s\n/, $list) ); >+ } >+ else { >+ if ( my $list = $input->param('barcodelist') ) { >+ push my @barcodelist, uniq( split( /\s\n/, $list ) ); > > foreach my $barcode (@barcodelist) { > >- my $item = Koha::Items->find({ barcode => $barcode }); >+ my $item = Koha::Items->find( { barcode => $barcode } ); > if ($item) { >- push @itemnumbers,$item->itemnumber; >- } else { >+ push @itemnumbers, $item->itemnumber; >+ } >+ else { > push @notfoundbarcodes, $barcode; > } > } >@@ -80,86 +82,99 @@ if ($op eq "show"){ > } > } > if (@notfoundbarcodes) { >- my @notfoundbarcodesloop = map{{barcode=>$_}}@notfoundbarcodes; >- $template->param(notfoundbarcodes => \@notfoundbarcodesloop); >+ my @notfoundbarcodesloop = map { { barcode => $_ } } @notfoundbarcodes; >+ $template->param( notfoundbarcodes => \@notfoundbarcodesloop ); > } > my @holdloop; > if (@itemnumbers) { > foreach my $itemnumber (@itemnumbers) { >- my $item = Koha::Items->find({ itemnumber => $itemnumber }); >- my $biblio = Koha::Biblios->find({ biblionumber => $item->biblionumber }); >- my $holdable = CanItemBeReserved($borrowernumber, $item->itemnumber)->{status}; >- push @holdloop, { >+ my $item = Koha::Items->find( { itemnumber => $itemnumber } ); >+ my $biblio = >+ Koha::Biblios->find( { biblionumber => $item->biblionumber } ); >+ my $holdable = >+ CanItemBeReserved( $borrowernumber, $item->itemnumber )->{status}; >+ push @holdloop, >+ { > 'biblionumber' => $biblio->biblionumber, >- 'title' => $biblio->title, >- 'itemnumber' => $item->itemnumber, >- 'barcode' => $item->barcode, >- 'holdable' => ($action eq "cancel" || $holdable eq 'OK') ? 1 : 0, >- }; >+ 'title' => $biblio->title, >+ 'itemnumber' => $item->itemnumber, >+ 'barcode' => $item->barcode, >+ 'holdable' => ( $action eq "cancel" || $holdable eq 'OK' ) >+ ? 1 >+ : 0, >+ }; > } > > } >- my $borrower = Koha::Patrons->find({ borrowernumber => $borrowernumber }); >+ my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } ); > $template->param( >- show => 1, >- holdloop => \@holdloop, >- borrowernumber => $borrowernumber, >- borrowersurname => $borrower->surname, >+ show => 1, >+ holdloop => \@holdloop, >+ borrowernumber => $borrowernumber, >+ borrowersurname => $borrower->surname, > borrowerfirstname => $borrower->firstname, >- branch => $branch, >- action => $action, >- op => $op >+ branch => $branch, >+ action => $action, >+ op => $op > ); > } > >-elsif ($op eq "result") { >- my $branch = $input->param('branch'); >+elsif ( $op eq "result" ) { >+ my $branch = $input->param('branch'); > my $borrowernumber = $input->param('borrowernumber'); >- my $action = $input->param('action'); >- my @itemnumbers = $input->multi_param('holdable'); >+ my $action = $input->param('action'); >+ my @itemnumbers = $input->multi_param('holdable'); > my @holdloop; > foreach my $itemnumber (@itemnumbers) { >- if ($action eq "place") { >- my $item = Koha::Items->find({ itemnumber => $itemnumber }); >+ if ( $action eq "place" ) { >+ my $item = Koha::Items->find( { itemnumber => $itemnumber } ); > my $biblionumber = $item->biblionumber; >- my $biblio = Koha::Biblios->find({ biblionumber => $item->biblionumber }); >- my $reserve_id = AddReserve({ >- branchcode => $branch, >- borrowernumber => $borrowernumber, >- biblionumber => $biblionumber, >- itemnumber => $itemnumber >- }); >- push @holdloop, { >+ my $biblio = >+ Koha::Biblios->find( { biblionumber => $item->biblionumber } ); >+ my $reserve_id = AddReserve( >+ { >+ branchcode => $branch, >+ borrowernumber => $borrowernumber, >+ biblionumber => $biblionumber, >+ itemnumber => $itemnumber >+ } >+ ); >+ push @holdloop, >+ { > 'biblionumber' => $biblio->biblionumber, >- 'title' => $biblio->title, >- 'itemnumber' => $itemnumber, >- 'barcode' => $item->barcode, >- 'reserve_id' => $reserve_id, >- }; >- } else { >- my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber }); >+ 'title' => $biblio->title, >+ 'itemnumber' => $itemnumber, >+ 'barcode' => $item->barcode, >+ 'reserve_id' => $reserve_id, >+ }; >+ } >+ else { >+ my $holds = Koha::Holds->search( >+ { >+ itemnumber => $itemnumber, >+ borrowernumber => $borrowernumber >+ } >+ ); > if ($holds) { > while ( my $hold = $holds->next ) { > $hold->cancel; > } > >- push @holdloop, { >- 'itemnumber' => $itemnumber, >- }; >+ push @holdloop, { 'itemnumber' => $itemnumber, }; > } > } > } >- my $borrower = Koha::Patrons->find({ borrowernumber => $borrowernumber }); >+ my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } ); > $template->param( >- result => 1, >- holdloop => \@holdloop, >- borrowernumber => $borrowernumber, >- borrowersurname => $borrower->surname, >+ result => 1, >+ holdloop => \@holdloop, >+ borrowernumber => $borrowernumber, >+ borrowersurname => $borrower->surname, > borrowerfirstname => $borrower->firstname, >- branch => $branch, >- cancel => $action eq "cancel" ? 1 : 0, >- place => $action eq "place" ? 1 : 0, >- op => $op >+ branch => $branch, >+ cancel => $action eq "cancel" ? 1 : 0, >+ place => $action eq "place" ? 1 : 0, >+ op => $op > ); > > } >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23258
:
91230
|
106055
|
106077
|
106091
|
106598
|
107408
|
108498
|
108504
|
108628
|
108630
|
180199
|
180231