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

(-)a/C4/Reserves.pm (-1 / +2 lines)
Lines 701-707 SELECT COUNT(*) FROM reserves WHERE biblionumber=? AND borrowernumber<>? Link Here
701
701
702
    my $dbh = C4::Context->dbh;
702
    my $dbh = C4::Context->dbh;
703
    my ( $fee ) = $dbh->selectrow_array( $borquery, undef, ($borrowernumber) );
703
    my ( $fee ) = $dbh->selectrow_array( $borquery, undef, ($borrowernumber) );
704
    if( $fee && $fee > 0 ) {
704
    my $hold_fee_mode = C4::Context->preference('HoldFeeMode') || 'not_always';
705
    if( $fee and $fee > 0 and $hold_fee_mode ne 'always' ) {
705
        # This is a reconstruction of the old code:
706
        # This is a reconstruction of the old code:
706
        # Compare number of items with items issued, and optionally check holds
707
        # Compare number of items with items issued, and optionally check holds
707
        # If not all items are issued and there are no holds: charge no fee
708
        # If not all items are issued and there are no holds: charge no fee
(-)a/installer/data/mysql/atomicupdate/bug_13592_add_HoldFeeMode_pref.sql (+1 lines)
Line 0 Link Here
1
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('HoldFeeMode','not_always','always|not_always','Set the hold fee mode','Choice');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 152-157 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
152
('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','YesNo'),
152
('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','YesNo'),
153
('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'),
153
('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'),
154
('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'),
154
('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'),
155
('HoldFeeMode','not_always','always|not_always','Set the hold fee mode','Choice'),
155
('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'),
156
('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'),
156
('HomeOrHoldingBranch','holdingbranch','holdingbranch|homebranch','Used by Circulation to determine which branch of an item to check with independent branches on, and by search to determine which branch to choose for availability ','Choice'),
157
('HomeOrHoldingBranch','holdingbranch','holdingbranch|homebranch','Used by Circulation to determine which branch of an item to check with independent branches on, and by search to determine which branch to choose for availability ','Choice'),
157
('HTML5MediaEnabled','not','not|opac|staff|both','Show a tab with a HTML5 media player for files catalogued in field 856','Choice'),
158
('HTML5MediaEnabled','not','not|opac|staff|both','Show a tab with a HTML5 media player for files catalogued in field 856','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 637-642 Circulation: Link Here
637
                  yes: Charge
637
                  yes: Charge
638
                  no: "Don't Charge"
638
                  no: "Don't Charge"
639
            - the replacement price when a patron loses an item.
639
            - the replacement price when a patron loses an item.
640
        -
641
            - pref: ReserveFee
642
              choices:
643
                  always: Always
644
                  not_always: "Don't always"
645
            - Charge fee when a hold is placed.
640
    Self Checkout:
646
    Self Checkout:
641
        -
647
        -
642
            - "Include the following JavaScript on all pages in the web-based self checkout:"
648
            - "Include the following JavaScript on all pages in the web-based self checkout:"
(-)a/t/db_dependent/Reserves/GetReserveFee.t (-5 / +10 lines)
Lines 21-29 Link Here
21
21
22
use Modern::Perl;
22
use Modern::Perl;
23
23
24
use Test::More tests => 5;
24
use Test::More tests => 6;
25
use Test::MockModule;
25
use Test::MockModule;
26
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
27
use t::lib::Mocks;
27
28
28
use C4::Circulation;
29
use C4::Circulation;
29
use C4::Reserves qw|AddReserve|;
30
use C4::Reserves qw|AddReserve|;
Lines 48-54 $builder->build({ Link Here
48
    source => 'Category',
49
    source => 'Category',
49
    value  => {
50
    value  => {
50
        categorycode          => 'XYZ1',
51
        categorycode          => 'XYZ1',
51
        reservefee            => 2.5,
52
        reservefee            => 2,
52
    },
53
    },
53
});
54
});
54
my $patron1 = $builder->build({
55
my $patron1 = $builder->build({
Lines 96-101 is( acctlines( $patron1->{borrowernumber} ), $acc1, 'No fee charged for patron 1 Link Here
96
# expect a charge for patron2.
97
# expect a charge for patron2.
97
C4::Circulation::AddIssue( $patron1, $item1->{barcode}, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter
98
C4::Circulation::AddIssue( $patron1, $item1->{barcode}, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter
98
my $acc2 = acctlines( $patron2->{borrowernumber} );
99
my $acc2 = acctlines( $patron2->{borrowernumber} );
100
t::lib::Mocks::mock_preference('HoldFeeMode', 'not_always');
99
my $fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->{biblionumber} );
101
my $fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->{biblionumber} );
100
is( $fee > 0, 1, 'Patron 2 should be charged cf GetReserveFee' );
102
is( $fee > 0, 1, 'Patron 2 should be charged cf GetReserveFee' );
101
C4::Reserves::ChargeReserveFee( $patron2->{borrowernumber}, $fee, $biblio->{title} );
103
C4::Reserves::ChargeReserveFee( $patron2->{borrowernumber}, $fee, $biblio->{title} );
Lines 104-115 is( acctlines( $patron2->{borrowernumber} ), $acc2 + 1, 'Patron 2 has been charg Link Here
104
# If we delete the reserve, there should be no charge
106
# If we delete the reserve, there should be no charge
105
$dbh->do( "DELETE FROM reserves WHERE reserve_id=?", undef, ( $res1 ) );
107
$dbh->do( "DELETE FROM reserves WHERE reserve_id=?", undef, ( $res1 ) );
106
$fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->{biblionumber} );
108
$fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->{biblionumber} );
107
is( $fee, 0, 'Patron 2 will not be charged now' );
109
is( $fee, 0, 'HoldFeeMode=not_always, Patron 2 should not be charged' );
110
111
t::lib::Mocks::mock_preference('HoldFeeMode', 'always');
112
$fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->{biblionumber} );
113
is( int($fee), 2, 'HoldFeeMode=always, Patron 2 should be charged' );
108
114
109
# If we delete the second item, there should be a charge
115
# If we delete the second item, there should be a charge
110
$dbh->do( "DELETE FROM items WHERE itemnumber=?", undef, ( $item2->{itemnumber} ) );
116
$dbh->do( "DELETE FROM items WHERE itemnumber=?", undef, ( $item2->{itemnumber} ) );
111
$fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->{biblionumber} );
117
$fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->{biblionumber} );
112
is( $fee > 0, 1, 'Patron 2 should be charged again this time' );
118
is( int($fee), 2, 'Patron 2 should be charged again this time' );
113
# End of tests
119
# End of tests
114
120
115
sub acctlines { #calculate number of accountlines for a patron
121
sub acctlines { #calculate number of accountlines for a patron
116
- 

Return to bug 13952