Пример #1
0
 /**
  * insert/update a new entry in the database.
  *
  * @param array $params (reference), array $ids
  *
  * @return object CRM_Price_DAO_FieldValue object
  * @access public
  * @static
  */
 static function &add(&$params, $ids)
 {
     $fieldValueBAO = new CRM_Price_BAO_FieldValue();
     $fieldValueBAO->copyValues($params);
     if ($id = CRM_Utils_Array::value('id', $ids)) {
         $fieldValueBAO->id = $id;
     }
     $fieldValueBAO->save();
     return $fieldValueBAO;
 }
 /**
  * insert/update a new entry in the database.
  *
  * @param array $params (reference), array $ids
  *
  * @return object CRM_Price_DAO_FieldValue object
  * @access public
  * @static
  */
 static function &add(&$params, $ids)
 {
     $fieldValueBAO = new CRM_Price_BAO_FieldValue();
     $fieldValueBAO->copyValues($params);
     if ($id = CRM_Utils_Array::value('id', $ids)) {
         $fieldValueBAO->id = $id;
     }
     if (CRM_Utils_Array::value('is_default', $params)) {
         $query = 'UPDATE civicrm_price_field_value SET is_default = 0 WHERE  price_field_id = %1';
         $p = array(1 => array($params['price_field_id'], 'Integer'));
         CRM_Core_DAO::executeQuery($query, $p);
     }
     $fieldValueBAO->save();
     return $fieldValueBAO;
 }