CRM-14937, also fixed display of phone type on event info
authorkurund <kurund@civicrm.org>
Tue, 15 Jul 2014 21:32:18 +0000 (03:02 +0530)
committerkurund <kurund@civicrm.org>
Tue, 15 Jul 2014 21:32:18 +0000 (03:02 +0530)
----------------------------------------
* 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
templates/CRM/Event/Page/EventInfo.tpl

index a6e5744976b9ae5586040883c52b7eca527065c4..e6a5700a5372019e42bf6b7f8ffa376217c2f2b1 100644 (file)
@@ -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);
index 8c136f31ab00e49dcb767449c644681dd1a5ca67..80268431ec5d59e3d34cc495d81a012f471488f2 100644 (file)
               {* 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}:
                           <span class="tel">{$phone.phone} {if $phone.phone_ext}&nbsp;{ts}ext.{/ts} {$phone.phone_ext}{/if} </span> <br />
                       {/if}
               {/foreach}