本文整理汇总了PHP中CRM_Core_BAO_UFJoin::findJoinEntryId方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFJoin::findJoinEntryId方法的具体用法?PHP CRM_Core_BAO_UFJoin::findJoinEntryId怎么用?PHP CRM_Core_BAO_UFJoin::findJoinEntryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFJoin
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFJoin::findJoinEntryId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* takes an associative array and creates a uf join object
*
* @param array $params (reference) an assoc array of name/value pairs
*
* @return object CRM_Core_DAO_UFJoin object
* @access public
* @static
*/
function &create($params)
{
// see if a record exists with the same weight
$id = CRM_Core_BAO_UFJoin::findJoinEntryId($params);
if ($id) {
$params['id'] = $id;
}
$dao =& new CRM_Core_DAO_UFJoin();
$dao->copyValues($params);
if ($params['uf_group_id']) {
$dao->save();
} else {
$dao->delete();
}
return $dao;
}
示例2: postProcess
/**
* Process the form.
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
// we do this in case the user has hit the forward/back button
if ($this->_id) {
$params['id'] = $this->_id;
} else {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
$config = CRM_Core_Config::singleton();
$params['currency'] = $config->defaultCurrency;
}
$params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE);
$params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
$params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
$params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], TRUE);
$params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
$params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
if (!$params['honor_block_is_active']) {
$params['honor_block_title'] = NULL;
$params['honor_block_text'] = NULL;
}
$dao = CRM_Contribute_BAO_ContributionPage::create($params);
$ufJoinParams = array('is_organization' => array('module' => 'on_behalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id), 'honor_block_is_active' => array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id));
foreach ($ufJoinParams as $index => $ufJoinParam) {
if (!empty($params[$index])) {
// first delete all past entries
CRM_Core_BAO_UFJoin::deleteAll($ufJoinParam);
$ufJoinParam['uf_group_id'] = $params[$index];
$ufJoinParam['weight'] = 1;
$ufJoinParam['is_active'] = 1;
if ($index == 'honor_block_is_active') {
$ufJoinParam['uf_group_id'] = $params['honoree_profile'];
$ufJoinParam['module_data'] = CRM_Contribute_BAO_ContributionPage::formatModuleData($params, FALSE, 'soft_credit');
} else {
$ufJoinParam['uf_group_id'] = $params['onbehalf_profile_id'];
$ufJoinParam['module_data'] = CRM_Contribute_BAO_ContributionPage::formatModuleData($params, FALSE, 'on_behalf');
}
CRM_Core_BAO_UFJoin::create($ufJoinParam);
} else {
if ($index == 'honor_block_is_active') {
$params['honor_block_title'] = NULL;
$params['honor_block_text'] = NULL;
} else {
$params['for_organization'] = NULL;
}
//On subsequent honor_block_is_active uncheck, disable(don't delete)
//that particular honoree profile entry in UFjoin table, CRM-13981
$ufId = CRM_Core_BAO_UFJoin::findJoinEntryId($ufJoinParam);
if ($ufId) {
$ufJoinParam['uf_group_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParam);
$ufJoinParam['is_active'] = 0;
CRM_Core_BAO_UFJoin::create($ufJoinParam);
}
}
}
$this->set('id', $dao->id);
if ($this->_action & CRM_Core_Action::ADD) {
$url = 'civicrm/admin/contribute/amount';
$urlParams = "action=update&reset=1&id={$dao->id}";
// special case for 'Save and Done' consistency.
if ($this->controller->getButtonName('submit') == '_qf_Amount_upload_done') {
$url = 'civicrm/admin/contribute';
$urlParams = 'reset=1';
CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())), ts('Saved'), 'success');
}
CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
}
parent::endPostProcess();
}
示例3: crm_find_uf_join_id
/**
* Given an assoc list of params, finds if there is a record
* for this set of params
*
* @param array $params (reference) an assoc array of name/value pairs
*
* @return int or null
* @access public
*
*/
function crm_find_uf_join_id(&$params)
{
if (!is_array($params) || empty($params)) {
return _crm_error("{$params} is not valid array");
}
if (!isset($params['id']) && (!isset($params['entity_table']) && !isset($params['entity_id']) && !isset($params['weight']))) {
return _crm_error("{$param} should have atleast entity_table or entiy_id or weight");
}
return CRM_Core_BAO_UFJoin::findJoinEntryId($params);
}