From 9f05e0a7b94f422d828433daa51d135f33c1569d Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Sat, 21 Apr 2018 02:10:37 +0530 Subject: [PATCH] (dev/core/issues/70) On any custom search 'Print selected rows' action doesn't retain columns/values --- CRM/Contact/Form/Task/Print.php | 3 ++- CRM/Contact/Selector/Custom.php | 9 ++++++--- templates/CRM/Contact/Form/Task/Print.tpl | 19 +++++++++++-------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CRM/Contact/Form/Task/Print.php b/CRM/Contact/Form/Task/Print.php index f94d4beb05..e42f447dd1 100644 --- a/CRM/Contact/Form/Task/Print.php +++ b/CRM/Contact/Form/Task/Print.php @@ -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, diff --git a/CRM/Contact/Selector/Custom.php b/CRM/Contact/Selector/Custom.php index 2c95ffd9f0..645ed78750 100644 --- a/CRM/Contact/Selector/Custom.php +++ b/CRM/Contact/Selector/Custom.php @@ -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( diff --git a/templates/CRM/Contact/Form/Task/Print.tpl b/templates/CRM/Contact/Form/Task/Print.tpl index a93b7712b0..dbc5564b43 100644 --- a/templates/CRM/Contact/Form/Task/Print.tpl +++ b/templates/CRM/Contact/Form/Task/Print.tpl @@ -32,7 +32,7 @@
-{if $id} +{if $id OR $customSearchID} {foreach from=$columnHeaders item=header} {/foreach} @@ -63,13 +63,16 @@ {foreach from=$rows item=row} {if $id} - - {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")} - - {/if} - {/foreach} - + + {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")} + + {/if} + {/foreach} +{elseif $customSearchID} + {foreach from=$columnHeaders item=header key=name} + + {/foreach} {else} {if !empty($columnHeaders.street_address)} -- 2.25.1
{$header}
{$row.sort_name}{$value}{$row.sort_name}{$value}{$row.$name}{$row.sort_name}