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

(-)a/C4/Overdues.pm (-1 / +15 lines)
Lines 272-279 sub CalcFine { Link Here
272
    } else {
272
    } else {
273
        # a zero (or null) chargeperiod or negative units_minus_grace value means no charge.
273
        # a zero (or null) chargeperiod or negative units_minus_grace value means no charge.
274
    }
274
    }
275
275
    $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
276
    $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
277
    $amount = $item->{'replacementprice'} if ( C4::Context->preference('MaxFineIsReplacementPrice') && $item->{'replacementprice'} && $amount > $item->{'replacementprice'} );
278
276
    $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
279
    $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
280
277
    return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
281
    return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
278
    # FIXME: chargename is NEVER populated anywhere.
282
    # FIXME: chargename is NEVER populated anywhere.
279
}
283
}
Lines 546-561 sub UpdateFine { Link Here
546
        }
550
        }
547
        $total_amount_other += $rec->{'amount'};
551
        $total_amount_other += $rec->{'amount'};
548
    }
552
    }
553
554
    if ( C4::Context->preference('MaxFineIsReplacementPrice') ) {
555
        my $item = C4::Items::GetItem( $itemnum );
556
        if ( $item->{'replacementprice'} && $amount > $item->{'replacementprice'} ) {
557
            $debug && warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $item->{'replacementprice'} - Fine exceeds replacement price";
558
            $amount = $item->{'replacementprice'};
559
        }
560
    }
561
549
    if (my $maxfine = C4::Context->preference('MaxFine')) {
562
    if (my $maxfine = C4::Context->preference('MaxFine')) {
550
        if ($total_amount_other + $amount > $maxfine) {
563
        if ($total_amount_other + $amount > $maxfine) {
551
            my $new_amount = $maxfine - $total_amount_other;
564
            my $new_amount = $maxfine - $total_amount_other;
552
            warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached";
565
            $debug && warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached";
553
            return if $new_amount <= 0.00;
566
            return if $new_amount <= 0.00;
554
567
555
            $amount = $new_amount;
568
            $amount = $new_amount;
556
        }
569
        }
557
    }
570
    }
558
571
572
559
    if ( $data ) {
573
    if ( $data ) {
560
574
561
		# we're updating an existing fine.  Only modify if amount changed
575
		# we're updating an existing fine.  Only modify if amount changed
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 421-423 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES( Link Here
421
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PatronSelfRegistrationAdditionalInstructions','','A free text field to display additional instructions to newly self registered patrons.','','free');
421
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PatronSelfRegistrationAdditionalInstructions','','A free text field to display additional instructions to newly self registered patrons.','','free');
422
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '0', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo');
422
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '0', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo');
423
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo');
423
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo');
424
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 (+7 lines)
Lines 6526-6531 if ( CheckVersion($DBversion) ) { Link Here
6526
    SetVersion($DBversion);
6526
    SetVersion($DBversion);
6527
}
6527
}
6528
6528
6529
$DBversion = "3.11.00.XXX";
6530
if ( CheckVersion($DBversion) ) {
6531
   $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MaxFineIsReplacementPrice',0,'Make the replacement price a second max fine ceiling.',NULL,'YesNo')");
6532
   print "Upgrade to $DBversion done (Bug 9129: Add syspref MaxFineIsReplacementPrice)\n";
6533
   SetVersion ($DBversion);
6534
}
6535
6529
6536
6530
=head1 FUNCTIONS
6537
=head1 FUNCTIONS
6531
6538
(-)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