Misc fixes for ADSL excess traffic and strtotime() functions for last month

This commit is contained in:
Deon George
2013-12-31 17:18:49 +11:00
parent e19518c505
commit 82c51de550
11 changed files with 27 additions and 15 deletions

View File

@@ -135,8 +135,15 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
if (! isset($data[$k]))
$data[$k] = 0;
if ($over)
$data[$k] = $invert ? $this->{$k} : $data[$k]-$this->{$k};
if ($over) {
// @todo This is an ugly hack - if our data has been passed it, it is assumed it has been reduced by $this->metric
$z = $this->metric ? round($this->{$k}/$this->metric,2) : $this->{$k};
$data[$k] = $invert ? $z : $data[$k]-$z;
// We need to return this back to base units as later, we'll return it back to metric
$data[$k] = $this->metric ? $data[$k]*$this->metric : $data[$k];
}
// Do we charge for extra, or merge it to another field
if (! is_null($this->{$v})) {