From 5f7c2b41adfbe4045ff04657aa57ed6fd4e79b88 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 12 Apr 2024 07:11:00 -0400 Subject: [PATCH] Bug 34032: (QA follow-up) Tidy code --- C4/Reserves.pm | 10 +++++----- Koha/Hold.pm | 12 +++++++----- t/db_dependent/Hold.t | 14 +++++++------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index f972109e86b..97374d95149 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -2161,13 +2161,13 @@ sub RevertWaitingStatus { ## Fix up the currently waiting reserve $hold->set( { - priority => 1, - found => undef, - waitingdate => undef, + priority => 1, + found => undef, + waitingdate => undef, expirationdate => $hold->patron_expiration_date, - itemnumber => $hold->item_level_hold ? $hold->itemnumber : undef, + itemnumber => $hold->item_level_hold ? $hold->itemnumber : undef, } - )->store({ hold_reverted => 1 }); + )->store( { hold_reverted => 1 } ); logaction( 'HOLDS', 'MODIFY', $hold->id, $hold ) if C4::Context->preference('HoldsLog'); diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 82a1340691f..01db4c3480b 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -954,12 +954,14 @@ sub store { return $self->SUPER::store unless %updated_columns; if ( exists $updated_columns{reservedate} || $hold_reverted ) { if ( - ( C4::Context->preference('DefaultHoldExpirationdate') - && ( ! exists $updated_columns{expirationdate} || $hold_reverted ) ) - ) + ( + C4::Context->preference('DefaultHoldExpirationdate') + && ( !exists $updated_columns{expirationdate} || $hold_reverted ) + ) + ) { - if($self->patron_expiration_date){ - $self->expirationdate($self->patron_expiration_date); + if ( $self->patron_expiration_date ) { + $self->expirationdate( $self->patron_expiration_date ); } else { $self->_set_default_expirationdate; } diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t index fa607a5c2e0..5c940510ef0 100755 --- a/t/db_dependent/Hold.t +++ b/t/db_dependent/Hold.t @@ -225,21 +225,21 @@ subtest "store() tests" => sub { $passed_date = dt_from_string('2023-06-20'); $hold->set( { - reservedate => $passed_date->ymd, - waitingdate => $passed_date->ymd, + reservedate => $passed_date->ymd, + waitingdate => $passed_date->ymd, } )->store(); $hold->discard_changes; $hold->set_waiting; - C4::Reserves::RevertWaitingStatus( - { itemnumber => $item->itemnumber } - ); + C4::Reserves::RevertWaitingStatus( { itemnumber => $item->itemnumber } ); $hold->discard_changes; $expected_date = dt_from_string( $hold->reservedate )->add( years => 2 )->ymd; - is( $hold->expirationdate, - $expected_date, 'Expiration date set after reverting holds waiting status.' ); + is( + $hold->expirationdate, + $expected_date, 'Expiration date set after reverting holds waiting status.' + ); my $patron_expiration_date = dt_from_string('2023-11-06')->ymd; $hold = Koha::Hold->new( -- 2.30.2