* @return CRM_Price_BAO_PriceField
*/
public static function add(&$params) {
+ $hook = empty($params['id']) ? 'create' : 'edit';
+ CRM_Utils_Hook::pre($hook, 'PriceField', CRM_Utils_Array::value('id', $params), $params);
+
$priceFieldBAO = new CRM_Price_BAO_PriceField();
$priceFieldBAO->copyValues($params);
}
$priceFieldBAO->save();
+ CRM_Utils_Hook::post($hook, 'PriceField', $priceFieldBAO->id, $priceFieldBAO);
return $priceFieldBAO;
}
* (reference) an assoc array of name/value pairs.
*
* @return CRM_Price_DAO_PriceField
+ *
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public static function create(&$params) {
if (empty($params['id']) && empty($params['name'])) {
$error['_qf_default'] = ts('%1 amount can not be less than zero. Please select the options accordingly.', [1 => $componentName]);
}
elseif ($totalAmount > 0 &&
- $totalPaymentAmountEnteredOnForm >= $totalAmount && // if total amount is equal to all selected amount in hand
+ // if total amount is equal to all selected amount in hand
+ $totalPaymentAmountEnteredOnForm >= $totalAmount &&
(CRM_Utils_Array::value('contribution_status_id', $fields) == CRM_Core_PseudoConstant::getKey('CRM_Contribute_DAO_Contribution', 'contribution_status_id', 'Partially paid'))
) {
$error['total_amount'] = ts('You have specified the status Partially Paid but have entered an amount that equals or exceeds the amount due. Please adjust the status of the payment or the amount');