View | Details | Raw Unified | Return to bug 14364
Collapse All | Expand All

(-)a/C4/Reserves.pm (-38 / +4 lines)
Lines 1849-1855 The following tables are availalbe witin the notice: Link Here
1849
1849
1850
sub _koha_notify_reserve {
1850
sub _koha_notify_reserve {
1851
    my $reserve_id = shift;
1851
    my $reserve_id = shift;
1852
    my $notify_library = shift;
1853
1852
1854
    my $hold = Koha::Holds->find($reserve_id);
1853
    my $hold = Koha::Holds->find($reserve_id);
1855
    my $borrowernumber = $hold->borrowernumber;
1854
    my $borrowernumber = $hold->borrowernumber;
Lines 1865-1879 sub _koha_notify_reserve { Link Here
1865
    } );
1864
    } );
1866
1865
1867
    my $library = Koha::Libraries->find( $hold->branchcode );
1866
    my $library = Koha::Libraries->find( $hold->branchcode );
1868
    my $admin_email_address = $library->from_email_address;
1867
    my $inbound_email_address = $library->inbound_email_address;
1869
    $library = $library->unblessed;
1870
1868
1871
    my %letter_params = (
1869
    my %letter_params = (
1872
        module => 'reserves',
1870
        module => 'reserves',
1873
        branchcode => $hold->branchcode,
1871
        branchcode => $hold->branchcode,
1874
        lang => $patron->lang,
1872
        lang => $patron->lang,
1875
        tables => {
1873
        tables => {
1876
            'branches'       => $library,
1874
            'branches'       => $library->unblessed,
1877
            'borrowers'      => $patron->unblessed,
1875
            'borrowers'      => $patron->unblessed,
1878
            'biblio'         => $hold->biblionumber,
1876
            'biblio'         => $hold->biblionumber,
1879
            'biblioitems'    => $hold->biblionumber,
1877
            'biblioitems'    => $hold->biblionumber,
Lines 1897-1903 sub _koha_notify_reserve { Link Here
1897
        C4::Letters::EnqueueLetter( {
1895
        C4::Letters::EnqueueLetter( {
1898
            letter => $letter,
1896
            letter => $letter,
1899
            borrowernumber => $borrowernumber,
1897
            borrowernumber => $borrowernumber,
1900
            from_address => $admin_email_address,
1898
            from_address => $inbound_email_address,
1901
            message_transport_type => $mtt,
1899
            message_transport_type => $mtt,
1902
        } );
1900
        } );
1903
    };
1901
    };
Lines 1918-1954 sub _koha_notify_reserve { Link Here
1918
        &$send_notification('print', 'HOLD');
1916
        &$send_notification('print', 'HOLD');
1919
    }
1917
    }
1920
1918
1921
    if ($notify_library) {
1922
        my $letter = C4::Letters::GetPreparedLetter(
1923
            module      => 'reserves',
1924
            letter_code => 'HOLD_CHANGED',
1925
            branchcode  => $hold->branchcode,
1926
            substitute  => { today => output_pref( dt_from_string ) },
1927
            tables      => {
1928
                'branches'    => $library,
1929
                'borrowers'   => $patron->unblessed,
1930
                'biblio'      => $hold->biblionumber,
1931
                'biblioitems' => $hold->biblionumber,
1932
                'reserves'    => $hold->unblessed,
1933
                'items'       => $hold->itemnumber,
1934
            },
1935
        );
1936
1937
        my $email =
1938
             C4::Context->preference('ExpireReservesAutoFillEmail')
1939
          || $library->{branchemail}
1940
          || C4::Context->preference('KohaAdminEmailAddress');
1941
1942
        C4::Letters::EnqueueLetter(
1943
            {
1944
                letter                 => $letter,
1945
                borrowernumber         => $borrowernumber,
1946
                message_transport_type => 'email',
1947
                from_address           => $email,
1948
                to_address             => $email,
1949
            }
1950
        );
1951
    }
1952
}
1919
}
1953
1920
1954
=head2 _koha_notify_hold_changed
1921
=head2 _koha_notify_hold_changed
Lines 1982-1989 sub _koha_notify_hold_changed { Link Here
1982
1949
1983
    my $email =
1950
    my $email =
1984
         C4::Context->preference('ExpireReservesAutoFillEmail')
1951
         C4::Context->preference('ExpireReservesAutoFillEmail')
1985
      || $library->branchemail
1952
      || $library->inbound_email_address;
1986
      || C4::Context->preference('KohaAdminEmailAddress');
1987
1953
1988
    C4::Letters::EnqueueLetter(
1954
    C4::Letters::EnqueueLetter(
1989
        {
1955
        {
(-)a/Koha/Hold.pm (-3 lines)
Lines 510-521 Cancel a hold: Link Here
510
510
511
sub cancel {
511
sub cancel {
512
    my ( $self, $params ) = @_;
512
    my ( $self, $params ) = @_;
513
<<<<<<< HEAD
514
=======
515
513
516
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
514
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
517
515
518
>>>>>>> Bug 14364: Allow automatically canceled expired waiting holds to fill the next hold
519
    $self->_result->result_source->schema->txn_do(
516
    $self->_result->result_source->schema->txn_do(
520
        sub {
517
        sub {
521
            $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
518
            $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
(-)a/installer/data/mysql/atomicupdate/bug_14364.perl (-12 / +19 lines)
Lines 1-12 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
1
use Modern::Perl;
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
5
        ('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
6
        ('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');
7
    });
8
2
9
    $dbh->do(q{
3
return {
4
    bug_number => "14364",
5
    description => "Allow automatically canceled expired waiting holds to fill the next hold",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        $dbh->do(q{
10
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
11
            ('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
12
            ('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');
13
        });
14
        say $out "Added ExpireReservesAutoFill system preferences";
15
16
        $dbh->do(q{
10
        INSERT IGNORE INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
17
        INSERT IGNORE INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
11
        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>>).
18
        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>>).
12
19
Lines 14-22 Please update the hold information for this item. Link Here
14
21
15
Title: <<biblio.title>>
22
Title: <<biblio.title>>
16
Author: <<biblio.author>>
23
Author: <<biblio.author>>
17
Copy: <<items.copynumber>>
24
Item: <<items.itemcallnumber>>
18
Pickup location: <<branches.branchname>>', 'email');
25
Pickup location: <<branches.branchname>>', 'email');
19
    });
26
        });
20
27
        say $out "Added HOLD_CHANGED notice";
21
    NewVersion( $DBversion, 14364, "Allow automatically canceled expired waiting holds to fill the next hold");
28
    },
22
}
29
}
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (+16 lines)
Lines 1281-1286 tables: Link Here
1281
          content:
1281
          content:
1282
            - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1282
            - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1283
1283
1284
        - module: reserves
1285
          code: HOLD_CHANGED
1286
          branchcode: ""
1287
          name: "Canceled hold available for different patron"
1288
          is_html: 0
1289
          title: "Canceled hold available for different patron"
1290
          message_transport_type: email
1291
          lang: default
1292
          content:
1293
            - "The patron picking up <<biblio.title>> (<<items.barcode>>) has changed to <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1294
            - "Please update the hold information for this item."
1295
            - "Title: <<biblio.title>>"
1296
            - "Author: <<biblio.author>>"
1297
            - "Item: <<items.itemcallnumber>>"
1298
            - "Pickup location: <<branches.branchname>>"
1299
1284
        - module: reserves
1300
        - module: reserves
1285
          code: HOLD_REMINDER
1301
          code: HOLD_REMINDER
1286
          branchcode: ""
1302
          branchcode: ""
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql (-2 / +2 lines)
Lines 476-486 INSERT IGNORE INTO letter (module, code, name, title, content, message_transport Link Here
476
[% END %]
476
[% END %]
477
", 'email');
477
", 'email');
478
INSERT INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
478
INSERT INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
479
    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>>).
479
    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>>).
480
480
481
Please update the hold information for this item.
481
Please update the hold information for this item.
482
482
483
Title: <<biblio.title>>
483
Title: <<biblio.title>>
484
Author: <<biblio.author>>
484
Author: <<biblio.author>>
485
Copy: <<items.copynumber>>
485
Item: <<items.itemcallnumber>>
486
Pickup location: <<branches.branchname>>', 'email');
486
Pickup location: <<branches.branchname>>', 'email');
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 203-209 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
203
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
203
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
204
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
204
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
205
('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
205
('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
206
('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'),
206
('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'),
207
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
207
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
208
('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'),
208
('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'),
209
('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'),
209
('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 (-6 / +4 lines)
Lines 733-749 Circulation: Link Here
733
              choices:
733
              choices:
734
                  1: Allow
734
                  1: Allow
735
                  0: "Don't allow"
735
                  0: "Don't allow"
736
            - '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.'
736
            - '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>'
737
            - '<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>'
738
            - pref: ExpireReservesAutoFill
737
            - pref: ExpireReservesAutoFill
739
              choices:
738
              choices:
740
                  1: "Do"
739
                  1: "Do"
741
                  0: "Don't"
740
                  0: "Don't"
742
            - 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.
741
            - automatically fill the next hold using the item.
743
        -
744
            - Send email notification of the new hold filled with a canceled item to
742
            - Send email notification of the new hold filled with a canceled item to
745
            - pref: ExpireReservesAutoFillEmail
743
            - pref: ExpireReservesAutoFillEmail
746
            - . 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.
744
            - . If no address is defined here, the email will be sent to the library's reply to address.
745
            - '<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>'
747
        -
746
        -
748
            - 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
747
            - 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
749
            - pref: ExpireReservesMaxPickUpDelayCharge
748
            - pref: ExpireReservesMaxPickUpDelayCharge
750
- 

Return to bug 14364