[open-ils-commits] [GIT] Evergreen ILS branch rel_3_3 updated. 4a4e45f2b531f641064f480671d7a65846ab0b03
Evergreen Git
git at git.evergreen-ils.org
Thu May 23 11:28:17 EDT 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_3_3 has been updated
via 4a4e45f2b531f641064f480671d7a65846ab0b03 (commit)
from 4561e40aaadd5d1480a10329f6d3d5514c866f41 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4a4e45f2b531f641064f480671d7a65846ab0b03
Author: Bill Erickson <berickxx at gmail.com>
Date: Thu Aug 3 15:01:34 2017 -0400
LP#1704819 Fine generator avoids int() rounding
Avoid using the Perl int() function for rounding in the fine generator,
since it can have unexpected outcomes.
For example:
$ perl -e 'print "230 = " . int(100 * 2.30) . "\n"'
230 = 229
Signed-off-by: Bill Erickson <berickxx at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm
index 3b6bfe9310..73b79a3856 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm
@@ -502,7 +502,7 @@ sub generate_fines {
$fine_interval =~ s/(\d{2}):(\d{2}):(\d{2})/$1 h $2 m $3 s/o;
$fine_interval = interval_to_seconds( $fine_interval );
- if ( $fine_interval == 0 || int($c->$recurring_fine_method * 100) == 0 || int($c->max_fine * 100) == 0 ) {
+ if ( $fine_interval == 0 || $c->$recurring_fine_method * 100 == 0 || $c->max_fine * 100 == 0 ) {
$conn->respond( "Fine Generator skipping circ due to 0 fine interval, 0 fine rate, or 0 max fine.\n" ) if $conn;
$logger->info( "Fine Generator skipping circ " . $c->id . " due to 0 fine interval, 0 fine rate, or 0 max fine." );
return;
@@ -536,8 +536,8 @@ sub generate_fines {
my $f_idx = 0;
my $fine = $fines[$f_idx] if (@fines);
my $current_fine_total = 0;
- $current_fine_total += int($_->amount * 100) for (grep { $_ and !$U->is_true($_->voided) } @fines);
- $current_fine_total -= int($_->amount * 100) for (map { @{$_->adjustments} } @fines);
+ $current_fine_total += $_->amount * 100 for (grep { $_ and !$U->is_true($_->voided) } @fines);
+ $current_fine_total -= $_->amount * 100 for (map { @{$_->adjustments} } @fines);
my $last_fine;
if ($fine) {
@@ -566,8 +566,8 @@ sub generate_fines {
$conn->respond( "\t$pending_fine_count pending fine(s)\n" ) if $conn;
return unless ($pending_fine_count);
- my $recurring_fine = int($c->$recurring_fine_method * 100);
- my $max_fine = int($c->max_fine * 100);
+ my $recurring_fine = $c->$recurring_fine_method * 100;
+ my $max_fine = $c->max_fine * 100;
my $skip_closed_check = $U->ou_ancestor_setting_value(
$c->$circ_lib_method, 'circ.fines.charge_when_closed');
-----------------------------------------------------------------------
Summary of changes:
.../src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list