2010-11-29 22:41:08 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class supports Services Traffic for ADSL
|
|
|
|
*
|
|
|
|
* @package OSB
|
|
|
|
* @subpackage Service
|
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
|
|
|
*/
|
2013-01-11 10:51:37 +00:00
|
|
|
class Model_Service_Plugin_Adsl_Traffic extends ORM_OSB {
|
2010-11-29 22:41:08 +00:00
|
|
|
protected $_table_name = 'service__adsl_traffic';
|
|
|
|
protected $_primary_key = 'service';
|
2011-09-28 06:46:22 +00:00
|
|
|
protected $_disable_wild_select = TRUE;
|
2010-11-29 22:41:08 +00:00
|
|
|
|
|
|
|
protected $_created_column = FALSE;
|
|
|
|
protected $_updated_column = FALSE;
|
2011-08-03 14:24:38 +00:00
|
|
|
|
|
|
|
public function rules() {
|
2012-10-22 12:24:28 +00:00
|
|
|
$result = parent::rules();
|
|
|
|
|
|
|
|
// We don use the "ID" field.
|
|
|
|
unset($result['id']);
|
|
|
|
|
|
|
|
return $result;
|
2011-08-03 14:24:38 +00:00
|
|
|
}
|
2011-10-14 05:44:12 +00:00
|
|
|
|
2013-01-11 10:51:37 +00:00
|
|
|
public function traffic(Model_Product_Plugin_Adsl $plan) {
|
2011-10-14 05:44:12 +00:00
|
|
|
// Roll up the charges according to the product plan configuration
|
|
|
|
return ADSL::allowance(array(
|
|
|
|
'base_down_peak'=>is_null($plan->base_down_peak) ? NULL : $this->down_peak,
|
|
|
|
'base_down_offpeak'=>is_null($plan->base_down_offpeak) ? NULL : $this->down_offpeak,
|
|
|
|
'base_up_peak'=>is_null($plan->base_up_peak) ? NULL : $this->up_peak,
|
|
|
|
'base_up_offpeak'=>is_null($plan->base_up_offpeak) ? NULL : $this->up_offpeak,
|
|
|
|
'extra_down_peak'=>$plan->extra_down_peak,
|
|
|
|
'extra_down_offpeak'=>$plan->extra_down_offpeak,
|
|
|
|
'extra_up_peak'=>$plan->extra_up_peak,
|
|
|
|
'extra_up_offpeak'=>$plan->extra_up_offpeak,
|
|
|
|
));
|
|
|
|
}
|
2010-11-29 22:41:08 +00:00
|
|
|
}
|
|
|
|
?>
|