From eb2b4bdbb5a3eb9e63de3999daacbcd36d74a1b2 Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Mon, 24 Feb 2014 21:00:17 +0530 Subject: [PATCH] CRM-13992 : custom data single record view handling, DELETE action handling, QA checks and fixes --- .../Page/MultipleRecordFieldsListing.php | 9 ++- templates/CRM/Contact/Form/CustomData.tpl | 23 ++++-- .../CRM/Contact/Page/View/CustomData.tpl | 42 +++++++++- templates/CRM/Custom/Page/CustomDataView.tpl | 77 +++++++++++++++---- .../Page/MultipleRecordFieldsListing.tpl | 8 +- 5 files changed, 133 insertions(+), 26 deletions(-) diff --git a/CRM/Profile/Page/MultipleRecordFieldsListing.php b/CRM/Profile/Page/MultipleRecordFieldsListing.php index 03b8b927c9..355a46efbb 100644 --- a/CRM/Profile/Page/MultipleRecordFieldsListing.php +++ b/CRM/Profile/Page/MultipleRecordFieldsListing.php @@ -115,6 +115,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $links[CRM_Core_Action::DELETE]['url'] = 'civicrm/profile/edit'; $links[CRM_Core_Action::DELETE]['qs'] = "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$delete}&snippet=1&context=multiProfileDialog&onPopupClose=%%onPopupClose%%"; } + // NOTE : links for DELETE action for customDataView is handled in browse self::$_links[$this->_pageViewType] = $links; } @@ -258,7 +259,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { // and $cgcount is used to build new record url $cgcount = 1; if ($result && !empty($result)) { - $links = self::links($this->_pageViewType); + $links = self::links(); if ($this->_pageViewType == 'profileDataView') { $pageCheckSum = $this->get('pageCheckSum'); if ($pageCheckSum) { @@ -290,10 +291,16 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $actionParams['recId'] = $recId; $actionParams['type'] = $this->_contactType; $actionParams['cgcount'] = $cgcount; + + // DELETE action links + $links[CRM_Core_Action::DELETE]['url'] = '#'; + $links[CRM_Core_Action::DELETE]['extra'] = " onclick='showDeleteInDialog({$recId}, {$this->_customGroupId}, {$this->_contactId})' "; + $links[CRM_Core_Action::DELETE]['class'] = 'ignore-jshref'; } if (!empty($pageCheckSum)) { $actionParams['cs'] = $pageCheckSum; } + $value['action'] = CRM_Core_Action::formLink( $links, $linkAction, diff --git a/templates/CRM/Contact/Form/CustomData.tpl b/templates/CRM/Contact/Form/CustomData.tpl index b011b2bc0f..a0cbf755dc 100644 --- a/templates/CRM/Contact/Form/CustomData.tpl +++ b/templates/CRM/Contact/Form/CustomData.tpl @@ -25,20 +25,27 @@ *} {* this template is used for building tabbed custom data *} {if $cdType } - {include file="CRM/Custom/Form/CustomData.tpl"} -{if $multiRecordDisplay eq 'single'} -
{$form.buttons.html}
-{/if} + {include file="CRM/Custom/Form/CustomData.tpl"} + {if $multiRecordDisplay eq 'single'} +
{$form.buttons.html}
+ {* for form rule handling *} + {include file="CRM/Form/validate.tpl"} + {literal} + + {/literal} + {/if} {else} -{debug}
{$form.buttons.html}
{*include custom data js file*} {include file="CRM/common/customData.tpl"} - - {if $customValueCount } + {if $customValueCount} {literal} + {/literal} {else} {strip} {if $action eq 16 or $action eq 4} {* Browse or View actions *} diff --git a/templates/CRM/Custom/Page/CustomDataView.tpl b/templates/CRM/Custom/Page/CustomDataView.tpl index 0037143ae1..4604ba3579 100644 --- a/templates/CRM/Custom/Page/CustomDataView.tpl +++ b/templates/CRM/Custom/Page/CustomDataView.tpl @@ -27,9 +27,10 @@ {assign var="showEdit" value=1} {foreach from=$viewCustomData item=customValues key=customGroupId} {foreach from=$customValues item=cd_edit key=cvID} +{if $multiRecordDisplay neq 'single'} {assign var='index' value=$groupId|cat:"_$cvID"} - {if $multiRecordDisplay neq 'single' and (($editOwnCustomData and $showEdit) or ($showEdit and $editCustomData and $groupId))} + {if ($editOwnCustomData and $showEdit) or ($showEdit and $editCustomData and $groupId)} - {/if}
{/if} {assign var="showEdit" value=0} - {if $multiRecordDisplay neq 'single'}
-
+
{if !$skipTitle}
{$cd_edit.title}
{/if} -
- {if $groupId and $cvID and $editCustomData and $multiRecordDisplay neq 'single'} +
+ {if $groupId and $cvID and $editCustomData}
{/if} {foreach from=$cd_edit.fields item=element key=field_id} - +
{if $element.options_per_line != 0} - {if $element.field_type == 'File'} {if $element.field_value.displayURL} - {else} - {/if} {else} {if $element.field_data_type == 'Money'} {if $element.field_type == 'Text'} - + {else} - + {/if} {else} -
{$element.field_title} + {* sort by fails for option per line. Added a variable to iterate through the element array*} {foreach from=$element.field_value item=val} {$val} @@ -79,25 +78,25 @@ {$element.field_title} + + {$element.field_value.fileName} {$element.field_value|crmMoney}{$element.field_value|crmMoney}{$element.field_value}{$element.field_value} + {if $element.contact_ref_id} {/if} @@ -124,6 +123,58 @@
+{else} + {foreach from=$cd_edit.fields item=element key=field_id} +
+ {if $element.options_per_line != 0} +
{$element.field_title}
+
+ {* sort by fails for option per line. Added a variable to iterate through the element array*} + {foreach from=$element.field_value item=val} + {$val} +
+ {/foreach} +
+ {else} +
{$element.field_title}
+ {if $element.field_type == 'File'} + {if $element.field_value.displayURL} +
+ {else} + + {/if} + {else} + {if $element.field_data_type == 'Money'} + {if $element.field_type == 'Text'} +
{$element.field_value|crmMoney}
+ {else} +
{$element.field_value}
+ {/if} + {else} + + {/if} + {/if} + {/if} + {/foreach} +{/if} {/foreach} {/foreach} {literal} diff --git a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl index e79714ad0a..89d15343e7 100644 --- a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl +++ b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl @@ -68,7 +68,7 @@ {if !$reachedMax} {if $pageViewType eq 'customDataView'} -
{ts 1=$customGroupTitle}Add %1 Record{/ts}
{else} -- 2.25.1