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

(-)a/C4/Reserves.pm (-38 / +4 lines)
Lines 1818-1824 The following tables are availalbe witin the notice: Link Here
1818
1818
1819
sub _koha_notify_reserve {
1819
sub _koha_notify_reserve {
1820
    my $reserve_id = shift;
1820
    my $reserve_id = shift;
1821
    my $notify_library = shift;
1822
1821
1823
    my $hold = Koha::Holds->find($reserve_id);
1822
    my $hold = Koha::Holds->find($reserve_id);
1824
    my $borrowernumber = $hold->borrowernumber;
1823
    my $borrowernumber = $hold->borrowernumber;
Lines 1834-1848 sub _koha_notify_reserve { Link Here
1834
    } );
1833
    } );
1835
1834
1836
    my $library = Koha::Libraries->find( $hold->branchcode );
1835
    my $library = Koha::Libraries->find( $hold->branchcode );
1837
    my $admin_email_address = $library->from_email_address;
1836
    my $inbound_email_address = $library->inbound_email_address;
1838
    $library = $library->unblessed;
1839
1837
1840
    my %letter_params = (
1838
    my %letter_params = (
1841
        module => 'reserves',
1839
        module => 'reserves',
1842
        branchcode => $hold->branchcode,
1840
        branchcode => $hold->branchcode,
1843
        lang => $patron->lang,
1841
        lang => $patron->lang,
1844
        tables => {
1842
        tables => {
1845
            'branches'       => $library,
1843
            'branches'       => $library->unblessed,
1846
            'borrowers'      => $patron->unblessed,
1844
            'borrowers'      => $patron->unblessed,
1847
            'biblio'         => $hold->biblionumber,
1845
            'biblio'         => $hold->biblionumber,
1848
            'biblioitems'    => $hold->biblionumber,
1846
            'biblioitems'    => $hold->biblionumber,
Lines 1866-1872 sub _koha_notify_reserve { Link Here
1866
        C4::Letters::EnqueueLetter( {
1864
        C4::Letters::EnqueueLetter( {
1867
            letter => $letter,
1865
            letter => $letter,
1868
            borrowernumber => $borrowernumber,
1866
            borrowernumber => $borrowernumber,
1869
            from_address => $admin_email_address,
1867
            from_address => $inbound_email_address,
1870
            message_transport_type => $mtt,
1868
            message_transport_type => $mtt,
1871
        } );
1869
        } );
1872
    };
1870
    };
Lines 1887-1923 sub _koha_notify_reserve { Link Here
1887
        &$send_notification('print', 'HOLD');
1885
        &$send_notification('print', 'HOLD');
1888
    }
1886
    }
1889
1887
1890
    if ($notify_library) {
1891
        my $letter = C4::Letters::GetPreparedLetter(
1892
            module      => 'reserves',
1893
            letter_code => 'HOLD_CHANGED',
1894
            branchcode  => $hold->branchcode,
1895
            substitute  => { today => output_pref( dt_from_string ) },
1896
            tables      => {
1897
                'branches'    => $library,
1898
                'borrowers'   => $patron->unblessed,
1899
                'biblio'      => $hold->biblionumber,
1900
                'biblioitems' => $hold->biblionumber,
1901
                'reserves'    => $hold->unblessed,
1902
                'items'       => $hold->itemnumber,
1903
            },
1904
        );
1905
1906
        my $email =
1907
             C4::Context->preference('ExpireReservesAutoFillEmail')
1908
          || $library->{branchemail}
1909
          || C4::Context->preference('KohaAdminEmailAddress');
1910
1911
        C4::Letters::EnqueueLetter(
1912
            {
1913
                letter                 => $letter,
1914
                borrowernumber         => $borrowernumber,
1915
                message_transport_type => 'email',
1916
                from_address           => $email,
1917
                to_address             => $email,
1918
            }
1919
        );
1920
    }
1921
}
1888
}
1922
1889
1923
=head2 _koha_notify_hold_changed
1890
=head2 _koha_notify_hold_changed
Lines 1951-1958 sub _koha_notify_hold_changed { Link Here
1951
1918
1952
    my $email =
1919
    my $email =
1953
         C4::Context->preference('ExpireReservesAutoFillEmail')
1920
         C4::Context->preference('ExpireReservesAutoFillEmail')
1954
      || $library->branchemail
1921
      || $library->inbound_email_address;
1955
      || C4::Context->preference('KohaAdminEmailAddress');
1956
1922
1957
    C4::Letters::EnqueueLetter(
1923
    C4::Letters::EnqueueLetter(
1958
        {
1924
        {
(-)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 1279-1284 tables: Link Here
1279
          content:
1279
          content:
1280
            - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1280
            - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1281
1281
1282
        - module: reserves
1283
          code: HOLD_CHANGED
1284
          branchcode: ""
1285
          name: "Canceled hold available for different patron"
1286
          is_html: 0
1287
          title: "Canceled hold available for different patron"
1288
          message_transport_type: email
1289
          lang: default
1290
          content:
1291
            - "The patron picking up <<biblio.title>> (<<items.barcode>>) has changed to <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1292
            - "Please update the hold information for this item."
1293
            - "Title: <<biblio.title>>"
1294
            - "Author: <<biblio.author>>"
1295
            - "Item: <<items.itemcallnumber>>"
1296
            - "Pickup location: <<branches.branchname>>"
1297
1282
        - module: reserves
1298
        - module: reserves
1283
          code: HOLD_REMINDER
1299
          code: HOLD_REMINDER
1284
          branchcode: ""
1300
          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 208-214 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
208
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
208
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
209
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
209
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
210
('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
210
('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
211
('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'),
211
('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'),
212
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
212
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
213
('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'),
213
('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'),
214
('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'),
214
('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 739-755 Circulation: Link Here
739
              choices:
739
              choices:
740
                  1: Allow
740
                  1: Allow
741
                  0: "Don't allow"
741
                  0: "Don't allow"
742
            - '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.'
742
            - '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>'
743
            - '<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>'
744
            - pref: ExpireReservesAutoFill
743
            - pref: ExpireReservesAutoFill
745
              choices:
744
              choices:
746
                  1: "Do"
745
                  1: "Do"
747
                  0: "Don't"
746
                  0: "Don't"
748
            - 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.
747
            - automatically fill the next hold using the item.
749
        -
750
            - Send email notification of the new hold filled with a canceled item to
748
            - Send email notification of the new hold filled with a canceled item to
751
            - pref: ExpireReservesAutoFillEmail
749
            - pref: ExpireReservesAutoFillEmail
752
            - . 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.
750
            - . If no address is defined here, the email will be sent to the library's reply to address.
751
            - '<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>'
753
        -
752
        -
754
            - 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
753
            - 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
755
            - pref: ExpireReservesMaxPickUpDelayCharge
754
            - pref: ExpireReservesMaxPickUpDelayCharge
756
- 

Return to bug 14364