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


PHP CRM_Activity_BAO_Activity::logActivityAction方法代码示例

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


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

示例1: mergeCases


//.........这里部分代码省略.........
                }
            }
            // 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);
                $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 activities
                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 source activity.
                $otherSourceActivity = new CRM_Activity_DAO_ActivityContact();
                $otherSourceActivity->activity_id = $otherActivityId;
                $otherSourceActivity->record_type_id = $sourceID;
                $otherSourceActivity->find();
                while ($otherSourceActivity->fetch()) {
                    $mainActivitySource = new CRM_Activity_DAO_ActivityContact();
                    $mainActivitySource->record_type_id = $sourceID;
                    $mainActivitySource->activity_id = $mainActivityId;
                    $mainActivitySource->contact_id = $otherSourceActivity->contact_id;
                    if ($mainActivitySource->contact_id == $otherContactId) {
                        $mainActivitySource->contact_id = $mainContactId;
                    }
                    //avoid duplicate object.
                    if (!$mainActivitySource->find(TRUE)) {
                        $mainActivitySource->save();
                    }
                    $mainActivitySource->free();
                }
                $otherSourceActivity->free();
                //migrate target activities.
                $otherTargetActivity = new CRM_Activity_DAO_ActivityContact();
                $otherTargetActivity->activity_id = $otherActivityId;
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:67,代码来源:Case.php

示例2: convertToCaseActivity

 static function convertToCaseActivity()
 {
     $params = array('caseID', 'activityID', 'contactID', 'newSubject', 'targetContactIds', 'mode');
     foreach ($params as $param) {
         ${$param} = CRM_Utils_Array::value($param, $_POST);
     }
     if (!$activityID || !$caseID) {
         echo json_encode(array('error_msg' => 'required params missing.'));
         CRM_Utils_System::civiExit();
     }
     require_once "CRM/Activity/DAO/Activity.php";
     $otherActivity = new CRM_Activity_DAO_Activity();
     $otherActivity->id = $activityID;
     if (!$otherActivity->find(true)) {
         echo json_encode(array('error_msg' => 'activity record is missing.'));
         CRM_Utils_System::civiExit();
     }
     $actDateTime = CRM_Utils_Date::isoToMysql($otherActivity->activity_date_time);
     //create new activity record.
     $mainActivity = new CRM_Activity_DAO_Activity();
     $mainActVals = array();
     CRM_Core_DAO::storeValues($otherActivity, $mainActVals);
     //get new activity subject.
     if (!empty($newSubject)) {
         $mainActVals['subject'] = $newSubject;
     }
     $mainActivity->copyValues($mainActVals);
     $mainActivity->id = null;
     $mainActivity->activity_date_time = $actDateTime;
     //make sure this is current revision.
     $mainActivity->is_current_revision = true;
     //drop all relations.
     $mainActivity->parent_id = $mainActivity->original_id = null;
     $mainActivity->save();
     $mainActivityId = $mainActivity->id;
     require_once 'CRM/Activity/BAO/Activity.php';
     CRM_Activity_BAO_Activity::logActivityAction($mainActivity);
     $mainActivity->free();
     //mark previous activity as deleted.
     if (in_array($mode, array('move', 'file'))) {
         $otherActivity->activity_date_time = $actDateTime;
         $otherActivity->is_deleted = 1;
         $otherActivity->save();
     }
     $otherActivity->free();
     require_once "CRM/Activity/BAO/Activity.php";
     $targetContacts = array();
     if (!empty($targetContactIds)) {
         $targetContacts = array_unique(explode(',', $targetContactIds));
     }
     foreach ($targetContacts as $key => $value) {
         $params = array('activity_id' => $mainActivityId, 'target_contact_id' => $value);
         CRM_Activity_BAO_Activity::createActivityTarget($params);
     }
     //attach newly created activity to case.
     require_once "CRM/Case/DAO/CaseActivity.php";
     $caseActivity = new CRM_Case_DAO_CaseActivity();
     $caseActivity->case_id = $caseID;
     $caseActivity->activity_id = $mainActivityId;
     $caseActivity->save();
     $error_msg = $caseActivity->_lastError;
     $caseActivity->free();
     echo json_encode(array('error_msg' => $error_msg));
     CRM_Utils_System::civiExit();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:65,代码来源:AJAX.php

示例3: _convertToCaseActivity

 /**
  * @param array $params
  *
  * @return array
  */
 public static function _convertToCaseActivity($params)
 {
     if (!$params['activityID'] || !$params['caseID']) {
         return array('error_msg' => 'required params missing.');
     }
     $otherActivity = new CRM_Activity_DAO_Activity();
     $otherActivity->id = $params['activityID'];
     if (!$otherActivity->find(TRUE)) {
         return array('error_msg' => 'activity record is missing.');
     }
     $actDateTime = CRM_Utils_Date::isoToMysql($otherActivity->activity_date_time);
     // Create new activity record.
     $mainActivity = new CRM_Activity_DAO_Activity();
     $mainActVals = array();
     CRM_Core_DAO::storeValues($otherActivity, $mainActVals);
     // Get new activity subject.
     if (!empty($params['newSubject'])) {
         $mainActVals['subject'] = $params['newSubject'];
     }
     $mainActivity->copyValues($mainActVals);
     $mainActivity->id = NULL;
     $mainActivity->activity_date_time = $actDateTime;
     // Make sure this is current revision.
     $mainActivity->is_current_revision = TRUE;
     // Drop all relations.
     $mainActivity->parent_id = $mainActivity->original_id = NULL;
     $mainActivity->save();
     $mainActivityId = $mainActivity->id;
     CRM_Activity_BAO_Activity::logActivityAction($mainActivity);
     $mainActivity->free();
     // Mark previous activity as deleted. If it was a non-case activity
     // then just change the subject.
     if (in_array($params['mode'], array('move', 'file'))) {
         $caseActivity = new CRM_Case_DAO_CaseActivity();
         $caseActivity->case_id = $params['caseID'];
         $caseActivity->activity_id = $otherActivity->id;
         if ($params['mode'] == 'move' || $caseActivity->find(TRUE)) {
             $otherActivity->is_deleted = 1;
         } else {
             $otherActivity->subject = ts('(Filed on case %1)', array(1 => $params['caseID'])) . ' ' . $otherActivity->subject;
         }
         $otherActivity->activity_date_time = $actDateTime;
         $otherActivity->save();
         $caseActivity->free();
     }
     $otherActivity->free();
     $targetContacts = array();
     if (!empty($params['targetContactIds'])) {
         $targetContacts = array_unique(explode(',', $params['targetContactIds']));
     }
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
     $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
     $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
     $sourceContactID = CRM_Activity_BAO_Activity::getSourceContactID($params['activityID']);
     $src_params = array('activity_id' => $mainActivityId, 'contact_id' => $sourceContactID, 'record_type_id' => $sourceID);
     CRM_Activity_BAO_ActivityContact::create($src_params);
     foreach ($targetContacts as $key => $value) {
         $targ_params = array('activity_id' => $mainActivityId, 'contact_id' => $value, 'record_type_id' => $targetID);
         CRM_Activity_BAO_ActivityContact::create($targ_params);
     }
     // typically this will be empty, since assignees on another case may be completely different
     $assigneeContacts = array();
     if (!empty($params['assigneeContactIds'])) {
         $assigneeContacts = array_unique(explode(',', $params['assigneeContactIds']));
     }
     foreach ($assigneeContacts as $key => $value) {
         $assigneeParams = array('activity_id' => $mainActivityId, 'contact_id' => $value, 'record_type_id' => $assigneeID);
         CRM_Activity_BAO_ActivityContact::create($assigneeParams);
     }
     // Attach newly created activity to case.
     $caseActivity = new CRM_Case_DAO_CaseActivity();
     $caseActivity->case_id = $params['caseID'];
     $caseActivity->activity_id = $mainActivityId;
     $caseActivity->save();
     $error_msg = $caseActivity->_lastError;
     $caseActivity->free();
     $params['mainActivityId'] = $mainActivityId;
     CRM_Activity_BAO_Activity::copyExtendedActivityData($params);
     return array('error_msg' => $error_msg, 'newId' => $mainActivity->id);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:86,代码来源:AJAX.php

示例4: mergeCases


//.........这里部分代码省略.........
            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();
                    $mainActivityTarget->activity_id = $mainActivityId;
                    $mainActivityTarget->target_contact_id = $otherTargetActivity->target_contact_id;
                    if ($mainActivityTarget->target_contact_id == $otherContactId) {
                        $mainActivityTarget->target_contact_id = $mainContactId;
                    }
                    //avoid duplicate object.
                    if (!$mainActivityTarget->find(true)) {
                        $mainActivityTarget->save();
                    }
                    $mainActivityTarget->free();
                }
                $otherTargetActivity->free();
                //migrate assignee activities.
                $otherAssigneeActivity = new CRM_Activity_DAO_ActivityAssignment();
                $otherAssigneeActivity->activity_id = $otherActivityId;
                $otherAssigneeActivity->find();
                while ($otherAssigneeActivity->fetch()) {
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:67,代码来源:Case.php


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