From 13565a5e900d97d6e37d987d569c59ca31083ec2 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/Report.php | 9 +++++++++ code/ReportAdmin.php | 11 ++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/code/Report.php b/code/Report.php index 5cbbee7f..9d29f6ea 100644 --- a/code/Report.php +++ b/code/Report.php @@ -80,6 +80,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. * diff --git a/code/ReportAdmin.php b/code/ReportAdmin.php index 78331c77..33a967a1 100644 --- a/code/ReportAdmin.php +++ b/code/ReportAdmin.php @@ -40,7 +40,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; @@ -131,8 +133,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; }