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 ($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)
{

View File

@ -79,7 +79,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault_Admin {
'order'=>1,
));
// Show un-applied payments
// Show un-applied payments
Block_Sub::add(array(
'title'=>'Unapplied Payments',
'body'=>Table::display(

View File

@ -73,7 +73,7 @@ class Controller_Tree extends lnApp_Controller_Tree {
$subdata[$sub][$name]['name'] = preg_replace('/^(.*: )/','',$mmo->notes);
$subdata[$sub][$name]['id'] = sprintf('%s_%s',$mmo->module_id,$id);
$subdata[$sub][$name]['href'] = (empty($details['page']) ? $url : $details['page']);
} else {
// We dont want to show these items again, if we can through on a submenu
if (! $idx)

View File

@ -41,7 +41,7 @@ tinyMCE.init({
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "iespell,media,advhr",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "center",
theme_advanced_toolbar_align : "center",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",

View File

@ -20,7 +20,7 @@ class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 {
public static function handler(Exception $e)
{
SystemMessage::add(array(
'title'=>_('Page not found'),
'title'=>_('Page not found'),
'type'=>'error',
'body'=>sprintf(_('The page [%s] you requested was not found?'),Request::detect_uri()),
));

View File

@ -18,7 +18,7 @@ class Kohana extends Kohana_Core {
* unless each site has exactly the same modules enabled.
* This is because Kohana::$file is cached with the enabled modules
* and is not OSB multi-site aware.
*
*
* @todo It might be nice to cache the Kohana::$file site-aware for improved performance
*/
public static function shutdown_handler() {

View File

@ -33,13 +33,13 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
if ($redir = Session::instance()->get('afterlogin')) {
Session::instance()->delete('afterlogin');
Request::current()->redirect($redir);
} else
Request::current()->redirect('user/welcome/index');
} else {
SystemMessage::add(array(
'title'=>_('Invalid username or password'),
'title'=>_('Invalid username or password'),
'type'=>'error',
'body'=>_('The username or password was invalid.')
));
@ -81,7 +81,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
// Generic validation reason
default:
SystemMessage::add(array(
'title'=>_('Validation failed'),
'title'=>_('Validation failed'),
'type'=>'error',
'body'=>sprintf(_('The defaults on your submission were not valid for field %s (%s).'),$f,$r)
));
@ -100,7 +100,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
}
SystemMessage::add(array(
'title'=>_('Already have an account?'),
'title'=>_('Already have an account?'),
'type'=>'info',
'body'=>_('If you already have an account, please login..')
));
@ -184,7 +184,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
public function action_noaccess() {
SystemMessage::add(array(
'title'=>_('No access to requested resource'),
'title'=>_('No access to requested resource'),
'type'=>'error',
'body'=>_('You do not have access to the requested resource, please contact your administrator.')
));

View File

@ -16,7 +16,7 @@ abstract class lnApp_PWgen {
throw new Kohana_Exception('No configuration for host or port (:host/:port)',array(':host'=>Kohana::Config('pwgen.host'),':port'=>Kohana::Config('pwgen.port')));
$ps = socket_create(AF_INET,SOCK_STREAM,0);
if (! socket_connect($ps,Kohana::Config('pwgen.host'),Kohana::Config('pwgen.port')))
if (! socket_connect($ps,Kohana::Config('pwgen.host'),Kohana::Config('pwgen.port')))
throw new Kohana_Exception('Unable to connect to password server');
// echo "Reading response:\n\n";

View File

@ -24,15 +24,15 @@ class Model_Account extends Model_Auth_UserDefault {
);
protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'date_orig'=>array(
array('Config::date',array(':value')),
),
'date_last'=>array(
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) {
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();
}
private function _active() {
return $this->where('active','=',TRUE);
private function _where_active() {
return $this->where('status','=',TRUE);
}
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() {
@ -152,7 +152,7 @@ class Model_Account extends Model_Auth_UserDefault {
}
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) {
$svs = $this->service->where('active','=',$active);
$svs = $this->service->where_active();
if ($afid)
$svs->where('affiliate_id','=',$afid);

View File

@ -209,12 +209,22 @@ abstract class ORMOSB extends ORM {
return empty($mc[$key]) ? '' : $mc[$key];
}
protected function _active() {
return $this->where('active','=',TRUE);
protected function _where_active() {
return $this->where('status','=',TRUE);
}
public function where_active() {
return $this->_where_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

@ -20,7 +20,7 @@ class Valid extends Kohana_Valid {
* @return boolean
*/
public static function matches_ifset($array, $field, $match)
{
{
return isset($array[$match]) ? ($array[$field] === $array[$match]) : TRUE;
}
}

View File

@ -25,7 +25,7 @@ class Model_ADSL_Supplier extends ORMOSB {
$a = $this->adsl_supplier_plan;
if ($active)
$a->where('status','=',TRUE);
$a->where_active();
return $a;
}
@ -56,27 +56,18 @@ class Model_ADSL_Supplier extends ORMOSB {
// Start with all our ADSL Plans
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))
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 (! $active OR $so->status)
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;
}
/** LIST FUNCTIONS **/
/**
* Return a list of active suppliers
*/
public function list_active() {
return $this->where('status','=',1)->find_all();
}
}
?>

View File

@ -160,7 +160,7 @@ class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
}
}
}
// If we got here and have data, we had a good fetch, update the stats date
$so->plugin()->service_stats_lastupdate = $lastday;
$so->plugin()->save();

View File

@ -153,7 +153,7 @@ class Service_Traffic_ADSL_ExetelPE extends Service_Traffic_ADSL {
}
}
}
// If we got here and have data, we had a good fetch, update the stats date
$so->plugin()->service_stats_lastupdate = $lastday;
$so->plugin()->save();

View File

@ -89,7 +89,7 @@ class Service_Traffic_ADSL_iiNetADSL extends Service_Traffic_ADSL {
foreach ($day_hour->get('usage') as $usage) {
$fields = $usage->attributes();
// If we find a field we dont understand, we'll return.
if (empty($fields['type']) OR empty($this->fields[$fields['type']]))
return array();

View File

@ -94,32 +94,32 @@ class Controller_Admin_Charge extends Controller_TemplateDefault_Admin {
source: "'.URL::site('admin/account/autocomplete').'",
minLength: 2,
change: function(event,ui) {
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
data: "aid="+$(this).val(),
dataType: "json",
cache: false,
url: "'.URL::site('admin/service/autolist').'",
timeout: 2000,
error: function() {
alert("Failed to submit");
},
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
data: "aid="+$(this).val(),
dataType: "json",
cache: false,
url: "'.URL::site('admin/service/autolist').'",
timeout: 2000,
error: function() {
alert("Failed to submit");
},
success: function(data) {
// Clear all options from sub category select
$("select[name=service_id] option").remove();
// Clear all options from sub category select
$("select[name=service_id] option").remove();
// Prepopulate a blank
var row = "<option value=\"\">&nbsp;</option>";
$(row).appendTo("select[name=service_id]");
// Fill sub category select
$.each(data, function(i, j){
var row = "<option value=\"" + j.value + "\">" + j.text + "</option>";
$(row).appendTo("select[name=service_id]");
});
}
});
var row = "<option value=\"\">&nbsp;</option>";
$(row).appendTo("select[name=service_id]");
// Fill sub category select
$.each(data, function(i, j){
var row = "<option value=\"" + j.value + "\">" + j.text + "</option>";
$(row).appendTo("select[name=service_id]");
});
}
});
}
});
});'

View File

@ -34,7 +34,7 @@ class Model_Checkout extends ORMOSB {
$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
if ($item->total_minimum AND $cart->total() < $item->total_minimum)
continue;

View File

@ -27,12 +27,12 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin {
// @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 .= Table::display(
$t->where('status','=','1')->find_all(),
$t->list_active(),
25,
array(
array(
'display("name")'=>array('label'=>'TLD Suffix'),
),
array(
array(
));
$output .= '</td></tr></table>';

View File

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

View File

@ -5,7 +5,7 @@
</tr>
<tr>
<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>
<td class="head">Notes:</td>

View File

@ -5,7 +5,7 @@
</tr>
<tr>
<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>
<td class="head">Notes:</td>

View File

@ -1,4 +1,4 @@
<tr>
<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>

View File

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

View File

@ -204,7 +204,7 @@
</tr>
<!-- END Invoice Total -->
<!-- Account Total Due -->
<tr>
<tr>
<td class="head" colspan="2">Total Outstanding This Account:</td>
<td class="bold-right" colspan="2"><?php echo $io->account->invoices_due_total(NULL,TRUE); ?></td>
</tr>

View File

@ -12,7 +12,7 @@
</tr>
<tr>
<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>
<td>Amount</td>

View File

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

View File

@ -15,7 +15,7 @@ class Controller_Product extends Controller_TemplateDefault {
$output = '<div id="category">';
$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 .= '<p>'.$pco->description().'</p>';

View File

@ -26,9 +26,6 @@ class Model_Product extends ORMOSB {
);
protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'price_base'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
@ -36,6 +33,9 @@ class Model_Product extends ORMOSB {
'price_type'=>array(
array('StaticList_PriceType::display',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'taxable'=>array(
array('StaticList_YesNo::display',array(':value')),
),
@ -173,6 +173,20 @@ class Model_Product extends ORMOSB {
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
*/
@ -182,20 +196,6 @@ class Model_Product extends ORMOSB {
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
* @todo This shouldnt be here.
@ -203,10 +203,7 @@ class Model_Product extends ORMOSB {
public function list_category($cat,$active=TRUE) {
$results = array();
if ($active)
$cats = $this->where('active','=',TRUE);
else
$cats = $this;
$cats = $active ? $this->_where_active() : $this;
foreach ($cats->find_all() as $po) {
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');
}
public function list_active() {
return $this->where('status','=',1);
}
public function list_bylistgroup($cat) {
$result = array();

View File

@ -7,7 +7,7 @@
<tr>
<td style="width: 40%;">Product Active</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>
<td colspan="2">Base Price</td>

View File

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

View File

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

View File

@ -14,7 +14,7 @@ class Controller_Task_Service extends Controller_Task {
private function _traffic_suppliers($active=FALSE) {
$suppliers = ORM::factory('adsl_supplier');
return $active ? $suppliers->list_active() : $suppliers->find_all();
return $active ? $suppliers->list_active() : $suppliers->find_all();
}
/**

View File

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

View File

@ -32,9 +32,6 @@ class Model_Service extends ORMOSB {
* Filters used to format the display of values into friendlier values
*/
protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'date_last_invoice'=>array(
array('Config::date',array(':value')),
),
@ -44,6 +41,9 @@ class Model_Service extends ORMOSB {
'recur_schedule'=>array(
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 **/
private function _list_active() {
return $this->where('active','=',1);
}
public function list_active() {
return $this->_list_active()->find_all();
}
public function list_bylistgroup($cat) {
$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.
*/
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('date_next_invoice','<',time()+(ORM::factory('invoice')->config('GEN_DAYS')+$days)*86400)
->find_all();
@ -184,7 +176,7 @@ class Model_Service extends ORMOSB {
* List services that need to be provisioned
*/
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%">
<tr>
<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>
<td>Queue</td>

View File

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

View File

@ -25,7 +25,7 @@ class Controller_User_SSL extends Controller_TemplateDefault_User {
$passwd = $_POST['passwd'];
if (strlen($passwd) < Kohana::config('ssl.minpass_length')) {
SystemMessage::add(array(
'title'=>_('Validation failed'),
'title'=>_('Validation failed'),
'type'=>'error',
'body'=>_('Your requested password is too short.'),
));

View File

@ -121,7 +121,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
}
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 '';
// @todo Do some password validation

View File

@ -81,14 +81,10 @@ class Model_Task extends ORMOSB {
/** LIST FUNCTIONS **/
private function _list_active() {
return $this->where('status','=',1)->find_all();
}
public function list_active() {
$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);
$c = new Cron($ct,$to->command);