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

(-)a/C4/Reserves.pm (-38 / +4 lines)
Lines 1815-1821 The following tables are availalbe witin the notice: Link Here
1815
1815
1816
sub _koha_notify_reserve {
1816
sub _koha_notify_reserve {
1817
    my $reserve_id = shift;
1817
    my $reserve_id = shift;
1818
    my $notify_library = shift;
1819
1818
1820
    my $hold = Koha::Holds->find($reserve_id);
1819
    my $hold = Koha::Holds->find($reserve_id);
1821
    my $borrowernumber = $hold->borrowernumber;
1820
    my $borrowernumber = $hold->borrowernumber;
Lines 1831-1845 sub _koha_notify_reserve { Link Here
1831
    } );
1830
    } );
1832
1831
1833
    my $library = Koha::Libraries->find( $hold->branchcode );
1832
    my $library = Koha::Libraries->find( $hold->branchcode );
1834
    my $admin_email_address = $library->from_email_address;
1833
    my $inbound_email_address = $library->inbound_email_address;
1835
    $library = $library->unblessed;
1836
1834
1837
    my %letter_params = (
1835
    my %letter_params = (
1838
        module => 'reserves',
1836
        module => 'reserves',
1839
        branchcode => $hold->branchcode,
1837
        branchcode => $hold->branchcode,
1840
        lang => $patron->lang,
1838
        lang => $patron->lang,
1841
        tables => {
1839
        tables => {
1842
            'branches'       => $library,
1840
            'branches'       => $library->unblessed,
1843
            'borrowers'      => $patron->unblessed,
1841
            'borrowers'      => $patron->unblessed,
1844
            'biblio'         => $hold->biblionumber,
1842
            'biblio'         => $hold->biblionumber,
1845
            'biblioitems'    => $hold->biblionumber,
1843
            'biblioitems'    => $hold->biblionumber,
Lines 1863-1869 sub _koha_notify_reserve { Link Here
1863
        C4::Letters::EnqueueLetter( {
1861
        C4::Letters::EnqueueLetter( {
1864
            letter => $letter,
1862
            letter => $letter,
1865
            borrowernumber => $borrowernumber,
1863
            borrowernumber => $borrowernumber,
1866
            from_address => $admin_email_address,
1864
            from_address => $inbound_email_address,
1867
            message_transport_type => $mtt,
1865
            message_transport_type => $mtt,
1868
        } );
1866
        } );
1869
    };
1867
    };
Lines 1884-1920 sub _koha_notify_reserve { Link Here
1884
        &$send_notification('print', 'HOLD');
1882
        &$send_notification('print', 'HOLD');
1885
    }
1883
    }
1886
1884
1887
    if ($notify_library) {
1888
        my $letter = C4::Letters::GetPreparedLetter(
1889
            module      => 'reserves',
1890
            letter_code => 'HOLD_CHANGED',
1891
            branchcode  => $hold->branchcode,
1892
            substitute  => { today => output_pref( dt_from_string ) },
1893
            tables      => {
1894
                'branches'    => $library,
1895
                'borrowers'   => $patron->unblessed,
1896
                'biblio'      => $hold->biblionumber,
1897
                'biblioitems' => $hold->biblionumber,
1898
                'reserves'    => $hold->unblessed,
1899
                'items'       => $hold->itemnumber,
1900
            },
1901
        );
1902
1903
        my $email =
1904
             C4::Context->preference('ExpireReservesAutoFillEmail')
1905
          || $library->{branchemail}
1906
          || C4::Context->preference('KohaAdminEmailAddress');
1907
1908
        C4::Letters::EnqueueLetter(
1909
            {
1910
                letter                 => $letter,
1911
                borrowernumber         => $borrowernumber,
1912
                message_transport_type => 'email',
1913
                from_address           => $email,
1914
                to_address             => $email,
1915
            }
1916
        );
1917
    }
1918
}
1885
}
1919
1886
1920
=head2 _koha_notify_hold_changed
1887
=head2 _koha_notify_hold_changed
Lines 1948-1955 sub _koha_notify_hold_changed { Link Here
1948
1915
1949
    my $email =
1916
    my $email =
1950
         C4::Context->preference('ExpireReservesAutoFillEmail')
1917
         C4::Context->preference('ExpireReservesAutoFillEmail')
1951
      || $library->branchemail
1918
      || $library->inbound_email_address;
1952
      || C4::Context->preference('KohaAdminEmailAddress');
1953
1919
1954
    C4::Letters::EnqueueLetter(
1920
    C4::Letters::EnqueueLetter(
1955
        {
1921
        {
(-)a/Koha/Hold.pm (-3 lines)
Lines 533-544 Cancel a hold: Link Here
533
533
534
sub cancel {
534
sub cancel {
535
    my ( $self, $params ) = @_;
535
    my ( $self, $params ) = @_;
536
<<<<<<< HEAD
537
=======
538
536
539
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
537
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
540
538
541
>>>>>>> Bug 14364: Allow automatically canceled expired waiting holds to fill the next hold
542
    $self->_result->result_source->schema->txn_do(
539
    $self->_result->result_source->schema->txn_do(
543
        sub {
540
        sub {
544
            my $patron = $self->patron;
541
            my $patron = $self->patron;
(-)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 1282-1287 tables: Link Here
1282
          content:
1282
          content:
1283
            - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1283
            - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1284
1284
1285
        - module: reserves
1286
          code: HOLD_CHANGED
1287
          branchcode: ""
1288
          name: "Canceled hold available for different patron"
1289
          is_html: 0
1290
          title: "Canceled hold available for different patron"
1291
          message_transport_type: email
1292
          lang: default
1293
          content:
1294
            - "The patron picking up <<biblio.title>> (<<items.barcode>>) has changed to <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1295
            - "Please update the hold information for this item."
1296
            - "Title: <<biblio.title>>"
1297
            - "Author: <<biblio.author>>"
1298
            - "Item: <<items.itemcallnumber>>"
1299
            - "Pickup location: <<branches.branchname>>"
1300
1285
        - module: reserves
1301
        - module: reserves
1286
          code: HOLD_REMINDER
1302
          code: HOLD_REMINDER
1287
          branchcode: ""
1303
          branchcode: ""
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql (-2 / +2 lines)
Lines 504-514 INSERT IGNORE INTO letter (module, code, name, title, content, message_transport Link Here
504
[% END %]
504
[% END %]
505
", 'email');
505
", 'email');
506
INSERT INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
506
INSERT INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
507
    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>>).
507
    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>>).
508
508
509
Please update the hold information for this item.
509
Please update the hold information for this item.
510
510
511
Title: <<biblio.title>>
511
Title: <<biblio.title>>
512
Author: <<biblio.author>>
512
Author: <<biblio.author>>
513
Copy: <<items.copynumber>>
513
Item: <<items.itemcallnumber>>
514
Pickup location: <<branches.branchname>>', 'email');
514
Pickup location: <<branches.branchname>>', 'email');
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 204-210 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
204
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
204
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
205
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
205
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
206
('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
206
('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
207
('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'),
207
('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'),
208
('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
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
209
('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
('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'),
210
('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'),
210
('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