[open-ils-commits] [GIT] Evergreen ILS branch master updated. aff37795825b477a9b82560fe16ea4685202d201

Evergreen Git git at git.evergreen-ils.org
Tue Jul 24 10:22:14 EDT 2012


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, master has been updated
       via  aff37795825b477a9b82560fe16ea4685202d201 (commit)
      from  26e4a209438aa3ccc97a739d33b3afddac40fe60 (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 aff37795825b477a9b82560fe16ea4685202d201
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Jul 23 18:01:50 2012 -0400

    ACQ repair reverse exchange rate in fund transfer
    
    Updated fund transfer code to use the DB exchange rate stored procedure.
    In addition to code consolidation, this allows the fund trasnfer
    operation to work if an exchange rate for the two currencies involved is
    only defined in one direction.  The existing code required that the rate
    be defined in both directions in the database or it would produce an
    error in the logs and no visible error in the interface.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
index 57eb88c..3fff0c3 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
@@ -415,23 +415,23 @@ sub transfer_money_between_funds {
     return $e->die_event unless $e->allowed(['ADMIN_FUND','MANAGE_FUND'], $dfund->org, $dfund);
 
     if (!defined $dfund_amount) {
-        my $ratio = 1;
+
         if ($ofund->currency_type ne $dfund->currency_type) {
-            my $exchange_rate = $e->json_query({
-                "select"=>{"acqexr"=>["ratio"]}, 
-                "from"=>"acqexr", 
-                "where"=>{
-                    "from_currency"=>$ofund->currency_type,
-                    "to_currency"=>$dfund->currency_type
-                }
-            });
-            if (scalar(@$exchange_rate)<1) {
-                $logger->error('Unable to find exchange rate for ' . $ofund->currency_type . ' to ' . $dfund->currency_type);
-                return $e->die_event;
-            }
-            $ratio = @{$exchange_rate}[0]->{ratio};
+
+            $dfund_amount = $e->json_query({
+                from => [
+                    'acq.exchange_ratio',
+                    $ofund->currency_type,
+                    $dfund->currency_type,
+                    $ofund_amount
+                ]
+            })->[0]->{'acq.exchange_ratio'};
+
+        } else {
+
+            $dfund_amount = $ofund_amount;
         }
-        $dfund_amount = $ofund_amount * $ratio;
+
     } else {
         return $e->die_event unless $e->allowed("ACQ_XFER_MANUAL_DFUND_AMOUNT");
     }

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/Application/Acq/Financials.pm      |   30 ++++++++++----------
 1 files changed, 15 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list