diff --git a/application/classes/Auth/OSB.php b/application/classes/Auth/OSB.php
index 081df456..20be1236 100644
--- a/application/classes/Auth/OSB.php
+++ b/application/classes/Auth/OSB.php
@@ -118,7 +118,7 @@ class Auth_OSB extends Auth_ORM {
$password = $this->hash($password);
// If the passwords match, perform a login
- if ($user->status AND $user->has_any('group',ORM::factory('Group',array('name'=>'Registered Users'))->list_childgrps(TRUE)) AND $user->password === $password) {
+ if ($user->active AND $user->has_any('group',ORM::factory('Group',array('name'=>'Registered Users'))->list_childgrps(TRUE)) AND $user->password === $password) {
// @todo This is not currently used.
if ($remember === TRUE) {
diff --git a/application/classes/Company.php b/application/classes/Company.php
index bf354b50..5cbed80f 100644
--- a/application/classes/Company.php
+++ b/application/classes/Company.php
@@ -21,7 +21,7 @@ class Company {
if (! $this->so->loaded())
throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http')));
- Kohana::$environment = (int)$this->so->status;
+ Kohana::$environment = (int)$this->so->active;
}
public static function instance() {
diff --git a/application/classes/Controller/Reseller/Account.php b/application/classes/Controller/Reseller/Account.php
index 60d4eed6..a0353f22 100644
--- a/application/classes/Controller/Reseller/Account.php
+++ b/application/classes/Controller/Reseller/Account.php
@@ -43,7 +43,7 @@ class Controller_Reseller_Account extends Controller_Account {
public function action_view() {
$ao = ORM::factory('Account',$this->request->param('id'));
- if (! $ao->loaded() OR ! $ao->status OR ! Auth::instance()->authorised($ao))
+ if (! $ao->loaded() OR ! $ao->active OR ! Auth::instance()->authorised($ao))
throw HTTP_Exception::factory(403,'Account either doesnt exist, or you are not authorised to see it');
$this->meta->title = 'Customer: '.$ao->name();
diff --git a/application/classes/Model/Account.php b/application/classes/Model/Account.php
index e8b7f8c2..6c5157f6 100644
--- a/application/classes/Model/Account.php
+++ b/application/classes/Model/Account.php
@@ -31,15 +31,15 @@ class Model_Account extends lnApp_Model_Account {
);
protected $_display_filters = array(
+ 'active'=>array(
+ array('StaticList_YesNo::get',array(':value',TRUE)),
+ ),
'date_orig'=>array(
array('Site::Date',array(':value')),
),
'date_last'=>array(
array('Site::Date',array(':value')),
),
- 'status'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
);
/** REQUIRED ABSTRACT METHODS **/
diff --git a/application/classes/Model/Group.php b/application/classes/Model/Group.php
index 1c6f4d83..4850f00f 100644
--- a/application/classes/Model/Group.php
+++ b/application/classes/Model/Group.php
@@ -19,7 +19,7 @@ class Model_Group extends Model_Auth_Role {
);
protected $_display_filters = array(
- 'status'=>array(
+ 'active'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
);
diff --git a/application/classes/Model/Module.php b/application/classes/Model/Module.php
deleted file mode 100644
index ef49b929..00000000
--- a/application/classes/Model/Module.php
+++ /dev/null
@@ -1,55 +0,0 @@
-array('model'=>'Record_ID','far_key'=>'id'),
- );
- protected $_has_many = array(
- 'module_method'=>array('far_key'=>'id'),
- );
- protected $_sorting = array(
- 'name'=>'ASC',
- );
-
- protected $_display_filters = array(
- 'external'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
- 'name'=>array(
- array('strtoupper',array(':value')),
- ),
- 'status'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
- );
-
- /**
- * Return an instance of this Module's Model
- *
- * @param $id PK of Model
- */
- public function instance($id=NULL) {
- if (! $this->loaded())
- throw new Kohana_Exception('Cant call an instance of a model when it is not loaded');
-
- return ORM::factory(Kohana::classname($this->name),$id);
- }
-
- public function list_external() {
- return $this->_where_active()->where('external','=',TRUE)->find_all();
- }
-}
-?>
diff --git a/application/classes/ORM.php b/application/classes/ORM.php
index 2d8c9b61..f0873dae 100644
--- a/application/classes/ORM.php
+++ b/application/classes/ORM.php
@@ -45,13 +45,6 @@ abstract class ORM extends lnApp_ORM {
return parent::_build($type);
}
- /**
- * Function help to find records that are active
- */
- final protected function _where_active() {
- return $this->where('status','=',TRUE);
- }
-
/**
* Determine if the account is authoised by the user
*/
@@ -188,13 +181,23 @@ abstract class ORM extends lnApp_ORM {
* Function help to find records that are active
*/
final public function list_active($active=TRUE) {
- $x=($active ? $this->_where_active() : $this);
+ $x=($active ? $this->where_active() : $this);
return $x->find_all();
}
+ /**
+ * Function help to find records that are active
+ */
final public function where_active() {
- return $this->_where_active();
+ return $this->where($this->_table_name.'.active','=',TRUE);
+ }
+
+ /**
+ * Function help to find records that are inactive
+ */
+ final public function where_inactive() {
+ return $this->where_open()->where($this->_table_name.'.active','=',FALSE)->or_where($this->_table_name.'.active','IS',NULL)->where_close();
}
// @todo This function shouldnt be here.
diff --git a/application/classes/Request.php b/application/classes/Request.php
index 9e184ef3..d8cee11a 100644
--- a/application/classes/Request.php
+++ b/application/classes/Request.php
@@ -26,7 +26,7 @@ class Request extends lnApp_Request {
$mo = ORM::factory('Module',array('name'=>$c));
- if ($mo->loaded() AND $mo->status) {
+ if ($mo->loaded() AND $mo->active) {
$method = strtolower($this->_directory ? sprintf('%s:%s',$this->_directory.($x ? '_'.$x : ''),$this->_action) : $this->_action);
// Get the method number
diff --git a/application/classes/Task/Account/Complete.php b/application/classes/Task/Account/Complete.php
index f4b9cdee..0c0489a2 100644
--- a/application/classes/Task/Account/Complete.php
+++ b/application/classes/Task/Account/Complete.php
@@ -18,7 +18,7 @@ class Task_Account_Complete extends Minion_Task {
foreach ($o->find_all() as $ao) {
if (count($ao->invoice->where_unprocessed()->find_all()) == 0 AND count($ao->service->where_active()->find_all()) == 0)
- $ao->status = 0;
+ $ao->active = 0;
$ao->save();
diff --git a/application/views/account/list.php b/application/views/account/list.php
index 0f5b5024..5280edd5 100644
--- a/application/views/account/list.php
+++ b/application/views/account/list.php
@@ -4,7 +4,7 @@
->jssort('customer')
->columns(array(
'id'=>'ID',
- 'status'=>'Active',
+ 'active'=>'Active',
'refnum()'=>'Num',
'name()'=>'Account',
'email'=>'Email',
diff --git a/application/views/account/reseller/view.php b/application/views/account/reseller/view.php
index bba9f861..b4867737 100644
--- a/application/views/account/reseller/view.php
+++ b/application/views/account/reseller/view.php
@@ -5,6 +5,6 @@
->title(sprintf('InActive Services for Account: %s',$o->refnum()))
->title_icon('fa fa-barcode')
->span(6)
- ->body(View::factory('service/user/list/inactive')->set('o',$o->service->where('status','!=',1)->or_where('status','IS',null)->find_all())); ?>
+ ->body(View::factory('service/user/list/inactive')->set('o',$o->service->where_inactive()->find_all())); ?>
set('o',$o); ?>
diff --git a/modules/adsl/classes/Controller/Admin/Adsl.php b/modules/adsl/classes/Controller/Admin/Adsl.php
index 0db6e0aa..04c523cc 100644
--- a/modules/adsl/classes/Controller/Admin/Adsl.php
+++ b/modules/adsl/classes/Controller/Admin/Adsl.php
@@ -44,7 +44,7 @@ class Controller_Admin_Adsl extends Controller_Adsl {
->columns(array(
'id'=>'ID',
'supplier_plan->name()'=>'Plan',
- 'supplier_plan->display("status")'=>'Avail',
+ 'supplier_plan->display("active")'=>'Avail',
'base_down_peak'=>'PD',
'base_down_offpeak'=>'OPD',
'base_up_peak'=>'PU',
@@ -181,7 +181,7 @@ class Controller_Admin_Adsl extends Controller_Adsl {
'service'=>'Service Login',
'plan->service->id'=>'Service',
'plan->service_number'=>'Service',
- 'plan->service->status'=>'Active',
+ 'plan->service->active'=>'Active',
'up_peak'=>'Up Peak',
'down_peak'=>'Down Peak',
'up_offpeak'=>'Up OffPeak',
diff --git a/modules/adsl/classes/Model/ADSL/Supplier/Plan.php b/modules/adsl/classes/Model/ADSL/Supplier/Plan.php
index 2eb12fba..d121f606 100644
--- a/modules/adsl/classes/Model/ADSL/Supplier/Plan.php
+++ b/modules/adsl/classes/Model/ADSL/Supplier/Plan.php
@@ -29,6 +29,9 @@ class Model_ADSL_Supplier_Plan extends ORM {
* Filters used to format the display of values into friendlier values
*/
protected $_display_filters = array(
+ 'active'=>array(
+ array('StaticList_YesNo::get',array(':value',TRUE)),
+ ),
'base_cost'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
@@ -49,9 +52,6 @@ class Model_ADSL_Supplier_Plan extends ORM {
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
),
- 'status'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
);
// Map the table fields
diff --git a/modules/charge/classes/Controller/Reseller/Charge.php b/modules/charge/classes/Controller/Reseller/Charge.php
index c5a30bc2..ffb0a11a 100644
--- a/modules/charge/classes/Controller/Reseller/Charge.php
+++ b/modules/charge/classes/Controller/Reseller/Charge.php
@@ -82,7 +82,7 @@ class Controller_Reseller_Charge extends Controller_Charge {
Block::factory()
->title('Customer Charges')
->title_icon('fa fa-list')
- ->body(View::factory('charge/list')->set('o',ORM::factory('Charge')->where_authorised($this->ao)->where('void','is',NULL)->order_by('id','DESC')->find_all()));
+ ->body(View::factory('charge/list')->set('o',ORM::factory('Charge')->where_authorised($this->ao)->where_active()->order_by('id','DESC')->find_all()));
}
}
?>
diff --git a/modules/charge/classes/Model/Charge.php b/modules/charge/classes/Model/Charge.php
index 2558c4e6..701ffd91 100644
--- a/modules/charge/classes/Model/Charge.php
+++ b/modules/charge/classes/Model/Charge.php
@@ -29,6 +29,9 @@ class Model_Charge extends ORM {
);
protected $_display_filters = array(
+ 'active'=>array(
+ array('StaticList_YesNo::get',array(':value',TRUE)),
+ ),
'amount'=>array(
array('Currency::display',array(':value')),
),
@@ -44,9 +47,6 @@ class Model_Charge extends ORM {
'sweep_type'=>array(
array('StaticList_SweepType::get',array(':value')),
),
- 'void'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
);
/**
diff --git a/modules/checkout/classes/Checkout/Plugin/Paypal.php b/modules/checkout/classes/Checkout/Plugin/Paypal.php
index caceb67d..92d0fa88 100644
--- a/modules/checkout/classes/Checkout/Plugin/Paypal.php
+++ b/modules/checkout/classes/Checkout/Plugin/Paypal.php
@@ -62,7 +62,7 @@ abstract class Checkout_Plugin_Paypal extends Checkout_Plugin {
$debug_mode = Kohana::$config->load('debug')->checkout_notify;
// If testing
- if (! $cno->status OR $cno->processed OR ($debug_mode AND Request::$client_ip == $this->ipn_test))
+ if (! $cno->active OR $cno->processed OR ($debug_mode AND Request::$client_ip == $this->ipn_test))
return _('Thank you');
$co = Cart::instance(isset($cno->data['custom']) ? $cno->data['custom'] : '');
@@ -200,14 +200,14 @@ abstract class Checkout_Plugin_Paypal extends Checkout_Plugin {
}
} else {
- $cno->status = FALSE;
+ $cno->active = FALSE;
}
break;
case 'INVALID':
default:
- $cno->status = FALSE;
+ $cno->active = FALSE;
}
if (! $debug_mode)
diff --git a/modules/checkout/classes/Controller/Checkout.php b/modules/checkout/classes/Controller/Checkout.php
index fcd9ba4f..f0f31080 100644
--- a/modules/checkout/classes/Controller/Checkout.php
+++ b/modules/checkout/classes/Controller/Checkout.php
@@ -63,7 +63,7 @@ class Controller_Checkout extends Controller_TemplateDefault {
if (! $test_id) {
$cno->checkout_id = $co->id;
- $cno->status = 1;
+ $cno->active = 1;
$cno->data = Request::current()->post();
$cno->save();
diff --git a/modules/checkout/classes/Task/Checkout/Notify/List.php b/modules/checkout/classes/Task/Checkout/Notify/List.php
index eb383339..c2be3e7c 100644
--- a/modules/checkout/classes/Task/Checkout/Notify/List.php
+++ b/modules/checkout/classes/Task/Checkout/Notify/List.php
@@ -21,7 +21,7 @@ class Task_Checkout_Notify_List extends Minion_Task {
$cno->display('date_orig'),
$cno->checkout_id,
$cno->checkout->name,
- $cno->status ? 'A' : 'I',
+ $cno->active ? 'A' : 'I',
$cno->processed ? 'A' : 'I',
$cno->data['mc_gross'],
$cno->data['mc_fee'],
diff --git a/modules/domain/classes/Controller/Admin/Service/Domain.php b/modules/domain/classes/Controller/Admin/Service/Domain.php
index 50ce9e79..ef7fd3ef 100644
--- a/modules/domain/classes/Controller/Admin/Service/Domain.php
+++ b/modules/domain/classes/Controller/Admin/Service/Domain.php
@@ -24,7 +24,7 @@ class Controller_Admin_Service_Domain extends Controller_Domain {
->columns(array(
'id'=>'ID',
'name()'=>'Domain',
- 'status'=>'Active',
+ 'active'=>'Active',
'suspend_billing'=>'Not Bill',
'external_billing'=>'Ext Bill',
'plugin()->display("domain_expire")'=>'Expire',
diff --git a/modules/email/classes/Controller/Admin/Email.php b/modules/email/classes/Controller/Admin/Email.php
index 6e09fcb8..a31767b9 100644
--- a/modules/email/classes/Controller/Admin/Email.php
+++ b/modules/email/classes/Controller/Admin/Email.php
@@ -57,7 +57,7 @@ class Controller_Admin_Email extends Controller_Email {
->columns(array(
'id'=>'ID',
'name'=>'Name',
- 'status'=>'Active',
+ 'active'=>'Active',
'description'=>'Descrption',
))
->prepend(array(
diff --git a/modules/email/classes/Model/Email/Template.php b/modules/email/classes/Model/Email/Template.php
index ea8e72ca..9ea61a84 100644
--- a/modules/email/classes/Model/Email/Template.php
+++ b/modules/email/classes/Model/Email/Template.php
@@ -22,7 +22,7 @@ class Model_Email_Template extends ORM {
);
protected $_display_filters = array(
- 'status'=>array(
+ 'active'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
);
diff --git a/modules/email/views/email/admin/add_edit_template.php b/modules/email/views/email/admin/add_edit_template.php
index 85d357c3..9873ea58 100644
--- a/modules/email/views/email/admin/add_edit_template.php
+++ b/modules/email/views/email/admin/add_edit_template.php
@@ -7,7 +7,7 @@
- status,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?>
+ active,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?>
diff --git a/modules/export/classes/Controller/Admin/Export.php b/modules/export/classes/Controller/Admin/Export.php
index 725fb33f..1104f3df 100644
--- a/modules/export/classes/Controller/Admin/Export.php
+++ b/modules/export/classes/Controller/Admin/Export.php
@@ -26,7 +26,7 @@ class Controller_Admin_Export extends Controller_Export {
$edo = ORM::factory('Export_DataMap');
if ($_POST AND isset($_POST['item_id']) AND $edo->values($_POST)->changed()) {
- $edo->status = 1;
+ $edo->active = 1;
$this->save($edo);
}
diff --git a/modules/host/views/host/admin/update.php b/modules/host/views/host/admin/update.php
index 06d60aff..c4cfe728 100644
--- a/modules/host/views/host/admin/update.php
+++ b/modules/host/views/host/admin/update.php
@@ -15,7 +15,7 @@
Active |
- status); ?> |
+ active); ?> |
Debug Mode |
diff --git a/modules/invoice/classes/Invoice.php b/modules/invoice/classes/Invoice.php
index c4a3249c..a753be05 100644
--- a/modules/invoice/classes/Invoice.php
+++ b/modules/invoice/classes/Invoice.php
@@ -33,7 +33,7 @@ class Invoice {
// Set our invoice as valid
if (is_null($io))
- $this->_io->status = 1;
+ $this->_io->active = 1;
}
/**
@@ -73,8 +73,8 @@ class Invoice {
// Check if there are any charges
$c = ORM::factory('Charge')
+ ->where_active()
->where('service_id','=',$so->id)
- ->where('void','is',NULL)
->where('processed','is',NULL);
foreach ($c->find_all() as $co) {
@@ -172,7 +172,7 @@ class Invoice {
case 'html':
switch ($section) {
case 'body':
- if (! $this->_io->status)
+ if (! $this->_io->active)
Style::factory()
->type('file')
->data('media/css/pages/invoice.css');
diff --git a/modules/invoice/classes/Model/Invoice.php b/modules/invoice/classes/Model/Invoice.php
index 1cd2c404..6c856311 100644
--- a/modules/invoice/classes/Model/Invoice.php
+++ b/modules/invoice/classes/Model/Invoice.php
@@ -27,18 +27,15 @@ class Model_Invoice extends ORM implements Cartable {
);
protected $_display_filters = array(
+ 'active'=>array(
+ array('StaticList_YesNo::get',array(':value',TRUE)),
+ ),
'date_orig'=>array(
array('Site::Date',array(':value')),
),
'due_date'=>array(
array('Site::Date',array(':value')),
),
- 'status'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
- 'void'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
);
// Items belonging to an invoice
@@ -98,7 +95,7 @@ class Model_Invoice extends ORM implements Cartable {
*/
public function due($format=FALSE) {
// If the invoice is active calculate the due amount
- $result = $this->status ? Currency::round($this->total()-$this->payments_total(),1) : 0;
+ $result = $this->active ? Currency::round($this->total()-$this->payments_total(),1) : 0;
return $format ? Currency::display($result) : $result;
}
@@ -136,7 +133,7 @@ class Model_Invoice extends ORM implements Cartable {
// Ensure we dont process this item again
array_push($track,$iio->id);
- if (! $iio->void)
+ if ($iio->active)
array_push($result['s'],$iio);
}
@@ -149,14 +146,14 @@ class Model_Invoice extends ORM implements Cartable {
// Ensure we dont process this item again
array_push($track,$iio->id);
- if (! $iio->void)
+ if ($iio->active)
array_push($result['s'],$iio);
}
}
// Get service items that dont have a recurring schedule
foreach ($this->_sub_items as $iio)
- if (! $iio->void AND ! in_array($iio->id,$track) AND $iio->service_id) {
+ if ($iio->active AND ! in_array($iio->id,$track) AND $iio->service_id) {
// Ensure we dont process this item again
array_push($track,$iio->id);
@@ -166,7 +163,7 @@ class Model_Invoice extends ORM implements Cartable {
// Next get the items we havent already got
$result['other'] = array();
foreach ($this->_sub_items as $iio)
- if (! $iio->void AND ! in_array($iio->id,$track))
+ if ($iio->active AND ! in_array($iio->id,$track))
array_push($result['other'],$iio);
// Debug
@@ -324,7 +321,7 @@ class Model_Invoice extends ORM implements Cartable {
$iio->save();
if (! $iio->saved()) {
- $this->void = 1;
+ $this->active = 0;
$this->save();
break;
@@ -416,7 +413,7 @@ class Model_Invoice extends ORM implements Cartable {
foreach ($this->_sub_items as $iio) {
// Ignore voided items
- if ($iio->void)
+ if (! $iio->active)
continue;
$return = FALSE;
@@ -529,12 +526,8 @@ class Model_Invoice extends ORM implements Cartable {
return $format ? Currency::display($result) : $result;
}
- private function _where_unprocessed() {
- return $this->where_open()->where('process_status','!=',1)->or_where('process_status','is',NULL)->where_close();
- }
-
public function where_unprocessed() {
- return $this->_where_unprocessed();
+ return $this->where_open()->where('process_status','!=',1)->or_where('process_status','is',NULL)->where_close();
}
// Our list function
@@ -570,7 +563,7 @@ class Model_Invoice extends ORM implements Cartable {
$this->where_authorised();
if (! $result)
- foreach ($this->_where_active()->_where_unprocessed()->find_all() as $io)
+ foreach ($this->where_active()->where_unprocessed()->find_all() as $io)
if ($io->due())
array_push($result,$io);
diff --git a/modules/invoice/classes/Model/Invoice/Item.php b/modules/invoice/classes/Model/Invoice/Item.php
index 55ea883f..fc70f6e6 100644
--- a/modules/invoice/classes/Model/Invoice/Item.php
+++ b/modules/invoice/classes/Model/Invoice/Item.php
@@ -238,7 +238,7 @@ class Model_Invoice_Item extends ORM {
$iito->save();
if (! $iito->saved()) {
- $this->void = 1;
+ $this->active = 0;
$this->save();
break;
@@ -301,7 +301,7 @@ class Model_Invoice_Item extends ORM {
}
public function total($format=FALSE) {
- $result = $this->void ? 0 : $this->subtotal()+$this->tax()-$this->discount();
+ $result = ! $this->active ? 0 : $this->subtotal()+$this->tax()-$this->discount();
return $format ? Currency::display($result) : Currency::round($result);
}
diff --git a/modules/invoice/views/invoice/user/view.php b/modules/invoice/views/invoice/user/view.php
index b3f3c308..99beb4c9 100644
--- a/modules/invoice/views/invoice/user/view.php
+++ b/modules/invoice/views/invoice/user/view.php
@@ -11,7 +11,7 @@ if ($o->due() AND ! $o->cart_exists())
->set('mid',$o->mid())
->set('o',$o);
-if (! $o->status)
+if (! $o->active)
$output .= 'Invoice CANCELLED.
';
echo Block::factory()
diff --git a/modules/lnapp b/modules/lnapp
index 68d96ca8..f5bc5dfa 160000
--- a/modules/lnapp
+++ b/modules/lnapp
@@ -1 +1 @@
-Subproject commit 68d96ca85f0befb37754de7caf6f861e6df64e3a
+Subproject commit f5bc5dfa296a1517ebdb29b2dd0f81b09f136b6a
diff --git a/modules/lnauth b/modules/lnauth
index 4b432d2e..33982a6c 160000
--- a/modules/lnauth
+++ b/modules/lnauth
@@ -1 +1 @@
-Subproject commit 4b432d2eb44bc8cf264c3082b009f9918c5e552b
+Subproject commit 33982a6cecb56069dae94af738541b5b4e4be4ff
diff --git a/modules/oauth/classes/Controller/Oauth.php b/modules/oauth/classes/Controller/Oauth.php
index 9cfa7b14..f27f53f8 100644
--- a/modules/oauth/classes/Controller/Oauth.php
+++ b/modules/oauth/classes/Controller/Oauth.php
@@ -18,7 +18,7 @@ class Controller_Oauth extends Controller_TemplateDefault {
public function action_login() {
// Make sure we are called with a valid oauth plugin
$oo = ORM::factory('Oauth',array('name'=>$this->request->param('id')));
- if (! $oo->loaded() OR ! $oo->status)
+ if (! $oo->loaded() OR ! $oo->active)
HTTP::redirect('login');
$auth = Auth::instance($oo);
@@ -47,7 +47,7 @@ class Controller_Oauth extends Controller_TemplateDefault {
public function action_link() {
// Make sure we are called with a valid oauth plugin
$oo = ORM::factory('Oauth',array('name'=>$this->request->param('id')));
- if (! $oo->loaded() OR ! $oo->status)
+ if (! $oo->loaded() OR ! $oo->active)
HTTP::redirect('login');
// Since we have logged in, get our user details
diff --git a/modules/payment/views/payment/list.php b/modules/payment/views/payment/list.php
index 2f809832..15a47d3f 100644
--- a/modules/payment/views/payment/list.php
+++ b/modules/payment/views/payment/list.php
@@ -6,7 +6,6 @@
'date_payment'=>'Pay Date',
'account->refnum()'=>'Num',
'account->name()'=>'Account',
- 'account->display("status")'=>'Active',
'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance',
))
diff --git a/modules/product/classes/Controller/Admin/Product.php b/modules/product/classes/Controller/Admin/Product.php
index 30d9359a..76d546a5 100644
--- a/modules/product/classes/Controller/Admin/Product.php
+++ b/modules/product/classes/Controller/Admin/Product.php
@@ -212,7 +212,7 @@ $.ajax({
* Show a list of products
*/
public function action_list() {
- $products = ($x=ORM::factory('Product_Category',$this->request->param('id')) AND $x->loaded()) ? $x->products() : ORM::factory('Product')->order_by('status','DESC')->order_by('prod_plugin_file')->find_all();
+ $products = ($x=ORM::factory('Product_Category',$this->request->param('id')) AND $x->loaded()) ? $x->products() : ORM::factory('Product')->order_by('active','DESC')->order_by('prod_plugin_file')->find_all();
Block::factory()
->title(_('Products').($x->loaded() ? ' - '.$x->name() : ' - All'))
@@ -230,7 +230,7 @@ $.ajax({
foreach (array_keys(ORM::factory('Product')->table_columns()) as $text)
$columns .= ($columns ? ',' : '').'p.'.$text;
- $products = $db->query(Database::SELECT,sprintf('SELECT %s FROM ab_product p,ab_service s WHERE s.product_id=p.id AND s.status=1 AND p.site_id = s.site_id AND s.site_id=%s GROUP BY p.id',$columns,Company::instance()->site()),'Model_Product');
+ $products = $db->query(Database::SELECT,sprintf('SELECT %s FROM ab_product p,ab_service s WHERE s.product_id=p.id AND s.active=1 AND p.site_id = s.site_id AND s.site_id=%s GROUP BY p.id',$columns,Company::instance()->site()),'Model_Product');
Block::factory()
->title(_('Products with Active Services'))
diff --git a/modules/product/classes/Controller/Product.php b/modules/product/classes/Controller/Product.php
index 85f1700d..10b301f0 100644
--- a/modules/product/classes/Controller/Product.php
+++ b/modules/product/classes/Controller/Product.php
@@ -24,7 +24,7 @@ class Controller_Product extends Controller_TemplateDefault {
$pco = ORM::factory('Product_Category',$this->request->param('id'));
// Only show categories that are active.
- if (! $pco->loaded() OR ((! $pco->status AND ! Kohana::$config->load('debug')->show_inactive)))
+ if (! $pco->loaded() OR ((! $pco->active AND ! Kohana::$config->load('debug')->show_inactive)))
HTTP::redirect('welcome/index');
$this->meta->title = $pco->name();
diff --git a/modules/product/classes/Model/Product.php b/modules/product/classes/Model/Product.php
index 6dbfaaf4..9860252a 100644
--- a/modules/product/classes/Model/Product.php
+++ b/modules/product/classes/Model/Product.php
@@ -25,12 +25,12 @@ class Model_Product extends ORM {
);
protected $_display_filters = array(
+ 'active'=>array(
+ array('StaticList_YesNo::get',array(':value',TRUE)),
+ ),
'price_type'=>array(
array('StaticList_PriceType::get',array(':value')),
),
- 'status'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
'taxable'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
diff --git a/modules/product/classes/Model/Product/Category.php b/modules/product/classes/Model/Product/Category.php
index 60187280..d0b57c7c 100644
--- a/modules/product/classes/Model/Product/Category.php
+++ b/modules/product/classes/Model/Product/Category.php
@@ -15,7 +15,7 @@ class Model_Product_Category extends ORM {
protected $_updated_column = FALSE;
protected $_nullifempty = array(
- 'status',
+ 'active',
'template',
);
diff --git a/modules/product/views/product/admin/edit.php b/modules/product/views/product/admin/edit.php
index b3ad8749..d37b6560 100644
--- a/modules/product/views/product/admin/edit.php
+++ b/modules/product/views/product/admin/edit.php
@@ -3,8 +3,8 @@
diff --git a/modules/product/views/product/category/admin/edit.php b/modules/product/views/product/category/admin/edit.php
index 34252e54..38b97626 100644
--- a/modules/product/views/product/category/admin/edit.php
+++ b/modules/product/views/product/category/admin/edit.php
@@ -3,7 +3,7 @@
- status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
+ active,FALSE,array('label'=>'Active','class'=>'span1')); ?>
diff --git a/modules/product/views/product/list.php b/modules/product/views/product/list.php
index 7f0b3941..2158a6b6 100644
--- a/modules/product/views/product/list.php
+++ b/modules/product/views/product/list.php
@@ -5,7 +5,7 @@
->columns(array(
'id'=>'ID',
'name(Site::language())'=>'Name',
- 'status'=>'Active',
+ 'active'=>'Active',
'prod_plugin_file'=>'Plugin Name',
'prod_plugin_data'=>'Plugin Data',
'price_type'=>'Price Type',
diff --git a/modules/service/classes/Controller/Admin/Service.php b/modules/service/classes/Controller/Admin/Service.php
index 8ffb8727..9c533d1d 100644
--- a/modules/service/classes/Controller/Admin/Service.php
+++ b/modules/service/classes/Controller/Admin/Service.php
@@ -166,11 +166,7 @@ $(document).ready(function() {
$bt = NULL;
$pr = TRUE; // Next entry is a pro-rata
foreach ($so->transactions()->where('item_type','=',0)->find_all() as $iio) {
- // @todo This hard coding of 3070 should be removed.
-// $xsid=197;
-// if (($iio->service_id == $xsid AND $iio->invoice_id < 3070) OR in_array($iio->id,array(960))) continue;
-
- if (! $iio->invoice->status OR $iio->void)
+ if (! $iio->invoice->active OR ! $iio->active)
continue;
if ($iio->quantity < 0 OR $iio->price_base < 0) {
diff --git a/modules/service/classes/Model/Service.php b/modules/service/classes/Model/Service.php
index 48f55116..e2eb9ef8 100644
--- a/modules/service/classes/Model/Service.php
+++ b/modules/service/classes/Model/Service.php
@@ -48,6 +48,9 @@ class Model_Service extends ORM {
* Filters used to format the display of values into friendlier values
*/
protected $_display_filters = array(
+ 'active'=>array(
+ array('StaticList_YesNo::get',array(':value',TRUE)),
+ ),
'date_start'=>array(
array('Site::Date',array(':value')),
),
@@ -72,9 +75,6 @@ class Model_Service extends ORM {
'suspend_billing'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
- 'status'=>array(
- array('StaticList_YesNo::get',array(':value',TRUE)),
- ),
);
protected $_nullifempty = array(
@@ -128,7 +128,7 @@ class Model_Service extends ORM {
->or_where('processed','=',FALSE)
->where_close();
- return $x->and_where('void','IS',NULL)->find_all();
+ return $x->where_active()->find_all();
}
/**
@@ -209,10 +209,10 @@ class Model_Service extends ORM {
return ORM::factory('Invoice_Item')
->where('item_type','IN',array(0,7))
->where('service_id','=',$this)
- ->where('invoice_item.void','IS',NULL)
+ ->where('invoice_item.active','=',1)
->join('invoice')
->on('invoice.id','=','invoice_item.invoice_id')
- ->on('invoice.status','=',1)
+ ->on('invoice.active','=',1)
->order_by('date_stop','DESC');
}
@@ -357,7 +357,7 @@ class Model_Service extends ORM {
->join('product')
->on($this->table_name().'.product_id','=','product.id')
->where('prod_plugin_file','=',$plugin)
- ->and_where('service.status','=',TRUE)
+ ->and_where('service.active','=',TRUE)
->find_all();
}
@@ -391,7 +391,7 @@ class Model_Service extends ORM {
* @param $days int Additional number of days to add to the query, above the module config.
*/
public function list_invoicesoon($days=0) {
- return $this->_where_active()
+ return $this->where_active()
->where_open()
->where('suspend_billing','IS',NULL)
->or_where('suspend_billing','=','0')
diff --git a/modules/service/classes/Model/Service/Plugin.php b/modules/service/classes/Model/Service/Plugin.php
index 81f3a46b..4656b2b9 100644
--- a/modules/service/classes/Model/Service/Plugin.php
+++ b/modules/service/classes/Model/Service/Plugin.php
@@ -42,7 +42,7 @@ abstract class Model_Service_Plugin extends ORM {
*/
protected function manage() {
// Dont show the manage button for expired or inactive services
- if (! $this->service->status OR $this->service->expiring())
+ if (! $this->service->active OR $this->service->expiring())
return FALSE;
static $x = '';
diff --git a/modules/service/views/service/admin/add.php b/modules/service/views/service/admin/add.php
index 3b879280..5731f866 100644
--- a/modules/service/views/service/admin/add.php
+++ b/modules/service/views/service/admin/add.php
@@ -3,7 +3,7 @@
set('data',['field'=>'account_id','value'=>$o->account_id,'text'=>'Account','name'=>'','ajaxurl'=>URL::link('admin','payment/ajaxlist')]);
- echo View::factory('field/select')->set('data',['field'=>'status','value'=>StaticList_YesNo::table(),'text'=>'Active','default'=>$o->status,'class'=>'col-md-1']);
+ echo View::factory('field/select')->set('data',['field'=>'active','value'=>StaticList_YesNo::table(),'text'=>'Active','default'=>$o->active,'class'=>'col-md-1']);
echo View::factory('field/select')->set('data',['field'=>'recur_schedule','value'=>StaticList_RecurSchedule::table(),'text'=>'Billing Period','default'=>$o->recur_schedule,'class'=>'col-md-2']);
echo View::factory('field/date')->set('data',['field'=>'data_next_invoice','value'=>$o->date_next_invoice ? $o->date_next_invoice : time(),'text'=>'Date Next Invoice','enddate'=>NULL]);
echo View::factory('field/select')->set('data',['field'=>'taxable','value'=>StaticList_YesNo::table(),'text'=>'Taxable','default'=>is_null($o->taxable) ? TRUE : $o->taxable,'class'=>'col-md-1']);
diff --git a/modules/service/views/service/admin/edit.php b/modules/service/views/service/admin/edit.php
index 8bdea37f..c9a6ae15 100644
--- a/modules/service/views/service/admin/edit.php
+++ b/modules/service/views/service/admin/edit.php
@@ -2,7 +2,7 @@