Merge pull request #20681 from eileenmcnaughton/order_easy
authorMonish Deb <monish.deb@jmaconsulting.biz>
Mon, 5 Jul 2021 07:48:36 +0000 (13:18 +0530)
committerGitHub <noreply@github.com>
Mon, 5 Jul 2021 07:48:36 +0000 (13:18 +0530)
Make Order api easier to use for default price set

1  2 
CRM/Contribute/BAO/Contribution.php
CRM/Financial/BAO/Order.php
api/v3/Order.php
tests/phpunit/api/v3/ContributionTest.php

Simple merge
Simple merge
index 8a794af79772d3368d348322ce17caa8e6ec9b5b,7ec2ae93b1b52437d76eb4de3180df223cc22244..cf0e8ee50ebe9c6f7c22a9155ccd554437da0681
@@@ -117,9 -114,11 +115,10 @@@ function civicrm_api3_order_create(arra
          if ($supportedEntity) {
            $entityParams['skipLineItem'] = TRUE;
            $entityResult = civicrm_api3($entity, 'create', $entityParams);
 -          $params['contribution_mode'] = $entity;
            $entityIds[] = $params[$entity . '_id'] = $entityResult['id'];
-           foreach ($lineItems['line_item'] as &$items) {
-             $items['entity_id'] = $entityResult['id'];
+           foreach ($lineItems['line_item'] as $innerIndex => $lineItem) {
+             $lineIndex = $index . '+' . $innerIndex;
+             $order->setLineItemValue('entity_id', $entityResult['id'], $lineIndex);
            }
          }
        }