From f35974a298cde16ef430b8311154ab847fc48bed Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Wed, 15 Nov 2017 12:29:39 -0500 Subject: [PATCH] Sort by country,second_name,first_name for pdf generation of international mailings --- CRM/Utils/Sort.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CRM/Utils/Sort.php b/CRM/Utils/Sort.php index d8dd68b1ea..133707f087 100644 --- a/CRM/Utils/Sort.php +++ b/CRM/Utils/Sort.php @@ -160,11 +160,17 @@ class CRM_Utils_Sort { $this->_vars[$this->_currentSortID]['direction'] == self::DONTCARE ) { $this->_vars[$this->_currentSortID]['name'] = str_replace(' ', '_', $this->_vars[$this->_currentSortID]['name']); - return CRM_Utils_Type::escape($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnNameOrAlias') . ' asc'; + // quidam: hack to reorder by country,second_name,first_name on pdf generation + if ($this->_vars[$this->_currentSortID]['title'] == 'Country'){ + return CRM_Utils_Type::escape($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnNameOrAlias') . ' asc,last_name asc,first_name asc'; } + return CRM_Utils_Type::escape($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnNameOrAlias') . ' asc '; } else { $this->_vars[$this->_currentSortID]['name'] = str_replace(' ', '_', $this->_vars[$this->_currentSortID]['name']); - return CRM_Utils_Type::escape($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnNameOrAlias') . ' desc'; + // quidam: hack to reorder by country,second_name,first_name on pdf generation + if ($this->_vars[$this->_currentSortID]['title'] == 'Country'){ + return CRM_Utils_Type::escape($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnNameOrAlias') . ' desc,last_name asc,first_name asc'; } + return CRM_Utils_Type::escape($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnNameOrAlias') . ' desc '; } } -- 2.25.1