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


PHP CRM_Case_BAO_Case::getCaseActivityDates方法代码示例

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


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

示例1: setDefaultValues

 /**
  * This function sets the default values for the form. For edit/view mode
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues(&$form)
 {
     $defaults = array();
     $openCaseActivityType = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
     $openCaseParams = array('activity_type_id' => $openCaseActivityType);
     $openCaseInfo = CRM_Case_BAO_Case::getCaseActivityDates($form->_caseId, $openCaseParams, TRUE);
     if (empty($openCaseInfo)) {
         list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults();
     } else {
         // We know there can only be one result
         $openCaseInfo = current($openCaseInfo);
         // store activity id for updating it later
         $form->openCaseActivityId = $openCaseInfo['id'];
         list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults($openCaseInfo['activity_date']);
     }
     return $defaults;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:25,代码来源:ChangeCaseStartDate.php

示例2: createActivity

 /**
  * @param $activityTypeXML
  * @param array $params
  *
  * @return bool
  * @throws CRM_Core_Exception
  * @throws Exception
  */
 public function createActivity($activityTypeXML, &$params)
 {
     $activityTypeName = (string) $activityTypeXML->name;
     $activityTypes =& $this->allActivityTypes(TRUE, TRUE);
     $activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $activityTypes);
     if (!$activityTypeInfo) {
         $docLink = CRM_Utils_System::docURL2("user/case-management/setup");
         CRM_Core_Error::fatal(ts('Activity type %1, found in case configuration file, is not present in the database %2', array(1 => $activityTypeName, 2 => $docLink)));
         return FALSE;
     }
     $activityTypeID = $activityTypeInfo['id'];
     if (isset($activityTypeXML->status)) {
         $statusName = (string) $activityTypeXML->status;
     } else {
         $statusName = 'Scheduled';
     }
     if ($this->_isMultiClient) {
         $client = $params['clientID'];
     } else {
         $client = array(1 => $params['clientID']);
     }
     //set order
     $orderVal = '';
     if (isset($activityTypeXML->order)) {
         $orderVal = (string) $activityTypeXML->order;
     }
     if ($activityTypeName == 'Open Case') {
         $activityParams = array('activity_type_id' => $activityTypeID, 'source_contact_id' => $params['creatorID'], 'is_auto' => FALSE, 'is_current_revision' => 1, 'subject' => CRM_Utils_Array::value('subject', $params) ? $params['subject'] : $activityTypeName, 'status_id' => CRM_Core_OptionGroup::getValue('activity_status', $statusName, 'name'), 'target_contact_id' => $client, 'medium_id' => CRM_Utils_Array::value('medium_id', $params), 'location' => CRM_Utils_Array::value('location', $params), 'details' => CRM_Utils_Array::value('details', $params), 'duration' => CRM_Utils_Array::value('duration', $params), 'weight' => $orderVal);
     } else {
         $activityParams = array('activity_type_id' => $activityTypeID, 'source_contact_id' => $params['creatorID'], 'is_auto' => TRUE, 'is_current_revision' => 1, 'status_id' => CRM_Core_OptionGroup::getValue('activity_status', $statusName, 'name'), 'target_contact_id' => $client, 'weight' => $orderVal);
     }
     //parsing date to default preference format
     $params['activity_date_time'] = CRM_Utils_Date::processDate($params['activity_date_time']);
     if ($activityTypeName == 'Open Case') {
         // we don't set activity_date_time for auto generated
         // activities, but we want it to be set for open case.
         $activityParams['activity_date_time'] = $params['activity_date_time'];
         if (array_key_exists('custom', $params) && is_array($params['custom'])) {
             $activityParams['custom'] = $params['custom'];
         }
         // Add parameters for attachments
         $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
         for ($i = 1; $i <= $numAttachments; $i++) {
             $attachName = "attachFile_{$i}";
             if (isset($params[$attachName]) && !empty($params[$attachName])) {
                 $activityParams[$attachName] = $params[$attachName];
             }
         }
     } else {
         $activityDate = NULL;
         //get date of reference activity if set.
         if ($referenceActivityName = (string) $activityTypeXML->reference_activity) {
             //we skip open case as reference activity.CRM-4374.
             if (!empty($params['resetTimeline']) && $referenceActivityName == 'Open Case') {
                 $activityDate = $params['activity_date_time'];
             } else {
                 $referenceActivityInfo = CRM_Utils_Array::value($referenceActivityName, $activityTypes);
                 if ($referenceActivityInfo['id']) {
                     $caseActivityParams = array('activity_type_id' => $referenceActivityInfo['id']);
                     //if reference_select is set take according activity.
                     if ($referenceSelect = (string) $activityTypeXML->reference_select) {
                         $caseActivityParams[$referenceSelect] = 1;
                     }
                     $referenceActivity = CRM_Case_BAO_Case::getCaseActivityDates($params['caseID'], $caseActivityParams, TRUE);
                     if (is_array($referenceActivity)) {
                         foreach ($referenceActivity as $aId => $details) {
                             $activityDate = CRM_Utils_Array::value('activity_date', $details);
                             break;
                         }
                     }
                 }
             }
         }
         if (!$activityDate) {
             $activityDate = $params['activity_date_time'];
         }
         list($activity_date, $activity_time) = CRM_Utils_Date::setDateDefaults($activityDate);
         $activityDateTime = CRM_Utils_Date::processDate($activity_date, $activity_time);
         //add reference offset to date.
         if ((int) $activityTypeXML->reference_offset) {
             $activityDateTime = CRM_Utils_Date::intervalAdd('day', (int) $activityTypeXML->reference_offset, $activityDateTime);
         }
         $activityParams['activity_date_time'] = CRM_Utils_Date::format($activityDateTime);
     }
     // if same activity is already there, skip and dont touch
     $params['activityTypeID'] = $activityTypeID;
     $params['activityTypeName'] = $activityTypeName;
     if ($this->isActivityPresent($params)) {
         return TRUE;
     }
     $activityParams['case_id'] = $params['caseID'];
     if (!empty($activityParams['is_auto'])) {
//.........这里部分代码省略.........
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:101,代码来源:Process.php

示例3: createActivity

 function createActivity($activityTypeXML, &$params)
 {
     $activityTypeName = (string) $activityTypeXML->name;
     $activityTypes =& $this->allActivityTypes();
     $activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $activityTypes);
     if (!$activityTypeInfo) {
         require_once 'CRM/Utils/System.php';
         $docLink = CRM_Utils_System::docURL2("CiviCase Configuration");
         CRM_Core_Error::fatal(ts('Activity type %1, found in case configuration file, is not present in the database %2', array(1 => $activityTypeName, 2 => $docLink)));
         return false;
     }
     $activityTypeID = $activityTypeInfo['id'];
     if (isset($activityTypeXML->status)) {
         $statusName = (string) $activityTypeXML->status;
     } else {
         $statusName = 'Scheduled';
     }
     require_once 'CRM/Core/OptionGroup.php';
     if ($activityTypeName == 'Open Case') {
         $activityParams = array('activity_type_id' => $activityTypeID, 'source_contact_id' => $params['creatorID'], 'is_auto' => false, 'is_current_revision' => 1, 'subject' => CRM_Utils_Array::value('subject', $params) ? $params['subject'] : $activityTypeName, 'status_id' => CRM_Core_OptionGroup::getValue('activity_status', $statusName, 'name'), 'target_contact_id' => $params['clientID'], 'medium_id' => CRM_Utils_Array::value('medium_id', $params), 'location' => CRM_Utils_Array::value('location', $params), 'details' => CRM_Utils_Array::value('details', $params), 'duration' => CRM_Utils_Array::value('duration', $params));
     } else {
         $activityParams = array('activity_type_id' => $activityTypeID, 'source_contact_id' => $params['creatorID'], 'is_auto' => true, 'is_current_revision' => 1, 'status_id' => CRM_Core_OptionGroup::getValue('activity_status', $statusName, 'name'), 'target_contact_id' => $params['clientID']);
     }
     if ($activityTypeName == 'Open Case') {
         // we don't set activity_date_time for auto generated
         // activities, but we want it to be set for open case.
         $activityParams['activity_date_time'] = $params['activity_date_time'];
         if (array_key_exists('custom', $params) && is_array($params['custom'])) {
             $activityParams['custom'] = $params['custom'];
         }
     } else {
         $activityDate = null;
         //get date of reference activity if set.
         if ($referenceActivityName = (string) $activityTypeXML->reference_activity) {
             //we skip open case as reference activity.CRM-4374.
             if (CRM_Utils_Array::value('resetTimeline', $params) && $referenceActivityName == 'Open Case') {
                 $activityDate = $params['activity_date_time'];
             } else {
                 $referenceActivityInfo = CRM_Utils_Array::value($referenceActivityName, $activityTypes);
                 if ($referenceActivityInfo['id']) {
                     $caseActivityParams = array('activity_type_id' => $referenceActivityInfo['id']);
                     //if reference_select is set take according activity.
                     if ($referenceSelect = (string) $activityTypeXML->reference_select) {
                         $caseActivityParams[$referenceSelect] = 1;
                     }
                     require_once 'CRM/Case/BAO/Case.php';
                     $referenceActivity = CRM_Case_BAO_Case::getCaseActivityDates($params['caseID'], $caseActivityParams, true);
                     if (is_array($referenceActivity)) {
                         foreach ($referenceActivity as $aId => $details) {
                             $activityDate = CRM_Utils_Array::value('activity_date', $details);
                             break;
                         }
                     }
                 }
             }
         }
         if (!$activityDate) {
             $activityDate = $params['activity_date_time'];
         }
         $datetime = new DateTime($activityDate);
         $activityDateTime = CRM_Utils_Date::unformat($datetime->format('Y:m:d:H:i:s'), ':');
         //add reference offset to date.
         if ((int) $activityTypeXML->reference_offset) {
             $activityDateTime = CRM_Utils_Date::intervalAdd('day', (int) $activityTypeXML->reference_offset, $activityDateTime);
         }
         $activityParams['activity_date_time'] = CRM_Utils_Date::format($activityDateTime);
     }
     // if same activity is already there, skip and dont touch
     $params['activityTypeID'] = $activityTypeID;
     $params['activityTypeName'] = $activityTypeName;
     if ($this->isActivityPresent($params)) {
         return true;
     }
     $activityParams['case_id'] = $params['caseID'];
     if (CRM_Utils_Array::value('is_auto', $activityParams)) {
         $activityParams['skipRecentView'] = true;
     }
     require_once 'CRM/Activity/BAO/Activity.php';
     $activity = CRM_Activity_BAO_Activity::create($activityParams);
     if (!$activity) {
         CRM_Core_Error::fatal();
         return false;
     }
     // create case activity record
     $caseParams = array('activity_id' => $activity->id, 'case_id' => $params['caseID']);
     require_once 'CRM/Case/BAO/Case.php';
     CRM_Case_BAO_Case::processCaseActivity($caseParams);
     return true;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:89,代码来源:Process.php


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