From 07754821e28e00cf4aac865dfd2edcef6cbdd834 Mon Sep 17 00:00:00 2001 From: Manoj L Date: Thu, 8 Aug 2019 11:11:24 +0530 Subject: [PATCH 01/19] Task #148898 chore: DB change: change ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci --- tjreports/administrator/sql/install.mysql.utf8.sql | 2 +- tjreports/administrator/sql/uninstall.mysql.utf8.sql | 3 +-- tjreports/administrator/sql/updates/mysql/1.1.1.sql | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 tjreports/administrator/sql/updates/mysql/1.1.1.sql diff --git a/tjreports/administrator/sql/install.mysql.utf8.sql b/tjreports/administrator/sql/install.mysql.utf8.sql index 26a7e86..70bd55f 100755 --- a/tjreports/administrator/sql/install.mysql.utf8.sql +++ b/tjreports/administrator/sql/install.mysql.utf8.sql @@ -12,4 +12,4 @@ CREATE TABLE IF NOT EXISTS `#__tj_reports` ( `datadenyset` int(11), `param` text NOT NULL, PRIMARY KEY (`id`) -) AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1; diff --git a/tjreports/administrator/sql/uninstall.mysql.utf8.sql b/tjreports/administrator/sql/uninstall.mysql.utf8.sql index d31a636..22e71a7 100755 --- a/tjreports/administrator/sql/uninstall.mysql.utf8.sql +++ b/tjreports/administrator/sql/uninstall.mysql.utf8.sql @@ -1,2 +1 @@ - -DELETE FROM `#__content_types` WHERE (type_alias LIKE 'com_tjreports.%'); \ No newline at end of file +--- DELETE FROM `#__content_types` WHERE (type_alias LIKE 'com_tjreports.%'); diff --git a/tjreports/administrator/sql/updates/mysql/1.1.1.sql b/tjreports/administrator/sql/updates/mysql/1.1.1.sql new file mode 100644 index 0000000..260a803 --- /dev/null +++ b/tjreports/administrator/sql/updates/mysql/1.1.1.sql @@ -0,0 +1,6 @@ +-- Change engine +ALTER TABLE `#__tj_reports` ENGINE = InnoDB; + +-- Change charset, collation +ALTER TABLE `#__tj_reports` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + From c5f2be4f9a21736f45a843de222b546aed760d2e Mon Sep 17 00:00:00 2001 From: Pranoti Patil Date: Thu, 8 Aug 2019 15:48:08 +0530 Subject: [PATCH 02/19] Task #148927 feat: Add reports API plugin in TJReport package --- .../language/en-GB/en-GB.plg_api_reports.ini | 7 ++ .../en-GB/en-GB.plg_api_reports.sys.ini | 7 ++ tjreports/plugins/api/reports/reports.php | 43 ++++++++ tjreports/plugins/api/reports/reports.xml | 21 ++++ .../plugins/api/reports/reports/filters.php | 61 ++++++++++++ .../plugins/api/reports/reports/report.php | 97 +++++++++++++++++++ tjreports/script.tjreports.php | 3 + 7 files changed, 239 insertions(+) create mode 100644 tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.ini create mode 100644 tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.sys.ini create mode 100644 tjreports/plugins/api/reports/reports.php create mode 100644 tjreports/plugins/api/reports/reports.xml create mode 100644 tjreports/plugins/api/reports/reports/filters.php create mode 100644 tjreports/plugins/api/reports/reports/report.php diff --git a/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.ini b/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.ini new file mode 100644 index 0000000..c01b6f1 --- /dev/null +++ b/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.ini @@ -0,0 +1,7 @@ +; @package Com_Tjreports +; @copyright Copyright © 2009-2018 Techjoomla. All rights reserved. +; @license GNU General Public License version 2, or later +; Note: All ini files need to be saved as UTF-8 + +PLG_API_REPORTS_REPORT_NAME_MISSSING="Please enter report name" +PLG_API_REPORTS_REPORT_NAME_INVALID="Please enter valid report name" diff --git a/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.sys.ini b/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.sys.ini new file mode 100644 index 0000000..5dc53f0 --- /dev/null +++ b/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.sys.ini @@ -0,0 +1,7 @@ +; @package Com_Tjreports +; @copyright Copyright © 2009-2018 Techjoomla. All rights reserved. +; @license GNU General Public License version 2, or later +; Note: All ini files need to be saved as UTF-8 + +PLG_API_REPORTS="TJ Reports Api Plugin" +PLG_API_REPORTS_DESCRIPTION="TJ Reports Api Plugin" diff --git a/tjreports/plugins/api/reports/reports.php b/tjreports/plugins/api/reports/reports.php new file mode 100644 index 0000000..5d4a54b --- /dev/null +++ b/tjreports/plugins/api/reports/reports.php @@ -0,0 +1,43 @@ + + * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access. +defined('_JEXEC') or die; + +jimport('joomla.plugin.plugin'); +JLoader::import('components.com_tjreports.models.report', JPATH_SITE); + +/** + * Tjreports API plugin + * + * @since 1.0 + */ +class PlgAPIReports extends ApiPlugin +{ + /** + * Constructor + * + * @param STRING &$subject subject + * @param array $config config + * + * @since 1.0 + */ + public function __construct(&$subject, $config = array()) + { + parent::__construct($subject, $config = array()); + + // Set resource path + ApiResource::addIncludePath(dirname(__FILE__) . '/reports'); + + // Load language files + $lang = JFactory::getLanguage(); + $lang->load('plg_api_reports', JPATH_SITE . "/plugins/api/reports/", 'en-GB', true); + } +} diff --git a/tjreports/plugins/api/reports/reports.xml b/tjreports/plugins/api/reports/reports.xml new file mode 100644 index 0000000..6bf8411 --- /dev/null +++ b/tjreports/plugins/api/reports/reports.xml @@ -0,0 +1,21 @@ + + + PLG_API_REPORTS + 1.0 + 28th May 2018 + Techjoomla + extensions@techjoomla.com + https://techjoomla.com + Techjoomla. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + PLG_API_REPORTS_DESCRIPTION + + reports.php + reports + language + + + en-GB/en-GB.plg_api_reports.ini + en-GB/en-GB.plg_api_reports.sys.ini + + diff --git a/tjreports/plugins/api/reports/reports/filters.php b/tjreports/plugins/api/reports/reports/filters.php new file mode 100644 index 0000000..c6ff182 --- /dev/null +++ b/tjreports/plugins/api/reports/reports/filters.php @@ -0,0 +1,61 @@ + + * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access. +defined('_JEXEC') or die; + +/** + * Tjreports API report class + * + * @since 1.0.0 + */ +class ReportsApiResourceFilters extends ApiResource +{ + /** + * Function get filters data + * + * @return boolean + */ + public function get() + { + $app = JFactory::getApplication(); + $jinput = $app->input; + $reportName = $jinput->getString('id'); + + if (!isset($reportName)) + { + ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); + } + + $lang = JFactory::getLanguage(); + //load default joomla language file + $lang->load('', JPATH_ADMINISTRATOR, 'en-GB', true); + + // Make object of the tjreports plugin to load filters for + JLoader::import('plugins.tjreports.' . $reportName . "." . $reportName, JPATH_SITE); + $className = 'TjreportsModel' . ucfirst($reportName); + + if (!class_exists($className)) + { + ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); + } + + $reportPlugin = new $className; + + $filters = $reportPlugin->displayFilters(); + $filter_array = []; + foreach ($filters[0] as $key => $value) { + $value['name'] = $key; + $filter_array[] = $value; + } + + $this->plugin->setResponse($filter_array); + } +} diff --git a/tjreports/plugins/api/reports/reports/report.php b/tjreports/plugins/api/reports/reports/report.php new file mode 100644 index 0000000..3ba048c --- /dev/null +++ b/tjreports/plugins/api/reports/reports/report.php @@ -0,0 +1,97 @@ + + * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access. +defined('_JEXEC') or die; + +/** + * Tjreports API report class + * + * @since 1.0.0 + */ +class ReportsApiResourceReport extends ApiResource +{ + /** + * Function to get report data from tjreports plugin + * + * @return json + */ + public function post() + { + $app = JFactory::getApplication(); + $jinput = $app->input; + $formData = $jinput->post; + $reportName = $app->input->getString('id'); + + if (empty($reportName)) + { + $reportName = $formData->getString('report'); + } + + if (!isset($reportName)) + { + ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); + } + + // Create object of tjreports plugin class + + JLoader::import('plugins.tjreports.' . $reportName . "." . $reportName, JPATH_SITE); + $className = 'TjreportsModel' . ucfirst($reportName); + + if (!class_exists($className)) + { + ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); + } + + $reportPlugin = new $className; + + // Load language files + $lang = JFactory::getLanguage(); + $lang->load('com_tjreports', JPATH_ADMINISTRATOR, 'en-GB', true); + $lang->load('plg_tjreports_' . $reportName, JPATH_SITE . "/plugins/tjreports/" . $reportName, 'en-GB', true); + + // Get filters and cols + $reportId = $reportPlugin->getDefaultReport($reportName); + $reportFilters = ($formData->get('filters')) ? $formData->get('filters') : []; + $reportCols = ($formData->get('colToshow')) ? $formData->get('colToshow') : []; + + $reportPlugin->setState('filters', $reportFilters); + $reportPlugin->setState('colToshow', $reportCols); + $reportPlugin->setState('reportId', $reportId); + + // Get results and errors if any + $report = $reportPlugin->getItems(); + $errors = $reportPlugin->getTJRMessages(); + + if (!empty($errors)) + { + ApiError::raiseError(400, $errors[0], 'APIValidationException'); + } + + // @TODO Handle else condition first to reduce nesting + if (!empty($reportCols)) + { + foreach ($report as $key => $value) + { + foreach ($value as $k => $v) + { + if (!in_array($k, $reportCols)) + { + unset($value[$k]); + } + } + + $report[$key] = $value; + } + } + + $this->plugin->setResponse($report); + } +} diff --git a/tjreports/script.tjreports.php b/tjreports/script.tjreports.php index 7d95be2..1585029 100755 --- a/tjreports/script.tjreports.php +++ b/tjreports/script.tjreports.php @@ -59,6 +59,9 @@ class Com_TjreportsInstallerScript ), 'user' => array( 'tjreportsindexer' => 0 + ), + 'api' => array( + 'reports' => 1 ) ) ); From 99a2d7610e50ed4cdfc7b3c0db574b3561028aee Mon Sep 17 00:00:00 2001 From: Manoj L Date: Wed, 25 Sep 2019 18:06:47 +0530 Subject: [PATCH 03/19] Revert "Task #148898 chore: DB change: change ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci" --- tjreports/administrator/sql/install.mysql.utf8.sql | 2 +- tjreports/administrator/sql/uninstall.mysql.utf8.sql | 3 ++- tjreports/administrator/sql/updates/mysql/1.1.1.sql | 6 ------ 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 tjreports/administrator/sql/updates/mysql/1.1.1.sql diff --git a/tjreports/administrator/sql/install.mysql.utf8.sql b/tjreports/administrator/sql/install.mysql.utf8.sql index 70bd55f..26a7e86 100755 --- a/tjreports/administrator/sql/install.mysql.utf8.sql +++ b/tjreports/administrator/sql/install.mysql.utf8.sql @@ -12,4 +12,4 @@ CREATE TABLE IF NOT EXISTS `#__tj_reports` ( `datadenyset` int(11), `param` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1; +) AUTO_INCREMENT=1 ; diff --git a/tjreports/administrator/sql/uninstall.mysql.utf8.sql b/tjreports/administrator/sql/uninstall.mysql.utf8.sql index 22e71a7..d31a636 100755 --- a/tjreports/administrator/sql/uninstall.mysql.utf8.sql +++ b/tjreports/administrator/sql/uninstall.mysql.utf8.sql @@ -1 +1,2 @@ ---- DELETE FROM `#__content_types` WHERE (type_alias LIKE 'com_tjreports.%'); + +DELETE FROM `#__content_types` WHERE (type_alias LIKE 'com_tjreports.%'); \ No newline at end of file diff --git a/tjreports/administrator/sql/updates/mysql/1.1.1.sql b/tjreports/administrator/sql/updates/mysql/1.1.1.sql deleted file mode 100644 index 260a803..0000000 --- a/tjreports/administrator/sql/updates/mysql/1.1.1.sql +++ /dev/null @@ -1,6 +0,0 @@ --- Change engine -ALTER TABLE `#__tj_reports` ENGINE = InnoDB; - --- Change charset, collation -ALTER TABLE `#__tj_reports` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - From 0fc793fa69d510c7d3f48129144689ef290d399e Mon Sep 17 00:00:00 2001 From: Vaibhav <35258839+vaibhavsTekdi@users.noreply.github.com> Date: Fri, 27 Sep 2019 13:02:23 +0530 Subject: [PATCH 04/19] =?UTF-8?q?Task=20#151=20feat:=20Show=20hash(md5=20s?= =?UTF-8?q?tring)=20of=20username=20&=20email=20data=20i=E2=80=A6=20(#152)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Task #151210 feat: Show hash(md5 string) of username & email data in reports * Task #151210 chore: Updated hashed column length * Task #151210 chore: Resolved PHPCS issue * Task #151210 chore: Resolved PHPCS issue --- .../plugins/actionlog/tjreports/tjreports.xml | 4 +-- .../tjreportsfields/tjreportsfields.xml | 4 +-- .../plugins/privacy/tjreports/tjreports.xml | 4 +-- .../sql/tjreportsindexer.install.sql | 4 ++- .../sql/updates/mysql/1.1.2.sql | 2 ++ .../tjreportsindexer/tjreportsindexer.php | 15 +++-------- .../tjreportsindexer/tjreportsindexer.xml | 4 +-- tjreports/site/models/reports.php | 27 +++++++++---------- tjreports/tjreports.xml | 4 +-- 9 files changed, 31 insertions(+), 37 deletions(-) create mode 100644 tjreports/plugins/user/tjreportsindexer/sql/updates/mysql/1.1.2.sql diff --git a/tjreports/plugins/actionlog/tjreports/tjreports.xml b/tjreports/plugins/actionlog/tjreports/tjreports.xml index 314baeb..1894721 100644 --- a/tjreports/plugins/actionlog/tjreports/tjreports.xml +++ b/tjreports/plugins/actionlog/tjreports/tjreports.xml @@ -2,12 +2,12 @@ plg_actionlog_tjreports Techjoomla - 12th Jul 2019 + 26th Sep 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL extensions@techjoomla.com https://techjoomla.com - 1.1.1 + 1.1.2 PLG_ACTIONLOG_TJREPORTS_XML_DESCRIPTION tjreports.php diff --git a/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml index f7f33d5..ad46f3e 100644 --- a/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml +++ b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml @@ -5,10 +5,10 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 12th Jul 2019 + 26th Sep 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.1.1 + 1.1.2 tjreportsfields.php diff --git a/tjreports/plugins/privacy/tjreports/tjreports.xml b/tjreports/plugins/privacy/tjreports/tjreports.xml index 45d6501..9eeb060 100644 --- a/tjreports/plugins/privacy/tjreports/tjreports.xml +++ b/tjreports/plugins/privacy/tjreports/tjreports.xml @@ -1,8 +1,8 @@ plg_privacy_tjreports - 1.1.1 - 12th Jul 2019 + 1.1.2 + 26th Sep 2019 Techjoomla extensions@techjoomla.com https://techjoomla.com diff --git a/tjreports/plugins/user/tjreportsindexer/sql/tjreportsindexer.install.sql b/tjreports/plugins/user/tjreportsindexer/sql/tjreportsindexer.install.sql index 4e64539..d79fa56 100755 --- a/tjreports/plugins/user/tjreportsindexer/sql/tjreportsindexer.install.sql +++ b/tjreports/plugins/user/tjreportsindexer/sql/tjreportsindexer.install.sql @@ -1,3 +1,5 @@ CREATE TABLE IF NOT EXISTS `#__tjreports_com_users_user` ( - `record_id` int(11) NOT NULL + `record_id` int(11) NOT NULL, + `username_hash` VARCHAR(100) NOT NULL, + `email_hash` VARCHAR(100) NOT NULL )ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/tjreports/plugins/user/tjreportsindexer/sql/updates/mysql/1.1.2.sql b/tjreports/plugins/user/tjreportsindexer/sql/updates/mysql/1.1.2.sql new file mode 100644 index 0000000..7977427 --- /dev/null +++ b/tjreports/plugins/user/tjreportsindexer/sql/updates/mysql/1.1.2.sql @@ -0,0 +1,2 @@ +ALTER TABLE `#__tjreports_com_users_user` ADD username_hash VARCHAR(100) NOT NULL AFTER record_id; +ALTER TABLE `#__tjreports_com_users_user` ADD email_hash VARCHAR(100) NOT NULL AFTER username_hash; diff --git a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.php b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.php index 533eab9..e43c79d 100644 --- a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.php +++ b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.php @@ -48,17 +48,6 @@ class PlgUserTjreportsindexer extends JPlugin */ public function onUserAfterSave($user, $isNew, $success, $msg) { - /* - [com_fields] => Array - ( - [job-position] => Developer - )*/ - - if (empty($user['com_fields'])) - { - return; - } - // Delete existing user-data entry // Here record_id = user_id $this->deleteIndexerEntry($user['id']); @@ -153,6 +142,10 @@ protected function addIndexerEntry($user) $values[] = $db->quote($value); } + // Add username & email hash values + array_push($columns, 'username_hash', 'email_hash'); + array_push($values, "'" . md5($user['username']) . "'", "'" . md5($user['email']) . "'"); + // Prepare the insert query $query = $db->getQuery(true); $query diff --git a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml index 568f885..e61e86c 100644 --- a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml +++ b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml @@ -5,10 +5,10 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 12th Jul 2019 + 26th Sep 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.1.1 + 1.1.2 sql/tjreportsindexer.install.sql diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index 5614ff4..a65a81e 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -95,7 +95,12 @@ public function __construct($config = array()) } // Get email column - $this->emailColumn = array_search(1, array_map(function ($ar) {return $ar['emailColumn'];}, $this->columns)); + $this->emailColumn = array_search( + 1, array_map( + function ($ar) {return $ar['emailColumn']; + }, $this->columns + ) + ); $this->initData(); @@ -148,15 +153,8 @@ protected function setCustomFieldsColumns() // Set columns from custom fields table into tjreports plugin's column list foreach ($columnNames as $columnName) { - // Skip primary key, record_id of indexed table - // As those are not part of custom fields - if (!isset($columnLabels[$columnName])) - { - continue; - } - $customField = array ( - 'title' => $columnLabels[$columnName], + 'title' => ($columnLabels[$columnName]) ? $columnLabels[$columnName] : $columnName, 'table_column' => $this->customFieldsTableAlias . '.' . $columnName // , 'disable_sorting' => true @@ -372,7 +370,6 @@ private function initData() $this->sortableColumns = array_values($this->sortableColumns); $this->sortableWoQuery = array_values($this->sortableWoQuery); $this->defaultColToShow = array_values($this->defaultColToShow); - } /** @@ -1085,7 +1082,7 @@ private function filterReportColumns($queryId, &$selColToshow) // Process if user has saved query is for a plugin if (!empty($parentId)) { - $this->processSavedReportColumns($parentId, $showhideCols, $paramColToshow, $selColToshow); + $this->processSavedReportColumns($parentId, $showhideCols, $paramColToshow, $selColToshow); } // If plugin has save any column assign that otherwise default plugin param will be applied @@ -1117,10 +1114,10 @@ private function filterReportColumns($queryId, &$selColToshow) /** * Method to Process parent Report columns * - * @param INT $queryId Query Id - * @param ARRAY &$showhideCols Show Hide columns - * @param ARRAY &$colToshow Columns to show - * @param ARRAY &$selColToshow Selected Cols + * @param INT $queryId Query Id + * @param ARRAY &$showhideCols Show Hide columns + * @param ARRAY &$colToshow Columns to show + * @param ARRAY &$selColToshow Selected Cols * * @return Void * diff --git a/tjreports/tjreports.xml b/tjreports/tjreports.xml index 3ddde42..9ebeee5 100644 --- a/tjreports/tjreports.xml +++ b/tjreports/tjreports.xml @@ -6,8 +6,8 @@ https://techjoomla.com Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 12th Jul 2019 - 1.1.1 + 26th Sep 2019 + 1.1.2 This component is used to access all the report at single place. From 5e0af3c63207a13fb28ca8e22ce04d28857b9dc8 Mon Sep 17 00:00:00 2001 From: vaishali k Date: Tue, 1 Oct 2019 14:08:25 +0530 Subject: [PATCH 05/19] Issue #153 fix: Undefined index: emailColumn in ../com_tjreports/models/reports.php --- tjreports/site/models/reports.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index a65a81e..c3e07f1 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -97,7 +97,11 @@ public function __construct($config = array()) // Get email column $this->emailColumn = array_search( 1, array_map( - function ($ar) {return $ar['emailColumn']; + function ($ar) { + if (!empty($ar['emailColumn'])) + { + return $ar['emailColumn']; + } }, $this->columns ) ); From 29f6c5cadf2862c5c1607617e4b99f2c6d1a5d49 Mon Sep 17 00:00:00 2001 From: Komal Mane Date: Fri, 11 Oct 2019 12:07:41 +0530 Subject: [PATCH 06/19] =?UTF-8?q?Feature=20#151485=20feat:=20TJ=20Reports?= =?UTF-8?q?=20Modifications=20for=20PII=20data=20acce=E2=80=A6=20(#155)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Task #151493 feat: Add 'PII Data' new permission on component level. * Task #151498 feat: API - report API Support PII * Feature #151485 feat: Resolve MR Commnets * Feature #149213 feat: Supporting Bulk emails * Feature #151485 feat: Resolve comments * Feature #151485 feat: Resolve comments * Solve scrutinizer issues * Solve scrutinizer issues * Solve scrutinizer issues * Resolve commnets * Solve scrutinizer issues --- tjreports/administrator/access.xml | 1 + tjreports/administrator/models/tjreport.php | 1 + .../en-GB/en-GB.com_tjreports.ini | 2 + tjreports/site/assets/js/tjrContentUI.js | 4 +- tjreports/site/models/reports.php | 120 +++++++++++++++--- 5 files changed, 106 insertions(+), 22 deletions(-) diff --git a/tjreports/administrator/access.xml b/tjreports/administrator/access.xml index 2e45095..85ca516 100755 --- a/tjreports/administrator/access.xml +++ b/tjreports/administrator/access.xml @@ -13,6 +13,7 @@ +
diff --git a/tjreports/administrator/models/tjreport.php b/tjreports/administrator/models/tjreport.php index ece6446..35b9793 100644 --- a/tjreports/administrator/models/tjreport.php +++ b/tjreports/administrator/models/tjreport.php @@ -181,6 +181,7 @@ public function getReportPluginData($pluginId, $pluginName = null) $params['colToshow'] = $plgModel->getState('colToshow'); $params['colToshow'] = array_combine($params['colToshow'], array_fill(0, count($params['colToshow']), true)); $params['showHideColumns'] = $plgModel->showhideCols; + $params['piiColumns'] = $plgModel->getState('piiColumns'); $report->param = json_encode($params); } diff --git a/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini b/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini index c57d742..cfbb861 100755 --- a/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini +++ b/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini @@ -111,6 +111,8 @@ COM_TJREPORTS_ACCESS_VIEW_SUBSCRIBE_DESC="Allow user to view only subscribed rep JACTION_VIEW="View" JACTION_VIEW_COMPONENT_DESC="Allow user to view reports in this extension" JACTION_EXPORT="Export" +COM_TJREPORTS_ACCESS_PIIDATA="View PII Data" +COM_TJREPORTS_ACCESS_PIIDATA_COMPONENT_DESC="Allow user to see Personally Identifiable Information (PII) data on the report." JACTION_EXPORT_COMPONENT_DESC="Allow user to export report data in this extension" ;tjreport lms diff --git a/tjreports/site/assets/js/tjrContentUI.js b/tjreports/site/assets/js/tjrContentUI.js index 5c16ad2..9927292 100755 --- a/tjreports/site/assets/js/tjrContentUI.js +++ b/tjreports/site/assets/js/tjrContentUI.js @@ -49,11 +49,11 @@ jQuery.extend(tjrContentUI.report, { // If sendEmail plug is enabled then try to add a column of checkboxes if ( - typeof tjutilitysendemail != 'undefined' && + typeof window.tjSendEmail.UI != 'undefined' && jQuery('body').find('.td-sendemail').length > 0 ) { - tjutilitysendemail.addColumn('report-table'); + window.tjemail = new window.tjSendEmail.UI("report-table", "td-sendemail", "cid"); } // Reinitialze some js like for calandar, tooltip, chosen diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index c3e07f1..c3c8fbd 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -14,6 +14,7 @@ // Load TJReports db helper JLoader::import('database', JPATH_SITE . '/components/com_tjreports/helpers'); +JLoader::import('components.com_tjreports.helpers.tjreports', JPATH_ADMINISTRATOR); /** * Methods supporting a list of Tjreports records. @@ -37,6 +38,9 @@ class TjreportsModelReports extends JModelList // Columns array contain columns data public $columns = array(); + // Columns array contain PII columns + private $piiColumns = array(); + // Columns array contain email columns private $emailColumn = ''; @@ -72,6 +76,14 @@ class TjreportsModelReports extends JModelList protected $tjreportsDbHelper; + private $piiPermission; + + private $filterShowhideCols = array(); + + private $filterPiiColumns = array(); + + private $filterParamColToshow = array(); + /** * Constructor. * @@ -106,6 +118,9 @@ function ($ar) { ) ); + // Check PII data permission + $this->piiPermission = $this->canViewPiiData(); + $this->initData(); parent::__construct($config); @@ -358,6 +373,11 @@ private function initData() unset($this->sortableColumns[$key]); } + if (isset($column['isPiiColumn']) && $column['isPiiColumn'] === true) + { + array_push($this->piiColumns, $key); + } + if (!isset($column['disable_sorting']) && (!isset($column['table_column']) || !in_array($key, $this->sortableColumns))) { array_push($this->sortableWoQuery, $key); @@ -370,6 +390,7 @@ private function initData() } } + $this->piiColumns = array_values($this->piiColumns); $this->showhideCols = array_values($this->showhideCols); $this->sortableColumns = array_values($this->sortableColumns); $this->sortableWoQuery = array_values($this->sortableWoQuery); @@ -512,6 +533,12 @@ protected function populateState($ordering = '', $direction = 'ASC') $reportParams = $this->getReportParams($reportId); $colToshow = $reportParams->get("colToshow"); + $piiColumns = array_flip($reportParams->get("piiColumns")); + + if (!empty($piiColumns)) + { + $colToshow = (object) array_diff_key((array) $colToshow, $piiColumns); + } } $this->filterReportColumns($reportId, $colToshow); @@ -533,6 +560,11 @@ protected function populateState($ordering = '', $direction = 'ASC') $value = $input->get('limitstart', 0, 'uint'); $this->setState('list.start', $value); + if (!empty($this->piiColumns)) + { + $this->setState('piiColumns', $this->piiColumns); + } + if ($this->emailColumn) { $this->setState('emailColumn', $this->emailColumn); @@ -944,6 +976,21 @@ public function getreportoptions() return $options; } + /** + * Check for permissions + * + * @return boolean + * + * @since 1.0 + */ + + public function canViewPiiData() + { + $canDo = TjreportsHelper::getActions(); + + return $canDo->get('core.view.piidata'); + } + /** * Check for permissions * @@ -1063,8 +1110,8 @@ public function loadLanguage($name, $type = 'tjreports', $extension = '', $baseP /** * Method to Process parent Report columns * - * @param string $queryId Query Id - * @param ARRAY &$selColToshow Columns to show + * @param INT $queryId Query Id + * @param ARRAY &$selColToshow Columns to show * * @return Void * @@ -1078,56 +1125,61 @@ private function filterReportColumns($queryId, &$selColToshow) } $query = $this->_db->getQuery(true); - $showhideCols = $paramColToshow = array(); + $this->filterShowhideCols = $this->filterPiiColumns = $this->filterParamColToshow = array(); + + // $this->filterSelColToshow = $selColToshow; // Process plugin params - $parentId = $this->processSavedReportColumns($queryId, $showhideCols, $paramColToshow, $selColToshow); + $parentId = $this->processSavedReportColumns($queryId, $selColToshow); // Process if user has saved query is for a plugin if (!empty($parentId)) { - $this->processSavedReportColumns($parentId, $showhideCols, $paramColToshow, $selColToshow); + $this->processSavedReportColumns($parentId, $selColToshow); } // If plugin has save any column assign that otherwise default plugin param will be applied - if ($paramColToshow) + if ($this->filterParamColToshow) { // If show hide column changes, check if there is any must to hide column if ($selColToshow) { - $selColToshow = array_intersect($selColToshow, $paramColToshow); - $selColToshow = $selColToshow ? $selColToshow : $paramColToshow; + $selColToshow = array_intersect($selColToshow, $this->filterParamColToshow); + $selColToshow = $selColToshow ? $selColToshow : $this->filterParamColToshow; } else { - $selColToshow = $paramColToshow; + $selColToshow = $this->filterParamColToshow; } } - if (!empty($showhideCols)) + if (!empty($this->filterShowhideCols)) { - $this->showhideCols = $showhideCols; + $this->showhideCols = $this->filterShowhideCols; } if (!empty($emailColumn)) { $this->emailColumn = $emailColumn; } + + if (!empty($this->filterPiiColumns)) + { + $this->piiColumns = $this->filterPiiColumns; + } } /** * Method to Process parent Report columns * * @param INT $queryId Query Id - * @param ARRAY &$showhideCols Show Hide columns - * @param ARRAY &$colToshow Columns to show * @param ARRAY &$selColToshow Selected Cols * - * @return Void + * @return INTEGER * * @since 3.0 */ - private function processSavedReportColumns($queryId, &$showhideCols, &$colToshow, &$selColToshow) + private function processSavedReportColumns($queryId, &$selColToshow) { $query = $this->_db->getQuery(true); $query->select(array('param', 'parent')) @@ -1143,13 +1195,25 @@ private function processSavedReportColumns($queryId, &$showhideCols, &$colToshow if (isset($param['showHideColumns'])) { - if (empty($showhideCols)) + if (empty($this->filterShowhideCols)) + { + $this->filterShowhideCols = (array) $param['showHideColumns']; + } + else + { + $this->filterShowhideCols = array_intersect($this->filterShowhideCols, (array) $param['showHideColumns']); + } + } + + if (isset($param['piiColumns'])) + { + if (empty($this->filterPiiColumns)) { - $showhideCols = (array) $param['showHideColumns']; + $this->filterPiiColumns = (array) $param['piiColumns']; } else { - $showhideCols = array_intersect($showhideCols, (array) $param['showHideColumns']); + $this->filterPiiColumns = array_intersect($this->filterPiiColumns, (array) $param['piiColumns']); } } @@ -1159,20 +1223,36 @@ private function processSavedReportColumns($queryId, &$showhideCols, &$colToshow { if ($show !== false || in_array($cols, $selColToshow)) { - $colToshow[$cols] = $cols; + $this->filterParamColToshow[$cols] = $cols; } if (!empty($param['showHideColumns']) && !in_array($cols, $param['showHideColumns']) && !empty($selColToshow)) { array_splice($selColToshow, $i, 0, $cols); $i++; - $colToshow[$cols] = $cols; + $this->filterParamColToshow[$cols] = $cols; } } } + // Check PII permission + if (!empty($param['piiColumns']) && !$this->piiPermission) + { + $this->filterParamColToshow = array_diff($this->filterParamColToshow, $param['piiColumns']); + $this->filterShowhideCols = array_diff($this->filterShowhideCols, $param['piiColumns']); + } + $parent = $queryData->parent; } + else + { + // Check PII permission if load params not set + if (!empty($this->piiColumns) && !$this->piiPermission) + { + $this->defaultColToShow = array_diff($this->defaultColToShow, $this->piiColumns); + $this->showhideCols = array_diff($this->showhideCols, $this->piiColumns); + } + } return $parent; } From 43f0458c0e7c467b16e81ed5b8d05a4b867474df Mon Sep 17 00:00:00 2001 From: Komal Mane Date: Fri, 18 Oct 2019 16:49:09 +0530 Subject: [PATCH 07/19] Tjreport Issue - Hide / show column config not working (#156) * Task #151493 feat: Add 'PII Data' new permission on component level. * Task #151498 feat: API - report API Support PII * Feature #151485 feat: Resolve MR Commnets * Feature #149213 feat: Supporting Bulk emails * Feature #151485 feat: Resolve comments * Feature #151485 feat: Resolve comments * Solve scrutinizer issues * Solve scrutinizer issues * Solve scrutinizer issues * Resolve commnets * Solve scrutinizer issues * Tjreport Issue - Hide / show column config not working * Tjreport Issue - Hide / show column config not working * Tjreport Issue - Hide / show column config not working * Task #151951 feat: After remove column from hide/show list and added in the colToshow list it will not display on report * Task #151951 feat: update commnets * Tjreport Issue - Hide / show column config not working --- tjreports/administrator/models/tjreport.php | 12 +++++++++++- tjreports/site/models/reports.php | 18 +++++++++++++++++- tjreports/site/views/reports/view.base.php | 17 ++++++++++++++++- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/tjreports/administrator/models/tjreport.php b/tjreports/administrator/models/tjreport.php index 35b9793..5ed7eeb 100644 --- a/tjreports/administrator/models/tjreport.php +++ b/tjreports/administrator/models/tjreport.php @@ -173,6 +173,8 @@ public function getReportPluginData($pluginId, $pluginName = null) JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/tjreports/' . $pluginName); $plgModel = JModelLegacy::getInstance($pluginName, 'TjreportsModel'); + $defaultColToHide = $plgModel->getState('defaultColToHide'); + $params = array(); $params['filter_order'] = $plgModel->getState('list.ordering'); $params['filter_order_Dir'] = $plgModel->getState('list.direction'); @@ -180,8 +182,16 @@ public function getReportPluginData($pluginId, $pluginName = null) $params['emailColumn'] = $plgModel->getState('emailColumn'); $params['colToshow'] = $plgModel->getState('colToshow'); $params['colToshow'] = array_combine($params['colToshow'], array_fill(0, count($params['colToshow']), true)); + + /* Here merge colToshow (array value is true) with defaultColToHide (array value is false) column - + * so false value column not display on report by default.*/ + if (!empty($defaultColToHide)) + { + $params['colToshow'] = array_merge($params['colToshow'], $defaultColToHide); + } + $params['showHideColumns'] = $plgModel->showhideCols; - $params['piiColumns'] = $plgModel->getState('piiColumns'); + $params['piiColumns'] = $plgModel->getState('piiColumns'); $report->param = json_encode($params); } diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index c3c8fbd..a224fc4 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -50,6 +50,9 @@ class TjreportsModelReports extends JModelList // Columns which will be displayed by default private $defaultColToShow = array(); + // Columns which will be hide by default + private $defaultColToHide = array(); + // Columns which are sortable with or without query statement public $sortableColumns = array(); @@ -364,7 +367,9 @@ private function initData() if ((isset($column['not_show_hide']) && $column['not_show_hide'] === true) || (strpos($key, '::') !== false && !isset($column['not_show_hide']))) { + // If column not_show_hide = true then this column hide from show/hide list as well as on the report unset($this->showhideCols[$key]); + unset($this->defaultColToShow[$key]); } if ((isset($column['disable_sorting']) && $column['disable_sorting']) @@ -386,15 +391,19 @@ private function initData() if (!isset($column['title']) || (strpos($key, '::') !== false) || (isset($column['not_show_hide']) && $column['not_show_hide'] === false)) { + /* If column not_show_hide = false then column does not show on the report + * but shows on Hide / show column list dropdown with unchecking the checkbox.*/ + array_push($this->defaultColToHide, $key); unset($this->defaultColToShow[$key]); } } - $this->piiColumns = array_values($this->piiColumns); + $this->piiColumns = array_values($this->piiColumns); $this->showhideCols = array_values($this->showhideCols); $this->sortableColumns = array_values($this->sortableColumns); $this->sortableWoQuery = array_values($this->sortableWoQuery); $this->defaultColToShow = array_values($this->defaultColToShow); + $this->defaultColToHide = array_values($this->defaultColToHide); } /** @@ -570,6 +579,13 @@ protected function populateState($ordering = '', $direction = 'ASC') $this->setState('emailColumn', $this->emailColumn); } + if ($this->defaultColToHide) + { + // Array set hide column in param as false value + $defaultColToHide = array_combine($this->defaultColToHide, array_fill(0, count($this->defaultColToHide), false)); + $this->setState('defaultColToHide', $defaultColToHide); + } + // Ordering $this->default_order = $input->get('filter_order', $this->default_order, 'STRING'); diff --git a/tjreports/site/views/reports/view.base.php b/tjreports/site/views/reports/view.base.php index d8809a9..bb25a18 100644 --- a/tjreports/site/views/reports/view.base.php +++ b/tjreports/site/views/reports/view.base.php @@ -159,13 +159,28 @@ public function processData($type = 'html') $this->pagination = $this->get('pagination'); $this->headerLevel = $this->model->headerLevel; + + // Array_key - defaultColToHide column are present then get the key as value. + $this->defaultColToHide = array_keys($this->model->getState('defaultColToHide')); $this->columns = $this->model->columns; + + /* Array_merge - here colToshow means get all true value array so want to mearg defaultColToHide column and then using + * array_intersect - only remove those column which is force fully added in load param in showhideCols config + */ $this->showHideColumns = $this->model->showhideCols; + + if (!empty($this->defaultColToHide)) + { + $this->showHideColumns = array_intersect($this->model->showhideCols, array_merge($this->model->getState('colToshow'), $this->defaultColToHide)); + } + $this->sortable = $this->model->sortableColumns; $this->emailColumn = $this->model->getState('emailColumn'); $this->srButton = $this->model->showSearchResetButton; - $this->colToshow = $this->model->getState('colToshow'); + // Array_intersect - if column present in colToshow as true/false but not in showHideColumns then remove it + $this->colToshow = array_intersect($this->model->getState('colToshow'), $this->model->showhideCols); + $this->filterValues = $this->model->getState('filters'); $this->userFilters = $this->model->displayFilters(); From f863d14fe8277c5e6469046ef41dd600d52f081e Mon Sep 17 00:00:00 2001 From: Manoj L Date: Tue, 22 Oct 2019 16:29:15 +0530 Subject: [PATCH 08/19] Task #148898 chore: DB change: change ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci --- tjreports/administrator/sql/install.mysql.utf8.sql | 2 +- tjreports/administrator/sql/uninstall.mysql.utf8.sql | 3 +-- tjreports/administrator/sql/updates/mysql/1.1.2.sql | 9 +++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 tjreports/administrator/sql/updates/mysql/1.1.2.sql diff --git a/tjreports/administrator/sql/install.mysql.utf8.sql b/tjreports/administrator/sql/install.mysql.utf8.sql index 26a7e86..70bd55f 100755 --- a/tjreports/administrator/sql/install.mysql.utf8.sql +++ b/tjreports/administrator/sql/install.mysql.utf8.sql @@ -12,4 +12,4 @@ CREATE TABLE IF NOT EXISTS `#__tj_reports` ( `datadenyset` int(11), `param` text NOT NULL, PRIMARY KEY (`id`) -) AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1; diff --git a/tjreports/administrator/sql/uninstall.mysql.utf8.sql b/tjreports/administrator/sql/uninstall.mysql.utf8.sql index d31a636..94f5d88 100755 --- a/tjreports/administrator/sql/uninstall.mysql.utf8.sql +++ b/tjreports/administrator/sql/uninstall.mysql.utf8.sql @@ -1,2 +1 @@ - -DELETE FROM `#__content_types` WHERE (type_alias LIKE 'com_tjreports.%'); \ No newline at end of file +-- DELETE FROM `#__content_types` WHERE (type_alias LIKE 'com_tjreports.%'); diff --git a/tjreports/administrator/sql/updates/mysql/1.1.2.sql b/tjreports/administrator/sql/updates/mysql/1.1.2.sql new file mode 100644 index 0000000..3478c66 --- /dev/null +++ b/tjreports/administrator/sql/updates/mysql/1.1.2.sql @@ -0,0 +1,9 @@ +-- Change engine +ALTER TABLE `#__tj_reports` ENGINE = InnoDB; + +-- Change charset, collation for table #__tj_reports +ALTER TABLE `__tj_reports` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `__tj_reports` CHANGE `alias` `alias` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, +ALTER TABLE `__tj_reports` CHANGE `plugin` `plugin` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8mb4_unicode_ci NOT NULL, +ALTER TABLE `__tj_reports` CHANGE `client` `client` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, +ALTER TABLE `__tj_reports` CHANGE `param` `param` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; From edad78300c11b9ca306f35d556046b47129c172e Mon Sep 17 00:00:00 2001 From: Manoj L Date: Tue, 22 Oct 2019 16:30:46 +0530 Subject: [PATCH 09/19] Task #148898 chore: Change version, date --- tjreports/plugins/actionlog/tjreports/tjreports.xml | 2 +- tjreports/plugins/content/tjreportsfields/tjreportsfields.xml | 2 +- tjreports/plugins/privacy/tjreports/tjreports.xml | 2 +- tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml | 2 +- tjreports/tjreports.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tjreports/plugins/actionlog/tjreports/tjreports.xml b/tjreports/plugins/actionlog/tjreports/tjreports.xml index 1894721..cf61054 100644 --- a/tjreports/plugins/actionlog/tjreports/tjreports.xml +++ b/tjreports/plugins/actionlog/tjreports/tjreports.xml @@ -2,7 +2,7 @@ plg_actionlog_tjreports Techjoomla - 26th Sep 2019 + 22nd Oct 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL extensions@techjoomla.com diff --git a/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml index ad46f3e..4357cea 100644 --- a/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml +++ b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml @@ -5,7 +5,7 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 26th Sep 2019 + 22nd Oct 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL 1.1.2 diff --git a/tjreports/plugins/privacy/tjreports/tjreports.xml b/tjreports/plugins/privacy/tjreports/tjreports.xml index 9eeb060..ab37f09 100644 --- a/tjreports/plugins/privacy/tjreports/tjreports.xml +++ b/tjreports/plugins/privacy/tjreports/tjreports.xml @@ -2,7 +2,7 @@ plg_privacy_tjreports 1.1.2 - 26th Sep 2019 + 22nd Oct 2019 Techjoomla extensions@techjoomla.com https://techjoomla.com diff --git a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml index e61e86c..4ee72f8 100644 --- a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml +++ b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml @@ -5,7 +5,7 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 26th Sep 2019 + 22nd Oct 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL 1.1.2 diff --git a/tjreports/tjreports.xml b/tjreports/tjreports.xml index 9ebeee5..ba4cd46 100644 --- a/tjreports/tjreports.xml +++ b/tjreports/tjreports.xml @@ -6,7 +6,7 @@ https://techjoomla.com Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 26th Sep 2019 + 22nd Oct 2019 1.1.2 This component is used to access all the report at single place. From 38a5054df489c6869ce81385a9fd2ea4b8783e7f Mon Sep 17 00:00:00 2001 From: Manoj L Date: Tue, 22 Oct 2019 16:31:50 +0530 Subject: [PATCH 10/19] Task #148898 chore: DB change: change ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci --- tjreports/administrator/sql/updates/mysql/1.1.2.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tjreports/administrator/sql/updates/mysql/1.1.2.sql b/tjreports/administrator/sql/updates/mysql/1.1.2.sql index 3478c66..0908242 100644 --- a/tjreports/administrator/sql/updates/mysql/1.1.2.sql +++ b/tjreports/administrator/sql/updates/mysql/1.1.2.sql @@ -2,8 +2,8 @@ ALTER TABLE `#__tj_reports` ENGINE = InnoDB; -- Change charset, collation for table #__tj_reports -ALTER TABLE `__tj_reports` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; -ALTER TABLE `__tj_reports` CHANGE `alias` `alias` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -ALTER TABLE `__tj_reports` CHANGE `plugin` `plugin` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8mb4_unicode_ci NOT NULL, -ALTER TABLE `__tj_reports` CHANGE `client` `client` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -ALTER TABLE `__tj_reports` CHANGE `param` `param` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `#__tj_reports` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `#__tj_reports` CHANGE `alias` `alias` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, +ALTER TABLE `#__tj_reports` CHANGE `plugin` `plugin` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8mb4_unicode_ci NOT NULL, +ALTER TABLE `#__tj_reports` CHANGE `client` `client` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, +ALTER TABLE `#__tj_reports` CHANGE `param` `param` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; From 7a0c9800457042e4af049b27876022240be4d4e2 Mon Sep 17 00:00:00 2001 From: Manoj L Date: Tue, 22 Oct 2019 18:35:02 +0530 Subject: [PATCH 11/19] Update 1.1.2.sql --- tjreports/administrator/sql/updates/mysql/1.1.2.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tjreports/administrator/sql/updates/mysql/1.1.2.sql b/tjreports/administrator/sql/updates/mysql/1.1.2.sql index 0908242..0da6991 100644 --- a/tjreports/administrator/sql/updates/mysql/1.1.2.sql +++ b/tjreports/administrator/sql/updates/mysql/1.1.2.sql @@ -3,7 +3,7 @@ ALTER TABLE `#__tj_reports` ENGINE = InnoDB; -- Change charset, collation for table #__tj_reports ALTER TABLE `#__tj_reports` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; -ALTER TABLE `#__tj_reports` CHANGE `alias` `alias` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -ALTER TABLE `#__tj_reports` CHANGE `plugin` `plugin` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8mb4_unicode_ci NOT NULL, -ALTER TABLE `#__tj_reports` CHANGE `client` `client` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, +ALTER TABLE `#__tj_reports` CHANGE `alias` `alias` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `#__tj_reports` CHANGE `plugin` `plugin` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `#__tj_reports` CHANGE `client` `client` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; ALTER TABLE `#__tj_reports` CHANGE `param` `param` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; From 2cef3e9abedb5002a6a3680075441add25cd84a0 Mon Sep 17 00:00:00 2001 From: Manoj L Date: Tue, 22 Oct 2019 18:38:16 +0530 Subject: [PATCH 12/19] Update 1.1.2.sql --- tjreports/administrator/sql/updates/mysql/1.1.2.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tjreports/administrator/sql/updates/mysql/1.1.2.sql b/tjreports/administrator/sql/updates/mysql/1.1.2.sql index 0da6991..b4c54ee 100644 --- a/tjreports/administrator/sql/updates/mysql/1.1.2.sql +++ b/tjreports/administrator/sql/updates/mysql/1.1.2.sql @@ -4,6 +4,6 @@ ALTER TABLE `#__tj_reports` ENGINE = InnoDB; -- Change charset, collation for table #__tj_reports ALTER TABLE `#__tj_reports` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; ALTER TABLE `#__tj_reports` CHANGE `alias` `alias` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; -ALTER TABLE `#__tj_reports` CHANGE `plugin` `plugin` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `#__tj_reports` CHANGE `plugin` `plugin` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; ALTER TABLE `#__tj_reports` CHANGE `client` `client` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; ALTER TABLE `#__tj_reports` CHANGE `param` `param` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; From 9cf6b5c3276139c067e1edb753f8f7d07518e145 Mon Sep 17 00:00:00 2001 From: Vaibhav S Date: Wed, 23 Oct 2019 17:55:42 +0530 Subject: [PATCH 13/19] Task #152327 feat: By default hide the custom field columns(record_id + hashed columns) in reports --- tjreports/site/models/reports.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index a224fc4..35c566c 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -177,9 +177,8 @@ protected function setCustomFieldsColumns() { $customField = array ( 'title' => ($columnLabels[$columnName]) ? $columnLabels[$columnName] : $columnName, - 'table_column' => $this->customFieldsTableAlias . '.' . $columnName - - // , 'disable_sorting' => true + 'table_column' => $this->customFieldsTableAlias . '.' . $columnName, + 'not_show_hide' => false ); // Eg. tuf.dob From b8d63b2550033f64707b83e63174774339890a02 Mon Sep 17 00:00:00 2001 From: Vaibhav S Date: Thu, 24 Oct 2019 11:15:58 +0530 Subject: [PATCH 14/19] Task #152327 chore: updated the build version --- tjreports/plugins/actionlog/tjreports/tjreports.xml | 4 ++-- tjreports/plugins/content/tjreportsfields/tjreportsfields.xml | 4 ++-- tjreports/plugins/privacy/tjreports/tjreports.xml | 4 ++-- tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml | 4 ++-- tjreports/tjreports.xml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tjreports/plugins/actionlog/tjreports/tjreports.xml b/tjreports/plugins/actionlog/tjreports/tjreports.xml index cf61054..8c4dd2b 100644 --- a/tjreports/plugins/actionlog/tjreports/tjreports.xml +++ b/tjreports/plugins/actionlog/tjreports/tjreports.xml @@ -2,12 +2,12 @@ plg_actionlog_tjreports Techjoomla - 22nd Oct 2019 + 24th Oct 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL extensions@techjoomla.com https://techjoomla.com - 1.1.2 + 1.1.3 PLG_ACTIONLOG_TJREPORTS_XML_DESCRIPTION tjreports.php diff --git a/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml index 4357cea..08dee73 100644 --- a/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml +++ b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml @@ -5,10 +5,10 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 22nd Oct 2019 + 24th Oct 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.1.2 + 1.1.3 tjreportsfields.php diff --git a/tjreports/plugins/privacy/tjreports/tjreports.xml b/tjreports/plugins/privacy/tjreports/tjreports.xml index ab37f09..870ecbc 100644 --- a/tjreports/plugins/privacy/tjreports/tjreports.xml +++ b/tjreports/plugins/privacy/tjreports/tjreports.xml @@ -1,8 +1,8 @@ plg_privacy_tjreports - 1.1.2 - 22nd Oct 2019 + 1.1.3 + 24th Oct 2019 Techjoomla extensions@techjoomla.com https://techjoomla.com diff --git a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml index 4ee72f8..20007a9 100644 --- a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml +++ b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml @@ -5,10 +5,10 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 22nd Oct 2019 + 24th Oct 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.1.2 + 1.1.3 sql/tjreportsindexer.install.sql diff --git a/tjreports/tjreports.xml b/tjreports/tjreports.xml index ba4cd46..a464ec7 100644 --- a/tjreports/tjreports.xml +++ b/tjreports/tjreports.xml @@ -6,8 +6,8 @@ https://techjoomla.com Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 22nd Oct 2019 - 1.1.2 + 24th Oct 2019 + 1.1.3 This component is used to access all the report at single place. From 46b6ed4be76ae3b6eeeb70997190aa82cb08d2d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CRohan=20Shinde?= <“balu.shinde@vowellms.com”> Date: Tue, 5 Nov 2019 11:52:13 +0530 Subject: [PATCH 15/19] Bug #152489 fix: Admin> Reports > Headers get vanished while clicking on it. --- tjreports/site/assets/js/tjrContentUI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tjreports/site/assets/js/tjrContentUI.js b/tjreports/site/assets/js/tjrContentUI.js index 9927292..a76c1af 100755 --- a/tjreports/site/assets/js/tjrContentUI.js +++ b/tjreports/site/assets/js/tjrContentUI.js @@ -49,7 +49,7 @@ jQuery.extend(tjrContentUI.report, { // If sendEmail plug is enabled then try to add a column of checkboxes if ( - typeof window.tjSendEmail.UI != 'undefined' && + typeof window.tjSendEmail != 'undefined' && jQuery('body').find('.td-sendemail').length > 0 ) { From b362883f61acb1b29d80833a23c2f644f92d1769 Mon Sep 17 00:00:00 2001 From: Vaibhav S Date: Thu, 7 Nov 2019 12:51:13 +0530 Subject: [PATCH 16/19] Issue #152792 fix: After unchecking the column from 'Hide or Show Columns' drop down option, unchecked column gets removed from dropdown --- tjreports/site/models/reports.php | 19 ++++++++++++++++--- tjreports/site/views/reports/view.base.php | 15 ++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index 35c566c..fc33b7a 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -48,7 +48,7 @@ class TjreportsModelReports extends JModelList public $showhideCols = array(); // Columns which will be displayed by default - private $defaultColToShow = array(); + public $defaultColToShow = array(); // Columns which will be hide by default private $defaultColToHide = array(); @@ -85,7 +85,10 @@ class TjreportsModelReports extends JModelList private $filterPiiColumns = array(); - private $filterParamColToshow = array(); + public $filterParamColToshow = array(); + + // Used to get the columns which are hide by default in load params + public $filterDefaultColToHide = array(); /** * Constructor. @@ -1140,7 +1143,7 @@ private function filterReportColumns($queryId, &$selColToshow) } $query = $this->_db->getQuery(true); - $this->filterShowhideCols = $this->filterPiiColumns = $this->filterParamColToshow = array(); + $this->filterDefaultColToHide = $this->filterShowhideCols = $this->filterPiiColumns = $this->filterParamColToshow = array(); // $this->filterSelColToshow = $selColToshow; @@ -1168,6 +1171,11 @@ private function filterReportColumns($queryId, &$selColToshow) } } + if (!empty($this->filterDefaultColToHide)) + { + $this->defaultColToHide = $this->filterDefaultColToHide; + } + if (!empty($this->filterShowhideCols)) { $this->showhideCols = $this->filterShowhideCols; @@ -1240,6 +1248,10 @@ private function processSavedReportColumns($queryId, &$selColToshow) { $this->filterParamColToshow[$cols] = $cols; } + else + { + $this->filterDefaultColToHide[$cols] = $cols; + } if (!empty($param['showHideColumns']) && !in_array($cols, $param['showHideColumns']) && !empty($selColToshow)) { @@ -1253,6 +1265,7 @@ private function processSavedReportColumns($queryId, &$selColToshow) // Check PII permission if (!empty($param['piiColumns']) && !$this->piiPermission) { + $this->filterDefaultColToHide = array_diff($this->filterDefaultColToHide, $param['piiColumns']); $this->filterParamColToshow = array_diff($this->filterParamColToshow, $param['piiColumns']); $this->filterShowhideCols = array_diff($this->filterShowhideCols, $param['piiColumns']); } diff --git a/tjreports/site/views/reports/view.base.php b/tjreports/site/views/reports/view.base.php index bb25a18..9e14e42 100644 --- a/tjreports/site/views/reports/view.base.php +++ b/tjreports/site/views/reports/view.base.php @@ -169,17 +169,26 @@ public function processData($type = 'html') */ $this->showHideColumns = $this->model->showhideCols; + /* To get the columns from loadparams*/ + $this->defaultColToshow = $this->model->filterParamColToshow; + + /* Check the columns in loadparams are available or not & show plugin level columns & custom field columns + * in case if load params are not available*/ + if (empty($this->defaultColToshow)) + { + $this->defaultColToshow = $this->model->defaultColToShow; + } + if (!empty($this->defaultColToHide)) { - $this->showHideColumns = array_intersect($this->model->showhideCols, array_merge($this->model->getState('colToshow'), $this->defaultColToHide)); + $this->showHideColumns = array_intersect($this->model->showhideCols, array_merge($this->defaultColToshow, $this->defaultColToHide)); } $this->sortable = $this->model->sortableColumns; $this->emailColumn = $this->model->getState('emailColumn'); $this->srButton = $this->model->showSearchResetButton; - // Array_intersect - if column present in colToshow as true/false but not in showHideColumns then remove it - $this->colToshow = array_intersect($this->model->getState('colToshow'), $this->model->showhideCols); + $this->colToshow = $this->model->getState('colToshow'); $this->filterValues = $this->model->getState('filters'); From 7a27b3bbacc400386e42a52141203191e7d45bbe Mon Sep 17 00:00:00 2001 From: Vaibhav S Date: Thu, 7 Nov 2019 16:44:36 +0530 Subject: [PATCH 17/19] Issue #152792 chore: Added the code comments --- tjreports/site/models/reports.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index fc33b7a..2472f24 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -1171,6 +1171,7 @@ private function filterReportColumns($queryId, &$selColToshow) } } + // Used to get the columns which are hide by default in load params if (!empty($this->filterDefaultColToHide)) { $this->defaultColToHide = $this->filterDefaultColToHide; @@ -1250,6 +1251,7 @@ private function processSavedReportColumns($queryId, &$selColToshow) } else { + // Used to get the columns which are hide (false) by default in load params $this->filterDefaultColToHide[$cols] = $cols; } @@ -1265,7 +1267,10 @@ private function processSavedReportColumns($queryId, &$selColToshow) // Check PII permission if (!empty($param['piiColumns']) && !$this->piiPermission) { + /* Checked the columns which are hide(false) in load params & if set them as piiColumns + * then it only returns the columns which are not available in piiColumns. */ $this->filterDefaultColToHide = array_diff($this->filterDefaultColToHide, $param['piiColumns']); + $this->filterParamColToshow = array_diff($this->filterParamColToshow, $param['piiColumns']); $this->filterShowhideCols = array_diff($this->filterShowhideCols, $param['piiColumns']); } From c954b5c6306fc626c80db60b3aca8dcf6359b65c Mon Sep 17 00:00:00 2001 From: Vaibhav S Date: Mon, 11 Nov 2019 12:56:01 +0530 Subject: [PATCH 18/19] Task #136681 feat: Version changes --- tjreports/plugins/actionlog/tjreports/tjreports.xml | 4 ++-- tjreports/plugins/content/tjreportsfields/tjreportsfields.xml | 4 ++-- tjreports/plugins/privacy/tjreports/tjreports.xml | 4 ++-- tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml | 4 ++-- tjreports/tjreports.xml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tjreports/plugins/actionlog/tjreports/tjreports.xml b/tjreports/plugins/actionlog/tjreports/tjreports.xml index 8c4dd2b..58e7c09 100644 --- a/tjreports/plugins/actionlog/tjreports/tjreports.xml +++ b/tjreports/plugins/actionlog/tjreports/tjreports.xml @@ -2,12 +2,12 @@ plg_actionlog_tjreports Techjoomla - 24th Oct 2019 + 11th Nov 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL extensions@techjoomla.com https://techjoomla.com - 1.1.3 + 1.1.4 PLG_ACTIONLOG_TJREPORTS_XML_DESCRIPTION tjreports.php diff --git a/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml index 08dee73..90250ec 100644 --- a/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml +++ b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml @@ -5,10 +5,10 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 24th Oct 2019 + 11th Nov 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.1.3 + 1.1.4 tjreportsfields.php diff --git a/tjreports/plugins/privacy/tjreports/tjreports.xml b/tjreports/plugins/privacy/tjreports/tjreports.xml index 870ecbc..db63cec 100644 --- a/tjreports/plugins/privacy/tjreports/tjreports.xml +++ b/tjreports/plugins/privacy/tjreports/tjreports.xml @@ -1,8 +1,8 @@ plg_privacy_tjreports - 1.1.3 - 24th Oct 2019 + 1.1.4 + 11th Nov 2019 Techjoomla extensions@techjoomla.com https://techjoomla.com diff --git a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml index 20007a9..4b2e249 100644 --- a/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml +++ b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml @@ -5,10 +5,10 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 24th Oct 2019 + 11th Nov 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.1.3 + 1.1.4 sql/tjreportsindexer.install.sql diff --git a/tjreports/tjreports.xml b/tjreports/tjreports.xml index a464ec7..ae12368 100644 --- a/tjreports/tjreports.xml +++ b/tjreports/tjreports.xml @@ -6,8 +6,8 @@ https://techjoomla.com Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 24th Oct 2019 - 1.1.3 + 11th Nov 2019 + 1.1.4 This component is used to access all the report at single place. From 32f6eaccefc3f973440f2b55eecf47d9ae68fe43 Mon Sep 17 00:00:00 2001 From: Nitesh Prakash Kesarkar Date: Fri, 10 Jan 2020 11:34:54 +0530 Subject: [PATCH 19/19] Issue #172 Fix: Notice: Undefined index in reports model & reports default view (#173) * Issue #172 Fix: Notice: Undefined index in reports model & reports default view * Issue #172 Fix: Notice: Undefined index in reports model & reports default view * Issue #172 Fix: Scrutinizer changes and namespaces * Issue #172 Fix: Scrutinizer changes --- tjreports/site/models/reports.php | 216 ++++++++++-------- tjreports/site/views/reports/tmpl/default.php | 82 ++++--- tjreports/site/views/reports/view.base.php | 81 ++++--- 3 files changed, 211 insertions(+), 168 deletions(-) diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index 2472f24..70728a6 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -10,6 +10,14 @@ // No direct access defined('_JEXEC') or die('Restricted access'); +Use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Factory; +Use Joomla\Registry\Registry; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\HTML\HTMLHelper; + jimport('joomla.application.component.modellist'); // Load TJReports db helper @@ -21,7 +29,7 @@ * * @since 1.0.0 */ -class TjreportsModelReports extends JModelList +class TjreportsModelReports extends ListModel { // Default ordering of Data protected $default_order = ''; @@ -114,14 +122,17 @@ public function __construct($config = array()) // Get email column $this->emailColumn = array_search( - 1, array_map( - function ($ar) { - if (!empty($ar['emailColumn'])) - { - return $ar['emailColumn']; - } - }, $this->columns - ) + 1, + array_map( + function ($ar) + { + if (!empty($ar['emailColumn'])) + { + return $ar['emailColumn']; + } + }, + $this->columns + ) ); // Check PII data permission @@ -154,7 +165,7 @@ protected function setCustomFieldsColumns() } // Get column name, type for custom fields index table - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $columnsDetails = $db->getTableColumns($this->customFieldsTable); // If no columns, return @@ -179,9 +190,9 @@ protected function setCustomFieldsColumns() foreach ($columnNames as $columnName) { $customField = array ( - 'title' => ($columnLabels[$columnName]) ? $columnLabels[$columnName] : $columnName, - 'table_column' => $this->customFieldsTableAlias . '.' . $columnName, - 'not_show_hide' => false + 'title' => isset($columnLabels[$columnName]) ? $columnLabels[$columnName] : $columnName, + 'table_column' => $this->customFieldsTableAlias . '.' . $columnName, + 'not_show_hide' => false ); // Eg. tuf.dob @@ -214,7 +225,7 @@ protected function setCustomFieldsDisplayFilters(&$displayFilters) } // Get column name, type for custom fields index table - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $columnsDetails = $db->getTableColumns($this->customFieldsTable); // If no columns, return @@ -275,13 +286,13 @@ protected function setCustomFieldsDisplayFilters(&$displayFilters) $this->customFieldsTableAlias . '.' . $key . '_from' => array ( 'attrib' => array ( 'placeholder' => 'YYYY-MM-DD', - 'onChange' => 'tjrContentUI.report.attachCalSubmit(this);' + 'onChange' => 'tjrContentUI.report.attachCalSubmit(this);' ) ), $this->customFieldsTableAlias . '.' . $key . '_to' => array ( 'attrib' => array ( 'placeholder' => 'YYYY-MM-DD', - 'onChange' => 'tjrContentUI.report.attachCalSubmit(this);' + 'onChange' => 'tjrContentUI.report.attachCalSubmit(this);' ) ) ); @@ -328,14 +339,14 @@ protected function setCustomFieldsDisplayFilters(&$displayFilters) */ protected function getCustomFieldsDisplayFilterOptions($column) { - $objArray = array(); - $obj = new stdClass; - $obj->text = JText::_('- Select ' . $column . ' -'); - $obj->value = ''; - $objArray[] = $obj; + $objArray = array(); + $obj = new stdClass; + $obj->text = Text::_('- Select ' . $column . ' -'); + $obj->value = ''; + $objArray[] = $obj; // Get column name, type for custom fields index table - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Get column labels from #__fields table for all indexed custom fields from this table $query = $db->getQuery(true); @@ -359,10 +370,11 @@ protected function getCustomFieldsDisplayFilterOptions($column) * */ private function initData() { - $columns = $this->columns; - $columnsKeys = array_keys($columns); + $columns = $this->columns; + $columnsKeys = array_keys($columns); + $this->sortableWoQuery = array(); + $this->defaultColToShow = $this->sortableColumns = $this->showhideCols = array_combine($columnsKeys, $columnsKeys); - $this->sortableWoQuery = array(); foreach ($columns as $key => $column) { @@ -430,9 +442,12 @@ public function getTJRMessages() public function getValidRequestVars() { $validVars = array( - 'colToshow' => 'ARRAY', 'filters' => 'ARRAY', - 'limit' => 'INT', 'limitstart' => 'INT', - 'filter_order' => 'STRING', 'filter_order_Dir' => 'STRING' + 'colToshow' => 'ARRAY', + 'filters' => 'ARRAY', + 'limit' => 'INT', + 'limitstart' => 'INT', + 'filter_order' => 'STRING', + 'filter_order_Dir' => 'STRING' ); return $validVars; @@ -524,8 +539,8 @@ protected function _getList($query, $limitstart = 0, $limit = 0) protected function populateState($ordering = '', $direction = 'ASC') { // List state information - $app = JFactory::getApplication(); - $input = JFactory::getApplication()->input; + $app = Factory::getApplication(); + $input = $app->input; if (!($reportId = $input->get('reportId', 0, 'uint'))) { @@ -542,13 +557,13 @@ protected function populateState($ordering = '', $direction = 'ASC') if (empty($colToshow)) { $reportParams = $this->getReportParams($reportId); - - $colToshow = $reportParams->get("colToshow"); - $piiColumns = array_flip($reportParams->get("piiColumns")); + $colToshow = (array) $reportParams->get("colToshow"); + $piiColumns = (array) $reportParams->get("piiColumns"); + $piiColumns = array_flip($piiColumns); if (!empty($piiColumns)) { - $colToshow = (object) array_diff_key((array) $colToshow, $piiColumns); + $colToshow = (object) array_diff_key($colToshow, $piiColumns); } } @@ -561,7 +576,7 @@ protected function populateState($ordering = '', $direction = 'ASC') $this->setState('colToshow', $colToshow); - $filters = $input->get('filters', array(), 'ARRAY'); + $filters = $input->get('filters', array(), 'ARRAY'); $this->setState('filters', $filters); // List state information @@ -620,7 +635,7 @@ protected function populateState($ordering = '', $direction = 'ASC') */ protected function getListQuery() { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $filters = (array) $this->getState('filters'); $displayFilters = (array) $this->displayFilters(); @@ -762,9 +777,9 @@ protected function sortCustomColumns($items) if (!empty($items) && !empty($sortKey) && in_array($sortKey, $this->sortableWoQuery) && $limit) { - $orderDir = $this->getState('list.direction', $this->default_order_dir); + $orderDir = $this->getState('list.direction', $this->default_order_dir); $this->multi_d_sort($items, $sortKey, $orderDir); - $items = array_splice($items, $limitstart, $limit); + $items = array_splice($items, $limitstart, $limit); } return $items; @@ -809,7 +824,7 @@ private function multi_d_sort(&$array, $column, $order) * * @param INT $reportToBuild report to build * - * @return object + * @return Mixed * * @since 1.0 */ @@ -817,7 +832,7 @@ public function getSavedQueries($user_id, $reportToBuild) { if (!empty($reportToBuild) && !empty($user_id)) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select('*'); $query->from('#__tj_reports'); @@ -843,7 +858,7 @@ public function getSavedQueries($user_id, $reportToBuild) */ public function getQueryData($queryId) { - $ol_user = JFactory::getUser()->id; + $ol_user = Factory::getUser()->id; $query = $this->_db->getQuery(true); $query->select('*'); $query->from('#__tj_reports'); @@ -859,23 +874,23 @@ public function getQueryData($queryId) /** * Get all plugins names * - * @return object + * @return Array * * @since 1.0 */ public function getenableReportPlugins() { - $user = JFactory::getUser(); - $input = JFactory::getApplication()->input; + $user = Factory::getUser(); + $input = Factory::getApplication()->input; $client = $input->get('client', '', 'STRING'); // Get all report plugin $dispatcher = JEventDispatcher::getInstance(); - $plugins = JPluginHelper::getPlugin('tjreports'); + $plugins = PluginHelper::getPlugin('tjreports'); $pluginExists = json_decode(json_encode($plugins), true); - $pluginNames = array_column($pluginExists, 'name'); + $pluginNames = array_column($pluginExists, 'name'); - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('id as reportId, title, plugin, ordering')); @@ -905,7 +920,10 @@ public function getenableReportPlugins() // In view layouts - reports[0] is used, and since array indexes are unset above, // Let's re-arrange index accordingly - $reports = array_values($reports); + if (is_array($reports)) + { + $reports = array_values($reports); + } return $reports; } @@ -919,7 +937,7 @@ public function getenableReportPlugins() */ public function getUserFilter() { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('u.id,u.username'); @@ -929,13 +947,13 @@ public function getUserFilter() $db->setQuery($query); $users = $db->loadObjectList(); - $userFilter[] = JHTML::_('select.option', '', JText::_('COM_TJREPORTS_FILTER_SELECT_USER')); + $userFilter[] = HTMLHelper::_('select.option', '', Text::_('COM_TJREPORTS_FILTER_SELECT_USER')); if (!empty($users)) { foreach ($users as $eachUser) { - $userFilter[] = JHTML::_('select.option', $eachUser->id, $eachUser->username); + $userFilter[] = HTMLHelper::_('select.option', $eachUser->id, $eachUser->username); } } @@ -952,9 +970,9 @@ public function getUserFilter() public function getreportoptions() { // Initialize variables. - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - $user_id = JFactory::getUser()->id; + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $user_id = Factory::getUser()->id; $clients = $this->getState('client'); @@ -984,11 +1002,11 @@ public function getreportoptions() $db->setQuery($query); $reports = $db->loadObjectList(); - $options[] = JHTML::_('select.option', 0, JText::_('COM_TJREPORTS_SELONE_REPORTS')); + $options[] = HTMLHelper::_('select.option', 0, Text::_('COM_TJREPORTS_SELONE_REPORTS')); foreach ($reports as $repo) { - $options[] = JHtml::_('select.option', $repo->value, $repo->text); + $options[] = HTMLHelper::_('select.option', $repo->value, $repo->text); } return $options; @@ -1014,14 +1032,14 @@ public function canViewPiiData() * * @param INT $reportId report id * - * @return object + * @return Mixed * - * @since 1.0 + * @since 1.0 */ public function checkpermissions($reportId) { - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($reportId) { @@ -1042,8 +1060,8 @@ public function checkpermissions($reportId) */ public function getUserGroupFilter($includeSuperAdmin = true) { - $groups = JHtml::_('user.groups', $includeSuperAdmin); - array_unshift($groups, JHtml::_('select.option', '', JText::_('JGLOBAL_FILTER_GROUPS_LABEL'))); + $groups = HTMLHelper::_('user.groups', $includeSuperAdmin); + array_unshift($groups, HTMLHelper::_('select.option', '', Text::_('JGLOBAL_FILTER_GROUPS_LABEL'))); return $groups; } @@ -1057,25 +1075,25 @@ public function getUserGroupFilter($includeSuperAdmin = true) */ public function datadenyset() { - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $reportId = $input->get('reportId', '0', 'int'); if ($reportId) { $this->model = $this->getModel('reports'); - $reportData = $this->model->getReportNameById($reportId); - $reportName = $reportData->title; + $reportData = $this->model->getReportNameById($reportId); + $reportName = $reportData->title; } else { return false; } - $user_id = JFactory::getUser()->id; + $user_id = Factory::getUser()->id; if ($reportName && $user_id && $reportId) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('param')); $query->from($db->quoteName('#__tj_reports')); @@ -1113,7 +1131,7 @@ public function loadLanguage($name, $type = 'tjreports', $extension = '', $baseP } $extension = strtolower($extension); - $lang = JFactory::getLanguage(); + $lang = Factory::getLanguage(); // If language already loaded, don't load it again. if ($lang->getPaths($extension)) @@ -1210,12 +1228,12 @@ private function processSavedReportColumns($queryId, &$selColToshow) ->from('#__tj_reports') ->where('id=' . (int) $queryId); $this->_db->setQuery($query); - $queryData = $this->_db->loadObject(); - $i = $parent = 0; + $queryData = $this->_db->loadObject(); + $i = $parent = 0; if (!empty($queryData->param)) { - $param = json_decode($queryData->param, true); + $param = json_decode($queryData->param, true); if (isset($param['showHideColumns'])) { @@ -1270,9 +1288,8 @@ private function processSavedReportColumns($queryId, &$selColToshow) /* Checked the columns which are hide(false) in load params & if set them as piiColumns * then it only returns the columns which are not available in piiColumns. */ $this->filterDefaultColToHide = array_diff($this->filterDefaultColToHide, $param['piiColumns']); - - $this->filterParamColToshow = array_diff($this->filterParamColToshow, $param['piiColumns']); - $this->filterShowhideCols = array_diff($this->filterShowhideCols, $param['piiColumns']); + $this->filterParamColToshow = array_diff($this->filterParamColToshow, $param['piiColumns']); + $this->filterShowhideCols = array_diff($this->filterShowhideCols, $param['piiColumns']); } $parent = $queryData->parent; @@ -1283,7 +1300,7 @@ private function processSavedReportColumns($queryId, &$selColToshow) if (!empty($this->piiColumns) && !$this->piiPermission) { $this->defaultColToShow = array_diff($this->defaultColToShow, $this->piiColumns); - $this->showhideCols = array_diff($this->showhideCols, $this->piiColumns); + $this->showhideCols = array_diff($this->showhideCols, $this->piiColumns); } } @@ -1295,15 +1312,15 @@ private function processSavedReportColumns($queryId, &$selColToshow) * * @param INT $reportId Report Id * - * @return Object + * @return Mixed * * @since 3.0 */ public function getReportNameById($reportId) { - $db = JFactory::getDBO(); - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); - $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); + $db = Factory::getDBO(); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = Table::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); $reportTable->load(array('id' => $reportId)); return $reportTable; @@ -1321,9 +1338,8 @@ public function getReportNameById($reportId) */ public function getReportLink($reportToLink, $filters) { - $user = JFactory::getUser(); - - $reports = $this->getPluginReport($reportToLink); + $user = Factory::getUser(); + $reports = $this->getPluginReport($reportToLink); $filterLink = ''; foreach ($filters as $key => $value) @@ -1349,18 +1365,18 @@ public function getReportLink($reportToLink, $filters) * * @param STRING $reportId Report id * - * @return Integer + * @return Object * * @since 1.1.0 */ public function getReportParams($reportId) { - $db = JFactory::getDBO(); - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); - $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); + $db = Factory::getDBO(); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = Table::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); $reportTable->load($reportId); - return new JRegistry($reportTable->param); + return new Registry($reportTable->param); } /** @@ -1374,9 +1390,9 @@ public function getReportParams($reportId) */ public function getDefaultReport($pluginName) { - $db = JFactory::getDBO(); - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); - $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); + $db = Factory::getDBO(); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = Table::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); $reportTable->load(array('plugin' => $pluginName, 'default' => 1)); return $reportTable->id; @@ -1397,7 +1413,7 @@ public function getPluginReport($pluginName) if (!isset($reports[$pluginName])) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('id as reportId', 'client')); $query->from($db->quoteName('#__tj_reports')); @@ -1459,7 +1475,7 @@ public function getPluginInstallationDetail($pluginName) if ($pluginName && !isset($clients[$pluginName])) { $clients[$pluginName] = ''; - $model = $this->getPluginModel($pluginName); + $model = $this->getPluginModel($pluginName); if ($model) { @@ -1477,7 +1493,7 @@ public function getPluginInstallationDetail($pluginName) */ public function addTjReportsPlugins() { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select( $db->quoteName( @@ -1509,21 +1525,21 @@ public function addTjReportsPlugins() foreach ($plugins as $plugin) { - $pluginName = $plugin->name; - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); - $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable'); - $details = $this->getPluginInstallationDetail($pluginName); + $pluginName = $plugin->name; + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = Table::getInstance('Tjreport', 'TjreportsTable'); + $details = $this->getPluginInstallationDetail($pluginName); $reportTable->load(array('plugin' => $pluginName, 'userid' => 0)); if (!$reportTable->id) { - $data = array(); - $data['title'] = $details['title']; + $data = array(); + $data['title'] = $details['title']; $data['plugin'] = $pluginName; - $data['alias'] = $pluginName; + $data['alias'] = $pluginName; $data['client'] = $details['client']; $data['parent'] = 0; - $data['default'] = 1; + $data['default'] = 1; $reportTable->save($data); $count++; diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index b63d2b3..284e142 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -10,11 +10,18 @@ // no direct access defined('_JEXEC') or die; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filter\OutputFilter; + +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); $emailColmClass = 'td-sendemail'; -$app = JFactory::getApplication(); +$app = Factory::getApplication(); $headerLevel = $this->headerLevel; $this->listOrder = $this->state->get('list.ordering'); $this->listDirn = $this->state->get('list.direction'); @@ -32,25 +39,25 @@ } } -$input = JFactory::getApplication()->input; +$input = Factory::getApplication()->input; $displayFilters = $this->userFilters; $totalHeadRows = count($displayFilters); $reportId = $app->getUserStateFromRequest('reportId', 'reportId', ''); -$user = JFactory::getUser(); +$user = Factory::getUser(); $userAuthorisedExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $reportId); -if ($app->isSite()) +if ($app->isClient('site')) { - $siteUrl = JUri::root(); - $message = array(); - $message['success'] = JText::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS"); - $message['error'] = JText::_("COM_TJREPORTS_EXPORT_FILE_ERROR"); - $message['inprogress'] = JText::_("COM_TJREPORTS_EXPORT_FILE_NOTICE"); - $message['text'] = JText::_("COM_TJREPORTS_CSV_EXPORT"); + $siteUrl = Uri::root(); + $message = array(); + $message['success'] = Text::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS"); + $message['error'] = Text::_("COM_TJREPORTS_EXPORT_FILE_ERROR"); + $message['inprogress'] = Text::_("COM_TJREPORTS_EXPORT_FILE_NOTICE"); + $message['text'] = Text::_("COM_TJREPORTS_CSV_EXPORT"); - JHtml::script(JUri::base() . 'libraries/techjoomla/assets/js/tjexport.js'); - $document = JFactory::getDocument(); - $csv_url = 'index.php?option=' . $input->get('option') . '&view=' . $input->get('view') . '&format=csv'; + HTMLHelper::script(Uri::base() . 'libraries/techjoomla/assets/js/tjexport.js'); + $document = Factory::getDocument(); + $csv_url = 'index.php?option=' . $input->get('option') . '&view=' . $input->get('view') . '&format=csv'; $document->addScriptDeclaration("var csv_export_url='{$csv_url}';"); $document->addScriptDeclaration("var csv_export_success='{$message['success']}';"); @@ -75,14 +82,14 @@ isSite() && isset($this->reportData->title)) + if ($app->isClient('site') && isset($this->reportData->title)) { ?>

reportData->title, ENT_COMPAT, 'UTF-8'); ?>

-
+
@@ -115,7 +122,7 @@
isAdmin()) + if (!$app->isClient('administrator')) { echo $this->pagination->getPaginationLinks('joomla.pagination.links', array('showPagesLinks' => false,'showLimitStart' => false)); } @@ -136,7 +143,7 @@ { ?>
- savedQueries, "queryId", 'class="" size="1" onchange="tjrContentUI.report.getQueryResult(this.value);" name="filter_saveQuery"', "value", "text", $this->queryId); + savedQueries, "queryId", 'class="" size="1" onchange="tjrContentUI.report.getQueryResult(this.value);" name="filter_saveQuery"', "value", "text", $this->queryId); ?> queryId) @@ -153,7 +160,7 @@ isSite()) + if ($app->isClient('site')) { if ($this->isExport) { @@ -165,7 +172,7 @@ - +
@@ -183,7 +190,7 @@ ?>
@@ -192,7 +199,7 @@ ?>
- +
    showHideColumns as $colKey) @@ -210,13 +217,13 @@ if (in_array($colKey, $this->colToshow)) { - $checked = 'checked="checked"'; + $checked = 'checked="checked"'; } ?>
  • isAdmin() && $userAuthorisedExport && $user) + if (!$app->isClient('administrator') && $userAuthorisedExport && $user) { ?> srButton !== -1) { ?> - -
@@ -323,15 +330,15 @@ echo ''; - $colTitle = JText::sprintf($subTextTitle, $keyDetails[1]) ; + $colTitle = Text::sprintf($subTextTitle, $keyDetails[1]) ; if (in_array($subKey, $this->sortable)) { - echo $sortHtml = JHtml::_('grid.sort', $colTitle, $subKey, $this->listDirn, $this->listOrder); + echo $sortHtml = HTMLHelper::_('grid.sort', $colTitle, $subKey, $this->listDirn, $this->listOrder); } else { - echo '
' . JText::_($colTitle) . '
'; + echo '
' . Text::_($colTitle) . '
'; } echo ''; @@ -340,7 +347,7 @@ else { $colKey = $detail; - $colKeyClass = JFilterOutput::stringURLSafe($colKey); + $colKeyClass = OutputFilter::stringURLSafe($colKey); if (!isset($this->columns[$colKey]['title'])) { $colTitle = 'PLG_TJREPORTS_' . strtoupper($this->pluginName . '_' . $colKey . '_TITLE'); @@ -359,11 +366,11 @@ if (in_array($colKey, $this->sortable)) { - echo $sortHtml = JHtml::_('grid.sort', $colTitle, $colKey, $this->listDirn, $this->listOrder); + echo $sortHtml = HTMLHelper::_('grid.sort', $colTitle, $colKey, $this->listDirn, $this->listOrder); } else { - echo '
' . JText::_($colTitle) . '
'; + echo '
' . Text::_($colTitle) . '
'; } if ($hasFilter) { @@ -434,7 +441,8 @@ else { $isSendEmailClass = ($key == $this->emailColumn) ? $emailColmClass : ''; - echo "{$item[$key]}"; + $value = isset($item[$key]) ? $item[$key] : ''; + echo "{$value}"; } } @@ -463,7 +471,7 @@
isAdmin()) + if (!$app->isClient('administrator')) { echo $this->pagination->getPaginationLinks('joomla.pagination.links', array('showLimitBox' => false)); } @@ -483,7 +491,7 @@ - +
diff --git a/tjreports/site/views/reports/view.base.php b/tjreports/site/views/reports/view.base.php index 9e14e42..a355165 100644 --- a/tjreports/site/views/reports/view.base.php +++ b/tjreports/site/views/reports/view.base.php @@ -13,6 +13,9 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; + jimport('joomla.application.component.view'); JLoader::import('components.com_tjreports.helpers.tjreports', JPATH_ADMINISTRATOR); JLoader::import('components.com_tjreports.models.tjreports', JPATH_SITE); @@ -38,12 +41,28 @@ class ReportsViewBase extends JViewLegacy protected $reportData; - protected $savedQueries = array(); + protected $headerLevel; protected $reportId = 0; protected $queryId = 0; + protected $savedQueries = array(); + + protected $defaultColToHide; + + protected $columns; + + protected $showhideCols; + + protected $filterParamColToshow; + + protected $defaultColToShow; + + protected $sortableColumns; + + protected $showSearchResetButton; + /** * Execute and display a template script. * @@ -53,15 +72,14 @@ class ReportsViewBase extends JViewLegacy */ public function processData($type = 'html') { - $app = JFactory::getApplication(); - $canDo = TjreportsHelper::getActions(); - $input = JFactory::getApplication()->input; - $user = JFactory::getUser(); + $canDo = TjreportsHelper::getActions(); + $input = Factory::getApplication()->input; + $user = Factory::getUser(); $this->reportId = $input->get('reportId', 0, 'INT'); - $this->model = $this->getModel('reports'); + $this->model = $this->getModel('reports'); - $reports = $this->model->getenableReportPlugins(); + $reports = $this->model->getenableReportPlugins(); $this->reportId = $this->reportId ? $this->reportId : (isset($reports['0']['reportId']) ? $reports['0']['reportId'] : ''); $this->reportData = $this->model->getReportNameById($this->reportId); @@ -81,7 +99,11 @@ public function processData($type = 'html') } $this->model = $this->getModel($this->pluginName); - $this->setModel($this->model, true); + + if ($this->model) + { + $this->setModel($this->model, true); + } if ($this->reportId) { @@ -131,8 +153,8 @@ public function processData($type = 'html') if (!empty($savedQueries)) { - $qOptions = array(); - $qOptions[] = JHTML::_('select.option', '', JText::_('COM_TJREPORTS_SELONE_QUERY')); + $qOptions = array(); + $qOptions[] = JHTML::_('select.option', '', JText::_('COM_TJREPORTS_SELONE_QUERY')); foreach ($savedQueries as $savedQuery) { @@ -154,15 +176,15 @@ public function processData($type = 'html') } $this->model->loadLanguage($this->pluginName); - $this->state = $this->get('State'); - $this->items = $this->model->getItems(); - $this->pagination = $this->get('pagination'); - - $this->headerLevel = $this->model->headerLevel; + $this->state = $this->get('State'); + $this->items = $this->model->getItems(); + $this->pagination = $this->get('pagination'); + $this->headerLevel = $this->model->headerLevel; // Array_key - defaultColToHide column are present then get the key as value. - $this->defaultColToHide = array_keys($this->model->getState('defaultColToHide')); - $this->columns = $this->model->columns; + $defaultColToHide = (array) $this->model->getState('defaultColToHide'); + $this->defaultColToHide = array_keys($defaultColToHide); + $this->columns = $this->model->columns; /* Array_merge - here colToshow means get all true value array so want to mearg defaultColToHide column and then using * array_intersect - only remove those column which is force fully added in load param in showhideCols config @@ -184,19 +206,16 @@ public function processData($type = 'html') $this->showHideColumns = array_intersect($this->model->showhideCols, array_merge($this->defaultColToshow, $this->defaultColToHide)); } - $this->sortable = $this->model->sortableColumns; - $this->emailColumn = $this->model->getState('emailColumn'); - $this->srButton = $this->model->showSearchResetButton; - - $this->colToshow = $this->model->getState('colToshow'); - - $this->filterValues = $this->model->getState('filters'); - - $this->userFilters = $this->model->displayFilters(); - $this->messages = $this->model->getTJRMessages(); + $this->sortable = $this->model->sortableColumns; + $this->emailColumn = $this->model->getState('emailColumn'); + $this->srButton = $this->model->showSearchResetButton; + $this->colToshow = $this->model->getState('colToshow'); + $this->filterValues = $this->model->getState('filters'); + $this->userFilters = $this->model->displayFilters(); + $this->messages = $this->model->getTJRMessages(); $this->enableReportPlugins = $this->model->getenableReportPlugins($this->client); - $this->isExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $this->reportId); + $this->isExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $this->reportId); return true; } @@ -208,14 +227,14 @@ public function processData($type = 'html') * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * - * @return JModelLegacy|boolean Model object on success; otherwise false on failure. + * @return BaseDatabaseModel|boolean Model object on success; otherwise false on failure. * * @since 3.0 */ public function getModel($name = '', $prefix = '', $config = array()) { - JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/tjreports/' . $name); + BaseDatabaseModel::addIncludePath(JPATH_SITE . '/plugins/tjreports/' . $name); - return JModelLegacy::getInstance($name, 'TjreportsModel', $config); + return BaseDatabaseModel::getInstance($name, 'TjreportsModel', $config); } }