optimization
authormonishdeb <monish.deb@webaccessglobal.com>
Mon, 11 Jan 2016 16:38:12 +0000 (22:08 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Mon, 11 Jan 2016 16:38:12 +0000 (22:08 +0530)
CRM/Case/Form/CaseView.php
CRM/Contact/Page/View/Relationship.php
CRM/Contribute/Form/ContributionView.php
CRM/Core/BAO/CustomField.php
CRM/Event/Form/ParticipantView.php
CRM/Event/Page/EventInfo.php
CRM/Pledge/Form/PledgeView.php
templates/CRM/Contact/Page/View/CustomDataFieldView.tpl
templates/CRM/Custom/Page/CustomDataView.tpl

index 3932eed6c8be61463cd0ea17d8bfc8c1837bec86..d9990326cd835f0455b0042f8ea81b8878241061 100644 (file)
@@ -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);
   }
 
   /**
index 7e53a60ddb57bbbf538e322dab5f4a69f94f9d4a..a7379d924a95765e78c73445b00ce8830ed49c65 100644 (file)
@@ -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
index aa3e03b3fe671b85531d344e3111107566a768f5..5b2446178b32acba69da6c4e2cb2f2def258deef 100644 (file)
@@ -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) {
index a2f13a1e66dd3cf3eb537a8249ff5c3a9d2d2fee..ae9c4023a18b806875c4058d6ceb543267825567 100644 (file)
@@ -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;
 
index 037cf473edfddd8eb576e03f9854c6811e9c91ef..90a0c19cb5d7c42636a8c19fc75d924d3d05a819 100644 (file)
@@ -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'])) {
index 0afdebb66fd13bebae9d98ce4deadfee0afac8c1..507d23ead656da8522f899f9f41c96a135234269 100644 (file)
@@ -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);
index 6f6c95bc97b827ce852733abe563ccab8007fe90..d76defa31a4b48ec2ab2dc1eaef8a3fb46bc5fca 100644 (file)
@@ -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');
index 6d1d15bafb8d917d83dad0231c7729b02f0fd5fb..491292c16233c00ccabddaee7ed353137a20b455 100644 (file)
           </div>
         {else}
           <div class="crm-label">{$element.field_title}</div>
-          {if $element.field_type == 'File' && !empty($element.field_value.displayURL)}
-                <div class="crm-content crm-custom_data crm-displayURL">
-                  <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
-                    <img src="{$element.field_value.displayURL}" height = "{$element.field_value.imageThumbHeight}"
-                         width="{$element.field_value.imageThumbWidth}">
-                  </a>
-             </div>
-          {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.*}
             <div class="crm-content crm-custom-data crm-contact-reference">
               <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$element.contact_ref_id`"}" title="view contact">{$element.field_value}</a>
index 13226b82c953eebc3122c72452694f641e81ec7e..ad87a1f531a31b4fcf590cece298d530af0fc19a 100644 (file)
                       </td>
                     {else}
                       <td class="label">{$element.field_title}</td>
-                      {if $element.field_type == 'File'}
-                        {if !empty($element.field_value.displayURL)}
-                          <td class="html-adjust">
-                            <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
-                              <img src="{$element.field_value.displayURL}" height="100" width="100">
-                            </a>
-                          </td>
+                      {if $element.field_data_type == 'Money'}
+                        {if $element.field_type == 'Text'}
+                          <td class="html-adjust">{$element.field_value|crmMoney}</td>
                         {else}
-                          <td class="html-adjust">
-                            {$element.field_value}
-                          </td>
+                          <td class="html-adjust">{$element.field_value}</td>
                         {/if}
                       {else}
-                        {if $element.field_data_type == 'Money'}
-                          {if $element.field_type == 'Text'}
-                            <td class="html-adjust">{$element.field_value|crmMoney}</td>
+                        <td class="html-adjust">
+                          {if $element.contact_ref_id}
+                            <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
+                          {/if}
+                          {if $element.field_data_type == 'Memo'}
+                            {$element.field_value|nl2br}
                           {else}
-                            <td class="html-adjust">{$element.field_value}</td>
+                            {$element.field_value}
                           {/if}
-                        {else}
-                          <td class="html-adjust">
-                            {if $element.contact_ref_id}
-                            <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$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}
                             </a>
-                            {/if}
-                          </td>
-                        {/if}
+                          {/if}
+                        </td>
                       {/if}
                     {/if}
                   </tr>