Many misc fixes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
|
@@ -370,7 +370,7 @@ class Model_Invoice extends ORMOSB {
|
||||
}
|
||||
|
||||
public function min_due($date) {
|
||||
return ($date < time()) ? time()+ORM::factory('invoice')->config('DUE_DAYS_MIN')*86400 : $date;
|
||||
return strtotime(date('Y-M-d',($date < time()) ? time()+ORM::factory('invoice')->config('DUE_DAYS_MIN')*86400 : $date));
|
||||
}
|
||||
|
||||
public function save(Validation $validation = NULL) {
|
||||
|
@@ -534,6 +534,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
'recur_schedule'=>array('label'=>'Billing'),
|
||||
'date_next_invoice'=>array('label'=>'Next Invoice'),
|
||||
'price'=>array('label'=>'Price','class'=>'right'),
|
||||
'charges_new()'=>array('label'=>'Charges','class'=>'right'),
|
||||
'active'=>array('label'=>'Active'),
|
||||
'account->accnum()'=>array('label'=>'Cust ID'),
|
||||
'account->name()'=>array('label'=>'Customer'),
|
||||
|
@@ -21,8 +21,12 @@ class Controller_Task_Service extends Controller_Task {
|
||||
* List all services by their default checkout method
|
||||
*/
|
||||
public function action_gettraffic() {
|
||||
foreach ($this->_traffic_suppliers(TRUE) as $aso)
|
||||
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
|
||||
if (CLI::options('verbose'))
|
||||
echo $aso->name."\n";
|
||||
|
||||
$traffic = Service_Traffic_ADSL::instance($aso->name)->update_traffic();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -123,6 +123,11 @@ class Model_Service extends ORMOSB {
|
||||
return $this->invoice_item->order_by('date_start,date_stop')->find_all();
|
||||
}
|
||||
|
||||
// @todo To implement
|
||||
public function charges_new() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** LIST FUNCTIONS **/
|
||||
|
||||
private function _list_active() {
|
||||
|
@@ -80,10 +80,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
|
||||
public function _details($type) {
|
||||
switch ($type) {
|
||||
case 'invoice_detail_items':
|
||||
return array(
|
||||
_('Service Address')=>$this->service_address ? $this->display('service_address') : '>NotSet<',
|
||||
_('Contract Until')=>$this->contract_date_end(),
|
||||
);
|
||||
return array();
|
||||
break;
|
||||
default:
|
||||
return parent::$_details($type);
|
||||
@@ -125,17 +122,19 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
|
||||
public function renew() {
|
||||
$d = SSL::details($this->cert);
|
||||
$ssl_conf = Kohana::config('ssl');
|
||||
// @todo change this so an admin can force this.
|
||||
$force = TRUE;
|
||||
|
||||
// If our certificate is not old enough skip
|
||||
if ($d['validTo_time_t'] > time()+$ssl_conf['min_renew_days']*86400)
|
||||
if ($d['validTo_time_t'] > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
|
||||
return FALSE;
|
||||
|
||||
$res = openssl_csr_sign($this->csr,$this->ssl_ca->sign_cert,$this->ssl_ca->sign_pk,$this->ssl->days,array(
|
||||
$res = openssl_csr_sign($this->csr,$this->ssl_ca->sign_cert,$this->ssl_ca->sign_pk,$this->service->product->plugin()->days,array(
|
||||
'config'=>$ssl_conf['config'],
|
||||
'x509_extensions'=>$this->ssl->extensions,
|
||||
'x509_extensions'=>$this->service->product->plugin()->extensions,
|
||||
),time());
|
||||
|
||||
if (openssl_x509_export($res,$cert)) {
|
||||
if ($res AND openssl_x509_export($res,$cert)) {
|
||||
$this->cert = $cert;
|
||||
$this->save();
|
||||
|
||||
|
@@ -18,6 +18,6 @@ return array(
|
||||
'minpass_length' => 4,
|
||||
|
||||
// Location to openssl config
|
||||
'config' => 'appliation/config/openssl.cnf',
|
||||
'config' => 'application/config/openssl.cnf',
|
||||
);
|
||||
?>
|
||||
|
Reference in New Issue
Block a user