當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Event_BAO_Participant::checkDuplicate方法代碼示例

本文整理匯總了PHP中CRM_Event_BAO_Participant::checkDuplicate方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Event_BAO_Participant::checkDuplicate方法的具體用法?PHP CRM_Event_BAO_Participant::checkDuplicate怎麽用?PHP CRM_Event_BAO_Participant::checkDuplicate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Event_BAO_Participant的用法示例。


在下文中一共展示了CRM_Event_BAO_Participant::checkDuplicate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _civicrm_api3_deprecated_participant_check_params

/**
 *
 * @param array $params
 *
 * @param bool $checkDuplicate
 *
 * @return array|bool
 *   <type>
 */
function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplicate = FALSE)
{
    // check if participant id is valid or not
    if (!empty($params['id'])) {
        $participant = new CRM_Event_BAO_Participant();
        $participant->id = $params['id'];
        if (!$participant->find(TRUE)) {
            return civicrm_api3_create_error(ts('Participant  id is not valid'));
        }
    }
    require_once 'CRM/Contact/BAO/Contact.php';
    // check if contact id is valid or not
    if (!empty($params['contact_id'])) {
        $contact = new CRM_Contact_BAO_Contact();
        $contact->id = $params['contact_id'];
        if (!$contact->find(TRUE)) {
            return civicrm_api3_create_error(ts('Contact id is not valid'));
        }
    }
    // check that event id is not an template
    if (!empty($params['event_id'])) {
        $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template');
        if (!empty($isTemplate)) {
            return civicrm_api3_create_error(ts('Event templates are not meant to be registered.'));
        }
    }
    $result = array();
    if ($checkDuplicate) {
        if (CRM_Event_BAO_Participant::checkDuplicate($params, $result)) {
            $participantID = array_pop($result);
            $error = CRM_Core_Error::createError("Found matching participant record.", CRM_Core_Error::DUPLICATE_PARTICIPANT, 'Fatal', $participantID);
            return civicrm_api3_create_error($error->pop(), array('contactID' => $params['contact_id'], 'participantID' => $participantID));
        }
    }
    return TRUE;
}
開發者ID:rameshrr99,項目名稱:civicrm-core,代碼行數:45,代碼來源:DeprecatedUtils.php

示例2: testcheckDuplicate

 /**
  * CheckDuplicate() method ( Checking for Duplicate Participant returns array of participant id)
  */
 public function testcheckDuplicate()
 {
     $duplicate = array();
     //Creating 3 new participants
     for ($i = 0; $i < 3; $i++) {
         $partiId[] = Participant::create($this->_contactId, $this->_eventId);
     }
     $params = array('event_id' => $this->_eventId, 'contact_id' => $this->_contactId);
     $checkDuplicate = CRM_Event_BAO_Participant::checkDuplicate($params, $duplicate);
     $this->assertEquals(count($duplicate), 3, 'Equating the array contains with duplicate array.');
     //Checking for the duplicate participant
     foreach ($duplicate as $key => $value) {
         $this->assertEquals($partiId[$key], $duplicate[$key], 'Equating the contactid which is in the database.');
     }
     //Deleting all participant
     for ($i = 0; $i < 3; $i++) {
         $partidel[] = Participant::delete($partiId[$i]);
     }
     Contact::delete($this->_contactId);
     Event::delete($this->_eventId);
 }
開發者ID:nganivet,項目名稱:civicrm-core,代碼行數:24,代碼來源:ParticipantTest.php

示例3: civicrm_participant_check_params

/**
 *
 * @param <type> $params
 * @return <type> 
 */
function civicrm_participant_check_params(&$params)
{
    require_once 'CRM/Event/BAO/Participant.php';
    $result = array();
    if (CRM_Event_BAO_Participant::checkDuplicate($params, $result)) {
        $participantID = array_pop($result);
        $error = CRM_Core_Error::createError("Found matching participant record.", CRM_Core_Error::DUPLICATE_PARTICIPANT, 'Fatal', $participantID);
        return civicrm_create_error($error->pop(), array('contactID' => $params['contact_id'], 'participantID' => $participantID));
    }
    return true;
}
開發者ID:ksecor,項目名稱:civicrm,代碼行數:16,代碼來源:Participant.php


注:本文中的CRM_Event_BAO_Participant::checkDuplicate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。