diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index a7cbc31..58bcfd4 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -237,8 +237,10 @@ protected function populateState($ordering = '', $direction = 'ASC') $colToshow = $input->get('colToshow', array(), 'ARRAY'); - $reportId = $input->get('reportId', 0, 'uint'); - $this->setState('reportId', $reportId); + if ($reportId = $input->get('reportId', 0, 'uint')) + { + $this->setState('reportId', $reportId); + } $this->filterReportColumns($reportId, $colToshow); @@ -915,6 +917,24 @@ public function getReportLink($reportToLink, $filters) } } + /** + * Method to get id of the report having default set as 1 + * + * @param STRING $pluginName Plugin Name + * + * @return Integer + * + * @since 1.1.0 + */ + public function getDefaultReport($pluginName) + { + JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); + $reportTable->load(array('plugin' => $pluginName, 'default' => 1)); + + return $reportTable->id; + } + /** * Method to get report plugin of particular type for inter linking *