Merge pull request #16017 from mattwire/setentitysubtype
[civicrm-core.git] / api / v3 / Order.php
index 19b4eaefe2065075d74ce04eaeebd02781c1940b..464dcd427058828abf546d574b188c23390afaf0 100644 (file)
@@ -117,6 +117,9 @@ function civicrm_api3_order_create($params) {
     }
   }
   $contributionParams = $params;
+  // If this is nested we need to set sequential to 0 as sequential handling is done
+  // in create_success & id will be miscalculated...
+  $contributionParams['sequential'] = 0;
   foreach ($contributionParams as $key => $value) {
     // Unset chained keys so the code does not attempt to do this chaining twice.
     // e.g if calling 'api.Payment.create' We want to finish creating the order first.
@@ -138,6 +141,9 @@ function civicrm_api3_order_create($params) {
       if ($entity == 'pledge') {
         $paymentParams += $entityParams;
       }
+      elseif ($entity == 'membership') {
+        $paymentParams['isSkipLineItem'] = TRUE;
+      }
       $payments = civicrm_api3($entity . '_payment', 'create', $paymentParams);
     }
   }