From 474bada03c5eb0e1e18a3b6f03e4cf729f81979d Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Fri, 19 Jul 2024 02:30:59 +0000 Subject: [PATCH] Bug 24194: Making the qa script happy Tidied up a bunch there are still a couple of perltidy complaints, but I am running out of time today so attaching this patch so it doesn't get lost No more test fails, or failing patterns Signed-off-by: Chris Cormack --- C4/UsageStats.pm | 1 + Koha/Club/Hold.pm | 2 +- Koha/REST/V1/Clubs/Holds.pm | 2 +- circ/waitingreserves.pl | 7 ++--- .../bug24194-add-ReserveExpiration-syspref.pl | 10 ++++--- koha-tmpl/intranet-tmpl/prog/js/holds.js | 7 +++-- .../bootstrap/en/includes/holds-table.inc | 5 ++-- .../bootstrap/en/modules/opac-reserve.tt | 26 +++++++++---------- misc/cronjobs/holds/cancel_expired_holds.pl | 2 +- t/db_dependent/Reserves.t | 2 -- 10 files changed, 34 insertions(+), 30 deletions(-) mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.pl diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 4492080c097..f651b78ecd8 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -206,6 +206,7 @@ sub _shared_preferences { ExpireReservesMaxPickUpDelay OPACAllowHoldDateInFuture OPACAllowUserToChooseBranch + ReserveExpiration ReservesControlBranch ReservesNeedReturns SuspendHoldsIntranet diff --git a/Koha/Club/Hold.pm b/Koha/Club/Hold.pm index 13ff372f95f..6efc1005954 100644 --- a/Koha/Club/Hold.pm +++ b/Koha/Club/Hold.pm @@ -70,7 +70,7 @@ sub add { unless scalar @enrollments; my $biblio = Koha::Biblios->find( $params->{biblio_id} ); - + if ( !C4::Context->preference('ReserveExpiration') and $params->{expiration_date} ) { Koha::Exceptions::Hold::ExpirationDateDisabled->throw; } diff --git a/Koha/REST/V1/Clubs/Holds.pm b/Koha/REST/V1/Clubs/Holds.pm index ba3f274e6f6..9d654304e08 100644 --- a/Koha/REST/V1/Clubs/Holds.pm +++ b/Koha/REST/V1/Clubs/Holds.pm @@ -53,7 +53,7 @@ sub add { my $pickup_library_id = $body->{pickup_library_id}; my $item_id = $body->{item_id}; my $item_type = $body->{item_type}; - my $expiration_date = C4::Context->preference('ReserveExpiration') ? $body->{expiration_date} : undef; + my $expiration_date = C4::Context->preference('ReserveExpiration') ? $body->{expiration_date} : undef; my $notes = $body->{notes}; my $default_patron_home = $body->{default_patron_home}; diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index d93d7bb642a..e99b8880fdf 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -104,10 +104,11 @@ my $today = Date_to_Days(&Today); while ( my $hold = $holds->next ) { next unless $hold->waitingdate; - my ( $expire_year, $expire_month, $expire_day ) = split (/-/, $hold->expirationdate); - my $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day ) if $hold->expirationdate; + my ( $expire_year, $expire_month, $expire_day ) = split( /-/, $hold->expirationdate ); + my $calcDate; + $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day ) if $hold->expirationdate; - if ($calcDate and $today > $calcDate) { + if ( $calcDate and $today > $calcDate ) { if ( $op eq 'cud-cancelall' ) { my $res = cancel( $hold->item->itemnumber, $hold->borrowernumber, $hold->item->holdingbranch, diff --git a/installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.pl b/installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.pl old mode 100644 new mode 100755 index 82668b44ae9..f2fa5cdb188 --- a/installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.pl +++ b/installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.pl @@ -1,12 +1,14 @@ use Modern::Perl; return { - bug_number => "24194", + bug_number => "24194", description => "Add new system preference ReserveExpiration", - up => sub { + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; + my ( $dbh, $out ) = @$args{qw(dbh out)}; - $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ("ReserveExpiration", 1, NULL, "Enable the use of expiration date in holds module.", "YesNo") }); + $dbh->do( + q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ("ReserveExpiration", 1, NULL, "Enable the use of expiration date in holds module.", "YesNo") } + ); }, }; diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 50999755b50..94af16c6d67 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -339,8 +339,11 @@ $(document).ready(function () { }, }, { - "visible": ReserveExpiration, - "data": { _: "expirationdate_formatted", "sort": "expirationdate" } + visible: ReserveExpiration, + data: { + _: "expirationdate_formatted", + sort: "expirationdate", + }, }, { data: function (oObj) { diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc index 8d5fc04f1ce..9ff34f9494d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc @@ -93,12 +93,11 @@ [% ELSE %] Never expires [% END %] + [% ELSE %] - - - + - [% END %] [% END %] - [% UNLESS( singleBranchMode) %] [% HOLD.branch.branchname | html %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt index 8d1f0aa80f7..53e1e17be4a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -291,19 +291,19 @@ [% END %] [% IF Koha.Preference('ReserveExpiration') %] -
  • - - - [% INCLUDE 'date-format.inc' %] - -
  • +
  • + + + [% INCLUDE 'date-format.inc' %] + +
  • [% END %] [% IF Koha.Preference('AllowHoldItemTypeSelection') %] diff --git a/misc/cronjobs/holds/cancel_expired_holds.pl b/misc/cronjobs/holds/cancel_expired_holds.pl index 744c817fd55..1d925b346ab 100755 --- a/misc/cronjobs/holds/cancel_expired_holds.pl +++ b/misc/cronjobs/holds/cancel_expired_holds.pl @@ -74,7 +74,7 @@ GetOptions( ) or pod2usage(1); pod2usage(1) if $help; -if( C4::Context->preference('ReserveExpiration') ) { +if ( C4::Context->preference('ReserveExpiration') ) { C4::Reserves::CancelExpiredReserves($reason); } diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index 2e052e0f995..a6c3d3050f5 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -1456,8 +1456,6 @@ subtest 'ReserveExpiration syspref tests' => sub { } } ); - - $hold->set_waiting(); $hold->revert_found(); is( -- 2.39.5