From 7277dc1600d0820d26df83cfd71d47e927e948b5 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 15 May 2014 14:49:41 +1200 Subject: [PATCH] BUG Fix sorting on main ReportAdmin grid ref: CWPBUG-133 --- code/controllers/ReportAdmin.php | 11 ++++++++--- code/reports/Report.php | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/code/controllers/ReportAdmin.php b/code/controllers/ReportAdmin.php index ec157688..1683dafa 100644 --- a/code/controllers/ReportAdmin.php +++ b/code/controllers/ReportAdmin.php @@ -37,7 +37,9 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider { parent::init(); //set the report we are currently viewing from the URL - $this->reportClass = (isset($this->urlParams['ReportClass'])) ? $this->urlParams['ReportClass'] : null; + $this->reportClass = (isset($this->urlParams['ReportClass']) && $this->urlParams['ReportClass'] !== 'index') + ? $this->urlParams['ReportClass'] + : null; $allReports = SS_Report::get_reports(); $this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null; @@ -132,8 +134,11 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider { * @return String */ public function Link($action = null) { - $link = parent::Link($action); - if ($this->reportObject) $link = $this->reportObject->getLink($action); + if ($this->reportObject) { + $link = $this->reportObject->getLink($action); + } else { + $link = self::join_links(parent::Link('index'), $action); + } return $link; } diff --git a/code/reports/Report.php b/code/reports/Report.php index bb965481..9e14f348 100644 --- a/code/reports/Report.php +++ b/code/reports/Report.php @@ -82,6 +82,15 @@ class SS_Report extends ViewableData { return $this->title; } + /** + * Allows access to title as a property + * + * @return string + */ + public function getTitle() { + return $this->title(); + } + /** * Return the description of this report. *