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


PHP CRM_Contact_DAO_Relationship::copyValues方法代码示例

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


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

示例1: addCaseRelationships

 /**
  * Function to add/copy relationships, when new client is added for a case
  *
  * @param int $caseId case id
  * @param int $contactId contact id / new client id
  *
  * @return void
  */
 static function addCaseRelationships($caseId, $contactId)
 {
     // get the case role / relationships for the case
     $caseRelationships = new CRM_Contact_DAO_Relationship();
     $caseRelationships->case_id = $caseId;
     $caseRelationships->find();
     $relationshipTypes = array();
     // make sure we don't add duplicate relationships of same relationship type.
     while ($caseRelationships->fetch() && !in_array($caseRelationships->relationship_type_id, $relationshipTypes)) {
         $values = array();
         CRM_Core_DAO::storeValues($caseRelationships, $values);
         // add relationship for new client.
         $newRelationship = new CRM_Contact_DAO_Relationship();
         $newRelationship->copyValues($values);
         $newRelationship->id = NULL;
         $newRelationship->case_id = $caseId;
         $newRelationship->contact_id_a = $contactId;
         $newRelationship->end_date = CRM_Utils_Date::isoToMysql($caseRelationships->end_date);
         $newRelationship->start_date = CRM_Utils_Date::isoToMysql($caseRelationships->start_date);
         // another check to avoid duplicate relationship, in cases where client is removed and re-added again.
         if (!$newRelationship->find(TRUE)) {
             $newRelationship->save();
         }
         $newRelationship->free();
         // store relationship type of newly created relationship
         $relationshipTypes[] = $caseRelationships->relationship_type_id;
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:36,代码来源:Case.php

示例2: mergeCases


//.........这里部分代码省略.........
                if (!$otherActId || in_array($otherActId, $otherActivityIds)) {
                    continue;
                }
                $otherActivityIds[] = $otherActId;
            }
            if ($duplicateCases) {
                if ($openCaseType = array_search('Open Case', $activityTypes)) {
                    $sql = "\nSELECT  id\n  FROM  civicrm_activity \n WHERE  activity_type_id = {$openCaseType} \n   AND  id IN ( " . implode(',', array_values($otherActivityIds)) . ');';
                    $dao = CRM_Core_DAO::executeQuery($sql);
                    while ($dao->fetch()) {
                        $singletonActivityIds[] = $dao->id;
                    }
                    $dao->free();
                }
            }
            // migrate all activities and connect to main contact.
            $copiedActivityIds = $activityMappingIds = array();
            sort($otherActivityIds);
            foreach ($otherActivityIds as $otherActivityId) {
                //for duplicate cases -
                //do not migrate singleton activities.
                if (!$otherActivityId || in_array($otherActivityId, $singletonActivityIds)) {
                    continue;
                }
                //migrate activity record.
                $otherActivity = new CRM_Activity_DAO_Activity();
                $otherActivity->id = $otherActivityId;
                if (!$otherActivity->find(TRUE)) {
                    continue;
                }
                $mainActVals = array();
                $mainActivity = new CRM_Activity_DAO_Activity();
                CRM_Core_DAO::storeValues($otherActivity, $mainActVals);
                $mainActivity->copyValues($mainActVals);
                $mainActivity->id = NULL;
                $mainActivity->activity_date_time = CRM_Utils_Date::isoToMysql($otherActivity->activity_date_time);
                //do check for merging contact,
                if ($mainActivity->source_contact_id == $otherContactId) {
                    $mainActivity->source_contact_id = $mainContactId;
                }
                $mainActivity->source_record_id = CRM_Utils_Array::value($mainActivity->source_record_id, $activityMappingIds);
                $mainActivity->original_id = CRM_Utils_Array::value($mainActivity->original_id, $activityMappingIds);
                $mainActivity->parent_id = CRM_Utils_Array::value($mainActivity->parent_id, $activityMappingIds);
                $mainActivity->save();
                $mainActivityId = $mainActivity->id;
                if (!$mainActivityId) {
                    continue;
                }
                $activityMappingIds[$otherActivityId] = $mainActivityId;
                // insert log of all activites
                CRM_Activity_BAO_Activity::logActivityAction($mainActivity);
                $otherActivity->free();
                $mainActivity->free();
                $copiedActivityIds[] = $otherActivityId;
                //create case activity record.
                $mainCaseActivity = new CRM_Case_DAO_CaseActivity();
                $mainCaseActivity->case_id = $mainCaseId;
                $mainCaseActivity->activity_id = $mainActivityId;
                $mainCaseActivity->save();
                $mainCaseActivity->free();
                //migrate target activities.
                $otherTargetActivity = new CRM_Activity_DAO_ActivityTarget();
                $otherTargetActivity->activity_id = $otherActivityId;
                $otherTargetActivity->find();
                while ($otherTargetActivity->fetch()) {
                    $mainActivityTarget = new CRM_Activity_DAO_ActivityTarget();
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:67,代码来源:Case.php

示例3: createRelationship

 /**
  * @param array $params
  *
  * @return bool
  */
 public function createRelationship(&$params)
 {
     $dao = new CRM_Contact_DAO_Relationship();
     $dao->copyValues($params);
     // only create a relationship if it does not exist
     if (!$dao->find(TRUE)) {
         $dao->save();
     }
     return TRUE;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:15,代码来源:Process.php

示例4: createRelationship

 function createRelationship(&$params)
 {
     require_once 'CRM/Contact/DAO/Relationship.php';
     $dao = new CRM_Contact_DAO_Relationship();
     $dao->copyValues($params);
     // only create a relationship if it does not exist
     if (!$dao->find(true)) {
         $dao->save();
     }
     return true;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:11,代码来源:Process.php


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