From 81ba683305b1807719c398aff64db3cfb468adc6 Mon Sep 17 00:00:00 2001 From: kurund Date: Wed, 16 Jul 2014 00:26:43 +0530 Subject: [PATCH] fixed invaild html generate while adding additional blocks CRM-14937 ---------------------------------------- * 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/Form/ManageEvent/Location.php | 11 ++++-- templates/CRM/Contact/Form/Edit/Phone.tpl | 39 +++++++++++-------- .../CRM/Event/Form/ManageEvent/Location.tpl | 3 +- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/CRM/Event/Form/ManageEvent/Location.php b/CRM/Event/Form/ManageEvent/Location.php index 2e03c1574d..6dcafef241 100644 --- a/CRM/Event/Form/ManageEvent/Location.php +++ b/CRM/Event/Form/ManageEvent/Location.php @@ -75,6 +75,14 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent { * @access public */ function preProcess() { + //location blocks. + CRM_Contact_Form_Location::preProcess($this); + + //skip rest of postpress when we are building additional email and phone blocks + if (!empty($this->_addBlockName)) { + return; + } + parent::preProcess(); $this->_values = $this->get('values'); @@ -92,9 +100,6 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent { CRM_Event_BAO_Event::retrieve($params, $this->_values); $this->set('values', $this->_values); } - - //location blocks. - CRM_Contact_Form_Location::preProcess($this); } /** diff --git a/templates/CRM/Contact/Form/Edit/Phone.tpl b/templates/CRM/Contact/Form/Edit/Phone.tpl index 1d859ce890..aa65c03bcd 100644 --- a/templates/CRM/Contact/Form/Edit/Phone.tpl +++ b/templates/CRM/Contact/Form/Edit/Phone.tpl @@ -28,29 +28,36 @@ {* @var blockId Contains the current block id, and assigned in the CRM/Contact/Form/Location.php file *} {if !$addBlock} - - {ts}Phone{/ts} - {ts}Phone Location{/ts} - {if $className eq 'CRM_Contact_Form_Contact'} - {ts}Phone Type{/ts} + + {ts}Phone{/ts} + {if $className eq 'CRM_Contact_Form_Contact'} + {ts}Phone Location{/ts} + {/if} + {ts}Phone Type{/ts} + {if $className eq 'CRM_Contact_Form_Contact'} {ts}Primary?{/ts} - {/if} - + {/if} + {/if} - {$form.phone.$blockId.phone.html}  {ts}ext.{/ts} {$form.phone.$blockId.phone_ext.html|crmAddClass:four}  - {$form.phone.$blockId.location_type_id.html} - {$form.phone.$blockId.phone_type_id.html} + {$form.phone.$blockId.phone.html}  {ts}ext.{/ts} {$form.phone.$blockId.phone_ext.html|crmAddClass:four}  + {if $className eq 'CRM_Contact_Form_Contact'} + {$form.phone.$blockId.location_type_id.html} + {/if} + {$form.phone.$blockId.phone_type_id.html} + {if $className eq 'CRM_Contact_Form_Contact'} {$form.phone.$blockId.is_primary.1.html} - {if $blockId gt 1} - {ts}delete{/ts} - {/if} + {/if} + {if $blockId gt 1} + {ts}delete{/ts} + {/if} + {if !$addBlock} - -  {ts}Add another Phone number{/ts} - + +   {ts}Add another Phone number{/ts} + {/if} diff --git a/templates/CRM/Event/Form/ManageEvent/Location.tpl b/templates/CRM/Event/Form/ManageEvent/Location.tpl index 8dde0645e6..05fb5216e0 100644 --- a/templates/CRM/Event/Form/ManageEvent/Location.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Location.tpl @@ -29,10 +29,11 @@ {ts}Use this form to configure the location and optional contact information for the event. This information will be displayed on the Event Information page. It will also be included in online registration pages and confirmation emails if these features are enabled.{/ts} {/if} -
+ {if $addBlock} {include file="CRM/Contact/Form/Edit/$blockName.tpl"} {else} +
{include file="CRM/common/formButtons.tpl" location="top"}
-- 2.25.1