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 911-927 sub CancelExpiredReserves { Link Here
911
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
912
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
912
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
913
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
913
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
914
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
915
        my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
916
917
        my $today = C4::Dates->new();
914
918
915
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
919
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
916
        $sth = $dbh->prepare( $query );
920
        $sth = $dbh->prepare( $query );
917
        $sth->execute( $max_pickup_delay );
921
        $sth->execute( $max_pickup_delay );
918
922
919
        while (my $res = $sth->fetchrow_hashref ) {
923
        while ( my $res = $sth->fetchrow_hashref ) {
920
            if ( $charge ) {
924
            my $do_cancel = 1;
921
                manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
925
            unless ( $cancel_on_holidays ) {
926
                my $calendar = C4::Calendar->new( branchcode => $res->{'branchcode'} );
927
                my $is_holiday = $calendar->isHoliday( split( '/', $today->output('metric') ) );
928
929
                if ( $is_holiday ) {
930
                    $do_cancel = 0;
931
                }
922
            }
932
            }
923
933
924
            CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
934
            if ( $do_cancel ) {
935
                if ( $charge ) {
936
                    manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
937
                }
938
939
                CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
940
            }
925
        }
941
        }
926
    }
942
    }
927
943
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 418-420 INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) V Link Here
418
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '0', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo');
418
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '0', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo');
419
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo');
419
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo');
420
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UNIMARCAuthorsFacetsSeparator',', ', 'UNIMARC authors facets separator', NULL, 'short');
420
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UNIMARCAuthorsFacetsSeparator',', ', 'UNIMARC authors facets separator', NULL, 'short');
421
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 6557-6562 if ( CheckVersion($DBversion) ) { Link Here
6557
    SetVersion($DBversion);
6557
    SetVersion($DBversion);
6558
}
6558
}
6559
6559
6560
$DBversion = "3.11.00.XXX";
6561
if(C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6562
    $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')");
6563
    print "Upgrade to $DBversion done (Add syspref ExpireReservesOnHolidays\n";
6564
    SetVersion ($DBversion);
6565
}
6566
6560
=head1 FUNCTIONS
6567
=head1 FUNCTIONS
6561
6568
6562
=head2 TableExists($table)
6569
=head2 TableExists($table)
(-)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