BUG Fix sorting on main ReportAdmin grid ref: CWPBUG-133

This commit is contained in:
Damian Mooyman 2014-05-15 14:49:41 +12:00 committed by Mateusz Uzdowski
parent 193a2ab31c
commit 13565a5e90
2 changed files with 17 additions and 3 deletions

View File

@ -80,6 +80,15 @@ class SS_Report extends ViewableData {
return $this->title; return $this->title;
} }
/**
* Allows access to title as a property
*
* @return string
*/
public function getTitle() {
return $this->title();
}
/** /**
* Return the description of this report. * Return the description of this report.
* *

View File

@ -40,7 +40,9 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
parent::init(); parent::init();
//set the report we are currently viewing from the URL //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(); $allReports = SS_Report::get_reports();
$this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null; $this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null;
@ -131,8 +133,11 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
* @return String * @return String
*/ */
public function Link($action = null) { public function Link($action = null) {
$link = parent::Link($action); if ($this->reportObject) {
if ($this->reportObject) $link = $this->reportObject->getLink($action); $link = $this->reportObject->getLink($action);
} else {
$link = self::join_links(parent::Link('index'), $action);
}
return $link; return $link;
} }