本文整理匯總了PHP中CRM_Price_BAO_PriceSet::setPriceSets方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Price_BAO_PriceSet::setPriceSets方法的具體用法?PHP CRM_Price_BAO_PriceSet::setPriceSets怎麽用?PHP CRM_Price_BAO_PriceSet::setPriceSets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Price_BAO_PriceSet
的用法示例。
在下文中一共展示了CRM_Price_BAO_PriceSet::setPriceSets方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
/**
* function to create the event
*
* @param array $params reference array contains the values submitted by the form
*
* @return object
* @access public
* @static
*
*/
public static function create(&$params)
{
$transaction = new CRM_Core_Transaction();
if (empty($params['is_template'])) {
$params['is_template'] = 0;
}
// check if new event, if so set the created_id (if not set)
// and always set created_date to now
if (empty($params['id'])) {
if (empty($params['created_id'])) {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
}
$params['created_date'] = date('YmdHis');
}
$event = self::add($params);
CRM_Price_BAO_PriceSet::setPriceSets($params, $event, 'event');
if (is_a($event, 'CRM_Core_Error')) {
CRM_Core_DAO::transaction('ROLLBACK');
return $event;
}
$session = CRM_Core_Session::singleton();
$contactId = $session->get('userID');
if (!$contactId) {
$contactId = CRM_Utils_Array::value('contact_id', $params);
}
// Log the information on successful add/edit of Event
$logParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id, 'modified_id' => $contactId, 'modified_date' => date('Ymd'));
CRM_Core_BAO_Log::add($logParams);
if (!empty($params['custom']) && is_array($params['custom'])) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_event', $event->id);
}
$transaction->commit();
return $event;
}