Consistent use of return , payment refund handling

This commit is contained in:
Deon George
2013-04-05 23:50:08 +11:00
parent 43dfd88bce
commit 52d9005b64
30 changed files with 255 additions and 210 deletions

View File

@@ -43,9 +43,9 @@ class GoogleChart_ComboChart extends GoogleChart {
}
public function json() {
$return = array();
$result = array();
$return['cols'][] = array(
$result['cols'][] = array(
'id'=>'date',
'label'=>'date',
'type'=>'string',
@@ -53,7 +53,7 @@ class GoogleChart_ComboChart extends GoogleChart {
// Columns
foreach (array_keys($this->_axis) as $l) {
$return['cols'][] = array(
$result['cols'][] = array(
'id'=>$l,
'label'=>$l,
'type'=>'number',
@@ -69,7 +69,7 @@ class GoogleChart_ComboChart extends GoogleChart {
foreach ($this->_axis as $l => $axis)
array_push($data,array('v'=>isset($v[$l]) ? $v[$l] : 0));
$return['rows'][] = array('c'=>$data);
$result['rows'][] = array('c'=>$data);
}
$options = array(
@@ -81,7 +81,7 @@ class GoogleChart_ComboChart extends GoogleChart {
'series' => $this->series(),
);
return json_encode(array('data'=>$return,'options'=>$options));
return json_encode(array('data'=>$result,'options'=>$options));
}
public function render() {
@@ -149,7 +149,7 @@ function drawChart_".$this->_divname."() {
}
private function series() {
$return = array();
$result = array();
$c = $this->seriescolors();
$j = count($c);
@@ -157,14 +157,14 @@ function drawChart_".$this->_divname."() {
foreach ($this->_axis as $l => $axis) {
// @todo This shouldnt be hard coded
if ($axis == 'yl')
array_push($return,array('type'=>'bar','color'=>$c[$i%$j],'targetAxisIndex'=>0));
array_push($result,array('type'=>'bar','color'=>$c[$i%$j],'targetAxisIndex'=>0));
else
array_push($return,array('type'=>'line','color'=>$c[$i%$j],'targetAxisIndex'=>1));
array_push($result,array('type'=>'line','color'=>$c[$i%$j],'targetAxisIndex'=>1));
$i++;
}
return $return;
return $result;
}
}
?>

View File

@@ -77,51 +77,51 @@ class GoogleChart_Legacy extends GoogleChart {
* Calculate our maximum for each side of the chart
*/
private function maxes() {
$return = array();
$result = array();
foreach ($this->_axis as $l => $axis) {
if (! isset($return[$axis]))
$return[$axis] = 0;
if (! isset($result[$axis]))
$result[$axis] = 0;
$return[$axis] += $this->_max[$l]*1.1; // @todo This scaleup should be configurable
$result[$axis] += $this->_max[$l]*1.1; // @todo This scaleup should be configurable
}
return $return;
return $result;
}
/** CHART FIELDS **/
private function chd() {
$return = array();
$result = array();
$maxes = $this->maxes();
// Perform our encoding
foreach ($this->_axis as $l => $axis)
array_push($return,$this->encode($this->_data[$l],$maxes[$axis]));
array_push($result,$this->encode($this->_data[$l],$maxes[$axis]));
$prefix = (count($maxes) > 1) ? sprintf('%s:',$this->axiscount('yl')) : ':';
// If encoding is text, we need to separate the series with a |
return ($this->_encodetype == 't') ? $prefix.implode('|',$return) : $prefix.implode(',',$return);
return ($this->_encodetype == 't') ? $prefix.implode('|',$result) : $prefix.implode(',',$result);
}
private function chm() {
$return = array();
$result = array();
$sc = $this->seriescolors();
$i = 0;
foreach ($this->_axis as $l => $axis) {
if ($axis == 'yr')
array_push($return,sprintf('%s,%s,%s,%s,%s,%s','D',$sc[$i],$i,0,2,2));// @todo 'D,0,2,2' May need to be configurable
array_push($result,sprintf('%s,%s,%s,%s,%s,%s','D',$sc[$i],$i,0,2,2));// @todo 'D,0,2,2' May need to be configurable
$i++;
}
return count($return) ? implode('|',$return) : '';
return count($result) ? implode('|',$result) : '';
}
private function chxl() {
$return = array();
$result = array();
// @todo This should be performed better - it may be a wrong assumption that all keys in the series have data.
foreach ($this->_data as $series => $data)
@@ -130,13 +130,13 @@ class GoogleChart_Legacy extends GoogleChart {
}
private function chxr() {
$return = array();
$result = array();
$i = 1;
foreach ($this->maxes() as $key => $value)
array_push($return,sprintf('%s,0,%s,0',$i++,$value));
array_push($result,sprintf('%s,0,%s,0',$i++,$value));
return implode('|',$return);
return implode('|',$result);
}
public function json() {}