Replace status with active in tables

This commit is contained in:
Deon George 2016-08-31 15:03:09 +10:00
parent 34e1e40f04
commit 54e4425aa8
51 changed files with 95 additions and 159 deletions

View File

@ -118,7 +118,7 @@ class Auth_OSB extends Auth_ORM {
$password = $this->hash($password); $password = $this->hash($password);
// If the passwords match, perform a login // 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. // @todo This is not currently used.
if ($remember === TRUE) { if ($remember === TRUE) {

View File

@ -21,7 +21,7 @@ class Company {
if (! $this->so->loaded()) if (! $this->so->loaded())
throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http'))); 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() { public static function instance() {

View File

@ -43,7 +43,7 @@ class Controller_Reseller_Account extends Controller_Account {
public function action_view() { public function action_view() {
$ao = ORM::factory('Account',$this->request->param('id')); $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'); throw HTTP_Exception::factory(403,'Account either doesnt exist, or you are not authorised to see it');
$this->meta->title = 'Customer: '.$ao->name(); $this->meta->title = 'Customer: '.$ao->name();

View File

@ -31,15 +31,15 @@ class Model_Account extends lnApp_Model_Account {
); );
protected $_display_filters = array( protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
'date_orig'=>array( 'date_orig'=>array(
array('Site::Date',array(':value')), array('Site::Date',array(':value')),
), ),
'date_last'=>array( 'date_last'=>array(
array('Site::Date',array(':value')), array('Site::Date',array(':value')),
), ),
'status'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
); );
/** REQUIRED ABSTRACT METHODS **/ /** REQUIRED ABSTRACT METHODS **/

View File

@ -19,7 +19,7 @@ class Model_Group extends Model_Auth_Role {
); );
protected $_display_filters = array( protected $_display_filters = array(
'status'=>array( 'active'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)), array('StaticList_YesNo::get',array(':value',TRUE)),
), ),
); );

View File

@ -1,55 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* OSB Application Module Model
*
* This module must remain in applications/ as it is used very early in the
* OSB initialisation.
*
* @package OSB
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Module extends ORM {
// Relationships
protected $_has_one = array(
'record_id'=>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();
}
}
?>

View File

@ -45,13 +45,6 @@ abstract class ORM extends lnApp_ORM {
return parent::_build($type); 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 * 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 * Function help to find records that are active
*/ */
final public function list_active($active=TRUE) { final public function list_active($active=TRUE) {
$x=($active ? $this->_where_active() : $this); $x=($active ? $this->where_active() : $this);
return $x->find_all(); return $x->find_all();
} }
/**
* Function help to find records that are active
*/
final public function where_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. // @todo This function shouldnt be here.

View File

@ -26,7 +26,7 @@ class Request extends lnApp_Request {
$mo = ORM::factory('Module',array('name'=>$c)); $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); $method = strtolower($this->_directory ? sprintf('%s:%s',$this->_directory.($x ? '_'.$x : ''),$this->_action) : $this->_action);
// Get the method number // Get the method number

View File

@ -18,7 +18,7 @@ class Task_Account_Complete extends Minion_Task {
foreach ($o->find_all() as $ao) { foreach ($o->find_all() as $ao) {
if (count($ao->invoice->where_unprocessed()->find_all()) == 0 AND count($ao->service->where_active()->find_all()) == 0) 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(); $ao->save();

View File

@ -4,7 +4,7 @@
->jssort('customer') ->jssort('customer')
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'status'=>'Active', 'active'=>'Active',
'refnum()'=>'Num', 'refnum()'=>'Num',
'name()'=>'Account', 'name()'=>'Account',
'email'=>'Email', 'email'=>'Email',

View File

@ -5,6 +5,6 @@
->title(sprintf('InActive Services for Account: %s',$o->refnum())) ->title(sprintf('InActive Services for Account: %s',$o->refnum()))
->title_icon('fa fa-barcode') ->title_icon('fa fa-barcode')
->span(6) ->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())); ?>
<?php echo View::factory('invoice/user/next')->set('o',$o); ?> <?php echo View::factory('invoice/user/next')->set('o',$o); ?>

View File

@ -44,7 +44,7 @@ class Controller_Admin_Adsl extends Controller_Adsl {
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'supplier_plan->name()'=>'Plan', 'supplier_plan->name()'=>'Plan',
'supplier_plan->display("status")'=>'Avail', 'supplier_plan->display("active")'=>'Avail',
'base_down_peak'=>'PD', 'base_down_peak'=>'PD',
'base_down_offpeak'=>'OPD', 'base_down_offpeak'=>'OPD',
'base_up_peak'=>'PU', 'base_up_peak'=>'PU',
@ -181,7 +181,7 @@ class Controller_Admin_Adsl extends Controller_Adsl {
'service'=>'Service Login', 'service'=>'Service Login',
'plan->service->id'=>'Service', 'plan->service->id'=>'Service',
'plan->service_number'=>'Service', 'plan->service_number'=>'Service',
'plan->service->status'=>'Active', 'plan->service->active'=>'Active',
'up_peak'=>'Up Peak', 'up_peak'=>'Up Peak',
'down_peak'=>'Down Peak', 'down_peak'=>'Down Peak',
'up_offpeak'=>'Up OffPeak', 'up_offpeak'=>'Up OffPeak',

View File

@ -29,6 +29,9 @@ class Model_ADSL_Supplier_Plan extends ORM {
* 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::get',array(':value',TRUE)),
),
'base_cost'=>array( 'base_cost'=>array(
array('Tax::add',array(':value')), array('Tax::add',array(':value')),
array('Currency::display',array(':value')), array('Currency::display',array(':value')),
@ -49,9 +52,6 @@ class Model_ADSL_Supplier_Plan extends ORM {
array('Tax::add',array(':value')), array('Tax::add',array(':value')),
array('Currency::display',array(':value')), array('Currency::display',array(':value')),
), ),
'status'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
); );
// Map the table fields // Map the table fields

View File

@ -82,7 +82,7 @@ class Controller_Reseller_Charge extends Controller_Charge {
Block::factory() Block::factory()
->title('Customer Charges') ->title('Customer Charges')
->title_icon('fa fa-list') ->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()));
} }
} }
?> ?>

View File

@ -29,6 +29,9 @@ class Model_Charge extends ORM {
); );
protected $_display_filters = array( protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
'amount'=>array( 'amount'=>array(
array('Currency::display',array(':value')), array('Currency::display',array(':value')),
), ),
@ -44,9 +47,6 @@ class Model_Charge extends ORM {
'sweep_type'=>array( 'sweep_type'=>array(
array('StaticList_SweepType::get',array(':value')), array('StaticList_SweepType::get',array(':value')),
), ),
'void'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
); );
/** /**

View File

@ -62,7 +62,7 @@ abstract class Checkout_Plugin_Paypal extends Checkout_Plugin {
$debug_mode = Kohana::$config->load('debug')->checkout_notify; $debug_mode = Kohana::$config->load('debug')->checkout_notify;
// If testing // 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'); return _('Thank you');
$co = Cart::instance(isset($cno->data['custom']) ? $cno->data['custom'] : ''); $co = Cart::instance(isset($cno->data['custom']) ? $cno->data['custom'] : '');
@ -200,14 +200,14 @@ abstract class Checkout_Plugin_Paypal extends Checkout_Plugin {
} }
} else { } else {
$cno->status = FALSE; $cno->active = FALSE;
} }
break; break;
case 'INVALID': case 'INVALID':
default: default:
$cno->status = FALSE; $cno->active = FALSE;
} }
if (! $debug_mode) if (! $debug_mode)

View File

@ -63,7 +63,7 @@ class Controller_Checkout extends Controller_TemplateDefault {
if (! $test_id) { if (! $test_id) {
$cno->checkout_id = $co->id; $cno->checkout_id = $co->id;
$cno->status = 1; $cno->active = 1;
$cno->data = Request::current()->post(); $cno->data = Request::current()->post();
$cno->save(); $cno->save();

View File

@ -21,7 +21,7 @@ class Task_Checkout_Notify_List extends Minion_Task {
$cno->display('date_orig'), $cno->display('date_orig'),
$cno->checkout_id, $cno->checkout_id,
$cno->checkout->name, $cno->checkout->name,
$cno->status ? 'A' : 'I', $cno->active ? 'A' : 'I',
$cno->processed ? 'A' : 'I', $cno->processed ? 'A' : 'I',
$cno->data['mc_gross'], $cno->data['mc_gross'],
$cno->data['mc_fee'], $cno->data['mc_fee'],

View File

@ -24,7 +24,7 @@ class Controller_Admin_Service_Domain extends Controller_Domain {
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'name()'=>'Domain', 'name()'=>'Domain',
'status'=>'Active', 'active'=>'Active',
'suspend_billing'=>'Not Bill', 'suspend_billing'=>'Not Bill',
'external_billing'=>'Ext Bill', 'external_billing'=>'Ext Bill',
'plugin()->display("domain_expire")'=>'Expire', 'plugin()->display("domain_expire")'=>'Expire',

View File

@ -57,7 +57,7 @@ class Controller_Admin_Email extends Controller_Email {
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'name'=>'Name', 'name'=>'Name',
'status'=>'Active', 'active'=>'Active',
'description'=>'Descrption', 'description'=>'Descrption',
)) ))
->prepend(array( ->prepend(array(

View File

@ -22,7 +22,7 @@ class Model_Email_Template extends ORM {
); );
protected $_display_filters = array( protected $_display_filters = array(
'status'=>array( 'active'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)), array('StaticList_YesNo::get',array(':value',TRUE)),
), ),
); );

View File

@ -7,7 +7,7 @@
</div> </div>
<div class="row"> <div class="row">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('active',$o->active,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?>
</div> </div>
<div class="row"> <div class="row">

View File

@ -26,7 +26,7 @@ class Controller_Admin_Export extends Controller_Export {
$edo = ORM::factory('Export_DataMap'); $edo = ORM::factory('Export_DataMap');
if ($_POST AND isset($_POST['item_id']) AND $edo->values($_POST)->changed()) { if ($_POST AND isset($_POST['item_id']) AND $edo->values($_POST)->changed()) {
$edo->status = 1; $edo->active = 1;
$this->save($edo); $this->save($edo);
} }

View File

@ -15,7 +15,7 @@
</tr> </tr>
<tr> <tr>
<th>Active</th> <th>Active</th>
<td><?php echo StaticList_YesNo::form('status',$hso->status); ?></td> <td><?php echo StaticList_YesNo::form('active',$hso->active); ?></td>
</tr> </tr>
<tr> <tr>
<th>Debug Mode</th> <th>Debug Mode</th>

View File

@ -33,7 +33,7 @@ class Invoice {
// Set our invoice as valid // Set our invoice as valid
if (is_null($io)) if (is_null($io))
$this->_io->status = 1; $this->_io->active = 1;
} }
/** /**
@ -73,8 +73,8 @@ class Invoice {
// Check if there are any charges // Check if there are any charges
$c = ORM::factory('Charge') $c = ORM::factory('Charge')
->where_active()
->where('service_id','=',$so->id) ->where('service_id','=',$so->id)
->where('void','is',NULL)
->where('processed','is',NULL); ->where('processed','is',NULL);
foreach ($c->find_all() as $co) { foreach ($c->find_all() as $co) {
@ -172,7 +172,7 @@ class Invoice {
case 'html': case 'html':
switch ($section) { switch ($section) {
case 'body': case 'body':
if (! $this->_io->status) if (! $this->_io->active)
Style::factory() Style::factory()
->type('file') ->type('file')
->data('media/css/pages/invoice.css'); ->data('media/css/pages/invoice.css');

View File

@ -27,18 +27,15 @@ class Model_Invoice extends ORM implements Cartable {
); );
protected $_display_filters = array( protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
'date_orig'=>array( 'date_orig'=>array(
array('Site::Date',array(':value')), array('Site::Date',array(':value')),
), ),
'due_date'=>array( 'due_date'=>array(
array('Site::Date',array(':value')), 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 // Items belonging to an invoice
@ -98,7 +95,7 @@ class Model_Invoice extends ORM implements Cartable {
*/ */
public function due($format=FALSE) { public function due($format=FALSE) {
// If the invoice is active calculate the due amount // 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; return $format ? Currency::display($result) : $result;
} }
@ -136,7 +133,7 @@ class Model_Invoice extends ORM implements Cartable {
// Ensure we dont process this item again // Ensure we dont process this item again
array_push($track,$iio->id); array_push($track,$iio->id);
if (! $iio->void) if ($iio->active)
array_push($result['s'],$iio); array_push($result['s'],$iio);
} }
@ -149,14 +146,14 @@ class Model_Invoice extends ORM implements Cartable {
// Ensure we dont process this item again // Ensure we dont process this item again
array_push($track,$iio->id); array_push($track,$iio->id);
if (! $iio->void) if ($iio->active)
array_push($result['s'],$iio); array_push($result['s'],$iio);
} }
} }
// Get service items that dont have a recurring schedule // Get service items that dont have a recurring schedule
foreach ($this->_sub_items as $iio) 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 // Ensure we dont process this item again
array_push($track,$iio->id); array_push($track,$iio->id);
@ -166,7 +163,7 @@ class Model_Invoice extends ORM implements Cartable {
// Next get the items we havent already got // Next get the items we havent already got
$result['other'] = array(); $result['other'] = array();
foreach ($this->_sub_items as $iio) 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); array_push($result['other'],$iio);
// Debug // Debug
@ -324,7 +321,7 @@ class Model_Invoice extends ORM implements Cartable {
$iio->save(); $iio->save();
if (! $iio->saved()) { if (! $iio->saved()) {
$this->void = 1; $this->active = 0;
$this->save(); $this->save();
break; break;
@ -416,7 +413,7 @@ class Model_Invoice extends ORM implements Cartable {
foreach ($this->_sub_items as $iio) { foreach ($this->_sub_items as $iio) {
// Ignore voided items // Ignore voided items
if ($iio->void) if (! $iio->active)
continue; continue;
$return = FALSE; $return = FALSE;
@ -529,12 +526,8 @@ class Model_Invoice extends ORM implements Cartable {
return $format ? Currency::display($result) : $result; 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() { 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 // Our list function
@ -570,7 +563,7 @@ class Model_Invoice extends ORM implements Cartable {
$this->where_authorised(); $this->where_authorised();
if (! $result) 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()) if ($io->due())
array_push($result,$io); array_push($result,$io);

View File

@ -238,7 +238,7 @@ class Model_Invoice_Item extends ORM {
$iito->save(); $iito->save();
if (! $iito->saved()) { if (! $iito->saved()) {
$this->void = 1; $this->active = 0;
$this->save(); $this->save();
break; break;
@ -301,7 +301,7 @@ class Model_Invoice_Item extends ORM {
} }
public function total($format=FALSE) { 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); return $format ? Currency::display($result) : Currency::round($result);
} }

View File

@ -11,7 +11,7 @@ if ($o->due() AND ! $o->cart_exists())
->set('mid',$o->mid()) ->set('mid',$o->mid())
->set('o',$o); ->set('o',$o);
if (! $o->status) if (! $o->active)
$output .= '<div id="cancelled">Invoice CANCELLED.</div>'; $output .= '<div id="cancelled">Invoice CANCELLED.</div>';
echo Block::factory() echo Block::factory()

@ -1 +1 @@
Subproject commit 68d96ca85f0befb37754de7caf6f861e6df64e3a Subproject commit f5bc5dfa296a1517ebdb29b2dd0f81b09f136b6a

@ -1 +1 @@
Subproject commit 4b432d2eb44bc8cf264c3082b009f9918c5e552b Subproject commit 33982a6cecb56069dae94af738541b5b4e4be4ff

View File

@ -18,7 +18,7 @@ class Controller_Oauth extends Controller_TemplateDefault {
public function action_login() { public function action_login() {
// Make sure we are called with a valid oauth plugin // Make sure we are called with a valid oauth plugin
$oo = ORM::factory('Oauth',array('name'=>$this->request->param('id'))); $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'); HTTP::redirect('login');
$auth = Auth::instance($oo); $auth = Auth::instance($oo);
@ -47,7 +47,7 @@ class Controller_Oauth extends Controller_TemplateDefault {
public function action_link() { public function action_link() {
// Make sure we are called with a valid oauth plugin // Make sure we are called with a valid oauth plugin
$oo = ORM::factory('Oauth',array('name'=>$this->request->param('id'))); $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'); HTTP::redirect('login');
// Since we have logged in, get our user details // Since we have logged in, get our user details

View File

@ -6,7 +6,6 @@
'date_payment'=>'Pay Date', 'date_payment'=>'Pay Date',
'account->refnum()'=>'Num', 'account->refnum()'=>'Num',
'account->name()'=>'Account', 'account->name()'=>'Account',
'account->display("status")'=>'Active',
'total(TRUE)'=>'Total', 'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance', 'balance(TRUE)'=>'Balance',
)) ))

View File

@ -212,7 +212,7 @@ $.ajax({
* Show a list of products * Show a list of products
*/ */
public function action_list() { 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() Block::factory()
->title(_('Products').($x->loaded() ? ' - '.$x->name() : ' - All')) ->title(_('Products').($x->loaded() ? ' - '.$x->name() : ' - All'))
@ -230,7 +230,7 @@ $.ajax({
foreach (array_keys(ORM::factory('Product')->table_columns()) as $text) foreach (array_keys(ORM::factory('Product')->table_columns()) as $text)
$columns .= ($columns ? ',' : '').'p.'.$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() Block::factory()
->title(_('Products with Active Services')) ->title(_('Products with Active Services'))

View File

@ -24,7 +24,7 @@ class Controller_Product extends Controller_TemplateDefault {
$pco = ORM::factory('Product_Category',$this->request->param('id')); $pco = ORM::factory('Product_Category',$this->request->param('id'));
// Only show categories that are active. // 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'); HTTP::redirect('welcome/index');
$this->meta->title = $pco->name(); $this->meta->title = $pco->name();

View File

@ -25,12 +25,12 @@ class Model_Product extends ORM {
); );
protected $_display_filters = array( protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
'price_type'=>array( 'price_type'=>array(
array('StaticList_PriceType::get',array(':value')), array('StaticList_PriceType::get',array(':value')),
), ),
'status'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
'taxable'=>array( 'taxable'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)), array('StaticList_YesNo::get',array(':value',TRUE)),
), ),

View File

@ -15,7 +15,7 @@ class Model_Product_Category extends ORM {
protected $_updated_column = FALSE; protected $_updated_column = FALSE;
protected $_nullifempty = array( protected $_nullifempty = array(
'status', 'active',
'template', 'template',
); );

View File

@ -3,8 +3,8 @@
<legend><?php echo $o->name(Site::language());?></legend> <legend><?php echo $o->name(Site::language());?></legend>
<div class="form-group"> <div class="form-group">
<label for="status" class="col-sm-2 control-label">Product Active</label> <label for="active" class="col-sm-2 control-label">Product Active</label>
<div class="col-sm-2"><?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','nocg'=>TRUE,'id'=>'status','class'=>'form-control')); ?></div> <div class="col-sm-2"><?php echo StaticList_YesNo::form('active',$o->active,FALSE,array('label'=>'Product Active','nocg'=>TRUE,'id'=>'active','class'=>'form-control')); ?></div>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -3,7 +3,7 @@
<legend>Update Category</legend> <legend>Update Category</legend>
<div class="row"> <div class="row">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('active',$o->active,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">

View File

@ -5,7 +5,7 @@
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'name(Site::language())'=>'Name', 'name(Site::language())'=>'Name',
'status'=>'Active', 'active'=>'Active',
'prod_plugin_file'=>'Plugin Name', 'prod_plugin_file'=>'Plugin Name',
'prod_plugin_data'=>'Plugin Data', 'prod_plugin_data'=>'Plugin Data',
'price_type'=>'Price Type', 'price_type'=>'Price Type',

View File

@ -166,11 +166,7 @@ $(document).ready(function() {
$bt = NULL; $bt = NULL;
$pr = TRUE; // Next entry is a pro-rata $pr = TRUE; // Next entry is a pro-rata
foreach ($so->transactions()->where('item_type','=',0)->find_all() as $iio) { foreach ($so->transactions()->where('item_type','=',0)->find_all() as $iio) {
// @todo This hard coding of 3070 should be removed. if (! $iio->invoice->active OR ! $iio->active)
// $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)
continue; continue;
if ($iio->quantity < 0 OR $iio->price_base < 0) { if ($iio->quantity < 0 OR $iio->price_base < 0) {

View File

@ -48,6 +48,9 @@ class Model_Service extends ORM {
* 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::get',array(':value',TRUE)),
),
'date_start'=>array( 'date_start'=>array(
array('Site::Date',array(':value')), array('Site::Date',array(':value')),
), ),
@ -72,9 +75,6 @@ class Model_Service extends ORM {
'suspend_billing'=>array( 'suspend_billing'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)), array('StaticList_YesNo::get',array(':value',TRUE)),
), ),
'status'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
),
); );
protected $_nullifempty = array( protected $_nullifempty = array(
@ -128,7 +128,7 @@ class Model_Service extends ORM {
->or_where('processed','=',FALSE) ->or_where('processed','=',FALSE)
->where_close(); ->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') return ORM::factory('Invoice_Item')
->where('item_type','IN',array(0,7)) ->where('item_type','IN',array(0,7))
->where('service_id','=',$this) ->where('service_id','=',$this)
->where('invoice_item.void','IS',NULL) ->where('invoice_item.active','=',1)
->join('invoice') ->join('invoice')
->on('invoice.id','=','invoice_item.invoice_id') ->on('invoice.id','=','invoice_item.invoice_id')
->on('invoice.status','=',1) ->on('invoice.active','=',1)
->order_by('date_stop','DESC'); ->order_by('date_stop','DESC');
} }
@ -357,7 +357,7 @@ class Model_Service extends ORM {
->join('product') ->join('product')
->on($this->table_name().'.product_id','=','product.id') ->on($this->table_name().'.product_id','=','product.id')
->where('prod_plugin_file','=',$plugin) ->where('prod_plugin_file','=',$plugin)
->and_where('service.status','=',TRUE) ->and_where('service.active','=',TRUE)
->find_all(); ->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. * @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->_where_active() return $this->where_active()
->where_open() ->where_open()
->where('suspend_billing','IS',NULL) ->where('suspend_billing','IS',NULL)
->or_where('suspend_billing','=','0') ->or_where('suspend_billing','=','0')

View File

@ -42,7 +42,7 @@ abstract class Model_Service_Plugin extends ORM {
*/ */
protected function manage() { protected function manage() {
// Dont show the manage button for expired or inactive services // 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; return FALSE;
static $x = ''; static $x = '';

View File

@ -3,7 +3,7 @@
<legend>Service Information</legend> <legend>Service Information</legend>
<?php <?php
echo View::factory('field/account')->set('data',['field'=>'account_id','value'=>$o->account_id,'text'=>'Account','name'=>'','ajaxurl'=>URL::link('admin','payment/ajaxlist')]); echo View::factory('field/account')->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/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/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']); 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']);

View File

@ -2,7 +2,7 @@
<fieldset> <fieldset>
<legend>Update Service</legend> <legend>Update Service</legend>
<?php <?php
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/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,'text'=>'Date Next Invoice','enddate'=>NULL]); echo View::factory('field/date')->set('data',['field'=>'data_next_invoice','value'=>$o->date_next_invoice,'text'=>'Date Next Invoice','enddate'=>NULL]);
echo View::factory('field/select')->set('data',['field'=>'taxable','value'=>StaticList_YesNo::table(),'text'=>'Taxable','default'=>$o->taxable,'class'=>'col-md-1']); echo View::factory('field/select')->set('data',['field'=>'taxable','value'=>StaticList_YesNo::table(),'text'=>'Taxable','default'=>$o->taxable,'class'=>'col-md-1']);

View File

@ -12,7 +12,7 @@
<?php else : ?> <?php else : ?>
<dt>Service Active</dt> <dt>Service Active</dt>
<dd><?php echo $o->display('status'); ?></dd> <dd><?php echo $o->display('active'); ?></dd>
<dt>Billing Period</dt> <dt>Billing Period</dt>
<dd><?php echo $o->display('recur_schedule');?></dd> <dd><?php echo $o->display('recur_schedule');?></dd>

View File

@ -8,7 +8,7 @@
'recur_schedule'=>'Billing', 'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price', 'price(TRUE,TRUE)'=>'Price',
'charges(TRUE,TRUE)'=>'Charges', 'charges(TRUE,TRUE)'=>'Charges',
'status'=>'Active', 'active'=>'Active',
'account->refnum()'=>'Cust ID', 'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer', 'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice', 'date_next_invoice'=>'Next Invoice',

View File

@ -6,7 +6,7 @@
->data($o->invoice_list(FALSE,20)) ->data($o->invoice_list(FALSE,20))
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'void'=>'Void', 'active'=>'Active',
'date_orig'=>'Date', 'date_orig'=>'Date',
'due_date'=>'Due', 'due_date'=>'Due',
'total(TRUE)'=>'Amount', 'total(TRUE)'=>'Amount',

View File

@ -6,7 +6,7 @@
'name()'=>'Service', 'name()'=>'Service',
'recur_schedule'=>'Billing', 'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price', 'price(TRUE,TRUE)'=>'Price',
'status'=>'Active', 'active'=>'Active',
)) ))
->prepend(array( ->prepend(array(

View File

@ -2,7 +2,7 @@
<?php <?php
echo View::factory('service/info')->set('o',$o); echo View::factory('service/info')->set('o',$o);
if ($o->status AND ! $o->external_billing) : if ($o->active AND ! $o->external_billing) :
echo View::factory('service/user/invoice/next')->set('o',$o); echo View::factory('service/user/invoice/next')->set('o',$o);
endif; endif;

View File

@ -26,7 +26,7 @@ class Task_Task_List extends Minion_Task {
foreach ($t->find_all() as $to) foreach ($t->find_all() as $to)
$output .= sprintf($header, $output .= sprintf($header,
$to->id, $to->id,
$to->status ? 'A' : 'I', $to->active ? 'A' : 'I',
$to->command, $to->command,
$to->display('date_run'), $to->display('date_run'),
$to->next_run(TRUE), $to->next_run(TRUE),

View File

@ -21,7 +21,7 @@ class Task_Task_Run extends Minion_Task {
$to = ORM::factory('Task',$params['id']); $to = ORM::factory('Task',$params['id']);
if ($to->loaded()) { if ($to->loaded()) {
if (! $to->status) if (! $to->active)
throw new Minion_Exception_InvalidTask('Task :task (:name) NOT active',array(':task'=>$params['id'],':name'=>$to->name)); throw new Minion_Exception_InvalidTask('Task :task (:name) NOT active',array(':task'=>$params['id'],':name'=>$to->name));
Kohana::$config->load('debug')->task_sim ? printf("Would Run task: (%s) %s\n",$to->id,$to->name) : $this->_run($to,$params['force'],$params['verbose']); Kohana::$config->load('debug')->task_sim ? printf("Would Run task: (%s) %s\n",$to->id,$to->name) : $this->_run($to,$params['force'],$params['verbose']);