From bd208c6d0dc78c1f50800cdadb153f9b408aa72a Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Sun, 22 May 2016 21:07:11 +0100 Subject: [PATCH] Moved chart styles to reports.css (#342) --- application/controllers/Reports.php | 9 +++--- application/views/partial/header.php | 2 +- application/views/reports/graphs/bar.php | 35 ++------------------- application/views/reports/graphs/hbar.php | 35 ++------------------- application/views/reports/graphs/line.php | 30 ++---------------- application/views/reports/graphs/pie.php | 11 ++----- css/reports.css | 30 +++++++++++++++++- dist/opensourcepos.min.css | 4 +-- templates/spacelab/views/partial/header.php | 2 +- 9 files changed, 46 insertions(+), 112 deletions(-) diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 73fcefa5d..343b9062f 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -422,6 +422,7 @@ class Reports extends Secure_area $this->load->view("reports/graphical", $data); } + // escape js text to avoid any issue with php strings having only one \ where js requires \\ private function _escapeJavaScriptText($string) { return str_replace("\n", '\n', str_replace('"', '\"', addcslashes(str_replace("\r", '', (string)$string), "\0..\37'\\"))); @@ -469,7 +470,7 @@ class Reports extends Secure_area $series = ''; foreach($report_data as $row) { - $labels .= "'" . $row['category'] . "', "; + $labels .= "'" . $this->_escapeJavaScriptText($row['category']) . "', "; $series .= $row['total'] . ", "; } @@ -497,7 +498,7 @@ class Reports extends Secure_area $series = ''; foreach($report_data as $row) { - $labels .= "'" . $row['supplier'] . "', "; + $labels .= "'" . $this->_escapeJavaScriptText($row['supplier']) . "', "; $series .= $row['total'] . ", "; } @@ -525,7 +526,7 @@ class Reports extends Secure_area $series = ''; foreach($report_data as $row) { - $labels .= "'" . $row['employee'] . "', "; + $labels .= "'" . $this->_escapeJavaScriptText($row['employee']) . "', "; $series .= $row['total'] . ", "; } @@ -581,7 +582,7 @@ class Reports extends Secure_area $series = ''; foreach($report_data as $row) { - $labels .= "'" . $row['customer'] . "', "; + $labels .= "'" . $this->_escapeJavaScriptText($row['customer']) . "', "; $series .= $row['total'] . ", "; } diff --git a/application/views/partial/header.php b/application/views/partial/header.php index 2f5c45240..4b1f78f27 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -64,7 +64,7 @@ - + diff --git a/application/views/reports/graphs/bar.php b/application/views/reports/graphs/bar.php index 9f5f01c57..587796927 100644 --- a/application/views/reports/graphs/bar.php +++ b/application/views/reports/graphs/bar.php @@ -1,30 +1,3 @@ - -