Skip to content
This repository
Browse code

BUGFIX: SSF-168 fixing bug in report admin where back button didn't work

  • Loading branch information...
commit b1e286cb23c3ea914b86dad9fa549a77ebb949f8 1 parent 4c76c85
Julian Seidenberg authored

Showing 1 changed file with 14 additions and 7 deletions. Show diff stats Hide diff stats

  1. 21  code/controllers/ReportAdmin.php
21  code/controllers/ReportAdmin.php
@@ -22,10 +22,23 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
22 22
 	static $template_path = null; // defaults to (project)/templates/email
23 23
 	
24 24
 	static $tree_class = 'SS_Report';
  25
+
  26
+	/**
  27
+	 * Variable that describes which report we are currently viewing based on the URL (gets set in init method)
  28
+	 * @var String
  29
+	 */
  30
+	protected $reportClass;
  31
+
  32
+	protected $reportObject;
25 33
 	
26 34
 	public function init() {
27 35
 		parent::init();
28 36
 
  37
+		//set the report we are currently viewing from the URL
  38
+		$this->reportClass = (isset($this->urlParams['ID'])) ? $this->urlParams['ID'] : null;
  39
+		$allReports = SS_Report::get_reports();
  40
+		$this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null;
  41
+
29 42
 		Requirements::css(CMS_DIR . '/css/screen.css');
30 43
 
31 44
 		// Set custom options for TinyMCE specific to ReportAdmin
@@ -58,12 +71,6 @@ function canView($member = null) {
58 71
 		return false;
59 72
 	}
60 73
 
61  
-	function currentReport() {
62  
-		$id = parent::currentPageID();
63  
-		$reports = SS_Report::get_reports();
64  
-		return (isset($reports[$id])) ? $reports[$id] : null;
65  
-	}
66  
-
67 74
 	/**
68 75
 	 * Return a SS_List of SS_Report subclasses
69 76
 	 * that are available for use.
@@ -111,7 +118,7 @@ function providePermissions() {
111 118
 	public function getEditForm($id = null, $fields = null) {
112 119
 		$fields = new FieldList();
113 120
 		
114  
-		$report = $this->currentReport();
  121
+		$report = $this->reportObject;
115 122
 
116 123
 		if($report) {
117 124
 			// List all reports

0 notes on commit b1e286c

Please sign in to comment.
Something went wrong with that request. Please try again.