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 424-426 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES(' Link Here
424
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo');
424
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo');
425
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice');
425
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice');
426
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UniqueItemFields', 'barcode', 'Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table', '', 'Free');
426
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UniqueItemFields', 'barcode', 'Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table', '', 'Free');
427
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 6784-6789 if ( CheckVersion($DBversion) ) { Link Here
6784
    SetVersion ($DBversion);
6784
    SetVersion ($DBversion);
6785
}
6785
}
6786
6786
6787
$DBversion = "3.11.00.XXX";
6788
if(C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6789
    $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')");
6790
    print "Upgrade to $DBversion done (Add syspref ExpireReservesOnHolidays\n";
6791
    SetVersion ($DBversion);
6792
}
6787
6793
6788
=head1 FUNCTIONS
6794
=head1 FUNCTIONS
6789
6795
(-)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