@@ -, +, @@ notices and prefs --- C4/Reserves.pm | 42 ++----------------- Koha/Hold.pm | 3 -- .../data/mysql/atomicupdate/bug_14364.perl | 31 ++++++++------ .../mysql/en/mandatory/sample_notices.yml | 16 +++++++ .../fr-FR/1-Obligatoire/sample_notices.sql | 4 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../admin/preferences/circulation.pref | 9 ++-- 7 files changed, 46 insertions(+), 61 deletions(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -1815,7 +1815,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; @@ -1831,15 +1830,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, @@ -1863,7 +1861,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, } ); }; @@ -1884,37 +1882,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 @@ -1948,8 +1915,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( { --- a/Koha/Hold.pm +++ a/Koha/Hold.pm @@ -533,12 +533,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; --- a/installer/data/mysql/atomicupdate/bug_14364.perl +++ a/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 <> (<>) has changed to <> <> (<>). @@ -14,9 +21,9 @@ Please update the hold information for this item. Title: <> Author: <> -Copy: <> +Item: <> Pickup location: <>', 'email'); - }); - - NewVersion( $DBversion, 14364, "Allow automatically canceled expired waiting holds to fill the next hold"); + }); + say $out "Added HOLD_CHANGED notice"; + }, } --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ a/installer/data/mysql/en/mandatory/sample_notices.yml @@ -1282,6 +1282,22 @@ tables: content: - "A hold has been placed on the following item : <> (<>) by the user <> <> (<>)." + - 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 <> (<>) has changed to <> <> (<>)." + - "Please update the hold information for this item." + - "Title: <>" + - "Author: <>" + - "Item: <>" + - "Pickup location: <>" + - module: reserves code: HOLD_REMINDER branchcode: "" --- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql +++ a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql @@ -504,11 +504,11 @@ INSERT IGNORE INTO letter (module, code, name, title, content, message_transport [% END %] ", 'email'); INSERT 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 <> (<>) has changed to <> <> (<>). + VALUES ( 'reserves', 'HOLD_CHANGED', '', 'Canceled hold available for different patron', '0', 'Canceled hold available for different patron', 'The patron picking up <> (<>) has changed to <> <> (<>). Please update the hold information for this item. Title: <> Author: <> -Copy: <> +Item: <> Pickup location: <>', 'email'); --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -204,7 +204,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'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -733,17 +733,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 ReservesMaxPickUpDelay system preference.' - - '
NOTE: This system preference requires the misc/cronjobs/holds/cancel_expired_holds.pl cronjob. Ask your system administrator to schedule it.
' + - 'holds to expire automatically if they have not been picked by within the time period specified in the ReservesMaxPickUpDelay system preference.
' - 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. + - '
NOTE: These system preferences require the misc/cronjobs/holds/cancel_expired_holds.pl cronjob. Ask your system administrator to schedule it.
' - - If using ExpireReservesMaxPickUpDelay, charge a patron who allows their waiting hold to expire a fee of - pref: ExpireReservesMaxPickUpDelayCharge --