From 45618a704782601760fb94640bc3380840afd0e7 Mon Sep 17 00:00:00 2001 From: kurund Date: Wed, 16 Jul 2014 03:02:18 +0530 Subject: [PATCH] CRM-14937, also fixed display of phone type on event info ---------------------------------------- * CRM-14937: CiviEvents: when using existing location on a new event, only the first phone number is loaded causing data loss on save https://issues.civicrm.org/jira/browse/CRM-14937 --- CRM/Event/Page/EventInfo.php | 10 ++++++++++ templates/CRM/Event/Page/EventInfo.tpl | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index a6e5744976..e6a5700a53 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -163,6 +163,16 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { $params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event'); $values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE); + // fix phone type labels + if (!empty($values['location']['phone'])) { + $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); + foreach ($values['location']['phone'] as &$val) { + if (!empty($val['phone_type_id'])) { + $val['phone_type_display'] = $phoneTypes[$val['phone_type_id']]; + } + } + } + //retrieve custom field information $groupTree = CRM_Core_BAO_CustomGroup::getTree('Event', $this, $this->_id, 0, $values['event']['event_type_id']); CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree); diff --git a/templates/CRM/Event/Page/EventInfo.tpl b/templates/CRM/Event/Page/EventInfo.tpl index 8c136f31ab..80268431ec 100644 --- a/templates/CRM/Event/Page/EventInfo.tpl +++ b/templates/CRM/Event/Page/EventInfo.tpl @@ -182,7 +182,7 @@ {* loop on any phones and emails for this event *} {foreach from=$location.phone item=phone} {if $phone.phone} - {if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: + {if $phone.phone_type_id}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}
{/if} {/foreach} -- 2.25.1