[freeside-commits] branch FREESIDE_4_BRANCH updated. 699c92dc9a4327c38e2ebb67f54fb2bcda25d94c

Ivan ivan at 420.am
Wed Nov 1 17:30:47 PDT 2017


The branch, FREESIDE_4_BRANCH has been updated
       via  699c92dc9a4327c38e2ebb67f54fb2bcda25d94c (commit)
      from  20fd8098a709fe5c63e8aa418f0a5344d7df9c42 (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 699c92dc9a4327c38e2ebb67f54fb2bcda25d94c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Nov 1 17:30:45 2017 -0700

    fix custom pricing vs. services issue in API order_package call too, RT#77484

diff --git a/FS/FS/API.pm b/FS/FS/API.pm
index 047bb4e..1758744 100644
--- a/FS/FS/API.pm
+++ b/FS/FS/API.pm
@@ -731,6 +731,9 @@ sub order_package {
        or ( length($r) && $r != $part_pkg->option('recur_fee') )
      )
   {
+
+    local($FS::part_pkg::skip_pkg_svc_hack) = 1;
+
     my $custom_part_pkg = $part_pkg->clone;
     $custom_part_pkg->disabled('Y');
     my %options = $part_pkg->options;
@@ -738,7 +741,18 @@ sub order_package {
     $options{'recur_fee'} = $r if length($r);
     my $error = $custom_part_pkg->insert( options=>\%options );
     return ( 'error' => "error customizing package: $error" ) if $error;
+
+    #not ->pkg_svc, we want to ignore links and clone the actual package def
+    foreach my $pkg_svc ( $part_pkg->_pkg_svc ) {
+      my $c_pkg_svc = new FS::pkg_svc { $pkg_svc->hash };
+      $c_pkg_svc->pkgsvcnum('');
+      $c_pkg_svc->pkgpart( $custom_part_pkg->pkgpart );
+      my $error = $c_pkg_svc->insert;
+      return "error customizing package: $error" if $error;
+    }
+
     $cust_pkg->pkgpart( $custom_part_pkg->pkgpart );
+
   }
 
   my %order_pkg = ( 'cust_pkg' => $cust_pkg );

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

Summary of changes:
 FS/FS/API.pm |   14 ++++++++++++++
 1 file changed, 14 insertions(+)




More information about the freeside-commits mailing list