Changed use of active to status

This commit is contained in:
Deon George 2012-08-01 22:43:33 +10:00
parent e4d600b8d0
commit 4220ade8ac
40 changed files with 123 additions and 145 deletions

View File

@ -226,7 +226,7 @@ class Auth_OSB extends Auth_ORM {
} }
// If the passwords match, perform a login // If the passwords match, perform a login
if ($user->active AND $user->has_any('group',ORM::factory('group',array('name'=>'Registered Users'))->list_childgrps(TRUE)) AND $user->password === $password) if ($user->status AND $user->has_any('group',ORM::factory('group',array('name'=>'Registered Users'))->list_childgrps(TRUE)) AND $user->password === $password)
{ {
if ($remember === TRUE) if ($remember === TRUE)
{ {

View File

@ -24,15 +24,15 @@ class Model_Account extends Model_Auth_UserDefault {
); );
protected $_display_filters = array( protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'date_orig'=>array( 'date_orig'=>array(
array('Config::date',array(':value')), array('Config::date',array(':value')),
), ),
'date_last'=>array( 'date_last'=>array(
array('Config::date',array(':value')), array('Config::date',array(':value')),
), ),
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
),
); );
/** /**
@ -67,7 +67,7 @@ class Model_Account extends Model_Auth_UserDefault {
} }
public function country($name) { public function country($name) {
return StaticList_Module::form($name,'country',$this->country_id,'id','name',array('active'=>'=:1'),FALSE,array('class'=>'form_button')); return StaticList_Module::form($name,'country',$this->country_id,'id','name',array('status'=>'=:1'),FALSE,array('class'=>'form_button'));
} }
/** /**
@ -133,12 +133,12 @@ class Model_Account extends Model_Auth_UserDefault {
return $alo->saved(); return $alo->saved();
} }
private function _active() { private function _where_active() {
return $this->where('active','=',TRUE); return $this->where('status','=',TRUE);
} }
public function list_active() { public function list_active() {
return $this->_active()->order_by('company,last_name,first_name')->find_all(); return $this->_where_active()->order_by('company,last_name,first_name')->find_all();
} }
public function list_affiliates() { public function list_affiliates() {
@ -152,7 +152,7 @@ class Model_Account extends Model_Auth_UserDefault {
} }
public function count_services($active=TRUE,$afid=NULL) { public function count_services($active=TRUE,$afid=NULL) {
return count($this->list_services($active,$afid)); return $this->list_services($active,$afid)->count();
} }
/** /**
@ -200,7 +200,7 @@ class Model_Account extends Model_Auth_UserDefault {
} }
public function list_services($active=TRUE,$afid=NULL) { public function list_services($active=TRUE,$afid=NULL) {
$svs = $this->service->where('active','=',$active); $svs = $this->service->where_active();
if ($afid) if ($afid)
$svs->where('affiliate_id','=',$afid); $svs->where('affiliate_id','=',$afid);

View File

@ -209,12 +209,22 @@ abstract class ORMOSB extends ORM {
return empty($mc[$key]) ? '' : $mc[$key]; return empty($mc[$key]) ? '' : $mc[$key];
} }
protected function _active() { protected function _where_active() {
return $this->where('active','=',TRUE); return $this->where('status','=',TRUE);
}
public function where_active() {
return $this->_where_active();
} }
public function list_active() { public function list_active() {
return $this->_active()->find_all(); return $this->_where_active()->find_all();
}
public function list_count($active=TRUE) {
$a=($active ? $this->_where_active() : $this);
return $a->find_all()->count();
} }
} }
?> ?>

View File

@ -25,7 +25,7 @@ class Model_ADSL_Supplier extends ORMOSB {
$a = $this->adsl_supplier_plan; $a = $this->adsl_supplier_plan;
if ($active) if ($active)
$a->where('status','=',TRUE); $a->where_active();
return $a; return $a;
} }
@ -56,27 +56,18 @@ class Model_ADSL_Supplier extends ORMOSB {
// Start with all our ADSL Plans // 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->active) if (! $active OR $so->status)
if (in_array($so->product->prod_plugin_data,$plans) OR in_array($so->plugin()->provided_adsl_plan_id,$plans)) if (in_array($so->product->prod_plugin_data,$plans) OR in_array($so->plugin()->provided_adsl_plan_id,$plans))
array_push($services,$so); array_push($services,$so);
// @todo poor cludge, we should find them without using list_bylistgroup() // @todo poor cludge, we should find them without using list_bylistgroup()
if (! $services) if (! $services)
foreach (ORM::factory('service')->list_bylistgroup('HSPA') as $so) foreach (ORM::factory('service')->list_bylistgroup('HSPA') as $so)
if (! $active OR $so->active) if (! $active OR $so->status)
if (in_array($so->product->prod_plugin_data,$plans) OR in_array($so->plugin()->provided_adsl_plan_id,$plans)) if (in_array($so->product->prod_plugin_data,$plans) OR in_array($so->plugin()->provided_adsl_plan_id,$plans))
array_push($services,$so); array_push($services,$so);
return $services; return $services;
} }
/** LIST FUNCTIONS **/
/**
* Return a list of active suppliers
*/
public function list_active() {
return $this->where('status','=',1)->find_all();
}
} }
?> ?>

View File

@ -34,7 +34,7 @@ class Model_Checkout extends ORMOSB {
$this->and_where('allow_new','=',TRUE); $this->and_where('allow_new','=',TRUE);
foreach ($this->where('active','=',TRUE)->find_all() as $item) { foreach ($this->list_active() as $item) {
// Check that the cart total meets the minimum requirement // Check that the cart total meets the minimum requirement
if ($item->total_minimum AND $cart->total() < $item->total_minimum) if ($item->total_minimum AND $cart->total() < $item->total_minimum)
continue; continue;

View File

@ -27,7 +27,7 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin {
// @todo Change this to a view. // @todo Change this to a view.
$output = sprintf('<table class="box-full"><tr class="head"><td>%s</td></tr><tr><td>',_('Domains are available with the following suffixes')); $output = sprintf('<table class="box-full"><tr class="head"><td>%s</td></tr><tr><td>',_('Domains are available with the following suffixes'));
$output .= Table::display( $output .= Table::display(
$t->where('status','=','1')->find_all(), $t->list_active(),
25, 25,
array( array(
'display("name")'=>array('label'=>'TLD Suffix'), 'display("name")'=>array('label'=>'TLD Suffix'),

View File

@ -23,7 +23,7 @@ class Model_Email_Template extends ORMOSB {
); );
protected $_display_filters = array( protected $_display_filters = array(
'active'=>array( 'status'=>array(
array('StaticList_YesNo::display',array(':value')), array('StaticList_YesNo::display',array(':value')),
), ),
); );

View File

@ -5,7 +5,7 @@
</tr> </tr>
<tr> <tr>
<td class="head">Active:</td> <td class="head">Active:</td>
<td><?php echo StaticList_YesNo::form('active',TRUE); ?></td> <td><?php echo StaticList_YesNo::form('status',TRUE); ?></td>
</tr> </tr>
<tr> <tr>
<td class="head">Notes:</td> <td class="head">Notes:</td>

View File

@ -5,7 +5,7 @@
</tr> </tr>
<tr> <tr>
<td class="head">Active:</td> <td class="head">Active:</td>
<td><?php echo StaticList_YesNo::form('active',$template->active); ?></td> <td><?php echo StaticList_YesNo::form('status',$template->status); ?></td>
</tr> </tr>
<tr> <tr>
<td class="head">Notes:</td> <td class="head">Notes:</td>

View File

@ -1,4 +1,4 @@
<tr> <tr>
<td><a href="<?php echo URL::site('admin/email/templateedit/'.$template->id); ?>" alt=""><?php echo $template->name; ?></a></td> <td><a href="<?php echo URL::site('admin/email/templateedit/'.$template->id); ?>" alt=""><?php echo $template->name; ?></a></td>
<td><?php echo $template->display('active'); ?></td> <td><?php echo $template->display('status'); ?></td>
</tr> </tr>

View File

@ -510,15 +510,11 @@ class Model_Invoice extends ORMOSB {
return $return; return $return;
} }
private function _list_active() {
return ORM::factory('invoice')->where('status','=',1);
}
private function _list_due() { private function _list_due() {
static $result = array(); static $result = array();
if (! $result) if (! $result)
foreach ($this->_list_active()->find_all() as $io) foreach ($this->list_active() as $io)
if ($io->due()) if ($io->due())
array_push($result,$io); array_push($result,$io);

View File

@ -12,7 +12,7 @@
</tr> </tr>
<tr> <tr>
<td>Method</td> <td>Method</td>
<td><?php echo StaticList_Module::form('checkout_plugin_id','checkout',$po->checkout_plugin_id,'id','name',array('active'=>'=:1'),TRUE,array('class'=>'form_button'));?></td> <td><?php echo StaticList_Module::form('checkout_plugin_id','checkout',$po->checkout_plugin_id,'id','name',array('status'=>'=:1'),TRUE,array('class'=>'form_button'));?></td>
</tr> </tr>
<tr> <tr>
<td>Amount</td> <td>Amount</td>

View File

@ -41,7 +41,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
if ($this->request->param('id')) if ($this->request->param('id'))
$prods = ORM::factory('product')->list_category($this->request->param('id'),FALSE); $prods = ORM::factory('product')->list_category($this->request->param('id'),FALSE);
else else
$prods = ORM::factory('product')->order_by('active DESC,prod_plugin_file')->find_all(); $prods = ORM::factory('product')->order_by('status DESC,prod_plugin_file')->find_all();
Block::add(array( Block::add(array(
'title'=>_('Customer Products'), 'title'=>_('Customer Products'),
@ -51,14 +51,14 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
array( array(
'id'=>array('label'=>'ID','url'=>'product/view/'), 'id'=>array('label'=>'ID','url'=>'product/view/'),
'name()'=>array('label'=>'Details'), 'name()'=>array('label'=>'Details'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'prod_plugin_file'=>array('label'=>'Plugin Name'), 'prod_plugin_file'=>array('label'=>'Plugin Name'),
'prod_plugin_data'=>array('label'=>'Plugin Data'), 'prod_plugin_data'=>array('label'=>'Plugin Data'),
'price_type'=>array('label'=>'Price Type'), 'price_type'=>array('label'=>'Price Type'),
'price_base'=>array('label'=>'Price Base'), 'price_base'=>array('label'=>'Price Base'),
'taxable'=>array('label'=>'Taxable'), 'taxable'=>array('label'=>'Taxable'),
'services_count()'=>array('label'=>'Services'), 'count_services()'=>array('label'=>'Services'),
'invoices_count()'=>array('label'=>'Invoices'), 'count_invoices()'=>array('label'=>'Invoices'),
), ),
array( array(
'page'=>TRUE, 'page'=>TRUE,
@ -130,7 +130,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
'account->accnum()'=>array(), 'account->accnum()'=>array(),
'account->name()'=>array('label'=>'Account'), 'account->name()'=>array('label'=>'Account'),
'name()'=>array('label'=>'Details'), 'name()'=>array('label'=>'Details'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'price(TRUE,TRUE)'=>array('label'=>'Price','align'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','align'=>'right'),
), ),
array( array(

View File

@ -15,7 +15,7 @@ class Controller_Product extends Controller_TemplateDefault {
$output = '<div id="category">'; $output = '<div id="category">';
$output .= '<ul>'; $output .= '<ul>';
foreach (ORM::factory('product_category')->list_active()->find_all() as $pco) { foreach (ORM::factory('product_category')->list_active() as $pco) {
$a = '<h3>'.$pco->display('name').'</h3>'; $a = '<h3>'.$pco->display('name').'</h3>';
$a .= '<p>'.$pco->description().'</p>'; $a .= '<p>'.$pco->description().'</p>';

View File

@ -26,9 +26,6 @@ class Model_Product extends ORMOSB {
); );
protected $_display_filters = array( protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'price_base'=>array( 'price_base'=>array(
array('Tax::add',array(':value')), array('Tax::add',array(':value')),
array('Currency::display',array(':value')), array('Currency::display',array(':value')),
@ -36,6 +33,9 @@ class Model_Product extends ORMOSB {
'price_type'=>array( 'price_type'=>array(
array('StaticList_PriceType::display',array(':value')), array('StaticList_PriceType::display',array(':value')),
), ),
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'taxable'=>array( 'taxable'=>array(
array('StaticList_YesNo::display',array(':value')), array('StaticList_YesNo::display',array(':value')),
), ),
@ -173,6 +173,20 @@ class Model_Product extends ORMOSB {
return array('price_base','price_setup'); return array('price_base','price_setup');
} }
/**
* List the number of services using this product
*/
public function count_services() {
return $this->service->list_count(TRUE);
}
/**
* List the number of invoices using this product
*/
public function count_invoices() {
return $this->invoice->list_count(TRUE);
}
/** /**
* Return the price for the particle group and price option for the period * Return the price for the particle group and price option for the period
*/ */
@ -182,20 +196,6 @@ class Model_Product extends ORMOSB {
return isset($x[$grp][$option]) ? $x[$grp][$option] : NULL; return isset($x[$grp][$option]) ? $x[$grp][$option] : NULL;
} }
/**
* List the number of services using this product
*/
public function services_count() {
return $this->service->where('active','=',1)->find_all()->count();
}
/**
* List the number of invoices using this product
*/
public function invoices_count() {
return $this->invoice->where('status','=',1)->find_all()->count();
}
/** /**
* Return the products for a given category * Return the products for a given category
* @todo This shouldnt be here. * @todo This shouldnt be here.
@ -203,10 +203,7 @@ class Model_Product extends ORMOSB {
public function list_category($cat,$active=TRUE) { public function list_category($cat,$active=TRUE) {
$results = array(); $results = array();
if ($active) $cats = $active ? $this->_where_active() : $this;
$cats = $this->where('active','=',TRUE);
else
$cats = $this;
foreach ($cats->find_all() as $po) { foreach ($cats->find_all() as $po) {
if ($c = unserialize($po->avail_category) AND in_array($cat,$c)) if ($c = unserialize($po->avail_category) AND in_array($cat,$c))

View File

@ -30,10 +30,6 @@ class Model_Product_Category extends ORMOSB {
return ($a=$this->product_category_translate->where('language_id','=',$ao->language_id)->find()->description) ? $a : _('No Description'); return ($a=$this->product_category_translate->where('language_id','=',$ao->language_id)->find()->description) ? $a : _('No Description');
} }
public function list_active() {
return $this->where('status','=',1);
}
public function list_bylistgroup($cat) { public function list_bylistgroup($cat) {
$result = array(); $result = array();

View File

@ -7,7 +7,7 @@
<tr> <tr>
<td style="width: 40%;">Product Active</td> <td style="width: 40%;">Product Active</td>
<td style="width: 5%;">&nbsp;</td> <td style="width: 5%;">&nbsp;</td>
<td style="width: 60%;" class="data"><?php echo StaticList_YesNo::form('active',$po->active); ?></td> <td style="width: 60%;" class="data"><?php echo StaticList_YesNo::form('status',$po->status); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="2">Base Price</td> <td colspan="2">Base Price</td>

View File

@ -34,7 +34,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
public function action_autolist() { public function action_autolist() {
$return = array(); $return = array();
$s = ORM::factory('service')->where('active','=',1); $s = ORM::factory('service')->where_active();
if (isset($_REQUEST['aid'])) if (isset($_REQUEST['aid']))
$s = $s->where('account_id','=',$_REQUEST['aid']); $s = $s->where('account_id','=',$_REQUEST['aid']);
@ -64,7 +64,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
'service_name()'=>array('label'=>'Details'), 'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'), 'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'account->accnum()'=>array('label'=>'Cust ID'), 'account->accnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'), 'account->name()'=>array('label'=>'Customer'),
), ),
@ -101,7 +101,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
'service_name()'=>array('label'=>'Details'), 'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'), 'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'account->accnum()'=>array('label'=>'Cust ID'), 'account->accnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'), 'account->name()'=>array('label'=>'Customer'),
'date_next_invoice'=>array('label'=>'Next Invoice'), 'date_next_invoice'=>array('label'=>'Next Invoice'),
@ -114,7 +114,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
)), )),
)); ));
foreach (ORM::factory('checkout')->where('active','=',1)->find_all() as $co) { foreach (ORM::factory('checkout')->list_active() as $co) {
$svs = array(); $svs = array();
foreach ($co->account->find_all() as $ao) foreach ($co->account->find_all() as $ao)
@ -133,7 +133,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
'service_name()'=>array('label'=>'Details'), 'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'), 'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'account->accnum()'=>array('label'=>'Cust ID'), 'account->accnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'), 'account->name()'=>array('label'=>'Customer'),
'date_next_invoice'=>array('label'=>'Next Invoice'), 'date_next_invoice'=>array('label'=>'Next Invoice'),
@ -209,7 +209,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
'account->accnum()'=>array('label'=>'Cust ID'), 'account->accnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'), 'account->name()'=>array('label'=>'Customer'),
'date_next_invoice'=>array('label'=>'Next Invoice'), 'date_next_invoice'=>array('label'=>'Next Invoice'),
'product->display("active")'=>array('label'=>'Current'), 'product->display("status")'=>array('label'=>'Current'),
), ),
array( array(
'type'=>'select', 'type'=>'select',
@ -603,7 +603,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
'date_next_invoice'=>array('label'=>'Next Invoice'), 'date_next_invoice'=>array('label'=>'Next Invoice'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'charges_new()'=>array('label'=>'Charges','class'=>'right'), 'charges_new()'=>array('label'=>'Charges','class'=>'right'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'account->accnum()'=>array('label'=>'Cust ID'), 'account->accnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'), 'account->name()'=>array('label'=>'Customer'),
), ),

View File

@ -34,7 +34,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
'service_name()'=>array('label'=>'Details'), 'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'), 'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'account->accnum()'=>array('label'=>'Cust ID'), 'account->accnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'), 'account->name()'=>array('label'=>'Customer'),
), ),
@ -71,7 +71,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
'service_name()'=>array('label'=>'Details'), 'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'), 'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'account->accnum()'=>array('label'=>'Cust ID'), 'account->accnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'), 'account->name()'=>array('label'=>'Customer'),
'date_next_invoice'=>array('label'=>'Next Invoice'), 'date_next_invoice'=>array('label'=>'Next Invoice'),
@ -89,7 +89,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
'body'=>_('None found'), 'body'=>_('None found'),
)); ));
foreach (ORM::factory('checkout')->where('active','=',1)->find_all() as $co) { foreach (ORM::factory('checkout')->list_active() as $co) {
$svs = array(); $svs = array();
foreach ($co->account->find_all() as $ao) foreach ($co->account->find_all() as $ao)
@ -108,7 +108,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
'service_name()'=>array('label'=>'Details'), 'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'), 'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'account->accnum()'=>array('label'=>'Cust ID'), 'account->accnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'), 'account->name()'=>array('label'=>'Customer'),
'date_next_invoice'=>array('label'=>'Next Invoice'), 'date_next_invoice'=>array('label'=>'Next Invoice'),

View File

@ -47,7 +47,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User {
'service_name()'=>array('label'=>'Details'), 'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'), 'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'active'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
), ),
array( array(
'page'=>TRUE, 'page'=>TRUE,

View File

@ -32,9 +32,6 @@ class Model_Service extends ORMOSB {
* Filters used to format the display of values into friendlier values * Filters used to format the display of values into friendlier values
*/ */
protected $_display_filters = array( protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'date_last_invoice'=>array( 'date_last_invoice'=>array(
array('Config::date',array(':value')), array('Config::date',array(':value')),
), ),
@ -44,6 +41,9 @@ class Model_Service extends ORMOSB {
'recur_schedule'=>array( 'recur_schedule'=>array(
array('StaticList_RecurSchedule::display',array(':value')), array('StaticList_RecurSchedule::display',array(':value')),
), ),
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
),
); );
/** /**
@ -143,14 +143,6 @@ class Model_Service extends ORMOSB {
/** LIST FUNCTIONS **/ /** LIST FUNCTIONS **/
private function _list_active() {
return $this->where('active','=',1);
}
public function list_active() {
return $this->_list_active()->find_all();
}
public function list_bylistgroup($cat) { public function list_bylistgroup($cat) {
$result = array(); $result = array();
@ -174,7 +166,7 @@ class Model_Service extends ORMOSB {
* @param $days int Additional number of days to add to the query, above the module config. * @param $days int Additional number of days to add to the query, above the module config.
*/ */
public function list_invoicesoon($days=0) { public function list_invoicesoon($days=0) {
return $this->_list_active() return $this->_where_active()
->where_open()->where('suspend_billing','IS',NULL)->or_where('suspend_billing','=','0')->where_close() ->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(); ->find_all();
@ -184,7 +176,7 @@ class Model_Service extends ORMOSB {
* List services that need to be provisioned * List services that need to be provisioned
*/ */
public function list_provision() { public function list_provision() {
return $this->_list_active()->where('queue','=','PROVISION'); return $this->_where_active()->where('queue','=','PROVISION');
} }
} }
?> ?>

View File

@ -6,7 +6,7 @@
<table width="100%"> <table width="100%">
<tr> <tr>
<td style="width: 40%;">Service Active</td> <td style="width: 40%;">Service Active</td>
<td style="width: 60%;" class="data"><?php echo StaticList_YesNo::form('active',$so->active); ?></td> <td style="width: 60%;" class="data"><?php echo StaticList_YesNo::form('status',$so->status); ?></td>
</tr> </tr>
<tr> <tr>
<td>Queue</td> <td>Queue</td>

View File

@ -10,7 +10,7 @@
</tr> </tr>
<tr> <tr>
<td>Service Active</td> <td>Service Active</td>
<td class="data"><?php echo $so->display('active'); ?></td> <td class="data"><?php echo $so->display('status'); ?></td>
</tr> </tr>
<tr> <tr>
<td>Billing Period</td> <td>Billing Period</td>

View File

@ -121,7 +121,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
} }
public function download_button() { public function download_button() {
if (! $this->service->active OR ! preg_match('/client/',$this->service->product->plugin()->extensions) OR $this->valid_to() < time()) if (! $this->service->status OR ! preg_match('/client/',$this->service->product->plugin()->extensions) OR $this->valid_to() < time())
return ''; return '';
// @todo Do some password validation // @todo Do some password validation

View File

@ -81,14 +81,10 @@ class Model_Task extends ORMOSB {
/** LIST FUNCTIONS **/ /** LIST FUNCTIONS **/
private function _list_active() {
return $this->where('status','=',1)->find_all();
}
public function list_active() { public function list_active() {
$return = array(); $return = array();
foreach ($this->_list_active() as $to) { foreach ($this->_where_active()->find_all() as $to) {
$ct = sprintf('%s %s %s %s %s',$to->int_min,$to->int_hour,$to->int_month_day,$to->int_month,$to->int_week_day); $ct = sprintf('%s %s %s %s %s',$to->int_min,$to->int_hour,$to->int_month_day,$to->int_month,$to->int_week_day);
$c = new Cron($ct,$to->command); $c = new Cron($ct,$to->command);