Bugzilla – Attachment 173249 Details for
Bug 38246
If using automatic return claim resolution on checkout, each checkout will overwrite the previous resolution
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38246: Perltidy
Bug-38246-Perltidy.patch (text/plain), 18.42 KB, created by
Phil Ringnalda
on 2024-10-24 05:14:40 UTC
(
hide
)
Description:
Bug 38246: Perltidy
Filename:
MIME Type:
Creator:
Phil Ringnalda
Created:
2024-10-24 05:14:40 UTC
Size:
18.42 KB
patch
obsolete
>From 02e672d40168ac816eb545a34b4946ee2aa221e5 Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Wed, 23 Oct 2024 15:59:39 -0400 >Subject: [PATCH] Bug 38246: Perltidy > >QA tool failed because the previous patch added one line to a large >block of code that was incorrectly indented. Fixed the indentation >separately on this patch. > >Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> >--- > circ/circulation.pl | 342 ++++++++++++++++++++++---------------------- > 1 file changed, 171 insertions(+), 171 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 6839f957f3..20c6649e1a 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -352,215 +352,215 @@ if (@$barcodes && $op eq 'cud-checkout') { > } > }; > >- my $blocker = $invalidduedate ? 1 : 0; >+ my $blocker = $invalidduedate ? 1 : 0; > >- $template_params->{alert} = $alerts; >- $template_params->{messages} = $messages; >+ $template_params->{alert} = $alerts; >+ $template_params->{messages} = $messages; > >- my $item = Koha::Items->find({ barcode => $barcode }); >+ my $item = Koha::Items->find({ barcode => $barcode }); > >- my $biblio; >- if ( $item ) { >- $biblio = $item->biblio; >- } >+ my $biblio; >+ if ( $item ) { >+ $biblio = $item->biblio; >+ } > >- if ( $issuingimpossible->{'STATS'} ) { >- my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) = >- AddReturn( $item->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 ); >+ if ( $issuingimpossible->{'STATS'} ) { >+ my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) = >+ AddReturn( $item->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 ); > >- $template->param( >- STATS => 1, >- CHECKEDIN => $stats_return, >- MESSAGES => $stats_messages, >- ITEM => $stats_iteminformation, >- BORROWER => $stats_borrower, >- ); >+ $template->param( >+ STATS => 1, >+ CHECKEDIN => $stats_return, >+ MESSAGES => $stats_messages, >+ ITEM => $stats_iteminformation, >+ BORROWER => $stats_borrower, >+ ); > >- #increment items.localuse >- my $localuse_count = $item->localuse; >- $localuse_count++; >- $item->localuse($localuse_count)->store; >- } >+ #increment items.localuse >+ my $localuse_count = $item->localuse; >+ $localuse_count++; >+ $item->localuse($localuse_count)->store; >+ } > >- # Fix for bug 7494: optional checkout-time fallback search for a book >+ # Fix for bug 7494: optional checkout-time fallback search for a book > >- if ( $issuingimpossible->{'UNKNOWN_BARCODE'} >- && C4::Context->preference("itemBarcodeFallbackSearch") >- && not $batch >- ) >- { >- $template_params->{FALLBACK} = 1; >- >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >- my $query = "kw=" . $barcode; >- my ( $searcherror, $results, $total_hits ) = $searcher->simple_search_compat($query, 0, 10); >- >- # if multiple hits, offer options to librarian >- if ( $total_hits > 0 ) { >- my @barcodes; >- foreach my $hit ( @{$results} ) { >- my $chosen = # Maybe easier to retrieve the itemnumber from $hit? >- TransformMarcToKoha({ record => C4::Search::new_record_from_zebra('biblioserver',$hit) }); >- >- # offer all barcodes individually >- if ( $chosen->{barcode} ) { >- push @barcodes, sort split(/\s*\|\s*/, $chosen->{barcode}); >+ if ( $issuingimpossible->{'UNKNOWN_BARCODE'} >+ && C4::Context->preference("itemBarcodeFallbackSearch") >+ && not $batch >+ ) >+ { >+ $template_params->{FALLBACK} = 1; >+ >+ my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $query = "kw=" . $barcode; >+ my ( $searcherror, $results, $total_hits ) = $searcher->simple_search_compat($query, 0, 10); >+ >+ # if multiple hits, offer options to librarian >+ if ( $total_hits > 0 ) { >+ my @barcodes; >+ foreach my $hit ( @{$results} ) { >+ my $chosen = # Maybe easier to retrieve the itemnumber from $hit? >+ TransformMarcToKoha({ record => C4::Search::new_record_from_zebra('biblioserver',$hit) }); >+ >+ # offer all barcodes individually >+ if ( $chosen->{barcode} ) { >+ push @barcodes, sort split(/\s*\|\s*/, $chosen->{barcode}); >+ } > } >+ my $items = Koha::Items->search({ barcode => {-in => \@barcodes}}); >+ $template_params->{options} = $items; > } >- my $items = Koha::Items->search({ barcode => {-in => \@barcodes}}); >- $template_params->{options} = $items; > } >- } > >- # Only some errors will block when performing forced onsite checkout, >- # for other cases all errors will block >- my @blocking_error_codes = >- ( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) >- ? qw( UNKNOWN_BARCODE NO_OPEN_DAYS ) >- : ( keys %$issuingimpossible ); >- >- if ( $issuingimpossible->{BOOKED_TO_ANOTHER} ) { >- $template_params->{BOOKED_TO_ANOTHER} = $issuingimpossible->{BOOKED_TO_ANOTHER}; >- $template_params->{IMPOSSIBLE} = 1; >- $blocker = 1; >- } >+ # Only some errors will block when performing forced onsite checkout, >+ # for other cases all errors will block >+ my @blocking_error_codes = >+ ( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) >+ ? qw( UNKNOWN_BARCODE NO_OPEN_DAYS ) >+ : ( keys %$issuingimpossible ); >+ >+ if ( $issuingimpossible->{BOOKED_TO_ANOTHER} ) { >+ $template_params->{BOOKED_TO_ANOTHER} = $issuingimpossible->{BOOKED_TO_ANOTHER}; >+ $template_params->{IMPOSSIBLE} = 1; >+ $blocker = 1; >+ } > >- foreach my $code ( @blocking_error_codes ) { >- if ($issuingimpossible->{$code}) { >- $template_params->{$code} = $issuingimpossible->{$code}; >+ foreach my $code ( @blocking_error_codes ) { >+ if ($issuingimpossible->{$code}) { >+ $template_params->{$code} = $issuingimpossible->{$code}; > >- $template_params->{IMPOSSIBLE} = 1; >- $blocker = 1; >+ $template_params->{IMPOSSIBLE} = 1; >+ $blocker = 1; >+ } > } >- } > >- delete $needsconfirmation->{'DEBT'} if ($debt_confirmed); >+ delete $needsconfirmation->{'DEBT'} if ($debt_confirmed); > >- if ( $item && C4::Context->preference('ClaimReturnedLostValue') ) { >- my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout'); >+ if ( $item && C4::Context->preference('ClaimReturnedLostValue') ) { >+ my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout'); > >- my $claims = Koha::Checkouts::ReturnClaims->search( >- { >- itemnumber => $item->id, >- resolution => undef, >- } >- ); >- if ( $claims->count ) { >- if ($autoClaimReturnCheckout) { >- my $claim = $claims->next; >+ my $claims = Koha::Checkouts::ReturnClaims->search( >+ { >+ itemnumber => $item->id, >+ resolution => undef, >+ } >+ ); >+ if ( $claims->count ) { >+ if ($autoClaimReturnCheckout) { >+ my $claim = $claims->next; > >- my $patron_id = $logged_in_user->borrowernumber; >- my $resolution = $autoClaimReturnCheckout; >+ my $patron_id = $logged_in_user->borrowernumber; >+ my $resolution = $autoClaimReturnCheckout; > >- $claim->resolve( >- { >- resolution => $resolution, >- resolved_by => $patron_id, >- } >- ); >- $template_params->{CLAIM_RESOLUTION} = $claim; >+ $claim->resolve( >+ { >+ resolution => $resolution, >+ resolved_by => $patron_id, >+ } >+ ); >+ $template_params->{CLAIM_RESOLUTION} = $claim; >+ } > } > } >- } > >- if( $item and ( !$blocker or $force_allow_issue ) ){ >- my $confirm_required = 0; >- unless($issueconfirmed){ >- # Get the item title for more information >- my $materials = $item->materials; >- my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials }); >- $materials = $descriptions->{lib} // $materials; >- $template_params->{ADDITIONAL_MATERIALS} = $materials; >- $template_params->{itemhomebranch} = $item->homebranch; >- >- # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. >- foreach my $needsconfirmation_key ( keys %$needsconfirmation ) { >- $template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key}; >- $template_params->{getTitleMessageIteminfo} = $biblio->title; >- $template_params->{getBarcodeMessageIteminfo} = $item->barcode; >- $template_params->{NEEDSCONFIRMATION} = 1; >- $confirm_required = 1; >- if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) { >- my $rule = Koha::CirculationRules->get_effective_rule( >+ if( $item and ( !$blocker or $force_allow_issue ) ){ >+ my $confirm_required = 0; >+ unless($issueconfirmed){ >+ # Get the item title for more information >+ my $materials = $item->materials; >+ my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials }); >+ $materials = $descriptions->{lib} // $materials; >+ $template_params->{ADDITIONAL_MATERIALS} = $materials; >+ $template_params->{itemhomebranch} = $item->homebranch; >+ >+ # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. >+ foreach my $needsconfirmation_key ( keys %$needsconfirmation ) { >+ $template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key}; >+ $template_params->{getTitleMessageIteminfo} = $biblio->title; >+ $template_params->{getBarcodeMessageIteminfo} = $item->barcode; >+ $template_params->{NEEDSCONFIRMATION} = 1; >+ $confirm_required = 1; >+ if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) { >+ my $rule = Koha::CirculationRules->get_effective_rule( >+ { >+ rule_name => 'bookings_lead_period', >+ itemtype => $item->effective_itemtype, >+ branchcode => "*" >+ } >+ ); >+ my $preparation_period = $rule ? $rule->rule_value : 1; >+ my $reduceddue = >+ dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date ) >+ ->subtract( days => $preparation_period ); >+ $template_params->{reduceddue} = $reduceddue; >+ } >+ } >+ } >+ unless ($confirm_required) { >+ my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}; >+ if ( C4::Context->preference('UseRecalls') && !$recall_id ) { >+ my $recall = Koha::Recalls->find( > { >- rule_name => 'bookings_lead_period', >- itemtype => $item->effective_itemtype, >- branchcode => "*" >+ biblio_id => $item->biblionumber, >+ item_id => [ undef, $item->itemnumber ], >+ status => [ 'requested', 'waiting' ], >+ completed => 0, >+ patron_id => $patron->borrowernumber, > } > ); >- my $preparation_period = $rule ? $rule->rule_value : 1; >- my $reduceddue = >- dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date ) >- ->subtract( days => $preparation_period ); >- $template_params->{reduceddue} = $reduceddue; >+ $recall_id = ( $recall and $recall->id ) ? $recall->id : undef; > } >- } >- } >- unless ($confirm_required) { >- my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}; >- if ( C4::Context->preference('UseRecalls') && !$recall_id ) { >- my $recall = Koha::Recalls->find( >+ >+ # If booked (alerts or confirmation) update datedue to end of booking >+ if ( my $booked = $needsconfirmation->{BOOKED_EARLY} // $alerts->{BOOKED} ) { >+ $datedue = $booked->end_date; >+ } >+ my $issue = AddIssue( >+ $patron, $barcode, $datedue, >+ $cancelreserve, >+ undef, undef, > { >- biblio_id => $item->biblionumber, >- item_id => [ undef, $item->itemnumber ], >- status => [ 'requested', 'waiting' ], >- completed => 0, >- patron_id => $patron->borrowernumber, >+ onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew'), >+ switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall, >+ recall_id => $recall_id, > } > ); >- $recall_id = ( $recall and $recall->id ) ? $recall->id : undef; >+ $template_params->{issue} = $issue; >+ $session->clear('auto_renew'); >+ $inprocess = 1; > } >+ } > >- # If booked (alerts or confirmation) update datedue to end of booking >- if ( my $booked = $needsconfirmation->{BOOKED_EARLY} // $alerts->{BOOKED} ) { >- $datedue = $booked->end_date; >- } >- my $issue = AddIssue( >- $patron, $barcode, $datedue, >- $cancelreserve, >- undef, undef, >- { >- onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew'), >- switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall, >- recall_id => $recall_id, >- } >+ if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){ >+ $template->param( >+ reserveborrowernumber => $needsconfirmation->{'resborrowernumber'}, >+ reserve_id => $needsconfirmation->{reserve_id}, > ); >- $template_params->{issue} = $issue; >- $session->clear('auto_renew'); >- $inprocess = 1; > } >- } >- >- if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){ >- $template->param( >- reserveborrowernumber => $needsconfirmation->{'resborrowernumber'}, >- reserve_id => $needsconfirmation->{reserve_id}, >- ); >- } > > >- # FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue >- $patron = Koha::Patrons->find( $borrowernumber ); >- $template_params->{issuecount} = $patron->checkouts->count; >+ # FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue >+ $patron = Koha::Patrons->find( $borrowernumber ); >+ $template_params->{issuecount} = $patron->checkouts->count; > >- if ( $item ) { >- $template_params->{item} = $item; >- $template_params->{biblio} = $biblio; >- $template_params->{itembiblionumber} = $biblio->biblionumber; >+ if ( $item ) { >+ $template_params->{item} = $item; >+ $template_params->{biblio} = $biblio; >+ $template_params->{itembiblionumber} = $biblio->biblionumber; >+ } >+ push @$checkout_infos, $template_params; > } >- push @$checkout_infos, $template_params; >- } >- unless ( $batch ) { >- $template->param( %{$checkout_infos->[0]} ); >- $template->param( barcode => $barcodes->[0] ); >- } else { >- my $confirmation_needed = grep { $_->{NEEDSCONFIRMATION} } @$checkout_infos; >- $template->param( >- checkout_infos => $checkout_infos, >- onsite_checkout => $onsite_checkout, >- confirmation_needed => $confirmation_needed, >- ); >- } >+ unless ( $batch ) { >+ $template->param( %{$checkout_infos->[0]} ); >+ $template->param( barcode => $barcodes->[0] ); >+ } else { >+ my $confirmation_needed = grep { $_->{NEEDSCONFIRMATION} } @$checkout_infos; >+ $template->param( >+ checkout_infos => $checkout_infos, >+ onsite_checkout => $onsite_checkout, >+ confirmation_needed => $confirmation_needed, >+ ); >+ } > } > > ################################################################################## >-- >2.44.0
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 38246
:
173238
|
173239
|
173248
|
173249
|
173497
|
173498
|
175578