From 95417e25fe36ed1d96b1f4d39bcf5fd66a522368 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 3 Oct 2019 11:06:47 +0000 Subject: [PATCH] Bug 17140: Make rounding syspref controlled Signed-off-by: Nick Clemens Signed-off-by: Jesse Maseto Signed-off-by: Martin Renvoize (cherry picked from commit ae075fded2a4ef8fb2f241e4cf9bb90d7587b02c) Signed-off-by: Fridolin Somers --- installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ members/pay.pl | 2 +- members/paycollect.pl | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index a22a86c10e..6635ff65af 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -521,6 +521,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ReturnpathDefault','',NULL,'Use this email address as return path or bounce address for undeliverable emails','Free'), ('reviewson','1','','If ON, enables patron reviews of bibliographic records in the OPAC','YesNo'), ('RisExportAdditionalFields', '', NULL , 'Define additional RIS tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.', 'textarea'), +('RoundFinesAtPayment','0', NULL,'If enabled any fines with fractions of a cent will be rounded to the nearest cent when payments are coll ected. e.g. 1.004 will be paid off by a 1.00 payment','YesNo'), ('RoutingListAddReserves','0','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'), ('RotationPreventTransfers','0',NULL,'If ON, prevent any transfers for items on stock rotation rotas, except for stock rotation transfers','YesNo'), ('RoutingListNote','To change this note edit RoutingListNote system preference.','70|10','Define a note to be shown on all routing lists','Textarea'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index af3823d06c..e3865c0533 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -919,6 +919,12 @@ Circulation: type: textarea syntax: javascript class: code + - + - pref: RoundFinesAtPayment + choices: + yes: Do + no: "Don't" + - round fines to the nearest cent when collecting payments. Enabling this preference allows paying fines of partial cents which may not be visible in the interface. Self Checkout: - - "Include the following JavaScript on all pages in the web-based self checkout:" diff --git a/members/pay.pl b/members/pay.pl index ecf1987680..bc42e13d1f 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -96,7 +96,7 @@ elsif ( $input->param('confirm_writeoff') ) { my $accountline = Koha::Account::Lines->find( $accountlines_id ); - $amount = $accountline->amountoutstanding if (abs($amount - $accountline->amountoutstanding) < 0.01); + $amount = $accountline->amountoutstanding if (abs($amount - $accountline->amountoutstanding) < 0.01) && C4::Context->preference('RoundFinesAtPayment'); if ( $amount > $accountline->amountoutstanding ) { print $input->redirect( "/cgi-bin/koha/members/paycollect.pl?" . "borrowernumber=$borrowernumber" diff --git a/members/paycollect.pl b/members/paycollect.pl index f6e711a235..e11b37e660 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -106,7 +106,7 @@ if ( $pay_individual || $writeoff_individual ) { } if ( $total_paid and $total_paid ne '0.00' ) { - $total_paid = $total_due if (abs($total_paid - $total_due) < 0.01); + $total_paid = $total_due if (abs($total_paid - $total_due) < 0.01) && C4::Context->preference('RoundFinesAtPayment'); if ( $total_paid < 0 or $total_paid > $total_due ) { $template->param( error_over => 1, -- 2.39.5