return array($membership, $renewalMode, $dates);
}
+ /**
+ * Get line items representing the default price set.
+ *
+ * @param int $membershipOrg
+ * @param int $membershipTypeID
+ * @param float $total_amount
+ *
+ * @return array
+ */
+ public static function getQuickConfigMembershipLineItems($membershipOrg, $membershipTypeID, $total_amount) {
+ $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name');
+ $priceSets = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId));
+
+ // The name of the price field corresponds to the membership_type organization contact.
+ $params = array(
+ 'price_set_id' => $priceSetId,
+ 'name' => $membershipOrg,
+ );
+ $results = array();
+ CRM_Price_BAO_PriceField::retrieve($params, $results);
+
+ if (!empty($results)) {
+ $fields[$results['id']] = $priceSets['fields'][$results['id']];
+ $fid = $results['id'];
+ $editedFieldParams = array(
+ 'price_field_id' => $results['id'],
+ 'membership_type_id' => $membershipTypeID,
+ );
+ $results = array();
+ CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $results);
+ $fields[$fid]['options'][$results['id']] = $priceSets['fields'][$fid]['options'][$results['id']];
+ if (!empty($total_amount)) {
+ $fields[$fid]['options'][$results['id']]['amount'] = $total_amount;
+ }
+ }
+
+ $fieldID = key($fields);
+ $returnParams = array(
+ 'price_set_id' => $priceSetId,
+ 'price_sets' => $priceSets,
+ 'fields' => $fields,
+ 'price_fields' => array(
+ 'price_' . $fieldID => CRM_Utils_Array::value('id', $results),
+ )
+ );
+ return $returnParams;
+ }
+
/**
* Process price set and line items.
*
/**
* Record line items for default membership.
+ * @deprecated
+ *
+ * Use getQuickConfigMembershipLineItems
*
* @param CRM_Core_Form $qf
* @param array $membershipType