[freeside-commits] branch master updated. 3e691871dc24b785968e5a3b5c4d12463e154efc

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


The branch, master has been updated
       via  3e691871dc24b785968e5a3b5c4d12463e154efc (commit)
      from  07f9cdaeaf10e0143897794218ba369991afeb42 (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 3e691871dc24b785968e5a3b5c4d12463e154efc
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Nov 1 17:30:42 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