Replace status with active in tables
This commit is contained in:
parent
34e1e40f04
commit
54e4425aa8
@ -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) {
|
||||
|
@ -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() {
|
||||
|
@ -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();
|
||||
|
@ -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 **/
|
||||
|
@ -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)),
|
||||
),
|
||||
);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
?>
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
->jssort('customer')
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'status'=>'Active',
|
||||
'active'=>'Active',
|
||||
'refnum()'=>'Num',
|
||||
'name()'=>'Account',
|
||||
'email'=>'Email',
|
||||
|
@ -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())); ?>
|
||||
|
||||
<?php echo View::factory('invoice/user/next')->set('o',$o); ?>
|
||||
|
@ -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',
|
||||
|
@ -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
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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)),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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'],
|
||||
|
@ -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',
|
||||
|
@ -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(
|
||||
|
@ -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)),
|
||||
),
|
||||
);
|
||||
|
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
|
||||
<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 class="row">
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<th>Debug Mode</th>
|
||||
|
@ -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');
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 .= '<div id="cancelled">Invoice CANCELLED.</div>';
|
||||
|
||||
echo Block::factory()
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 68d96ca85f0befb37754de7caf6f861e6df64e3a
|
||||
Subproject commit f5bc5dfa296a1517ebdb29b2dd0f81b09f136b6a
|
@ -1 +1 @@
|
||||
Subproject commit 4b432d2eb44bc8cf264c3082b009f9918c5e552b
|
||||
Subproject commit 33982a6cecb56069dae94af738541b5b4e4be4ff
|
@ -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
|
||||
|
@ -6,7 +6,6 @@
|
||||
'date_payment'=>'Pay Date',
|
||||
'account->refnum()'=>'Num',
|
||||
'account->name()'=>'Account',
|
||||
'account->display("status")'=>'Active',
|
||||
'total(TRUE)'=>'Total',
|
||||
'balance(TRUE)'=>'Balance',
|
||||
))
|
||||
|
@ -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'))
|
||||
|
@ -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();
|
||||
|
@ -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)),
|
||||
),
|
||||
|
@ -15,7 +15,7 @@ class Model_Product_Category extends ORM {
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
protected $_nullifempty = array(
|
||||
'status',
|
||||
'active',
|
||||
'template',
|
||||
);
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
<legend><?php echo $o->name(Site::language());?></legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="status" 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>
|
||||
<label for="active" class="col-sm-2 control-label">Product Active</label>
|
||||
<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 class="form-group">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<legend>Update Category</legend>
|
||||
|
||||
<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 class="row">
|
||||
|
@ -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',
|
||||
|
@ -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) {
|
||||
|
@ -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')
|
||||
|
@ -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 = '';
|
||||
|
@ -3,7 +3,7 @@
|
||||
<legend>Service Information</legend>
|
||||
<?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/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']);
|
||||
|
@ -2,7 +2,7 @@
|
||||
<fieldset>
|
||||
<legend>Update Service</legend>
|
||||
<?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/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']);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
<?php else : ?>
|
||||
<dt>Service Active</dt>
|
||||
<dd><?php echo $o->display('status'); ?></dd>
|
||||
<dd><?php echo $o->display('active'); ?></dd>
|
||||
|
||||
<dt>Billing Period</dt>
|
||||
<dd><?php echo $o->display('recur_schedule');?></dd>
|
||||
|
@ -8,7 +8,7 @@
|
||||
'recur_schedule'=>'Billing',
|
||||
'price(TRUE,TRUE)'=>'Price',
|
||||
'charges(TRUE,TRUE)'=>'Charges',
|
||||
'status'=>'Active',
|
||||
'active'=>'Active',
|
||||
'account->refnum()'=>'Cust ID',
|
||||
'account->name()'=>'Customer',
|
||||
'date_next_invoice'=>'Next Invoice',
|
||||
|
@ -6,7 +6,7 @@
|
||||
->data($o->invoice_list(FALSE,20))
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'void'=>'Void',
|
||||
'active'=>'Active',
|
||||
'date_orig'=>'Date',
|
||||
'due_date'=>'Due',
|
||||
'total(TRUE)'=>'Amount',
|
||||
|
@ -6,7 +6,7 @@
|
||||
'name()'=>'Service',
|
||||
'recur_schedule'=>'Billing',
|
||||
'price(TRUE,TRUE)'=>'Price',
|
||||
'status'=>'Active',
|
||||
'active'=>'Active',
|
||||
|
||||
))
|
||||
->prepend(array(
|
||||
|
@ -2,7 +2,7 @@
|
||||
<?php
|
||||
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);
|
||||
endif;
|
||||
|
||||
|
@ -26,7 +26,7 @@ class Task_Task_List extends Minion_Task {
|
||||
foreach ($t->find_all() as $to)
|
||||
$output .= sprintf($header,
|
||||
$to->id,
|
||||
$to->status ? 'A' : 'I',
|
||||
$to->active ? 'A' : 'I',
|
||||
$to->command,
|
||||
$to->display('date_run'),
|
||||
$to->next_run(TRUE),
|
||||
|
@ -21,7 +21,7 @@ class Task_Task_Run extends Minion_Task {
|
||||
$to = ORM::factory('Task',$params['id']);
|
||||
|
||||
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));
|
||||
|
||||
Kohana::$config->load('debug')->task_sim ? printf("Would Run task: (%s) %s\n",$to->id,$to->name) : $this->_run($to,$params['force'],$params['verbose']);
|
||||
|
Reference in New Issue
Block a user