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

(-)a/C4/Overdues.pm (-1 / +15 lines)
Lines 268-275 sub CalcFine { Link Here
268
    } else {
268
    } else {
269
        # a zero (or null) chargeperiod or negative units_minus_grace value means no charge.
269
        # a zero (or null) chargeperiod or negative units_minus_grace value means no charge.
270
    }
270
    }
271
271
    $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
272
    $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
273
    $amount = $item->{'replacementprice'} if ( C4::Context->preference('MaxFineIsReplacementPrice') && $item->{'replacementprice'} && $amount > $item->{'replacementprice'} );
274
272
    $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
275
    $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
276
273
    return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
277
    return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
274
    # FIXME: chargename is NEVER populated anywhere.
278
    # FIXME: chargename is NEVER populated anywhere.
275
}
279
}
Lines 542-557 sub UpdateFine { Link Here
542
        }
546
        }
543
        $total_amount_other += $rec->{'amount'};
547
        $total_amount_other += $rec->{'amount'};
544
    }
548
    }
549
550
    if ( C4::Context->preference('MaxFineIsReplacementPrice') ) {
551
        my $item = C4::Items::GetItem( $itemnum );
552
        if ( $item->{'replacementprice'} && $amount > $item->{'replacementprice'} ) {
553
            $debug && warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $item->{'replacementprice'} - Fine exceeds replacement price";
554
            $amount = $item->{'replacementprice'};
555
        }
556
    }
557
545
    if (my $maxfine = C4::Context->preference('MaxFine')) {
558
    if (my $maxfine = C4::Context->preference('MaxFine')) {
546
        if ($total_amount_other + $amount > $maxfine) {
559
        if ($total_amount_other + $amount > $maxfine) {
547
            my $new_amount = $maxfine - $total_amount_other;
560
            my $new_amount = $maxfine - $total_amount_other;
548
            warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached";
561
            $debug && warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached";
549
            return if $new_amount <= 0.00;
562
            return if $new_amount <= 0.00;
550
563
551
            $amount = $new_amount;
564
            $amount = $new_amount;
552
        }
565
        }
553
    }
566
    }
554
567
568
555
    if ( $data ) {
569
    if ( $data ) {
556
570
557
		# we're updating an existing fine.  Only modify if amount changed
571
		# we're updating an existing fine.  Only modify if amount changed
(-)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,explanation,options,type) VALUES('MaxFineIsReplacementPrice',0,'Make the replacement price a second max fine ceiling.',NULL,'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 ( CheckVersion($DBversion) ) {
6789
   $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MaxFineIsReplacementPrice',0,'Make the replacement price a second max fine ceiling.',NULL,'YesNo')");
6790
   print "Upgrade to $DBversion done (Bug 9129: Add syspref MaxFineIsReplacementPrice)\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/patrons.pref (-1 / +6 lines)
Lines 80-85 Patrons: Link Here
80
         - '[% local_currency %].'
80
         - '[% local_currency %].'
81
         - Empty value means no limit. Single item caps are specified in the circulation rules matrix.
81
         - Empty value means no limit. Single item caps are specified in the circulation rules matrix.
82
     -
82
     -
83
         - pref: MaxFineIsReplacementPrice
84
           choices:
85
               yes: Allow
86
               no: "Don't allow"
87
         - the maximum fine for an item to exceed the replacement price for that item.
88
     -
83
         - pref: memberofinstitution
89
         - pref: memberofinstitution
84
           choices:
90
           choices:
85
               yes: Do
91
               yes: Do
86
- 

Return to bug 9129