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

(-)a/C4/Reserves.pm (-2 / +2 lines)
Lines 944-950 sub AutoUnsuspendReserves { Link Here
944
944
945
  CancelReserve({ reserve_id => $reserve_id, [ biblionumber => $biblionumber, borrowernumber => $borrrowernumber, itemnumber => $itemnumber, ] [ charge_cancel_fee => 1 ] });
945
  CancelReserve({ reserve_id => $reserve_id, [ biblionumber => $biblionumber, borrowernumber => $borrrowernumber, itemnumber => $itemnumber, ] [ charge_cancel_fee => 1 ] });
946
946
947
Cancels a reserve. If C<charge_cancel_fee> is passed and the C<ExpireReservesMaxPickUpDelayCharge> syspref is set, charge that fee to the patron's account.
947
Cancels a reserve. If C<charge_cancel_fee> is passed and the C<WaitingHoldCancelationFee> syspref is set, charge that fee to the patron's account.
948
948
949
=cut
949
=cut
950
950
Lines 995-1001 sub CancelReserve { Link Here
995
        _FixPriority({ biblionumber => $reserve->{biblionumber} });
995
        _FixPriority({ biblionumber => $reserve->{biblionumber} });
996
996
997
        # and, if desired, charge a cancel fee
997
        # and, if desired, charge a cancel fee
998
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
998
        my $charge = C4::Context->preference("WaitingHoldCancelationFee");
999
        if ( $charge && $params->{'charge_cancel_fee'} ) {
999
        if ( $charge && $params->{'charge_cancel_fee'} ) {
1000
            manualinvoice($reserve->{'borrowernumber'}, $reserve->{'itemnumber'}, '', 'HE', $charge);
1000
            manualinvoice($reserve->{'borrowernumber'}, $reserve->{'itemnumber'}, '', 'HE', $charge);
1001
        }
1001
        }
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 153-159 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
153
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
153
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
154
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
154
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
155
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
155
('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'),
156
('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'),
156
('WaitingHoldCancelationFee','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'),
157
('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'),
157
('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'),
158
('ExcludeHolidaysFromMaxPickUpDelay', '0', NULL, 'If ON, reserves max pickup delay takes into accountthe closed days.', 'YesNo'),
158
('ExcludeHolidaysFromMaxPickUpDelay', '0', NULL, 'If ON, reserves max pickup delay takes into accountthe closed days.', 'YesNo'),
159
('ExportCircHistory', 0, NULL, "Display the export circulation options",  'YesNo' ),
159
('ExportCircHistory', 0, NULL, "Display the export circulation options",  'YesNo' ),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-2 / +3 lines)
Lines 540-548 Circulation: Link Here
540
                  no: "Don't allow"
540
                  no: "Don't allow"
541
            - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay"
541
            - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay"
542
        -
542
        -
543
            - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of
543
            - Charge an amount of
544
            - pref: ExpireReservesMaxPickUpDelayCharge
544
            - pref: WaitingHoldCancelationFee
545
              class: currency
545
              class: currency
546
            - if a waiting hold cancellation fee is to be charged, based on if the hold has been waiting more days than defined by ReservesMaxPickUpDelay.
546
        -
547
        -
547
            - Satisfy holds using items from the libraries
548
            - Satisfy holds using items from the libraries
548
            - pref: StaticHoldsQueueWeight
549
            - pref: StaticHoldsQueueWeight
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-1 / +1 lines)
Lines 723-729 $(document).ready(function () { Link Here
723
                        [% END %]
723
                        [% END %]
724
                        <label for="dropboxcheck">Book drop mode</label>
724
                        <label for="dropboxcheck">Book drop mode</label>
725
                    </p>
725
                    </p>
726
                    [% IF Koha.Preference('ExpireReservesMaxPickUpDelayCharge') %]
726
                    [% IF Koha.Preference('WaitingHoldCancelationFee') %]
727
                    <p>
727
                    <p>
728
                        [% IF ( forgivemanualholdsexpire ) %]
728
                        [% IF ( forgivemanualholdsexpire ) %]
729
                        <input type="checkbox" id="forgivemanualholdsexpire" name="forgivemanualholdsexpire" value="forgivemanualholdsexpire" checked="checked" />
729
                        <input type="checkbox" id="forgivemanualholdsexpire" name="forgivemanualholdsexpire" value="forgivemanualholdsexpire" checked="checked" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (-2 / +2 lines)
Lines 143-149 Link Here
143
                   <input type="hidden" name="allbranches" value="[% allbranches %]" />
143
                   <input type="hidden" name="allbranches" value="[% allbranches %]" />
144
                   <input type="hidden" name="tab" value="holdsover">
144
                   <input type="hidden" name="tab" value="holdsover">
145
                   <input type="submit" value="Cancel [% IF TransferWhenCancelAllWaitingHolds %]and Transfer [% END %]All" />
145
                   <input type="submit" value="Cancel [% IF TransferWhenCancelAllWaitingHolds %]and Transfer [% END %]All" />
146
                   [% IF Koha.Preference('ExpireReservesMaxPickUpDelayCharge') %]
146
                   [% IF Koha.Preference('WaitingHoldCancelationFee') %]
147
                       <p><input type="checkbox" class="charge_cancel_fee" name="charge_cancel_fee" value="1" checked="checked" /> Charge cancelation fee</p>
147
                       <p><input type="checkbox" class="charge_cancel_fee" name="charge_cancel_fee" value="1" checked="checked" /> Charge cancelation fee</p>
148
                   [% END %]
148
                   [% END %]
149
               </form>
149
               </form>
Lines 188-194 Link Here
188
                            <input type="hidden" name="tbr" value="[% overloo.homebranch %]" />
188
                            <input type="hidden" name="tbr" value="[% overloo.homebranch %]" />
189
                            <input type="hidden" name="tab" value="holdsover">
189
                            <input type="hidden" name="tab" value="holdsover">
190
190
191
                            [% IF Koha.Preference('ExpireReservesMaxPickUpDelayCharge') %]
191
                            [% IF Koha.Preference('WaitingHoldCancelationFee') %]
192
                                <p><input type="checkbox" class="charge_cancel_fee" name="charge_cancel_fee" value="1" checked="checked" /> Charge cancelation fee</p>
192
                                <p><input type="checkbox" class="charge_cancel_fee" name="charge_cancel_fee" value="1" checked="checked" /> Charge cancelation fee</p>
193
                            [% END %]
193
                            [% END %]
194
194
(-)a/t/db_dependent/Holds/CancelAll.t (-2 / +2 lines)
Lines 38-44 my $borrowers_count = 2; Link Here
38
38
39
my ( $biblionumber, $title, $biblioitemnumber ) = create_helper_biblio('DUMMY');
39
my ( $biblionumber, $title, $biblioitemnumber ) = create_helper_biblio('DUMMY');
40
40
41
C4::Context->set_preference( 'ExpireReservesMaxPickUpDelayCharge', '5.00' );
41
C4::Context->set_preference( 'WaitingHoldCancelationFee', '5.00' );
42
42
43
my ( undef, undef, $itemnumber ) = AddItem(
43
my ( undef, undef, $itemnumber ) = AddItem(
44
    {
44
    {
Lines 107-113 is( $hold, undef, 'Hold canceled correctly' ); Link Here
107
$accountlines =
107
$accountlines =
108
  Koha::Account::Lines->search( { borrowernumber => $borrowernumber } );
108
  Koha::Account::Lines->search( { borrowernumber => $borrowernumber } );
109
is( $accountlines->count(), 1, "Found charge for cancelation" );
109
is( $accountlines->count(), 1, "Found charge for cancelation" );
110
is( $accountlines->as_list->[0]->amountoutstanding, '5.000000', 'Charge is equal to ExpireReservesMaxPickUpDelayCharge' );
110
is( $accountlines->as_list->[0]->amountoutstanding, '5.000000', 'Charge is equal to WaitingHoldCancelationFee' );
111
111
112
# Helper method to set up a Biblio.
112
# Helper method to set up a Biblio.
113
sub create_helper_biblio {
113
sub create_helper_biblio {
(-)a/t/db_dependent/Reserves.t (-3 / +2 lines)
Lines 586-592 my $bz14464_fines = $patron->account->balance; Link Here
586
is( !$bz14464_fines || $bz14464_fines==0, 1, 'Bug 14464 - No fines at beginning' );
586
is( !$bz14464_fines || $bz14464_fines==0, 1, 'Bug 14464 - No fines at beginning' );
587
587
588
# First, test cancelling a reserve when there's no charge configured.
588
# First, test cancelling a reserve when there's no charge configured.
589
t::lib::Mocks::mock_preference('ExpireReservesMaxPickUpDelayCharge', 0);
589
t::lib::Mocks::mock_preference('WaitingHoldCancelationFee', 0);
590
590
591
my $bz14464_reserve = AddReserve(
591
my $bz14464_reserve = AddReserve(
592
    $branch_1,
592
    $branch_1,
Lines 613-619 $bz14464_fines = $patron->account->balance; Link Here
613
is( !$bz14464_fines || $bz14464_fines==0, 1, 'Bug 14464 - No fines after cancelling reserve with no charge configured' );
613
is( !$bz14464_fines || $bz14464_fines==0, 1, 'Bug 14464 - No fines after cancelling reserve with no charge configured' );
614
614
615
# Then, test cancelling a reserve when there's no charge desired.
615
# Then, test cancelling a reserve when there's no charge desired.
616
t::lib::Mocks::mock_preference('ExpireReservesMaxPickUpDelayCharge', 42);
616
t::lib::Mocks::mock_preference('WaitingHoldCancelationFee', 42);
617
617
618
$bz14464_reserve = AddReserve(
618
$bz14464_reserve = AddReserve(
619
    $branch_1,
619
    $branch_1,
620
- 

Return to bug 15561