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 (+1 lines)
Lines 411-413 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
411
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
411
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
412
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
412
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
413
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');
413
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');
414
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 (+6 lines)
Lines 6399-6404 if ( CheckVersion($DBversion) ) { Link Here
6399
    SetVersion($DBversion);
6399
    SetVersion($DBversion);
6400
}
6400
}
6401
6401
6402
$DBversion ="3.11.00.XXX";
6403
if(C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6404
    $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')");
6405
    print "Upgrade to $DBversion done (Add syspref ExpireReservesOnHolidays\n";
6406
    SetVersion ($DBversion);
6407
}
6402
6408
6403
=head1 FUNCTIONS
6409
=head1 FUNCTIONS
6404
6410
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +6 lines)
Lines 442-447 Circulation: Link Here
442
                  no: "Don't allow"
442
                  no: "Don't allow"
443
            - holds to be suspended from the OPAC.
443
            - holds to be suspended from the OPAC.
444
        -
444
        -
445
            - pref: ExpireReservesOnHolidays
446
              choices:
447
                  yes: Allow
448
                  no: "Don't allow"
449
            - expired holds to be canceled on days the library is closed..
450
        -
445
            - pref: decreaseLoanHighHolds
451
            - pref: decreaseLoanHighHolds
446
              choices:
452
              choices:
447
                  yes: Enable
453
                  yes: Enable
448
- 

Return to bug 8735