Many misc fixes

This commit is contained in:
Deon George
2012-02-22 19:15:46 +11:00
parent f0f6479ca2
commit d9c3394b0f
14 changed files with 47 additions and 18 deletions

View File

@@ -60,6 +60,13 @@ class Model_ADSL_Supplier extends ORMOSB {
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)
if (! $active OR $so->active)
if (in_array($so->product->prod_plugin_data,$plans) OR in_array($so->plugin()->provided_adsl_plan_id,$plans))
array_push($services,$so);
return $services;
}

View File

@@ -70,11 +70,17 @@ class Service_Traffic_ADSL {
* Traffic data from supplier
*/
public function update_traffic() {
if (CLI::options('verbose'))
echo ' - Last: '.date('Y-m-d',strtotime($this->last_update().'+1 day'))."\n";
$alreadyrun = FALSE;
for ($querydate=date('Y-m-d',strtotime($this->last_update().'+1 day'));
$querydate<=$this->today;
$querydate=date('Y-m-d',strtotime($querydate.'+1 day'))) {
if (CLI::options('verbose'))
echo " - Date: $querydate\n";
$goodfetch = false;
// @todo log this fetch in a "log"
@@ -82,6 +88,9 @@ class Service_Traffic_ADSL {
// Data returned should be in MB's
$data = $this->getdata($querydate);
if (CLI::options('verbose'))
print_r($data);
if (! $this->fetchresult) {
echo 'Bad fetch'.get_class($this);
break;

View File

@@ -39,6 +39,9 @@ class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
$update = array();
foreach ($this->so->services() as $so) {
if (CLI::options('verbose'))
echo " = Service: ".$so->name()."\n";
if ($so->plugin()->service_stats_collect AND $so->plugin()->service_stats_lastupdate < $date) {
// Start Session
$request = Request::factory($this->so->stats_url)