(dev/core/issues/70) On any custom search 'Print selected rows' action doesn't retain...
authordeb.monish <monish.deb@jmaconsulting.biz>
Fri, 20 Apr 2018 20:40:37 +0000 (02:10 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Fri, 20 Apr 2018 20:40:37 +0000 (02:10 +0530)
CRM/Contact/Form/Task/Print.php
CRM/Contact/Selector/Custom.php
templates/CRM/Contact/Form/Task/Print.tpl

index f94d4beb05d1c53a42eb37ba08bd8a49f891285f..e42f447dd1bd78aa9e1d98ab2376c9d5ba9ae143 100644 (file)
@@ -82,8 +82,9 @@ class CRM_Contact_Form_Task_Print extends CRM_Contact_Form_Task {
     $selectorName = $this->controller->selectorName();
     require_once str_replace('_', DIRECTORY_SEPARATOR, $selectorName) . '.php';
 
-    $returnP = isset($returnPropeties) ? $returnPropeties : "";
+    $returnP = isset($returnProperties) ? $returnProperties : "";
     $customSearchClass = $this->get('customSearchClass');
+    $this->assign('customSearchID', $this->get('customSearchID'));
     $selector = new $selectorName($customSearchClass,
       $fv,
       $params,
index 2c95ffd9f07cf20ef5e503b7af023c645a2b0413..645ed78750bc381d69faf775274eacb79cc9859b 100644 (file)
@@ -227,11 +227,14 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector {
    */
   public function &getColumnHeaders($action = NULL, $output = NULL) {
     $columns = $this->_search->columns();
-    if ($output == CRM_Core_Selector_Controller::EXPORT) {
-      return array_keys($columns);
+    $headers = array();
+    if ($output == CRM_Core_Selector_Controller::EXPORT || $output == CRM_Core_Selector_Controller::SCREEN) {
+      foreach ($columns as $name => $key) {
+        $headers[$key] = $name;
+      }
+      return $headers;
     }
     else {
-      $headers = array();
       foreach ($columns as $name => $key) {
         if (!empty($name)) {
           $headers[] = array(
index a93b7712b0687944ed7251a5f8e045471aa525fc..dbc5564b43307770760f6562734ddf5158fe96cd 100644 (file)
@@ -32,7 +32,7 @@
 <br />
 <table>
   <tr class="columnheader">
-{if $id}
+{if $id OR $customSearchID}
   {foreach from=$columnHeaders item=header}
      <th>{$header}</th>
   {/foreach}
 {foreach from=$rows item=row}
     <tr class="{cycle values="odd-row,even-row"}">
 {if $id}
-        <td>{$row.sort_name}</td>
-         {foreach from=$row item=value key=key}
-           {if ($key neq "checkbox") and ($key neq "action") and ($key neq "contact_type") and ($key neq "status") and ($key neq "contact_id") and ($key neq "sort_name")}
-              <td>{$value}</td>
-           {/if}
-         {/foreach}
-
+  <td>{$row.sort_name}</td>
+  {foreach from=$row item=value key=key}
+    {if ($key neq "checkbox") and ($key neq "action") and ($key neq "contact_type") and ($key neq "status") and ($key neq "contact_id") and ($key neq "sort_name")}
+      <td>{$value}</td>
+    {/if}
+  {/foreach}
+{elseif $customSearchID}
+  {foreach from=$columnHeaders item=header key=name}
+    <td>{$row.$name}</td>
+  {/foreach}
 {else}
         <td>{$row.sort_name}</td>
         {if !empty($columnHeaders.street_address)}