From d78d0915b55cd692361597b6e9e3e6b39cbd9503 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Mon, 25 Apr 2022 14:41:33 +0000
Subject: [PATCH] Bug 14364: Fix spelling and tests

Moved the installer to pl file
Adjusted capitalization / reply-to
Fix tests by importing needed fuction and adjusting a wrong call

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 Koha/Hold.pm                                                | 2 +-
 .../mysql/atomicupdate/{bug_14364.perl => bug_14364.pl}     | 6 +++---
 installer/data/mysql/mandatory/sysprefs.sql                 | 2 +-
 .../prog/en/modules/admin/preferences/circulation.pref      | 2 +-
 t/db_dependent/Holds/ExpireReservesAutoFill.t               | 3 ++-
 5 files changed, 8 insertions(+), 7 deletions(-)
 rename installer/data/mysql/atomicupdate/{bug_14364.perl => bug_14364.pl} (88%)

diff --git a/Koha/Hold.pm b/Koha/Hold.pm
index 31d57bd9b57..1dd28dfe246 100644
--- a/Koha/Hold.pm
+++ b/Koha/Hold.pm
@@ -640,7 +640,7 @@ sub cancel {
             my $is_transfer = $self->branchcode ne $next_hold->{branchcode};
 
             C4::Reserves::ModReserveAffect( $self->itemnumber, $self->borrowernumber, $is_transfer, $next_hold->{reserve_id}, $self->desk_id, $autofill_next );
-            C4::Reserves::ModItemTransfer( $self->itemnumber, $self->branchcode, $next_hold->{branchcode}, "Reserve" ) if $is_transfer;
+            C4::Items::ModItemTransfer( $self->itemnumber, $self->branchcode, $next_hold->{branchcode}, "Reserve" ) if $is_transfer;
         }
     }
 
diff --git a/installer/data/mysql/atomicupdate/bug_14364.perl b/installer/data/mysql/atomicupdate/bug_14364.pl
similarity index 88%
rename from installer/data/mysql/atomicupdate/bug_14364.perl
rename to installer/data/mysql/atomicupdate/bug_14364.pl
index 5a8b657c64d..76a0b3ddfc0 100644
--- a/installer/data/mysql/atomicupdate/bug_14364.perl
+++ b/installer/data/mysql/atomicupdate/bug_14364.pl
@@ -9,13 +9,13 @@ return {
         $dbh->do(q{
             INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
             ('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
-            ('ExpireReservesAutoFillEmail','', NULL,'. Send email notification of hold filled from automatically expired/cancelled hold to this address. If not defined, Koha will fallback to the library reply to address','Free');
+            ('ExpireReservesAutoFillEmail','', NULL,'. Send email notification of hold filled from automatically expired/cancelled hold to this address. If not defined, Koha will fallback to the library reply-to address','Free');
         });
         say $out "Added ExpireReservesAutoFill system preferences";
 
         $dbh->do(q{
         INSERT IGNORE INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
-        VALUES ( 'reserves', 'HOLD_CHANGED', '', 'Canceled Hold Available for Different Patron', '0', 'Canceled Hold Available for Different Patron', 'The patron picking up <<biblio.title>> (<<items.barcode>>) has changed to <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).
+        VALUES ( 'reserves', 'HOLD_CHANGED', '', 'Canceled hold available for different patron', '0', 'Canceled Hold Available for Different Patron', 'The patron picking up <<biblio.title>> (<<items.barcode>>) has changed to <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).
 
 Please update the hold information for this item.
 
@@ -26,4 +26,4 @@ Pickup location: <<branches.branchname>>', 'email');
         });
         say $out "Added HOLD_CHANGED notice";
     },
-}
+};
diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql
index a163b552237..8bc24b66059 100644
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ b/installer/data/mysql/mandatory/sysprefs.sql
@@ -215,7 +215,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
 ('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
 ('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
-('ExpireReservesAutoFillEmail','', NULL,'Send email notification of hold filled from automatically expired/cancelled hold to this address. If not defined, Koha will fallback to the library reply to address','Free'),
+('ExpireReservesAutoFillEmail','', NULL,'Send email notification of hold filled from automatically expired/cancelled hold to this address. If not defined, Koha will fallback to the library reply-to address','Free'),
 ('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
 ('ExpireReservesMaxPickUpDelayCharge','0',NULL,'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.','free'),
 ('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
index 34a6b77fbeb..aedfc6cf249 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
@@ -770,7 +770,7 @@ Circulation:
             - automatically fill the next hold using the item.
             - Send email notification of the new hold filled with a canceled item to
             - pref: ExpireReservesAutoFillEmail
-            - . If no address is defined here, the email will be sent to the library's reply to address.
+            - . If no address is defined here, the email will be sent to the library's reply-to address.
             - '<br><strong>NOTE:</strong> These system preferences require the <code>misc/cronjobs/holds/cancel_expired_holds.pl</code> cronjob. Ask your system administrator to schedule it.<br>'
         -
             - If using <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ExpireReservesMaxPickUpDelay">ExpireReservesMaxPickUpDelay</a>, charge a patron who allows their waiting hold to expire a fee of
diff --git a/t/db_dependent/Holds/ExpireReservesAutoFill.t b/t/db_dependent/Holds/ExpireReservesAutoFill.t
index d805c500292..ab1eaf3c0f2 100755
--- a/t/db_dependent/Holds/ExpireReservesAutoFill.t
+++ b/t/db_dependent/Holds/ExpireReservesAutoFill.t
@@ -12,6 +12,7 @@ use MARC::Record;
 use C4::Context;
 use C4::Biblio;
 use C4::Items;
+use C4::Reserves qw(CancelExpiredReserves);
 use Koha::Database;
 use Koha::Holds;
 
@@ -176,7 +177,7 @@ subtest 'Test automatically canceled expired waiting holds to fill the next hold
 
     CancelExpiredReserves();
 
-    my @holds = Koha::Holds->search( {}, { order_by => 'priority' } );
+    my @holds = Koha::Holds->search( {}, { order_by => 'priority' } )->as_list;
     $hold_2 = $holds[0];
 
     is( @holds,            1,   'Found 1 hold' );
-- 
2.30.2