From: monishdeb Date: Mon, 11 Jan 2016 16:38:12 +0000 (+0530) Subject: optimization X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e34e697967b00afe2802510acd6bb91c0fc9f1a1;p=civicrm-core.git optimization --- diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index 3932eed6c8..d9990326cd 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -184,9 +184,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { NULL, $entitySubType ); - CRM_Core_BAO_CustomGroup::buildCustomDataView($this, - $groupTree - ); + CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_caseID); } /** diff --git a/CRM/Contact/Page/View/Relationship.php b/CRM/Contact/Page/View/Relationship.php index 7e53a60ddb..a7379d924a 100644 --- a/CRM/Contact/Page/View/Relationship.php +++ b/CRM/Contact/Page/View/Relationship.php @@ -87,7 +87,7 @@ class CRM_Contact_Page_View_Relationship extends CRM_Core_Page { $this->assign('viewNote', $viewNote); $groupTree = CRM_Core_BAO_CustomGroup::getTree('Relationship', $this, $this->_id, 0, $relType); - CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree); + CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_id); $rType = CRM_Utils_Array::value('rtype', $viewRelationship[$this->_id]); // add viewed contribution to recent items list diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index aa3e03b3fe..5b2446178b 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -104,7 +104,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { } $groupTree = CRM_Core_BAO_CustomGroup::getTree('Contribution', $this, $id, 0, CRM_Utils_Array::value('financial_type_id', $values)); - CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree); + CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $id); $premiumId = NULL; if ($id) { diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index a2f13a1e66..ae9c4023a1 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1217,16 +1217,18 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { case 'File': // In the context of displaying a profile, show file/image - if ($entityId) { - $url = self::getFileURL($entityId, $field['id']); - if ($url) { - $display = $url['file_url']; + if ($value) { + if ($entityId) { + $url = self::getFileURL($entityId, $field['id']); + if ($url) { + $display = $url['file_url']; + } + } + else { + // In other contexts show a paperclip icon + $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value); + $display = $icons[$value]; } - } - elseif ($value) { - // In other contexts show a paperclip icon - $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value); - $display = $icons[$value]; } break; diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index 037cf473ed..90a0c19cb5 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -152,7 +152,7 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $finalTree[$treeId] = $trees; } } - CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $finalTree); + CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $finalTree, FALSE, NULL, NULL, NULL, $participantID); $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $values[$participantID]['event_id'], 'title'); //CRM-7150, show event name on participant view even if the event is disabled if (empty($values[$participantID]['event'])) { diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index 0afdebb66f..507d23ead6 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -186,7 +186,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { //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); + CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_id); $this->assign('action', CRM_Core_Action::VIEW); //To show the event location on maps directly on event info page $locations = CRM_Event_BAO_Event::getMapInfo($this->_id); diff --git a/CRM/Pledge/Form/PledgeView.php b/CRM/Pledge/Form/PledgeView.php index 6f6c95bc97..d76defa31a 100644 --- a/CRM/Pledge/Form/PledgeView.php +++ b/CRM/Pledge/Form/PledgeView.php @@ -64,7 +64,7 @@ class CRM_Pledge_Form_PledgeView extends CRM_Core_Form { // handle custom data. $groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']); - CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree); + CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $params['id']); if (!empty($values['contribution_page_id'])) { $values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title'); diff --git a/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl b/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl index 6d1d15bafb..491292c162 100644 --- a/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl +++ b/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl @@ -43,14 +43,7 @@ {else}
{$element.field_title}
- {if $element.field_type == 'File' && !empty($element.field_value.displayURL)} -
- - - -
- {elseif $element.field_data_type EQ 'ContactReference' && $element.contact_ref_id} + {if $element.field_data_type EQ 'ContactReference' && $element.contact_ref_id} {*Contact ref id passed if user has sufficient permissions - so make a link.*}
{$element.field_value} diff --git a/templates/CRM/Custom/Page/CustomDataView.tpl b/templates/CRM/Custom/Page/CustomDataView.tpl index 13226b82c9..ad87a1f531 100644 --- a/templates/CRM/Custom/Page/CustomDataView.tpl +++ b/templates/CRM/Custom/Page/CustomDataView.tpl @@ -73,40 +73,26 @@ {else} {$element.field_title} - {if $element.field_type == 'File'} - {if !empty($element.field_value.displayURL)} - - - - - + {if $element.field_data_type == 'Money'} + {if $element.field_type == 'Text'} + {$element.field_value|crmMoney} {else} - - {$element.field_value} - + {$element.field_value} {/if} {else} - {if $element.field_data_type == 'Money'} - {if $element.field_type == 'Text'} - {$element.field_value|crmMoney} + + {if $element.contact_ref_id} + + {/if} + {if $element.field_data_type == 'Memo'} + {$element.field_value|nl2br} {else} - {$element.field_value} + {$element.field_value} {/if} - {else} - - {if $element.contact_ref_id} - - {/if} - {if $element.field_data_type == 'Memo'} - {$element.field_value|nl2br} - {else} - {$element.field_value} - {/if} - {if $element.contact_ref_id} + {if $element.contact_ref_id} - {/if} - - {/if} + {/if} + {/if} {/if}