Some cleanup, setup improvements and other misc items
This commit is contained in:
@@ -62,6 +62,10 @@ class Company {
|
||||
return $this->so->site_details('fax');
|
||||
}
|
||||
|
||||
public function faq() {
|
||||
return $this->so->site_details('faqurl');
|
||||
}
|
||||
|
||||
public function language() {
|
||||
return $this->so->language;
|
||||
}
|
||||
@@ -80,8 +84,8 @@ class Company {
|
||||
return $this->so->site_details('name');
|
||||
}
|
||||
|
||||
public function module_config($item) {
|
||||
return $this->so->module_config($item);
|
||||
public function module_config($item,array $value=NULL) {
|
||||
return $this->so->module_config($item,$value);
|
||||
}
|
||||
|
||||
public function pcode() {
|
||||
|
@@ -130,8 +130,8 @@ class Config extends Kohana_Config {
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function module_config($item) {
|
||||
return Company::instance()->module_config($item);
|
||||
public static function module_config($item,array $value=NULL) {
|
||||
return Company::instance()->module_config($item,$value);
|
||||
}
|
||||
|
||||
public static function module_exist($module) {
|
||||
|
@@ -19,55 +19,29 @@ class Controller_Admin_Setup extends Controller_TemplateDefault {
|
||||
*/
|
||||
public function action_edit() {
|
||||
$o = Company::instance()->so();
|
||||
$output = '';
|
||||
|
||||
if ($_POST) {
|
||||
// Entry updated
|
||||
if ($o->values($_POST)->check() AND $o->save())
|
||||
SystemMessage::add(array(
|
||||
'title'=>'Site Configuration Recorded',
|
||||
'type'=>'info',
|
||||
'body'=>'Site Config successfully recorded.',
|
||||
));
|
||||
}
|
||||
// Store our new values
|
||||
$o->values($_POST);
|
||||
|
||||
$output .= Form::open();
|
||||
// Run validation and save
|
||||
if ($o->changed())
|
||||
if ($o->check() AND $o->save())
|
||||
SystemMessage::factory()
|
||||
->title('Record updated')
|
||||
->type('success')
|
||||
->body(_('Your setup record has been updated.'));
|
||||
|
||||
// site_details
|
||||
$output .= View::factory($this->viewpath())
|
||||
->set('o',$o);;
|
||||
Block::factory()
|
||||
->title('Update Site Configuration')
|
||||
->title_icon('icon-wrench')
|
||||
->type('form-horizontal')
|
||||
->body(View::factory('setup/admin/edit')->set('o',$o));
|
||||
|
||||
$output .= '<div>'.Form::submit('submit','submit',array('class'=>'form_button')).'</div>';
|
||||
$output .= Form::close();
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Update Site Configuration'),
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
// module_config
|
||||
$output = '';
|
||||
$output .= View::factory($this->viewpath().'/module/head');
|
||||
|
||||
foreach ($o->module_config as $mid => $detail) {
|
||||
$mo = ORM::factory('Module',$mid);
|
||||
|
||||
$output .= View::factory($this->viewpath().'/module/body')
|
||||
->set('mo',$mo);
|
||||
|
||||
Script::add(array('type'=>'stdin','data'=>'
|
||||
$(document).ready(function() {
|
||||
$("div[id='.$mo->name.']").load("'.URL::link('admin',$mo->name.'/setup',TRUE).'");
|
||||
});'
|
||||
));
|
||||
}
|
||||
|
||||
$output .= View::factory($this->viewpath().'/module/foot');
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Update Module Specific Configuration'),
|
||||
'body'=>$output,
|
||||
));
|
||||
Block::factory()
|
||||
->title('Update Module Configuration')
|
||||
->title_icon('icon-wrench')
|
||||
->type('form-horizontal')
|
||||
->body(View::factory('setup/admin/module')->set('o',$o)->set('mid',NULL));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -1,130 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Admin Main home page
|
||||
*
|
||||
* @package OSB
|
||||
* @category Controllers/Admin
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_Admin_Welcome extends Controller_Welcome {
|
||||
protected $auth_required = TRUE;
|
||||
public $secure_actions = array(
|
||||
'index'=>TRUE,
|
||||
);
|
||||
|
||||
public function action_index() {
|
||||
$t = time();
|
||||
|
||||
// Show outstanding invoices
|
||||
$o = ORM::factory('Invoice');
|
||||
|
||||
Block_Sub::add(array(
|
||||
'title'=>'Invoices Overdue - No Auto Billing',
|
||||
'body'=>Table::display(
|
||||
$o->list_overdue_billing($t),
|
||||
25,
|
||||
array(
|
||||
'due_date'=>array('label'=>'Due Date'),
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'=>'Account'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
|
||||
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
|
||||
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
|
||||
),
|
||||
array('page'=>TRUE)),
|
||||
'position'=>1,
|
||||
'order'=>1,
|
||||
));
|
||||
|
||||
Block_Sub::add(array(
|
||||
'title'=>'Invoices Overdue - Auto Billing',
|
||||
'body'=>Table::display(
|
||||
$o->list_overdue_billing($t,TRUE),
|
||||
25,
|
||||
array(
|
||||
'due_date'=>array('label'=>'Due Date'),
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'=>'Account'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
|
||||
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
|
||||
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
|
||||
),
|
||||
array('page'=>TRUE)),
|
||||
'position'=>2,
|
||||
'order'=>1,
|
||||
));
|
||||
|
||||
Block_Sub::add(array(
|
||||
'title'=>'Invoices Due',
|
||||
'body'=>Table::display(
|
||||
$o->list_due(),
|
||||
25,
|
||||
array(
|
||||
'due_date'=>array('label'=>'Due Date'),
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
|
||||
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
|
||||
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
|
||||
),
|
||||
array('show_other'=>'due()')),
|
||||
'position'=>3,
|
||||
'order'=>1,
|
||||
));
|
||||
|
||||
// Show un-applied payments
|
||||
Block_Sub::add(array(
|
||||
'title'=>'Unapplied Payments',
|
||||
'body'=>Table::display(
|
||||
ORM::factory('Payment')->list_unapplied(),
|
||||
25,
|
||||
array(
|
||||
'date_payment'=>array('label'=>'Pay Date'),
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'=>'Account'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>URL::link('admin','payment/edit/')),
|
||||
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
|
||||
'balance(TRUE)'=>array('label'=>'Balance','class'=>'right'),
|
||||
),
|
||||
array('show_other'=>'balance()')),
|
||||
'position'=>1,
|
||||
'order'=>2,
|
||||
));
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s %s',$this->ao->accnum(),$this->ao->first_name,$this->ao->last_name),
|
||||
'subtitle'=>_('Administrator Overview'),
|
||||
'body'=>(string)Block_Sub::factory(),
|
||||
));
|
||||
|
||||
// We are a site administrator
|
||||
$output = '';
|
||||
if ($this->ao->rtm_id == NULL) {
|
||||
$rtmo = ORM::factory('RTM',array('account_id','=',$this->ao->id))->find();
|
||||
|
||||
// Quick validation, if we are an admin, we should have an entry in the RTM table.
|
||||
if (! $rtmo->loaded())
|
||||
throw new Kohana_Exception('User :aid not set up properly',array(':aid'=>$this->ao->id));
|
||||
|
||||
$output = View::factory('welcome/admin')
|
||||
->set('o',$rtmo);
|
||||
|
||||
} else {
|
||||
$rtmo = ORM::factory('RTM',$this->ao->rtm_id);
|
||||
}
|
||||
|
||||
if ($output)
|
||||
Block::add(array(
|
||||
'title'=>sprintf('Reseller %s',$this->ao->display('company')),
|
||||
'body'=>$output,
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
@@ -24,10 +24,11 @@ class Controller_Reseller_Account extends Controller_Account {
|
||||
->title(_('Customer List'))
|
||||
->title_icon('icon-th-list')
|
||||
->body(Table::factory()
|
||||
->data(ORM::factory('Account')->where('id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all())
|
||||
->data(ORM::factory('Account')->where_authorised($this->ao,'id')->find_all())
|
||||
->jssort('customer')
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'status(TRUE)'=>'Active',
|
||||
'accnum()'=>'Num',
|
||||
'name(TRUE)'=>'Account',
|
||||
'email'=>'Email',
|
||||
@@ -48,7 +49,7 @@ class Controller_Reseller_Account extends Controller_Account {
|
||||
->title(_('Customer Login Activity'))
|
||||
->title_icon('icon-eye-open')
|
||||
->body(Table::factory()
|
||||
->data(ORM::factory('Account_Log')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all())
|
||||
->data(ORM::factory('Account_Log')->where_authorised($this->ao)->find_all())
|
||||
->page_items(25)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* lnApp Main home page
|
||||
* OSB Reseller Main home page
|
||||
*
|
||||
* @package OSB
|
||||
* @category Controllers/Reseller
|
||||
@@ -11,15 +11,96 @@
|
||||
*/
|
||||
class Controller_Reseller_Welcome extends Controller_Welcome {
|
||||
protected $auth_required = TRUE;
|
||||
protected $secure_actions = array(
|
||||
public $secure_actions = array(
|
||||
'index'=>TRUE,
|
||||
);
|
||||
|
||||
public function action_index() {
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s',$this->ao->accnum(),$this->ao->name(TRUE)),
|
||||
'body'=>View::factory('welcome/reseller'),
|
||||
));
|
||||
$t = time();
|
||||
|
||||
// Show outstanding invoices
|
||||
$o = ORM::factory('Invoice');
|
||||
|
||||
Block::factory()
|
||||
->title($this->ao->RTM->display('name'))
|
||||
->body('');
|
||||
|
||||
Block::factory()
|
||||
->title('Invoices Overdue - No Auto Billing')
|
||||
->title_icon('icon-info-sign')
|
||||
->span(6)
|
||||
->body(Table::factory()
|
||||
->data($o->list_overdue_billing($t))
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'due_date'=>'Due',
|
||||
'account->accnum()'=>'Num',
|
||||
'account->name()'=>'Account',
|
||||
'total(TRUE)'=>'Total',
|
||||
'due(TRUE)'=>'Due',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','invoice/view/')),
|
||||
))
|
||||
);
|
||||
|
||||
Block::factory()
|
||||
->title('Invoices Overdue - Auto Billing')
|
||||
->title_icon('icon-info-sign')
|
||||
->span(6)
|
||||
->body(Table::factory()
|
||||
->data($o->list_overdue_billing($t,TRUE))
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'due_date'=>'Due',
|
||||
'account->accnum()'=>'Num',
|
||||
'account->name()'=>'Account',
|
||||
'total(TRUE)'=>'Total',
|
||||
'due(TRUE)'=>'Due',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','invoice/view/')),
|
||||
))
|
||||
);
|
||||
|
||||
Block::factory()
|
||||
->title('Upcoming Invoices')
|
||||
->title_icon('icon-info-sign')
|
||||
->span(6)
|
||||
->body(Table::factory()
|
||||
->data($o->list_due())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'due_date'=>'Due',
|
||||
'account->accnum()'=>'Num',
|
||||
'account->name()'=>'Account',
|
||||
'total(TRUE)'=>'Total',
|
||||
'due(TRUE)'=>'Due',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','invoice/view/')),
|
||||
))
|
||||
);
|
||||
|
||||
Block::factory()
|
||||
->title('Un-applied payments')
|
||||
->title_icon('icon-info-sign')
|
||||
->span(6)
|
||||
->body(Table::factory()
|
||||
->data(ORM::factory('Payment')->where_authorised()->list_unapplied())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'date_payment'=>'Pay Date',
|
||||
'account->accnum()'=>'Num',
|
||||
'account->name()'=>'Account',
|
||||
'account->display("status")'=>'Active',
|
||||
'total(TRUE)'=>'Total',
|
||||
'balance(TRUE)'=>'Balance',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('reseller','payment/view/')),
|
||||
))
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -51,35 +51,24 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
|
||||
}
|
||||
|
||||
protected function setup(array $config_items=array()) {
|
||||
$module = Request::current()->controller();
|
||||
$mo = ORM::factory('Module',array('name'=>Request::current()->controller()));
|
||||
if (! $mo->loaded())
|
||||
throw HTTP_Exception::factory(501,'Unknown module :module',array(':module'=>Request::current()->controller()));
|
||||
|
||||
if ($_POST AND isset($_POST['module_config'][$module]))
|
||||
Config::instance()->module_config($module,$_POST['module_config'][$module])->save();
|
||||
if ($_POST AND isset($_POST['module_config'][$mo->id]))
|
||||
if (Config::instance()->module_config($mo->name,$_POST['module_config'][$mo->id])->save())
|
||||
SystemMessage::factory()
|
||||
->title('Record updated')
|
||||
->type('success')
|
||||
->body(_('Your setup record has been updated.'));
|
||||
|
||||
if ($config_items) {
|
||||
$output = '';
|
||||
$mc = Config::instance()->module_config($module);
|
||||
|
||||
$output .= Form::open();
|
||||
$output .= View::factory('setup/admin/module/head');
|
||||
|
||||
foreach ($config_items as $k=>$v)
|
||||
$output .= View::factory('setup/admin/module/body')
|
||||
->set('module',$module)
|
||||
->set('mc',$mc)
|
||||
->set('key',$k)
|
||||
->set('info',$v)
|
||||
->set('val',isset($mc[$k]) ? $mc[$k] : '');
|
||||
|
||||
$output .= View::factory('setup/admin/module/foot');
|
||||
|
||||
$output .= Form::submit('submit',_('Submit'),array('class'=>'form_button'));
|
||||
$output .= Form::close();
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s',strtoupper($module),_('Configuration')),
|
||||
'body'=>$output,
|
||||
));
|
||||
Block::factory()
|
||||
->title('Update Module Configuration')
|
||||
->title_icon('icon-wrench')
|
||||
->type('form-horizontal')
|
||||
->body(View::factory('setup/admin/module')->set('o',Company::instance()->so())->set('mid',$mo->id));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,23 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* lnApp User Main home page controller
|
||||
*
|
||||
* @package OSB
|
||||
* @category Controllers/Admin
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_TemplateDefault_Admin extends Controller_TemplateDefault_User {
|
||||
public function after() {
|
||||
SystemMessage::add(array(
|
||||
'title'=>'Retire this class extension',
|
||||
'type'=>'info',
|
||||
'body'=>__METHOD__,
|
||||
));
|
||||
|
||||
return parent::after();
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,14 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* lnApp User Main home page controller
|
||||
*
|
||||
* @package OSB
|
||||
* @category Controllers/User
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_TemplateDefault_User extends Controller_TemplateDefault {
|
||||
}
|
||||
?>
|
@@ -3,8 +3,8 @@
|
||||
/**
|
||||
* This class overrides Kohana's Cookie
|
||||
*
|
||||
* @package OSB/Modifications
|
||||
* @category Helpers
|
||||
* @package OSB
|
||||
* @category Modifications
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
|
@@ -70,6 +70,14 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
return $processed ? $o->find_all() : $o->where_unprocessed()->find_all();
|
||||
}
|
||||
|
||||
public function isAdmin() {
|
||||
return ($this->RTM->loaded() AND is_null($this->RTM->parent_id));
|
||||
}
|
||||
|
||||
public function isReseller() {
|
||||
return $this->RTM->loaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of due invoices for this account
|
||||
*
|
||||
|
@@ -42,7 +42,7 @@ class Model_Setup extends ORM_OSB {
|
||||
if (! $this->loaded() OR (is_null($value) AND ! $this->module_config))
|
||||
return array();
|
||||
|
||||
$mo = ORM::factory('Module')->where('name','=',$key)->find();
|
||||
$mo = ORM::factory('Module',array('name'=>$key));
|
||||
|
||||
if (! $mo->loaded())
|
||||
throw new Kohana_Exception('Unknown module :name',array(':name'=>$key));
|
||||
@@ -60,6 +60,25 @@ class Model_Setup extends ORM_OSB {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function module_config_id($key=NULL) {
|
||||
$result = array();
|
||||
|
||||
foreach (array_keys($this->module_config) as $mid) {
|
||||
if (is_null($key) OR $key == $mid) {
|
||||
$result[$mid] = array(
|
||||
'object'=>ORM::factory('Module',$mid),
|
||||
'data'=>$this->module_config[$mid],
|
||||
);
|
||||
|
||||
// If we are just after our key, we can continue here
|
||||
if ($key AND $key==$mid)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get/Set our Site Configuration from the DB
|
||||
*
|
||||
@@ -67,7 +86,7 @@ class Model_Setup extends ORM_OSB {
|
||||
* @param $value Values to store. If NULL, retrieves the value stored, otherwise stores value.
|
||||
*/
|
||||
public function site_details($key,array $value=NULL) {
|
||||
if (! in_array($key,array('name','address1','address2','city','state','pcode','phone','fax','email')))
|
||||
if (! in_array($key,array('name','address1','address2','city','state','pcode','phone','fax','email','faqurl')))
|
||||
throw new Kohana_Exception('Unknown Site Configuration Key :key',array(':key'=>$key));
|
||||
|
||||
// If $value is NULL, we are a getter
|
||||
|
@@ -48,8 +48,8 @@ abstract class ORM extends Kohana_ORM {
|
||||
/**
|
||||
* Format fields for display purposes
|
||||
*
|
||||
* @param string column name
|
||||
* @return mixed
|
||||
* @param string column name
|
||||
* @return mixed
|
||||
*/
|
||||
private function _format() {
|
||||
foreach ($this->_display_filters as $column => $formats)
|
||||
@@ -137,6 +137,21 @@ abstract class ORM extends Kohana_ORM {
|
||||
$this->_display_filters = Arr::merge($this->_display_filters,$filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a bootstrap label button for a field with a boolean value
|
||||
*/
|
||||
public function label_bool($column,$render=FALSE) {
|
||||
if (! isset($this->_table_columns[$column]))
|
||||
return NULL;
|
||||
|
||||
if (! $render)
|
||||
return $this->display($column);
|
||||
|
||||
return View::factory(Config::theme().'/label/bool')
|
||||
->set('label',$this->$column ? 'label-success' : '')
|
||||
->set('column',$this->display($column));
|
||||
}
|
||||
|
||||
/**
|
||||
* Function help to find records that are active
|
||||
*/
|
||||
@@ -203,8 +218,19 @@ abstract class ORM extends Kohana_ORM {
|
||||
return $x;
|
||||
}
|
||||
|
||||
public function status($render=FALSE) {
|
||||
return $this->label_bool('status',$render);
|
||||
}
|
||||
|
||||
public function where_active() {
|
||||
return $this->_where_active();
|
||||
}
|
||||
|
||||
public function where_authorised(Model_Account $ao=NULL,$aid='account_id') {
|
||||
if (is_null($ao))
|
||||
$ao = Auth::instance()->get_user();
|
||||
|
||||
return $this->where($aid,'IN',$ao->RTM->customers($ao->RTM));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -195,21 +195,6 @@ abstract class ORM_OSB extends ORM {
|
||||
return array_key_exists($key,$this->$column) ? $this->{$column}[$key] : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a bootstrap label button for a field with a boolean value
|
||||
*/
|
||||
public function label_bool($column,$render=FALSE) {
|
||||
if (! isset($this->_table_columns[$column]))
|
||||
return NULL;
|
||||
|
||||
if (! $render)
|
||||
return $this->display($column);
|
||||
|
||||
return View::factory(Config::theme().'/label/bool')
|
||||
->set('label',$this->$column ? 'label-success' : '')
|
||||
->set('column',$this->display($column));
|
||||
}
|
||||
|
||||
final public function module() {
|
||||
return ORM::factory(Kohana::classname($this->name));
|
||||
}
|
||||
@@ -261,10 +246,6 @@ abstract class ORM_OSB extends ORM {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function status($render=FALSE) {
|
||||
return $this->label_bool('status',$render);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function help to find records that are active
|
||||
*/
|
||||
|
@@ -48,8 +48,10 @@ class Request extends Kohana_Request {
|
||||
|
||||
// Get the method number
|
||||
$mmo = $mo->module_method
|
||||
->where_open()
|
||||
->where('name','=',$method)
|
||||
->or_where('name','=',str_replace(':','_',$method)) // @todo This is temporary until all our method names have a colon delimiter
|
||||
->where_close()
|
||||
->find();
|
||||
|
||||
if ($mmo->loaded())
|
||||
|
@@ -19,6 +19,8 @@ abstract class StaticList {
|
||||
|
||||
if (! $table)
|
||||
return 'No Table';
|
||||
elseif (! $id AND empty($table[$id]))
|
||||
return '';
|
||||
elseif (empty($table[$id]))
|
||||
return sprintf('No Value (%s)',$id);
|
||||
else
|
||||
|
@@ -18,6 +18,9 @@ class StaticList_YesNo extends StaticList {
|
||||
}
|
||||
|
||||
public static function get($value) {
|
||||
if (! $value)
|
||||
$value = 0;
|
||||
|
||||
return static::factory()->_get($value);
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
class Task_Account_Complete extends Minion_Task {
|
||||
protected function _execute(array $params) {
|
||||
$c = 0;
|
||||
$c = array();
|
||||
|
||||
$o = ORM::factory('Account')
|
||||
->where_active();
|
||||
@@ -23,10 +23,10 @@ class Task_Account_Complete extends Minion_Task {
|
||||
$ao->save();
|
||||
|
||||
if ($ao->saved())
|
||||
$c++;
|
||||
array_push($c,$ao->id);
|
||||
}
|
||||
|
||||
printf("%s services made inactive\n",$c);
|
||||
printf("%s accounts made inactive (%s)\n",count($c),join('|',$c));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user