Bugzilla – Attachment 13615 Details for
Bug 9129
Add the ability to set the maximum fine for an item to its replacement price
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9129 - Add the ability to set the maximum fine for an item to its replacement price
Bug-9129---Add-the-ability-to-set-the-maximum-fine.patch (text/plain), 5.23 KB, created by
Kyle M Hall (khall)
on 2012-11-21 20:18:40 UTC
(
hide
)
Description:
Bug 9129 - Add the ability to set the maximum fine for an item to its replacement price
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-11-21 20:18:40 UTC
Size:
5.23 KB
patch
obsolete
>From 01883e569954661dfe608665eda551c1535314a1 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 21 Nov 2012 14:54:17 -0500 >Subject: [PATCH] Bug 9129 - Add the ability to set the maximum fine for an item to its replacement price > >--- > C4/Overdues.pm | 16 +++++++++++++++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 8 ++++++++ > .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ > 4 files changed, 30 insertions(+), 1 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index ac66c36..582ae62 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -268,8 +268,12 @@ sub CalcFine { > } else { > # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. > } >+ > $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap}; >+ $amount = $item->{'replacementprice'} if ( C4::Context->preference('MaxFineIsReplacementPrice') && $item->{'replacementprice'} && $amount > $item->{'replacementprice'} ); >+ > $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); >+ > return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); > # FIXME: chargename is NEVER populated anywhere. > } >@@ -542,16 +546,26 @@ sub UpdateFine { > } > $total_amount_other += $rec->{'amount'}; > } >+ >+ if ( C4::Context->preference('MaxFineIsReplacementPrice') ) { >+ my $item = C4::Items::GetItem( $itemnum ); >+ if ( $item->{'replacementprice'} && $amount > $item->{'replacementprice'} ) { >+ $debug && warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $item->{'replacementprice'} - Fine exceeds replacement price"; >+ $amount = $item->{'replacementprice'}; >+ } >+ } >+ > if (my $maxfine = C4::Context->preference('MaxFine')) { > if ($total_amount_other + $amount > $maxfine) { > my $new_amount = $maxfine - $total_amount_other; >- warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached"; >+ $debug && warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached"; > return if $new_amount <= 0.00; > > $amount = $new_amount; > } > } > >+ > if ( $data ) { > > # we're updating an existing fine. Only modify if amount changed >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index a4e4102..9693d68 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -386,3 +386,4 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidy > INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); > INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MaxFineIsReplacementPrice',0,'Make the replacement price a second max fine ceiling.',NULL,'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 964df0c..5a09513 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6063,6 +6063,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > } > > >+$DBversion = "3.09.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MaxFineIsReplacementPrice',0,'Make the replacement price a second max fine ceiling.',NULL,'YesNo')"); >+ print "Upgrade to $DBversion done (Bug 9107: Add syspref MaxFineIsReplacementPrice)\n"; >+ SetVersion ($DBversion); >+} >+ >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 74d14af..33cb821 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -80,6 +80,12 @@ Patrons: > - '[% local_currency %].' > - Empty value means no limit. Single item caps are specified in the circulation rules matrix. > - >+ - pref: MaxFineIsReplacementPrice >+ choices: >+ yes: Allow >+ no: "Don't allow" >+ - the maximum fine for an item to exceed the replacement price for that item. >+ - > - pref: memberofinstitution > choices: > yes: Do >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9129
:
13612
|
13614
|
13615
|
13616
|
14553
|
16197
|
17989
|
17990
|
17991
|
17992
|
18366
|
18367
|
18368
|
18370
|
18371
|
18642
|
18643
|
23305
|
43252
|
43253
|
43298
|
43592
|
43685
|
43686
|
43688
|
43689
|
43745
|
43746
|
43747
|
43781
|
43782
|
43783
|
43784
|
46157