//create mode only as we don't support editing line items
CRM_Utils_Hook::pre('create', 'LineItem', $params['entity_id'], $params);
-
+
$lineItemBAO = new CRM_Price_BAO_LineItem();
$lineItemBAO->copyValues($params);
'auto_renew' => CRM_Utils_Array::value('auto_renew', $options[$oid]),
'html_type' => $fields['html_type'],
'financial_type_id' => CRM_Utils_Array::value( 'financial_type_id', $options[$oid]),
-
+
);
if ($values[$oid]['membership_type_id'] && !isset($values[$oid]['auto_renew'])) {
- $values[$oid]['auto_renew'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $values[$oid]['membership_type_id'], 'auto_renew');
+ $values[$oid]['auto_renew'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $values[$oid]['membership_type_id'], 'auto_renew');
}
}
}
* @access public
* @static
*/
- public static function deleteLineItems($entityId, $entityTable) {
+ public static function deleteLineItems($entityId, $entityTable) {
if (!$entityId || !$entityTable) {
return FALSE;
}
) {
return;
}
-
+
foreach ($lineItem as $priceSetId => $values) {
if (!$priceSetId) {
continue;
}
}
}
- }
+ }
public static function syncLineItems($entityId, $entityTable = 'civicrm_contribution', $amount, $otherParams = NULL) {
if (!$entityId || CRM_Utils_System::isNull($amount))
LEFT JOIN civicrm_price_field pf ON pf.id = li.price_field_id
LEFT JOIN civicrm_price_set ps ON ps.id = pf.price_set_id ";
- $set = " li.unit_price = %3,
+ $set = " li.unit_price = %3,
li.line_total = %3 ";
- $where = " li.entity_id = %1 AND
+ $where = " li.entity_id = %1 AND
li.entity_table = %2 ";
$params = array(
if ($entityTable == 'civicrm_contribution') {
$entityName = 'default_contribution_amount';
$where .= " AND ps.name = %4 ";
- $params[4] = array($entityName, 'String');
- }
+ $params[4] = array($entityName, 'String');
+ }
elseif ($entityTable == 'civicrm_participant') {
$from .= "
LEFT JOIN civicrm_price_set_entity cpse ON cpse.price_set_id = ps.id
);
}
- $query = "
+ $query = "
UPDATE $from
SET $set
- WHERE $where
+ WHERE $where
";
CRM_Core_DAO::executeQuery($query, $params);
* @static
*/
static function getLineItemArray(&$params, $entityId = NULL, $entityTable = 'contribution') {
-
+
if (!$entityId) {
$priceSetDetails = CRM_Price_BAO_Set::getDefaultPriceSet();
foreach ($priceSetDetails as $values) {
'financial_type_id' => $params['financial_type_id']
);
}
- }
+ }
else {
$setID = NULL;
$totalEntityId = count($entityId);