[freeside-commits] branch master updated. 40ae74719fe9c1dd0e1993888dc19f0a93257103

Ivan ivan at 420.am
Sat Jan 18 15:03:40 PST 2014


The branch, master has been updated
       via  40ae74719fe9c1dd0e1993888dc19f0a93257103 (commit)
      from  965d64dbe634d499face4cea77c8b73188282a46 (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 40ae74719fe9c1dd0e1993888dc19f0a93257103
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Jan 18 15:03:38 2014 -0800

    default currency pricing to 0 if base pricing is 0, better error message when you leave it blank otherwise, RT#26600

diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index e7f08d2..26cdf70 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -259,10 +259,20 @@ sub insert {
   my %part_pkg_currency = %{ $options{'part_pkg_currency'} || {} };
   foreach my $key ( keys %part_pkg_currency ) {
     $key =~ /^(.+)_([A-Z]{3})$/ or next;
+    my( $optionname, $currency ) = ( $1, $2 );
+    if ( $part_pkg_currency{$key} =~ /^\s*$/ ) {
+      if ( $self->option($optionname) == 0 ) {
+        $part_pkg_currency{$key} = '0';
+      } else {
+        $dbh->rollback if $oldAutoCommit;
+        ( my $thing = $optionname ) =~ s/_/ /g;
+        return ucfirst($thing). " $currency is required";
+      }
+    }
     my $part_pkg_currency = new FS::part_pkg_currency {
       'pkgpart'     => $self->pkgpart,
-      'optionname'  => $1,
-      'currency'    => $2,
+      'optionname'  => $optionname,
+      'currency'    => $currency,
       'optionvalue' => $part_pkg_currency{$key},
     };
     my $error = $part_pkg_currency->insert;

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

Summary of changes:
 FS/FS/part_pkg.pm |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list