本文整理汇总了PHP中CRM_Core_BAO_Block::handlePrimary方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Block::handlePrimary方法的具体用法?PHP CRM_Core_BAO_Block::handlePrimary怎么用?PHP CRM_Core_BAO_Block::handlePrimary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Block
的用法示例。
在下文中一共展示了CRM_Core_BAO_Block::handlePrimary方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
static function create($params)
{
if (is_numeric(CRM_Utils_Array::value('is_primary', $params)) || empty($params['id'])) {
CRM_Core_BAO_Block::handlePrimary($params, get_class());
}
$email = CRM_Core_BAO_Email::add($params);
return $email;
}
示例2: create
/**
* Create email address - note that the create function calls 'add' but
* has more business logic
*
* @param array $params
* Input parameters.
*
* @return object
*/
public static function create($params)
{
// if id is set & is_primary isn't we can assume no change
if (is_numeric(CRM_Utils_Array::value('is_primary', $params)) || empty($params['id'])) {
CRM_Core_BAO_Block::handlePrimary($params, get_class());
}
$email = CRM_Core_BAO_Email::add($params);
return $email;
}
示例3: create
/**
* @param $params
*
* @return object
* @throws API_Exception
*/
static function create($params)
{
// Ensure mysql phone function exists
CRM_Core_DAO::checkSqlFunctionsExist();
if (is_numeric(CRM_Utils_Array::value('is_primary', $params)) || empty($params['id'])) {
CRM_Core_BAO_Block::handlePrimary($params, get_class());
}
$phone = self::add($params);
return $phone;
}
示例4: create
public static function create($params)
{
$entityName = 'HRJob';
$hook = empty($params['id']) ? 'create' : 'edit';
if (is_numeric(CRM_Utils_Array::value('is_primary', $params)) || empty($params['id'])) {
CRM_Core_BAO_Block::handlePrimary($params, get_class());
}
CRM_Utils_Hook::pre($hook, $entityName, CRM_Utils_Array::value('id', $params), $params);
$instance = new self();
$instance->copyValues($params);
$instance->save();
$resultRoleGet = civicrm_api3('HRJobRole', 'get', array('job_id' => $instance->id, 'title' => $instance->title));
$duplicate = CRM_Utils_Array::value('action', $params, $hook);
if ($hook == 'create' && $resultRoleGet['count'] == 0 && $duplicate != 'duplicate') {
civicrm_api3('HRJobRole', 'create', array('job_id' => $instance->id, 'title' => $instance->title, 'location' => $instance->location, 'percent_pay_role' => 100));
}
CRM_Utils_Hook::post($hook, $entityName, $instance->id, $instance);
return $instance;
}
示例5: add
/**
* Takes an associative array and adds address.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param bool $fixAddress
* True if you need to fix (format) address values.
* before inserting in db
*
* @return CRM_Core_BAO_Address|null
*/
public static function add(&$params, $fixAddress)
{
static $customFields = NULL;
$address = new CRM_Core_DAO_Address();
// fixAddress mode to be done
if ($fixAddress) {
CRM_Core_BAO_Address::fixAddress($params);
}
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'Address', CRM_Utils_Array::value('id', $params), $params);
// if id is set & is_primary isn't we can assume no change
if (is_numeric(CRM_Utils_Array::value('is_primary', $params)) || empty($params['id'])) {
CRM_Core_BAO_Block::handlePrimary($params, get_class());
}
$config = CRM_Core_Config::singleton();
$address->copyValues($params);
$address->save();
if ($address->id) {
if (!$customFields) {
$customFields = CRM_Core_BAO_CustomField::getFields('Address', FALSE, TRUE);
}
if (!empty($customFields)) {
$addressCustom = CRM_Core_BAO_CustomField::postProcess($params, $address->id, 'Address', TRUE);
}
if (!empty($addressCustom)) {
CRM_Core_BAO_CustomValueTable::store($addressCustom, 'civicrm_address', $address->id);
}
//call the function to sync shared address
self::processSharedAddress($address->id, $params);
// call the function to create shared relationships
// we only create create relationship if address is shared by Individual
if (!CRM_Utils_System::isNull($address->master_id)) {
self::processSharedAddressRelationship($address->master_id, $params);
}
// lets call the post hook only after we've done all the follow on processing
CRM_Utils_Hook::post($hook, 'Address', $address->id, $address);
}
return $address;
}