Fixes to OSB to work with KH 3.3
This commit is contained in:
@@ -36,7 +36,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
public function action_ajaxlist() {
|
||||
$return = array();
|
||||
|
||||
$return += ORM::factory('service')->list_autocomplete(
|
||||
$return += ORM::factory('Service')->list_autocomplete(
|
||||
isset($_REQUEST['term']) ? $_REQUEST['term'] : '',
|
||||
'id',
|
||||
isset($_REQUEST['aid']) ? array(array('account_id','=',$_REQUEST['aid'])) : array());
|
||||
@@ -48,7 +48,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
|
||||
public function action_ajaxjson_traffic() {
|
||||
$return = array();
|
||||
$svs = ORM::factory('service')->list_bylistgroup('ADSL');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('ADSL');
|
||||
$data = $this->consoltraffic($svs,time());
|
||||
|
||||
$google = GoogleChart::factory('ComboChart');
|
||||
@@ -70,7 +70,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
Block::add(array(
|
||||
'title'=>_('Customer Services'),
|
||||
'body'=>Table::display(
|
||||
ORM::factory('service')->find_all(),
|
||||
ORM::factory('Service')->find_all(),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
|
||||
@@ -95,9 +95,9 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
public function action_listbycheckout() {
|
||||
$svs = array();
|
||||
// @todo This needs to be configurable
|
||||
$go = ORM::factory('group',array('name'=>'Personal'));
|
||||
$go = ORM::factory('Group',array('name'=>'Personal'));
|
||||
|
||||
foreach (ORM::factory('account')->list_active() as $ao)
|
||||
foreach (ORM::factory('Account')->list_active() as $ao)
|
||||
if ($ao->has_any('group',array($go)))
|
||||
foreach ($ao->service->list_active() as $so)
|
||||
if (! $so->service_billing->checkout_plugin_id)
|
||||
@@ -127,7 +127,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
)),
|
||||
));
|
||||
|
||||
foreach (ORM::factory('checkout')->list_active() as $co) {
|
||||
foreach (ORM::factory('Checkout')->list_active() as $co) {
|
||||
$svs = array();
|
||||
|
||||
foreach ($co->account->find_all() as $ao)
|
||||
@@ -194,7 +194,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_listadslservices() {
|
||||
$svs = ORM::factory('service')->list_bylistgroup('ADSL');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('ADSL');
|
||||
$data = $this->consoltraffic($svs,time());
|
||||
|
||||
$google = GoogleChart::factory('ComboChart')
|
||||
@@ -238,7 +238,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
* Show a list of services that are expiring or have expired
|
||||
*/
|
||||
public function action_listexpiring() {
|
||||
$svs = ORM::factory('service')->list_expiring();
|
||||
$svs = ORM::factory('Service')->list_expiring();
|
||||
|
||||
Sort::MAsort($svs,'expire()');
|
||||
|
||||
@@ -261,7 +261,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_listhspaservices() {
|
||||
$svs = ORM::factory('service')->list_bylistgroup('HSPA');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('HSPA');
|
||||
$data = $this->consoltraffic($svs,time());
|
||||
|
||||
$google = GoogleChart::factory('Legacy')
|
||||
@@ -302,7 +302,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_listdomainservices() {
|
||||
$svs = ORM::factory('service')->list_bylistgroup('DOMAIN');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('DOMAIN');
|
||||
Sort::MAsort($svs,'name()');
|
||||
|
||||
Block::add(array(
|
||||
@@ -329,7 +329,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_listdomainservicesbysupplier() {
|
||||
$svs = ORM::factory('service')->list_bylistgroup('DOMAIN');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('DOMAIN');
|
||||
Sort::MAsort($svs,'plugin()->domain_registrar_id,name()');
|
||||
|
||||
$list = array();
|
||||
@@ -362,13 +362,13 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_listdomainservicesbydnshost() {
|
||||
$svs = ORM::factory('service')->list_bylistgroup('DOMAIN');
|
||||
Sort::MAsort($svs,'plugin()->service_plugin_host,name()');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('DOMAIN');
|
||||
Sort::MAsort($svs,'plugin()->service_plugin_HOST,name()');
|
||||
|
||||
$list = array();
|
||||
|
||||
foreach ($svs as $so)
|
||||
$list[$so->plugin()->service_plugin_host->host_server_id][] = $so;
|
||||
$list[$so->plugin()->service_plugin_HOST->host_server_id][] = $so;
|
||||
|
||||
foreach (array_keys($list) as $sid)
|
||||
Block::add(array(
|
||||
@@ -392,7 +392,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_listhostservices() {
|
||||
$svs = ORM::factory('service')->list_bylistgroup('HOST');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('HOST');
|
||||
Sort::MAsort($svs,'name()');
|
||||
|
||||
Block::add(array(
|
||||
@@ -419,7 +419,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_listhostservicesbysupplier() {
|
||||
$svs = ORM::factory('service')->list_bylistgroup('HOST');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('HOST');
|
||||
Sort::MAsort($svs,'plugin()->host_server,name()');
|
||||
|
||||
$list = array();
|
||||
@@ -452,7 +452,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_listwebservices() {
|
||||
$svs = ORM::factory('service')->list_bylistgroup('WEB');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('WEB');
|
||||
Sort::MAsort($svs,'name()');
|
||||
|
||||
Block::add(array(
|
||||
@@ -482,8 +482,10 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
*
|
||||
* @todo this should really be in a different class, since adsl wont be part of the main app
|
||||
*/
|
||||
public function action_listadslbilling($id) {
|
||||
$aso = ORM::factory('adsl_supplier',$id);
|
||||
public function action_listadslbilling() {
|
||||
$id = $this->request->param('id');
|
||||
|
||||
$aso = ORM::factory('ADSL_Supplier',$id);
|
||||
|
||||
// Process upload
|
||||
// @todo This should be separated out by supplier in case each supplier has a different format
|
||||
@@ -646,7 +648,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
Block::add(array(
|
||||
'title'=>_('Services to Invoice'),
|
||||
'body'=>Table::display(
|
||||
ORM::factory('service')->list_invoicesoon(ORM::factory('invoice')->config('GEN_SOON_DAYS')),
|
||||
ORM::factory('Service')->list_invoicesoon(ORM::factory('Invoice')->config('GEN_SOON_DAYS')),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
|
||||
@@ -669,10 +671,10 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
|
||||
public function action_update() {
|
||||
$id = $this->request->param('id');
|
||||
$so = ORM::factory('service',$id);
|
||||
$so = ORM::factory('Service',$id);
|
||||
|
||||
if (! $so->loaded())
|
||||
Request::current()->redirect('welcome/index');
|
||||
HTTP::redirect('welcome/index');
|
||||
|
||||
if ($_POST) {
|
||||
if (isset($_POST['plugin']) AND $_POST['plugin'])
|
||||
@@ -717,7 +719,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
public function action_view() {
|
||||
list($id,$output) = Table::page(__METHOD__);
|
||||
|
||||
$so = ORM::factory('service',$id);
|
||||
$so = ORM::factory('Service',$id);
|
||||
|
||||
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id,$so->affiliate_id)) {
|
||||
$this->template->content = 'Unauthorised or doesnt exist?';
|
||||
@@ -781,7 +783,8 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['go']))
|
||||
$this->request->redirect('admin/service/view/'.$so->id);
|
||||
HTTP::redirect('admin/service/view/'.$so->id);
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('Transaction History for %s: %s',$so->id(),$so->name()),
|
||||
'body'=>$loutput,
|
||||
@@ -803,7 +806,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
|
||||
public function action_adslstat() {
|
||||
$output = '';
|
||||
$svs = ORM::factory('service')->list_bylistgroup('ADSL');
|
||||
$svs = ORM::factory('Service')->list_bylistgroup('ADSL');
|
||||
$stats = array();
|
||||
// @todo This needs to be configurable.
|
||||
$traffic = array(1000,2000,5000,10000,25000,50000,75000,100000);
|
@@ -27,7 +27,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
|
||||
Block::add(array(
|
||||
'title'=>_('Customer Services'),
|
||||
'body'=>Table::display(
|
||||
$this->filter(ORM::factory('service')->list_active(),$this->ao->affiliate->id),
|
||||
$this->filter(ORM::factory('Service')->list_active(),$this->ao->affiliate->id),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
|
||||
@@ -52,9 +52,9 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
|
||||
public function action_listbycheckout() {
|
||||
$svs = array();
|
||||
// @todo This needs to be configurable
|
||||
$go = ORM::factory('group',array('name'=>'Personal'));
|
||||
$go = ORM::factory('Group',array('name'=>'Personal'));
|
||||
|
||||
foreach (ORM::factory('account')->list_active() as $ao)
|
||||
foreach (ORM::factory('Account')->list_active() as $ao)
|
||||
if ($ao->has_any('group',array($go)))
|
||||
foreach ($this->filter($ao->service->list_active(),$this->ao->affiliate->id,'name()') as $so)
|
||||
if (! $so->service_billing->checkout_plugin_id)
|
||||
@@ -89,7 +89,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
|
||||
'body'=>_('None found'),
|
||||
));
|
||||
|
||||
foreach (ORM::factory('checkout')->list_active() as $co) {
|
||||
foreach (ORM::factory('Checkout')->list_active() as $co) {
|
||||
$svs = array();
|
||||
|
||||
foreach ($co->account->find_all() as $ao)
|
||||
@@ -156,7 +156,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
|
||||
}
|
||||
|
||||
public function action_listadslservices() {
|
||||
$svs = $this->filter(ORM::factory('service')->list_bylistgroup('ADSL'),$this->ao->affiliate->id,'name()');
|
||||
$svs = $this->filter(ORM::factory('Service')->list_bylistgroup('ADSL'),$this->ao->affiliate->id,'name()');
|
||||
$data = $this->consoltraffic($svs,time());
|
||||
|
||||
$google = GoogleChart::factory('Legacy')
|
||||
@@ -197,7 +197,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
|
||||
}
|
||||
|
||||
public function action_listhspaservices() {
|
||||
$svs = $this->filter(ORM::factory('service')->list_bylistgroup('HSPA'),$this->ao->affiliate->id,'name()');
|
||||
$svs = $this->filter(ORM::factory('Service')->list_bylistgroup('HSPA'),$this->ao->affiliate->id,'name()');
|
||||
$data = $this->consoltraffic($svs,time());
|
||||
|
||||
$google = GoogleChart::factory('Legacy')
|
||||
@@ -241,7 +241,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
|
||||
Block::add(array(
|
||||
'title'=>_('Domain Names'),
|
||||
'body'=>Table::display(
|
||||
$this->filter(ORM::factory('service')->list_bylistgroup('DOMAIN'),$this->ao->affiliate->id,'name()'),
|
||||
$this->filter(ORM::factory('Service')->list_bylistgroup('DOMAIN'),$this->ao->affiliate->id,'name()'),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
|
||||
@@ -265,7 +265,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
|
||||
Block::add(array(
|
||||
'title'=>_('Hosting Services'),
|
||||
'body'=>Table::display(
|
||||
$this->filter(ORM::factory('service')->list_bylistgroup('HOST'),$this->ao->affiliate->id,'name()'),
|
||||
$this->filter(ORM::factory('Service')->list_bylistgroup('HOST'),$this->ao->affiliate->id,'name()'),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
|
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
class Controller_Task_Service extends Controller_Task {
|
||||
private function _traffic_suppliers($active=FALSE) {
|
||||
$suppliers = ORM::factory('adsl_supplier');
|
||||
$suppliers = ORM::factory('Adsl_Supplier');
|
||||
|
||||
return $active ? $suppliers->list_active() : $suppliers->find_all();
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class Controller_Task_Service extends Controller_Task {
|
||||
*/
|
||||
public function action_gettraffic() {
|
||||
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
|
||||
if (CLI::options('verbose'))
|
||||
if (Minion_CLI::options('verbose'))
|
||||
echo $aso->name."\n";
|
||||
|
||||
$traffic = Service_Traffic_ADSL::instance($aso->name)->update_traffic();
|
@@ -20,7 +20,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User {
|
||||
public function action_ajaxmanage() {
|
||||
$this->auto_render = FALSE;
|
||||
|
||||
$so = ORM::factory('service',$this->request->param('id'));
|
||||
$so = ORM::factory('Service',$this->request->param('id'));
|
||||
$k = Session::instance()->get_once('manage_button');
|
||||
$amo = $so->plugin(isset($_REQUEST['t']) ? $_REQUEST['t'] : '');
|
||||
|
||||
@@ -60,7 +60,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User {
|
||||
public function action_view() {
|
||||
list($id,$output) = Table::page(__METHOD__);
|
||||
|
||||
$so = ORM::factory('service',$id);
|
||||
$so = ORM::factory('Service',$id);
|
||||
|
||||
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id,$so->affiliate_id)) {
|
||||
$this->template->content = 'Unauthorised or doesnt exist?';
|
@@ -56,7 +56,7 @@ class Model_Service extends ORM_OSB {
|
||||
if (! is_numeric($this->product->prod_plugin_data))
|
||||
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->product->id,':type'=>$this->product->prod_plugin_file));
|
||||
|
||||
$o = ORM::factory(sprintf('service_plugin_%s',$this->product->prod_plugin_file),array('service_id'=>$this->id));
|
||||
$o = ORM::factory(sprintf('Service_Plugin_%s',$this->product->prod_plugin_file),array('service_id'=>$this->id));
|
||||
|
||||
return $type ? $o->$type : $o;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ class Model_Service extends ORM_OSB {
|
||||
public function list_bylistgroup($cat) {
|
||||
$result = array();
|
||||
|
||||
$cats = ORM::factory('product_category')->list_bylistgroup($cat);
|
||||
$cats = ORM::factory('Product_Category')->list_bylistgroup($cat);
|
||||
|
||||
foreach ($this->list_active() as $so) {
|
||||
if (! $so->product->avail_category OR ! preg_match('/^a:/',$so->product->avail_category))
|
||||
@@ -256,7 +256,7 @@ class Model_Service extends ORM_OSB {
|
||||
public function list_invoicesoon($days=0) {
|
||||
return $this->_where_active()
|
||||
->where_open()->where('suspend_billing','IS',NULL)->or_where('suspend_billing','=','0')->where_close()
|
||||
->where('date_next_invoice','<',time()+(ORM::factory('invoice')->config('GEN_DAYS')+$days)*86400)
|
||||
->where('date_next_invoice','<',time()+(ORM::factory('Invoice')->config('GEN_DAYS')+$days)*86400)
|
||||
->find_all();
|
||||
}
|
||||
|
Reference in New Issue
Block a user