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

(-)a/C4/Reserves.pm (-4 / +20 lines)
Lines 36-41 use C4::Members qw(); Link Here
36
use C4::Letters;
36
use C4::Letters;
37
use C4::Branch qw( GetBranchDetail );
37
use C4::Branch qw( GetBranchDetail );
38
use C4::Dates qw( format_date_in_iso );
38
use C4::Dates qw( format_date_in_iso );
39
use C4::Calendar;
39
40
40
use Koha::DateUtils;
41
use Koha::DateUtils;
41
42
Lines 887-903 sub CancelExpiredReserves { Link Here
887
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
888
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
888
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
889
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
889
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
890
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
891
        my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
892
893
        my $today = C4::Dates->new();
890
894
891
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
895
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
892
        $sth = $dbh->prepare( $query );
896
        $sth = $dbh->prepare( $query );
893
        $sth->execute( $max_pickup_delay );
897
        $sth->execute( $max_pickup_delay );
894
898
895
        while (my $res = $sth->fetchrow_hashref ) {
899
        while ( my $res = $sth->fetchrow_hashref ) {
896
            if ( $charge ) {
900
            my $do_cancel = 1;
897
                manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
901
            unless ( $cancel_on_holidays ) {
902
                my $calendar = C4::Calendar->new( branchcode => $res->{'branchcode'} );
903
                my $is_holiday = $calendar->isHoliday( split( '/', $today->output('metric') ) );
904
905
                if ( $is_holiday ) {
906
                    $do_cancel = 0;
907
                }
898
            }
908
            }
899
909
900
            CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
910
            if ( $do_cancel ) {
911
                if ( $charge ) {
912
                    manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
913
                }
914
915
                CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
916
            }
901
        }
917
        }
902
    }
918
    }
903
919
(-)a/installer/data/mysql/sysprefs.sql (+4 lines)
Lines 406-408 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
406
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free');
406
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free');
407
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free');
407
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free');
408
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
408
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
409
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
410
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
411
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');
412
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 6339-6344 if ( CheckVersion($DBversion) ) { Link Here
6339
   SetVersion ($DBversion);
6339
   SetVersion ($DBversion);
6340
}
6340
}
6341
6341
6342
$DBversion ="3.11.00.XXX";
6343
if(C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6344
    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo')");
6345
    print "Upgrade to $DBversion done (Add syspref ExpireReservesOnHolidays\n";
6346
    SetVersion ($DBversion);
6347
}
6348
6342
=head1 FUNCTIONS
6349
=head1 FUNCTIONS
6343
6350
6344
=head2 TableExists($table)
6351
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +6 lines)
Lines 430-435 Circulation: Link Here
430
                  no: "Don't allow"
430
                  no: "Don't allow"
431
            - holds to be suspended from the OPAC.
431
            - holds to be suspended from the OPAC.
432
        -
432
        -
433
            - pref: ExpireReservesOnHolidays
434
              choices:
435
                  yes: Allow
436
                  no: "Don't allow"
437
            - expired holds to be canceled on days the library is closed..
438
        -
433
            - pref: decreaseLoanHighHolds
439
            - pref: decreaseLoanHighHolds
434
              choices:
440
              choices:
435
                  yes: Enable
441
                  yes: Enable
436
- 

Return to bug 8735