Bugzilla – Attachment 137929 Details for
Bug 14364
Allow automatically canceled expired waiting holds to fill the next hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14364: (follow-up) Cleanup duplicate code and adjust notices and prefs
Bug-14364-follow-up-Cleanup-duplicate-code-and-adj.patch (text/plain), 12.43 KB, created by
Kyle M Hall (khall)
on 2022-07-20 14:26:18 UTC
(
hide
)
Description:
Bug 14364: (follow-up) Cleanup duplicate code and adjust notices and prefs
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-07-20 14:26:18 UTC
Size:
12.43 KB
patch
obsolete
>From 539d28321232caf95b2f0f40e6730c209d51c7b7 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 20 Dec 2021 14:03:22 +0000 >Subject: [PATCH] Bug 14364: (follow-up) Cleanup duplicate code and adjust > notices and prefs > >This patch removes a duplicated stanza left form moving routine >Changes the routines to use inbound_library_address >Improves the display if the system preferences >Updates the update file >Moves smaple notice > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Reserves.pm | 42 ++----------------- > Koha/Hold.pm | 3 -- > .../data/mysql/atomicupdate/bug_14364.perl | 31 ++++++++------ > .../mysql/en/mandatory/sample_notices.yml | 16 +++++++ > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > .../admin/preferences/circulation.pref | 9 ++-- > 6 files changed, 44 insertions(+), 59 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 90d4e56cbe1..d5e01f283dc 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1875,7 +1875,6 @@ The following tables are availalbe witin the notice: > > sub _koha_notify_reserve { > my $reserve_id = shift; >- my $notify_library = shift; > > my $hold = Koha::Holds->find($reserve_id); > my $borrowernumber = $hold->borrowernumber; >@@ -1891,15 +1890,14 @@ sub _koha_notify_reserve { > } ); > > my $library = Koha::Libraries->find( $hold->branchcode ); >- my $admin_email_address = $library->from_email_address; >- $library = $library->unblessed; >+ my $inbound_email_address = $library->inbound_email_address; > > my %letter_params = ( > module => 'reserves', > branchcode => $hold->branchcode, > lang => $patron->lang, > tables => { >- 'branches' => $library, >+ 'branches' => $library->unblessed, > 'borrowers' => $patron->unblessed, > 'biblio' => $hold->biblionumber, > 'biblioitems' => $hold->biblionumber, >@@ -1923,7 +1921,7 @@ sub _koha_notify_reserve { > C4::Letters::EnqueueLetter( { > letter => $letter, > borrowernumber => $borrowernumber, >- from_address => $admin_email_address, >+ from_address => $inbound_email_address, > message_transport_type => $mtt, > } ); > }; >@@ -1944,37 +1942,6 @@ sub _koha_notify_reserve { > &$send_notification('print', 'HOLD'); > } > >- if ($notify_library) { >- my $letter = C4::Letters::GetPreparedLetter( >- module => 'reserves', >- letter_code => 'HOLD_CHANGED', >- branchcode => $hold->branchcode, >- substitute => { today => output_pref( dt_from_string ) }, >- tables => { >- 'branches' => $library, >- 'borrowers' => $patron->unblessed, >- 'biblio' => $hold->biblionumber, >- 'biblioitems' => $hold->biblionumber, >- 'reserves' => $hold->unblessed, >- 'items' => $hold->itemnumber, >- }, >- ); >- >- my $email = >- C4::Context->preference('ExpireReservesAutoFillEmail') >- || $library->{branchemail} >- || C4::Context->preference('KohaAdminEmailAddress'); >- >- C4::Letters::EnqueueLetter( >- { >- letter => $letter, >- borrowernumber => $borrowernumber, >- message_transport_type => 'email', >- from_address => $email, >- to_address => $email, >- } >- ); >- } > } > > =head2 _koha_notify_hold_changed >@@ -2008,8 +1975,7 @@ sub _koha_notify_hold_changed { > > my $email = > C4::Context->preference('ExpireReservesAutoFillEmail') >- || $library->branchemail >- || C4::Context->preference('KohaAdminEmailAddress'); >+ || $library->inbound_email_address; > > C4::Letters::EnqueueLetter( > { >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index b41152d6985..31d57bd9b57 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -548,12 +548,9 @@ Cancel a hold: > > sub cancel { > my ( $self, $params ) = @_; >-<<<<<<< HEAD >-======= > > my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W'; > >->>>>>>> Bug 14364: Allow automatically canceled expired waiting holds to fill the next hold > $self->_result->result_source->schema->txn_do( > sub { > my $patron = $self->patron; >diff --git a/installer/data/mysql/atomicupdate/bug_14364.perl b/installer/data/mysql/atomicupdate/bug_14364.perl >index 2b50da6913f..5a8b657c64d 100644 >--- a/installer/data/mysql/atomicupdate/bug_14364.perl >+++ b/installer/data/mysql/atomicupdate/bug_14364.perl >@@ -1,12 +1,19 @@ >-$DBversion = 'XXX'; # will be replaced by the RM >-if( CheckVersion( $DBversion ) ) { >- $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,'If ExpireReservesAutoFill and an email is defined here, the email notification for the change in the hold will be sent to this address.','Free'); >- }); >+use Modern::Perl; > >- $dbh->do(q{ >+return { >+ bug_number => "14364", >+ description => "Allow automatically canceled expired waiting holds to fill the next hold", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ $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'); >+ }); >+ 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>>). > >@@ -14,9 +21,9 @@ Please update the hold information for this item. > > Title: <<biblio.title>> > Author: <<biblio.author>> >-Copy: <<items.copynumber>> >+Item: <<items.itemcallnumber>> > Pickup location: <<branches.branchname>>', 'email'); >- }); >- >- NewVersion( $DBversion, 14364, "Allow automatically canceled expired waiting holds to fill the next hold"); >+ }); >+ say $out "Added HOLD_CHANGED notice"; >+ }, > } >diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml >index 34ffab80dfb..5c2869a4e98 100644 >--- a/installer/data/mysql/en/mandatory/sample_notices.yml >+++ b/installer/data/mysql/en/mandatory/sample_notices.yml >@@ -1306,6 +1306,22 @@ tables: > content: > - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)." > >+ - module: reserves >+ code: HOLD_CHANGED >+ branchcode: "" >+ name: "Canceled hold available for different patron" >+ is_html: 0 >+ title: "Canceled hold available for different patron" >+ message_transport_type: email >+ lang: default >+ content: >+ - "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." >+ - "Title: <<biblio.title>>" >+ - "Author: <<biblio.author>>" >+ - "Item: <<items.itemcallnumber>>" >+ - "Pickup location: <<branches.branchname>>" >+ > - module: reserves > code: HOLD_REMINDER > branchcode: "" >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 31d51ecca6e..a163b552237 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,'If ExpireReservesAutoFill and an email is defined here, the email notification for the change in the hold will be sent to this 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 795f828f7de..34a6b77fbeb 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 >@@ -762,17 +762,16 @@ Circulation: > choices: > 1: Allow > 0: "Don't allow" >- - 'holds to expire automatically if they have not been picked by within the time period specified in the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReservesMaxPickUpDelay">ReservesMaxPickUpDelay</a> system preference.' >- - '<br><strong>NOTE:</strong> This system preference requires the <code>misc/cronjobs/holds/cancel_expired_holds.pl</code> cronjob. Ask your system administrator to schedule it.<br>' >+ - 'holds to expire automatically if they have not been picked by within the time period specified in the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReservesMaxPickUpDelay">ReservesMaxPickUpDelay</a> system preference.</br>' > - pref: ExpireReservesAutoFill > choices: > 1: "Do" > 0: "Don't" >- - automatically fill the next hold using the item. If enabled, an email notification will be sent to either the email address defined in ExpireReservesAutoFillEmail, the item's holding library's email address, or the email address defined in KohaAdminEmailAddress in that order. >- - >+ - 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 either the item's holding library or the email address defined in KohaAdminEmailAddress in that order. >+ - . 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 > - pref: ExpireReservesMaxPickUpDelayCharge >-- >2.30.2
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 14364
:
39998
|
41236
|
45149
|
49699
|
49700
|
49822
|
52310
|
52311
|
52312
|
71148
|
80126
|
103297
|
105015
|
115427
|
115466
|
120494
|
120941
|
120942
|
128757
|
128758
|
128759
|
132019
|
132020
|
132021
|
133812
|
133923
|
133924
|
133925
|
133926
|
133927
|
133928
|
137927
|
137928
| 137929 |
137930
|
137931
|
137932