X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=CRM%2FEvent%2FBAO%2FEvent.php;h=1af2f6c685ebec8d56a1c27312a3d9ce71584112;hb=ea3ddccf2929c9778e4443ecd039c02a0a957dd8;hp=404d9045f2743b3d7f94d1d33db74c6750887f33;hpb=c06f9725742256947b937f5e5574fb026112f10e;p=civicrm-core.git diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 404d9045f2..cd8a27bb0b 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1,7 +1,7 @@ array($optionGroupId, 'Integer')); - $mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'civicrm_event', 'id', 'entity_value'); + $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array( + 'id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID, + ))); $dao = CRM_Core_DAO::executeQuery($query, $params); while ($dao->fetch()) { foreach ($properties as $property => $name) { @@ -466,7 +463,7 @@ $event_summary_limit $params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event'); $values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE); if (is_numeric(CRM_Utils_Array::value('geo_code_1', $values['location']['address'][1])) || - ($config->mapGeoCoding && + ( !empty($values['location']['address'][1]['city']) && !empty($values['location']['address'][1]['state_province_id']) ) @@ -476,7 +473,8 @@ $event_summary_limit } $eventSummary['events'][$dao->id][$property] = $set; - if (in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) { + if (is_array($permissions[CRM_Core_Permission::EDIT]) + && in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) { $eventSummary['events'][$dao->id]['configure'] = CRM_Utils_System::url('civicrm/admin/event', "action=update&id=$dao->id&reset=1"); } break; @@ -547,7 +545,7 @@ $event_summary_limit $eventSummary['events'][$dao->id]['is_show_location'] = $dao->is_show_location; $eventSummary['events'][$dao->id]['is_subevent'] = $dao->slot_label_id; $eventSummary['events'][$dao->id]['is_pcp_enabled'] = $dao->is_pcp_enabled; - $eventSummary['events'][$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mappingID); + $eventSummary['events'][$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mapping->getId()); $eventSummary['events'][$dao->id]['is_repeating_event'] = $dao->is_repeating_event; $statusTypes = CRM_Event_PseudoConstant::participantStatus(); @@ -911,8 +909,9 @@ WHERE civicrm_event.is_active = 1 } /** - * make a copy of a Event, including - * all the fields in the event Wizard + * Make a copy of a Event. + * + * Include all the fields in the event Wizard. * * @param int $id * The event id to copy. @@ -986,25 +985,15 @@ WHERE civicrm_event.is_active = 1 array('replace' => array('target_entity_id' => $copyEvent->id)) ); - if ($eventValues['is_template']) { - $field = 'event_template'; - } - else { - $field = 'civicrm_event'; - } - $mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $field, 'id', 'entity_value'); - $oldData = array('entity_value' => $id, 'mapping_id' => $mappingId); - if ($copyEvent->is_template == 1) { - $field = 'event_template'; - } - else { - $field = 'civicrm_event'; - } - $copyMappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $field, 'id', 'entity_value'); - $newData = array('entity_value' => $copyEvent->id, 'mapping_id' => $copyMappingId); + $oldMapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array( + 'id' => ($eventValues['is_template'] ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID), + ))); + $copyMapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array( + 'id' => ($copyEvent->is_template == 1 ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID), + ))); $copyReminder = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_ActionSchedule', - $oldData, - $newData + array('entity_value' => $id, 'mapping_id' => $oldMapping->getId()), + array('entity_value' => $copyEvent->id, 'mapping_id' => $copyMapping->getId()) ); if (!$afterCreate) { @@ -1040,8 +1029,13 @@ WHERE civicrm_event.is_active = 1 } /** - * This is sometimes called in a loop (during event search) - * hence we cache the values to prevent repeated calls to the db + * This is sometimes called in a loop (during event search). + * + * We cache the values to prevent repeated calls to the db. + * + * @param int $id + * + * @return */ public static function isMonetary($id) { static $isMonetary = array(); @@ -1055,8 +1049,13 @@ WHERE civicrm_event.is_active = 1 } /** - * This is sometimes called in a loop (during event search) - * hence we cache the values to prevent repeated calls to the db + * This is sometimes called in a loop (during event search). + * + * We cache the values to prevent repeated calls to the db. + * + * @param int $id + * + * @return bool */ public static function usesPriceSet($id) { static $usesPriceSet = array(); @@ -1067,15 +1066,13 @@ WHERE civicrm_event.is_active = 1 } /** - * Process that send e-mails + * Send e-mails. * * @param int $contactID - * @param $values + * @param array $values * @param int $participantId * @param bool $isTest * @param bool $returnMessageText - * - * @return void */ public static function sendMail($contactID, &$values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) { @@ -1161,6 +1158,7 @@ WHERE civicrm_event.is_active = 1 'email' => $email, 'confirm_email_text' => CRM_Utils_Array::value('confirm_email_text', $values['event']), 'isShowLocation' => CRM_Utils_Array::value('is_show_location', $values['event']), + // The concept of contributeMode is deprecated. 'contributeMode' => CRM_Utils_Array::value('contributeMode', $template->_tpl_vars), 'participantID' => $participantId, 'conference_sessions' => $sessions, @@ -1196,12 +1194,13 @@ WHERE civicrm_event.is_active = 1 // address required during receipt processing (pdf and email receipt) if ($displayAddress = CRM_Utils_Array::value('address', $values)) { $sendTemplateParams['tplParams']['address'] = $displayAddress; + // The concept of contributeMode is deprecated. $sendTemplateParams['tplParams']['contributeMode'] = NULL; } // set lineItem details if ($lineItem = CRM_Utils_Array::value('lineItem', $values)) { - // check if additional prticipant, if so filter only to relevant ones + // check if additional participant, if so filter only to relevant ones // CRM-9902 if (!empty($values['params']['additionalParticipant'])) { $ownLineItems = array(); @@ -1246,7 +1245,7 @@ WHERE civicrm_event.is_active = 1 $taxAmt = $template->get_template_vars('totalTaxAmount'); $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue); - if (isset($invoicing) && isset($prefixValue['is_email_pdf'])) { + if (isset($invoicing) && isset($prefixValue['is_email_pdf']) && !empty($values['contributionId'])) { $sendTemplateParams['isEmailPdf'] = TRUE; $sendTemplateParams['contributionId'] = $values['contributionId']; } @@ -1268,8 +1267,6 @@ WHERE civicrm_event.is_active = 1 * @param $isTest * @param bool $isCustomProfile * @param array $participantParams - * - * @return void */ public static function buildCustomDisplay( $id, @@ -1455,8 +1452,6 @@ WHERE civicrm_event.is_active = 1 * Formatted array of key value. * * @param array $profileFields - * - * @return void */ public static function displayProfile(&$params, $gid, &$groupTitle, &$values, &$profileFields = array()) { if ($gid) {