Fixes to OSB to work with KH 3.3

This commit is contained in:
Deon George
2012-11-10 10:13:57 +11:00
parent ea36639638
commit 6db02ae77d
238 changed files with 813 additions and 938 deletions

View File

@@ -33,7 +33,7 @@ class ADSL {
if (preg_match('/^a:/',$data))
throw new Kohana_Exception('Data shouldnt be a serialized array');
$ao = ORM::factory('adsl_plan',$data);
$ao = ORM::factory('ADSL_Plan',$data);
$output = View::factory('adsl/contract_view')
->set('record',$ao)
->set('price_base',$price_base)

View File

@@ -13,7 +13,7 @@
class Model_ADSL_Supplier extends ORM_OSB {
// Relationships
protected $_has_many = array(
'adsl_supplier_plan'=>array('foreign_key'=>'supplier_id','far_key'=>'id'),
'ADSL_supplier_plan'=>array('foreign_key'=>'supplier_id','far_key'=>'id'),
);
protected $_updated_column = FALSE;
@@ -22,7 +22,7 @@ class Model_ADSL_Supplier extends ORM_OSB {
* Return a list of plans that this supplier makes available
*/
public function plans($active=TRUE) {
$a = $this->adsl_supplier_plan;
$a = $this->ADSL_supplier_plan;
if ($active)
$a->where_active();
@@ -37,7 +37,7 @@ class Model_ADSL_Supplier extends ORM_OSB {
$return = array();
foreach ($this->plans($active)->find_all() as $po)
foreach ($po->adsl_plan->find_all() as $apo)
foreach ($po->ADSL_plan->find_all() as $apo)
$return[$apo->id] = $apo;
return $return;
@@ -55,14 +55,14 @@ class Model_ADSL_Supplier extends ORM_OSB {
$plans = array_keys($this->adsl_plans(FALSE));
// Start with all our ADSL Plans
foreach (ORM::factory('service')->list_bylistgroup('ADSL') as $so)
foreach (ORM::factory('Service')->list_bylistgroup('ADSL') as $so)
if (! $active OR $so->status)
if (in_array($so->product->prod_plugin_data,$plans) OR in_array($so->plugin()->provided_adsl_plan_id,$plans))
array_push($services,$so);
// @todo poor cludge, we should find them without using list_bylistgroup()
if (! $services)
foreach (ORM::factory('service')->list_bylistgroup('HSPA') as $so)
foreach (ORM::factory('Service')->list_bylistgroup('HSPA') as $so)
if (! $active OR $so->status)
if (in_array($so->product->prod_plugin_data,$plans) OR in_array($so->plugin()->provided_adsl_plan_id,$plans))
array_push($services,$so);

View File

@@ -13,10 +13,10 @@
class Model_ADSL_Supplier_Plan extends ORM_OSB {
// Relationships
protected $_has_many = array(
'adsl_plan'=>array('far_key'=>'id'),
'ADSL_plan'=>array('far_key'=>'id'),
);
protected $_belongs_to = array(
'adsl_supplier'=>array('foreign_key'=>'supplier_id'),
'ADSL_supplier'=>array('foreign_key'=>'supplier_id'),
);
/**

View File

@@ -132,7 +132,7 @@ class Model_Service_Plugin_ADSL extends Model_Service_Plugin {
if (is_null($period))
$period = strtotime('yesterday');
$t = ORM::factory('service_plugin_adsl_traffic')
$t = ORM::factory('Service_Plugin_ADSL_Traffic')
->where('service','=',$this->service_username)
->and_where('date','>=',date('Y-m-d',mktime(0,0,0,date('m',$period),1,date('Y',$period))))
->and_where('date','<=',date('Y-m-d',strtotime('last day of '.date('M Y',$period))))
@@ -160,7 +160,7 @@ class Model_Service_Plugin_ADSL extends Model_Service_Plugin {
if (is_null($period))
$period = strtotime('yesterday');
$t = ORM::factory('service_plugin_adsl_traffic')
$t = ORM::factory('Service_Plugin_ADSL_Traffic')
->select(
array('date_format(date,\'%y-%m\')','month'),
array('sum(up_peak)','up_peak'),

View File

@@ -34,7 +34,7 @@ class Service_Traffic_ADSL {
// Our DB record must be the suffix of this class name
$supplier = preg_replace('/^'.get_parent_class($this).'_/','',get_class($this));
$so = ORM::factory('adsl_supplier')
$so = ORM::factory('Adsl_Supplier')
->where('name','=',$supplier)
->find();
@@ -70,7 +70,7 @@ class Service_Traffic_ADSL {
* Traffic data from supplier
*/
public function update_traffic() {
if (CLI::options('verbose'))
if (Minion_CLI::options('verbose'))
echo ' - Last: '.date('Y-m-d',strtotime($this->last_update().'+1 day'))."\n";
$alreadyrun = FALSE;
@@ -78,7 +78,7 @@ class Service_Traffic_ADSL {
$querydate<=$this->today;
$querydate=date('Y-m-d',strtotime($querydate.'+1 day'))) {
if (CLI::options('verbose'))
if (Minion_CLI::options('verbose'))
echo " - Date: $querydate\n";
$goodfetch = false;
@@ -88,7 +88,7 @@ class Service_Traffic_ADSL {
// Data returned should be in MB's
$data = $this->getdata($querydate);
if (CLI::options('verbose'))
if (Minion_CLI::options('verbose'))
print_r($data);
if (! $this->fetchresult) {
@@ -96,7 +96,7 @@ class Service_Traffic_ADSL {
break;
}
$traffic = ORM::factory('service_plugin_adsl_traffic');
$traffic = ORM::factory('Service_Plugin_Adsl_Traffic');
foreach ($data as $item) {
$traffic->values($item,array_keys($item));
$traffic->supplier_id = $this->so->id;
@@ -122,7 +122,7 @@ class Service_Traffic_ADSL {
foreach ($this->so->services() as $so) {
if ($charge = $so->plugin()->traffic_lastmonth_exceed(FALSE,$date)) {
foreach ($charge as $metric => $details) {
$co = ORM::factory('charge');
$co = ORM::factory('Charge');
$co->status = 0;
$co->sweep_type = 6;

View File

@@ -39,7 +39,7 @@ class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
$update = array();
foreach ($this->so->services() as $so) {
if (CLI::options('verbose'))
if (Minion_CLI::options('verbose'))
echo " = Service: ".$so->name()."\n";
if ($so->plugin()->service_stats_collect AND $so->plugin()->service_stats_lastupdate < $date) {
@@ -51,7 +51,7 @@ class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
->post('doLogin',1)
->post('submit','Login');
$request->get_client()->options($this->curlopts+array(
$request->client()->options($this->curlopts+array(
CURLOPT_COOKIEJAR=>sprintf('/tmp/usage.cookies.%s.txt',$so->plugin()->service_number),
));
@@ -87,7 +87,7 @@ class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
->post('end_day_search_key',date('d',strtotime($lastday)))
->post('do_usage_search',1);
$request->get_client()->options($this->curlopts+array(
$request->client()->options($this->curlopts+array(
CURLOPT_COOKIEFILE=>sprintf('/tmp/usage.cookies.%s.txt',$so->plugin()->service_number),
));

View File

@@ -48,7 +48,7 @@ class Service_Traffic_ADSL_ExetelPE extends Service_Traffic_ADSL {
->post('doLogin',1)
->post('submit','Login');
$request->get_client()->options($this->curlopts+array(
$request->client()->options($this->curlopts+array(
CURLOPT_COOKIEJAR=>sprintf('/tmp/usage.cookies.%s.txt',$so->plugin()->service_number),
));
@@ -83,7 +83,7 @@ class Service_Traffic_ADSL_ExetelPE extends Service_Traffic_ADSL {
->post('end_day_search_key',date('d',strtotime($lastday)))
->post('do_usage_search',1);
$request->get_client()->options($this->curlopts+array(
$request->client()->options($this->curlopts+array(
CURLOPT_COOKIEFILE=>sprintf('/tmp/usage.cookies.%s.txt',$so->plugin()->service_number),
));

View File

@@ -27,7 +27,7 @@ class Service_Traffic_ADSL_ExetelVisp extends Service_Traffic_ADSL {
->post($this->login_pass_field,$this->so->stats_password)
->post($this->date_field,$date);
$request->get_client()->options($this->curlopts+array(
$request->client()->options($this->curlopts+array(
CURLOPT_POST => TRUE,
));