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 979-995 sub CancelExpiredReserves { Link Here
979
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
980
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
980
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
981
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
981
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
982
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
983
        my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
984
985
        my $today = C4::Dates->new();
982
986
983
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
987
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
984
        $sth = $dbh->prepare( $query );
988
        $sth = $dbh->prepare( $query );
985
        $sth->execute( $max_pickup_delay );
989
        $sth->execute( $max_pickup_delay );
986
990
987
        while (my $res = $sth->fetchrow_hashref ) {
991
        while ( my $res = $sth->fetchrow_hashref ) {
988
            if ( $charge ) {
992
            my $do_cancel = 1;
989
                manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
993
            unless ( $cancel_on_holidays ) {
994
                my $calendar = C4::Calendar->new( branchcode => $res->{'branchcode'} );
995
                my $is_holiday = $calendar->isHoliday( split( '/', $today->output('metric') ) );
996
997
                if ( $is_holiday ) {
998
                    $do_cancel = 0;
999
                }
990
            }
1000
            }
991
1001
992
            CancelReserve({ reserve_id => $res->{'reserve_id'} });
1002
            if ( $do_cancel ) {
1003
                if ( $charge ) {
1004
                    manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
1005
                }
1006
1007
                CancelReserve({ reserve_id => $res->{'reserve_id'} });
1008
            }
993
        }
1009
        }
994
    }
1010
    }
995
1011
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 115-120 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
115
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
115
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
116
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
116
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
117
('ExpireReservesMaxPickUpDelayCharge','0',NULL,'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.','free'),
117
('ExpireReservesMaxPickUpDelayCharge','0',NULL,'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.','free'),
118
('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'),
118
('ExtendedPatronAttributes','0',NULL,'Use extended patron IDs and attributes','YesNo'),
119
('ExtendedPatronAttributes','0',NULL,'Use extended patron IDs and attributes','YesNo'),
119
('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'),
120
('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'),
120
('FilterBeforeOverdueReport','0','','Do not run overdue report until filter selected','YesNo'),
121
('FilterBeforeOverdueReport','0','','Do not run overdue report until filter selected','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 8551-8556 if (CheckVersion($DBversion)) { Link Here
8551
    SetVersion($DBversion);
8551
    SetVersion($DBversion);
8552
}
8552
}
8553
8553
8554
$DBversion = "3.15.00.XXX";
8555
if(C4::Context->preference("Version") < TransformToNum($DBversion) ) {
8556
    $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')");
8557
    print "Upgrade to $DBversion done (Add syspref ExpireReservesOnHolidays\n";
8558
    SetVersion ($DBversion);
8559
}
8560
8554
=head1 FUNCTIONS
8561
=head1 FUNCTIONS
8555
8562
8556
=head2 TableExists($table)
8563
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +6 lines)
Lines 498-503 Circulation: Link Here
498
                  no: "Don't allow"
498
                  no: "Don't allow"
499
            - holds to be suspended from the OPAC.
499
            - holds to be suspended from the OPAC.
500
        -
500
        -
501
            - pref: ExpireReservesOnHolidays
502
              choices:
503
                  yes: Allow
504
                  no: "Don't allow"
505
            - expired holds to be canceled on days the library is closed..
506
        -
501
            - pref: decreaseLoanHighHolds
507
            - pref: decreaseLoanHighHolds
502
              choices:
508
              choices:
503
                  yes: Enable
509
                  yes: Enable
504
- 

Return to bug 8735