diff --git a/application/classes/StaticList/ItemType.php b/application/classes/StaticList/ItemType.php index bd97c17c..1c9a93d8 100644 --- a/application/classes/StaticList/ItemType.php +++ b/application/classes/StaticList/ItemType.php @@ -12,16 +12,17 @@ class StaticList_ItemType extends StaticList { protected function _table() { return array( - 0=>_('Product/Service Charge'), // Line Charge Topic on Invoice, eg: Service Name + 0=>_('Product/Service Charge'), // Line Charge Topic on Invoice, eg: Service Name 1=>_('Hardware'), 2=>_('Service Relocation Fee'), 3=>_('Service Change Fee'), 4=>_('Service Connection Fee'), - 5=>_('Excess Usage'), // Excess Service Item, of item 0 + 5=>_('Excess Usage'), // Excess Service Item, of item 0 6=>_('Service Cancellation Fee'), 7=>_('Extra Product/Service Charge'), // Service Billing in advance + 8=>_('Product Addition'), // Additional Product Customisation 124=>_('Late Payment Fee'), - 125=>_('Payment Fee'), // Payment processing fee + 125=>_('Payment Fee'), // Payment processing fee 126=>_('Other'), 127=>_('Rounding'), ); diff --git a/modules/adsl/classes/Controller/Admin/Adsl.php b/modules/adsl/classes/Controller/Admin/Adsl.php index 731d4202..31a2e35a 100644 --- a/modules/adsl/classes/Controller/Admin/Adsl.php +++ b/modules/adsl/classes/Controller/Admin/Adsl.php @@ -124,7 +124,7 @@ class Controller_Admin_Adsl extends Controller_Adsl { $a = 0; foreach (array_reverse($traffic) as $i) { - if ($i < $so->plugin()->traffic_month(strtotime('last month'),TRUE)) + if ($i < $so->plugin()->traffic_month(strtotime('first day of last month'),TRUE)) break; $a = $i; diff --git a/modules/adsl/classes/Controller/Reseller/Service/Adsl.php b/modules/adsl/classes/Controller/Reseller/Service/Adsl.php index c4b83c52..a3e67ccc 100644 --- a/modules/adsl/classes/Controller/Reseller/Service/Adsl.php +++ b/modules/adsl/classes/Controller/Reseller/Service/Adsl.php @@ -72,7 +72,7 @@ class Controller_Reseller_Service_Adsl extends Controller_Service { 'product->plugin()->supplier_plan->speed'=>'Speed', 'product->plugin()->allowance(array(),TRUE,TRUE,TRUE)'=>'Allowance', 'plugin()->traffic_month(strtotime("yesterday"),TRUE,TRUE)'=>'This Month', - 'plugin()->traffic_month(strtotime("last month"),TRUE,TRUE)'=>'Last Month', + 'plugin()->traffic_month(strtotime("first day of last month"),TRUE,TRUE)'=>'Last Month', 'recur_schedule'=>'Billing', 'price(TRUE,TRUE)'=>'Price', 'account->accnum()'=>'Cust ID', diff --git a/modules/adsl/classes/Model/Product/Plugin/Adsl.php b/modules/adsl/classes/Model/Product/Plugin/Adsl.php index 779e566c..18916ac0 100644 --- a/modules/adsl/classes/Model/Product/Plugin/Adsl.php +++ b/modules/adsl/classes/Model/Product/Plugin/Adsl.php @@ -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})) { diff --git a/modules/adsl/classes/Task/Adsl/Trafficalert.php b/modules/adsl/classes/Task/Adsl/Trafficalert.php index 51b416d5..3c53ccc2 100644 --- a/modules/adsl/classes/Task/Adsl/Trafficalert.php +++ b/modules/adsl/classes/Task/Adsl/Trafficalert.php @@ -15,7 +15,7 @@ class Task_Adsl_Trafficalert extends Minion_Task { ); protected function _execute(array $params) { - $date = strtotime('last month'); + $date = strtotime('first day of last month'); $c = array(); // @todo Pick up services that are no longer active, but were inactive < 30 days ago. diff --git a/modules/adsl/classes/Task/Adsl/Trafficcharge.php b/modules/adsl/classes/Task/Adsl/Trafficcharge.php index 11c1b6e2..62b183c1 100644 --- a/modules/adsl/classes/Task/Adsl/Trafficcharge.php +++ b/modules/adsl/classes/Task/Adsl/Trafficcharge.php @@ -15,7 +15,7 @@ class Task_Adsl_Trafficcharge extends Minion_Task { ); protected function _execute(array $params) { - $date = strtotime('last month'); + $date = strtotime('first day of last month'); $c = array(); // @todo Pick up services that are no longer active, but were inactive < 30 days ago. diff --git a/modules/adsl/views/service/user/plugin/adsl/view.php b/modules/adsl/views/service/user/plugin/adsl/view.php index 1dd755ad..7b24fc30 100644 --- a/modules/adsl/views/service/user/plugin/adsl/view.php +++ b/modules/adsl/views/service/user/plugin/adsl/view.php @@ -41,7 +41,7 @@