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

(-)a/C4/Reserves.pm (-4 / +19 lines)
Lines 887-903 sub CancelExpiredReserves { Link Here
887
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
887
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
888
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
888
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
889
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
889
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
890
        my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
891
892
        my $today = C4::Dates->new();
890
893
891
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
894
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
892
        $sth = $dbh->prepare( $query );
895
        $sth = $dbh->prepare( $query );
893
        $sth->execute( $max_pickup_delay );
896
        $sth->execute( $max_pickup_delay );
894
897
895
        while (my $res = $sth->fetchrow_hashref ) {
898
        while ( my $res = $sth->fetchrow_hashref ) {
896
            if ( $charge ) {
899
            my $do_cancel = 1;
897
                manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
900
            unless ( $cancel_on_holidays ) {
901
                my $calendar = C4::Calendar->new( branchcode => $res->{'branchcode'} );
902
                my $is_holiday = $calendar->isHoliday( split( '/', $today->output('metric') ) );
903
904
                if ( $is_holiday ) {
905
                    $do_cancel = 0;
906
                }
898
            }
907
            }
899
908
900
            CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
909
            if ( $do_cancel ) {
910
                if ( $charge ) {
911
                    manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
912
                }
913
914
                CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
915
            }
901
        }
916
        }
902
    }
917
    }
903
918
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 371-373 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
371
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free');
371
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free');
372
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionMarker','','Markers for age restriction indication, e.g. FSK|PEGI|Age|',NULL,'free');
372
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionMarker','','Markers for age restriction indication, e.g. FSK|PEGI|Age|',NULL,'free');
373
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionOverride',0,'Allow staff to check out an item with age restriction.',NULL,'YesNo');
373
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionOverride',0,'Allow staff to check out an item with age restriction.',NULL,'YesNo');
374
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 (-1 / +7 lines)
Lines 5696-5701 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5696
    SetVersion($DBversion);
5696
    SetVersion($DBversion);
5697
}
5697
}
5698
5698
5699
$DBversion ="3.09.00.XXX";
5700
if(C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5701
    $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')");
5702
    print "Upgrade to $DBversion done (Add syspref ExpireReservesOnHolidays\n";
5703
    SetVersion ($DBversion);
5704
}
5705
5699
=head1 FUNCTIONS
5706
=head1 FUNCTIONS
5700
5707
5701
=head2 TableExists($table)
5708
=head2 TableExists($table)
5702
- 

Return to bug 8735