From eaf756c02c5bc2f42ee897b5077ebfbb10387468 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 14 Aug 2014 15:21:33 +0100 Subject: [PATCH] CRM-15109 - Fix deleting custom records and update UX to 4.5 conventions --- CRM/Contact/Page/View/CustomData.php | 5 +- templates/CRM/Contact/Form/Contact.tpl | 17 +++++++ .../CRM/Contact/Form/Edit/CustomData.tpl | 47 ++---------------- templates/CRM/Custom/Form/CustomData.tpl | 16 ++++-- templates/CRM/Custom/Page/CustomDataView.tpl | 49 +++++++++---------- 5 files changed, 62 insertions(+), 72 deletions(-) diff --git a/CRM/Contact/Page/View/CustomData.php b/CRM/Contact/Page/View/CustomData.php index 2406084a6a..07a89e8277 100644 --- a/CRM/Contact/Page/View/CustomData.php +++ b/CRM/Contact/Page/View/CustomData.php @@ -128,9 +128,12 @@ class CRM_Contact_Page_View_CustomData extends CRM_Core_Page { 'style' ); - if ($displayStyle === 'Tab with table' && $this->_multiRecordDisplay != 'single') { + if ($this->_multiRecordDisplay != 'single') { $id = "custom_{$this->_groupId}"; $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent($id, $this->_contactId, $groupTree[$this->_groupId]['table_name']); + } + + if ($displayStyle === 'Tab with table' && $this->_multiRecordDisplay != 'single') { $ctype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'contact_type' diff --git a/templates/CRM/Contact/Form/Contact.tpl b/templates/CRM/Contact/Form/Contact.tpl index 8923334e01..732830e129 100644 --- a/templates/CRM/Contact/Form/Contact.tpl +++ b/templates/CRM/Contact/Form/Contact.tpl @@ -108,6 +108,7 @@ diff --git a/templates/CRM/Contact/Form/Edit/CustomData.tpl b/templates/CRM/Contact/Form/Edit/CustomData.tpl index d0ea6b03dc..ba1c641c18 100644 --- a/templates/CRM/Contact/Form/Edit/CustomData.tpl +++ b/templates/CRM/Contact/Form/Edit/CustomData.tpl @@ -24,13 +24,12 @@ +--------------------------------------------------------------------+ *} - {foreach from=$groupTree item=cd_edit key=group_id} {if $cd_edit.is_multiple eq 1} {assign var=tableID value=$cd_edit.table_id} {assign var=divName value=$group_id|cat:"_$tableID"}
-
{else}
- - - - + + {ts}Delete{/ts} + @@ -69,35 +62,5 @@ {/foreach} {include file="CRM/common/customData.tpl"} - {include file="CRM/Form/attachmentjs.tpl"} diff --git a/templates/CRM/Custom/Form/CustomData.tpl b/templates/CRM/Custom/Form/CustomData.tpl index 0960fae327..1a4677d58f 100644 --- a/templates/CRM/Custom/Form/CustomData.tpl +++ b/templates/CRM/Custom/Form/CustomData.tpl @@ -38,7 +38,12 @@
{$cd_edit.help_post}
{/if} {if $cd_edit.is_multiple and ( ( $cd_edit.max_multiple eq '' ) or ( $cd_edit.max_multiple > 0 and $cd_edit.max_multiple > $cgCount ) ) } - + {/if} {else} {foreach from=$groupTree item=cd_edit key=group_id name=custom_sets} @@ -61,7 +66,7 @@
{if !$skipTitle}
- {$cd_edit.title} + {$cd_edit.title} {$cgCount}
{/if}
@@ -86,7 +91,12 @@ {ts 1=$cd_edit.title}Click "Edit Contact" to add more %1 records{/ts}
{else} - + {/if} {/if} {/if} diff --git a/templates/CRM/Custom/Page/CustomDataView.tpl b/templates/CRM/Custom/Page/CustomDataView.tpl index 28474618b5..66783eaf8f 100644 --- a/templates/CRM/Custom/Page/CustomDataView.tpl +++ b/templates/CRM/Custom/Page/CustomDataView.tpl @@ -25,6 +25,7 @@ *} {* Custom Data view mode*} {assign var="showEdit" value=1} +{assign var="rowCount" value=1} {foreach from=$viewCustomData item=customValues key=customGroupId} {foreach from=$customValues item=cd_edit key=cvID} {if $multiRecordDisplay neq 'single'} @@ -49,16 +50,16 @@
{if !$skipTitle}
- {$cd_edit.title} + {$cd_edit.title} {$rowCount}
{/if}
{if $groupId and $cvID and $editCustomData} {/if} @@ -115,6 +116,7 @@ {/foreach} + {assign var="rowCount" value=$rowCount+1}
@@ -186,28 +188,23 @@ {if $groupId} {/if} -- 2.25.1