当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Financial_BAO_FinancialItem::checkContactPresent方法代码示例

本文整理汇总了PHP中CRM_Financial_BAO_FinancialItem::checkContactPresent方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_BAO_FinancialItem::checkContactPresent方法的具体用法?PHP CRM_Financial_BAO_FinancialItem::checkContactPresent怎么用?PHP CRM_Financial_BAO_FinancialItem::checkContactPresent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Financial_BAO_FinancialItem的用法示例。


在下文中一共展示了CRM_Financial_BAO_FinancialItem::checkContactPresent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formRule

 /**
  * global form rule
  *
  * @param array $fields  the input form values
  * @param array $files   the uploaded files if any
  * @param object $self form object
  *
  * @return true if no errors, else array of errors
  * @access public
  * @static
  */
 static function formRule($fields, $files, $self)
 {
     // CRM-12929
     $error = array();
     if ($self->_skipUndelete) {
         CRM_Financial_BAO_FinancialItem::checkContactPresent($self->_contactIds, $error);
     }
     return $error;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:20,代码来源:Delete.php

示例2: civicrm_api3_contact_delete

/**
 * Delete a Contact with given contact_id.
 *
 * @param array $params
 *   input parameters per getfields
 *
 * @throws \Civi\API\Exception\UnauthorizedException
 * @return array
 *   API Result Array
 */
function civicrm_api3_contact_delete($params)
{
    $contactID = CRM_Utils_Array::value('id', $params);
    if (!empty($params['check_permissions']) && !CRM_Contact_BAO_Contact_Permission::allow($contactID, CRM_Core_Permission::DELETE)) {
        throw new \Civi\API\Exception\UnauthorizedException('Permission denied to modify contact record');
    }
    $session = CRM_Core_Session::singleton();
    if ($contactID == $session->get('userID')) {
        return civicrm_api3_create_error('This contact record is linked to the currently logged in user account - and cannot be deleted.');
    }
    $restore = !empty($params['restore']) ? $params['restore'] : FALSE;
    $skipUndelete = !empty($params['skip_undelete']) ? $params['skip_undelete'] : FALSE;
    // CRM-12929
    // restrict permanent delete if a contact has financial trxn associated with it
    $error = NULL;
    if ($skipUndelete && CRM_Financial_BAO_FinancialItem::checkContactPresent(array($contactID), $error)) {
        return civicrm_api3_create_error($error['_qf_default']);
    }
    if (CRM_Contact_BAO_Contact::deleteContact($contactID, $restore, $skipUndelete, CRM_Utils_Array::value('check_permissions', $params))) {
        return civicrm_api3_create_success();
    } else {
        return civicrm_api3_create_error('Could not delete contact');
    }
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:34,代码来源:Contact.php

示例3: deleteContact

 /**
  * Delete a contact and all its associated records.
  *
  * @param int $id
  *   Id of the contact to delete.
  * @param bool $restore
  *   Whether to actually restore, not delete.
  * @param bool $skipUndelete
  *   Whether to force contact delete or not.
  *
  * @return bool
  *   Was contact deleted?
  */
 public static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE)
 {
     if (!$id) {
         return FALSE;
     }
     // If trash is disabled in system settings then we always skip
     if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_undelete', NULL, 1)) {
         $skipUndelete = TRUE;
     }
     // make sure we have edit permission for this contact
     // before we delete
     if ($skipUndelete && !CRM_Core_Permission::check('delete contacts') || $restore && !CRM_Core_Permission::check('access deleted contacts')) {
         return FALSE;
     }
     // CRM-12929
     // Restrict contact to be delete if contact has financial trxns
     $error = NULL;
     if ($skipUndelete && CRM_Financial_BAO_FinancialItem::checkContactPresent(array($id), $error)) {
         return FALSE;
     }
     // make sure this contact_id does not have any membership types
     $membershipTypeID = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $id, 'id', 'member_of_contact_id');
     if ($membershipTypeID) {
         return FALSE;
     }
     $contact = new CRM_Contact_DAO_Contact();
     $contact->id = $id;
     if (!$contact->find(TRUE)) {
         return FALSE;
     }
     $contactType = $contact->contact_type;
     // currently we only clear employer cache.
     // we are now deleting inherited membership if any.
     if ($contact->contact_type == 'Organization') {
         $action = $restore ? CRM_Core_Action::ENABLE : CRM_Core_Action::DISABLE;
         $relationshipDtls = CRM_Contact_BAO_Relationship::getRelationship($id);
         if (!empty($relationshipDtls)) {
             foreach ($relationshipDtls as $rId => $details) {
                 CRM_Contact_BAO_Relationship::disableEnableRelationship($rId, $action);
             }
         }
         CRM_Contact_BAO_Contact_Utils::clearAllEmployee($id);
     }
     if ($restore) {
         return self::contactTrashRestore($contact, TRUE);
     }
     // start a new transaction
     $transaction = new CRM_Core_Transaction();
     if ($skipUndelete) {
         CRM_Utils_Hook::pre('delete', $contactType, $id, CRM_Core_DAO::$_nullArray);
         //delete billing address if exists.
         CRM_Contribute_BAO_Contribution::deleteAddress(NULL, $id);
         // delete the log entries since we dont have triggers enabled as yet
         $logDAO = new CRM_Core_DAO_Log();
         $logDAO->entity_table = 'civicrm_contact';
         $logDAO->entity_id = $id;
         $logDAO->delete();
         // delete contact participants CRM-12155
         CRM_Event_BAO_Participant::deleteContactParticipant($id);
         // delete contact contributions CRM-12155
         CRM_Contribute_BAO_Contribution::deleteContactContribution($id);
         // do activity cleanup, CRM-5604
         CRM_Activity_BAO_Activity::cleanupActivity($id);
         // delete all notes related to contact
         CRM_Core_BAO_Note::cleanContactNotes($id);
         // delete cases related to contact
         $contactCases = CRM_Case_BAO_Case::retrieveCaseIdsByContactId($id);
         if (!empty($contactCases)) {
             foreach ($contactCases as $caseId) {
                 //check if case is associate with other contact or not.
                 $caseContactId = CRM_Case_BAO_Case::getCaseClients($caseId);
                 if (count($caseContactId) <= 1) {
                     CRM_Case_BAO_Case::deleteCase($caseId);
                 }
             }
         }
         $contact->delete();
     } else {
         self::contactTrashRestore($contact);
     }
     //delete the contact id from recently view
     CRM_Utils_Recent::delContact($id);
     // Update the group contact cache
     if ($restore) {
         CRM_Contact_BAO_GroupContactCache::remove();
     } else {
         CRM_Contact_BAO_GroupContactCache::removeContact($id);
//.........这里部分代码省略.........
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:101,代码来源:Contact.php

示例4: civicrm_api3_contact_delete

/**
 * Delete a contact with given contact id
 *
 * @param  array       $params (reference ) input parameters, contact_id element required
 *
 * @return array API Result Array
 * @access public
 *
 * @example ContactDelete.php
 * {@getfields contact_delete}
 */
function civicrm_api3_contact_delete($params)
{
    $contactID = CRM_Utils_Array::value('id', $params);
    $session = CRM_Core_Session::singleton();
    if ($contactID == $session->get('userID')) {
        return civicrm_api3_create_error('This contact record is linked to the currently logged in user account - and cannot be deleted.');
    }
    $restore = CRM_Utils_Array::value('restore', $params) ? $params['restore'] : FALSE;
    $skipUndelete = CRM_Utils_Array::value('skip_undelete', $params) ? $params['skip_undelete'] : FALSE;
    // CRM-12929
    // restrict permanent delete if a contact has financial trxn associated with it
    $error = NULL;
    if ($skipUndelete && CRM_Financial_BAO_FinancialItem::checkContactPresent(array($contactID), $error)) {
        return civicrm_api3_create_error($error['_qf_default']);
    }
    if (CRM_Contact_BAO_Contact::deleteContact($contactID, $restore, $skipUndelete)) {
        return civicrm_api3_create_success();
    } else {
        return civicrm_api3_create_error('Could not delete contact');
    }
}
开发者ID:hguru,项目名称:224Civi,代码行数:32,代码来源:Contact.php


注:本文中的CRM_Financial_BAO_FinancialItem::checkContactPresent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。