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

(-)a/C4/Reserves.pm (-38 / +4 lines)
Lines 1875-1881 The following tables are availalbe witin the notice: Link Here
1875
1875
1876
sub _koha_notify_reserve {
1876
sub _koha_notify_reserve {
1877
    my $reserve_id = shift;
1877
    my $reserve_id = shift;
1878
    my $notify_library = shift;
1879
1878
1880
    my $hold = Koha::Holds->find($reserve_id);
1879
    my $hold = Koha::Holds->find($reserve_id);
1881
    my $borrowernumber = $hold->borrowernumber;
1880
    my $borrowernumber = $hold->borrowernumber;
Lines 1891-1905 sub _koha_notify_reserve { Link Here
1891
    } );
1890
    } );
1892
1891
1893
    my $library = Koha::Libraries->find( $hold->branchcode );
1892
    my $library = Koha::Libraries->find( $hold->branchcode );
1894
    my $admin_email_address = $library->from_email_address;
1893
    my $inbound_email_address = $library->inbound_email_address;
1895
    $library = $library->unblessed;
1896
1894
1897
    my %letter_params = (
1895
    my %letter_params = (
1898
        module => 'reserves',
1896
        module => 'reserves',
1899
        branchcode => $hold->branchcode,
1897
        branchcode => $hold->branchcode,
1900
        lang => $patron->lang,
1898
        lang => $patron->lang,
1901
        tables => {
1899
        tables => {
1902
            'branches'       => $library,
1900
            'branches'       => $library->unblessed,
1903
            'borrowers'      => $patron->unblessed,
1901
            'borrowers'      => $patron->unblessed,
1904
            'biblio'         => $hold->biblionumber,
1902
            'biblio'         => $hold->biblionumber,
1905
            'biblioitems'    => $hold->biblionumber,
1903
            'biblioitems'    => $hold->biblionumber,
Lines 1923-1929 sub _koha_notify_reserve { Link Here
1923
        C4::Letters::EnqueueLetter( {
1921
        C4::Letters::EnqueueLetter( {
1924
            letter => $letter,
1922
            letter => $letter,
1925
            borrowernumber => $borrowernumber,
1923
            borrowernumber => $borrowernumber,
1926
            from_address => $admin_email_address,
1924
            from_address => $inbound_email_address,
1927
            message_transport_type => $mtt,
1925
            message_transport_type => $mtt,
1928
        } );
1926
        } );
1929
    };
1927
    };
Lines 1944-1980 sub _koha_notify_reserve { Link Here
1944
        &$send_notification('print', 'HOLD');
1942
        &$send_notification('print', 'HOLD');
1945
    }
1943
    }
1946
1944
1947
    if ($notify_library) {
1948
        my $letter = C4::Letters::GetPreparedLetter(
1949
            module      => 'reserves',
1950
            letter_code => 'HOLD_CHANGED',
1951
            branchcode  => $hold->branchcode,
1952
            substitute  => { today => output_pref( dt_from_string ) },
1953
            tables      => {
1954
                'branches'    => $library,
1955
                'borrowers'   => $patron->unblessed,
1956
                'biblio'      => $hold->biblionumber,
1957
                'biblioitems' => $hold->biblionumber,
1958
                'reserves'    => $hold->unblessed,
1959
                'items'       => $hold->itemnumber,
1960
            },
1961
        );
1962
1963
        my $email =
1964
             C4::Context->preference('ExpireReservesAutoFillEmail')
1965
          || $library->{branchemail}
1966
          || C4::Context->preference('KohaAdminEmailAddress');
1967
1968
        C4::Letters::EnqueueLetter(
1969
            {
1970
                letter                 => $letter,
1971
                borrowernumber         => $borrowernumber,
1972
                message_transport_type => 'email',
1973
                from_address           => $email,
1974
                to_address             => $email,
1975
            }
1976
        );
1977
    }
1978
}
1945
}
1979
1946
1980
=head2 _koha_notify_hold_changed
1947
=head2 _koha_notify_hold_changed
Lines 2008-2015 sub _koha_notify_hold_changed { Link Here
2008
1975
2009
    my $email =
1976
    my $email =
2010
         C4::Context->preference('ExpireReservesAutoFillEmail')
1977
         C4::Context->preference('ExpireReservesAutoFillEmail')
2011
      || $library->branchemail
1978
      || $library->inbound_email_address;
2012
      || C4::Context->preference('KohaAdminEmailAddress');
2013
1979
2014
    C4::Letters::EnqueueLetter(
1980
    C4::Letters::EnqueueLetter(
2015
        {
1981
        {
(-)a/Koha/Hold.pm (-3 lines)
Lines 548-559 Cancel a hold: Link Here
548
548
549
sub cancel {
549
sub cancel {
550
    my ( $self, $params ) = @_;
550
    my ( $self, $params ) = @_;
551
<<<<<<< HEAD
552
=======
553
551
554
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
552
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
555
553
556
>>>>>>> Bug 14364: Allow automatically canceled expired waiting holds to fill the next hold
557
    $self->_result->result_source->schema->txn_do(
554
    $self->_result->result_source->schema->txn_do(
558
        sub {
555
        sub {
559
            my $patron = $self->patron;
556
            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 1306-1311 tables: Link Here
1306
          content:
1306
          content:
1307
            - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1307
            - "A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1308
1308
1309
        - module: reserves
1310
          code: HOLD_CHANGED
1311
          branchcode: ""
1312
          name: "Canceled hold available for different patron"
1313
          is_html: 0
1314
          title: "Canceled hold available for different patron"
1315
          message_transport_type: email
1316
          lang: default
1317
          content:
1318
            - "The patron picking up <<biblio.title>> (<<items.barcode>>) has changed to <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)."
1319
            - "Please update the hold information for this item."
1320
            - "Title: <<biblio.title>>"
1321
            - "Author: <<biblio.author>>"
1322
            - "Item: <<items.itemcallnumber>>"
1323
            - "Pickup location: <<branches.branchname>>"
1324
1309
        - module: reserves
1325
        - module: reserves
1310
          code: HOLD_REMINDER
1326
          code: HOLD_REMINDER
1311
          branchcode: ""
1327
          branchcode: ""
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 215-221 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
215
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
215
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
216
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
216
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
217
('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
217
('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'),
218
('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'),
218
('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'),
219
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
219
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
220
('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'),
220
('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'),
221
('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'),
221
('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 762-778 Circulation: Link Here
762
              choices:
762
              choices:
763
                  1: Allow
763
                  1: Allow
764
                  0: "Don't allow"
764
                  0: "Don't allow"
765
            - '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.'
765
            - '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>'
766
            - '<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>'
767
            - pref: ExpireReservesAutoFill
766
            - pref: ExpireReservesAutoFill
768
              choices:
767
              choices:
769
                  1: "Do"
768
                  1: "Do"
770
                  0: "Don't"
769
                  0: "Don't"
771
            - 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.
770
            - automatically fill the next hold using the item.
772
        -
773
            - Send email notification of the new hold filled with a canceled item to
771
            - Send email notification of the new hold filled with a canceled item to
774
            - pref: ExpireReservesAutoFillEmail
772
            - pref: ExpireReservesAutoFillEmail
775
            - . 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.
773
            - . If no address is defined here, the email will be sent to the library's reply to address.
774
            - '<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>'
776
        -
775
        -
777
            - 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
776
            - 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
778
            - pref: ExpireReservesMaxPickUpDelayCharge
777
            - pref: ExpireReservesMaxPickUpDelayCharge
779
- 

Return to bug 14364