Some updates after changing to KH335 and updating submodules

This commit is contained in:
Deon George 2016-05-03 12:47:00 +10:00
parent 453f97324f
commit 44769e3de7
11 changed files with 58 additions and 161 deletions

View File

@ -130,8 +130,8 @@ Kohana::$config->attach(new Config_File);
* Enable modules. Modules are referenced by a relative or absolute path. * Enable modules. Modules are referenced by a relative or absolute path.
*/ */
Kohana::modules(array( Kohana::modules(array(
'lnapp' => MODPATH.'lnapp', // lnApp Base Application Tools
'oauth' => MODPATH.'oauth', // OAuth Module for External Authentication 'oauth' => MODPATH.'oauth', // OAuth Module for External Authentication
'lnapp' => MODPATH.'lnapp', // lnApp Base Application Tools
'auth' => SMDPATH.'auth', // Basic authentication 'auth' => SMDPATH.'auth', // Basic authentication
'cache' => SMDPATH.'cache', // Caching with multiple backends 'cache' => SMDPATH.'cache', // Caching with multiple backends
'cron' => SMDPATH.'cron', // Kohana Cron Module 'cron' => SMDPATH.'cron', // Kohana Cron Module

View File

@ -16,59 +16,7 @@ class Controller_User_Welcome extends Controller_Welcome {
); );
public function action_index() { public function action_index() {
Block::factory() $this->template->content = View::factory('welcome/user/view')->set('o',$this->ao);
->title(sprintf('Active Service for Account: %s',$this->ao->accnum()))
->title_icon('icon-info-sign')
->span(6)
->body(Table::factory()
->data($this->ao->service->list_active())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
Block::factory()
->title('Quick Shortcuts')
->title_icon('icon-bookmark')
->span(6)
->body(View::factory('welcome/user/shortcuts'));
Block::factory()
->title(sprintf('Invoices Due Account: %s (%s)',$this->ao->accnum(),$this->ao->invoice->list_due_total(TRUE)))
->title_icon('icon-info-sign')
->span(6)
->body(Table::factory()
->data($this->ao->invoice->list_due())
->columns(array(
'id'=>'ID',
'due_date'=>'Date Due',
'total(TRUE)'=>'Invoice Total',
'due(TRUE)'=>'Amount Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
Block::factory()
->title(sprintf('Services Expiring for Account: %s',$this->ao->accnum()))
->title_icon('icon-info-sign')
->span(6)
->body(Table::factory()
->data($this->ao->service->list_expiring())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
'expire(TRUE)'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
} }
} }
?> ?>

View File

@ -1,18 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends the core Kohana class by adding some core application
* specific functions, and configuration.
*
* @package OSB
* @category Modifications
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
abstract class Database extends Kohana_Database {
public function caching() {
return isset($this->_config['caching']) ? $this->_config['caching'] : FALSE;
}
}
?>

View File

@ -8,92 +8,7 @@
* @author Deon George * @author Deon George
* @copyright (c) 2009-2013 Open Source Billing * @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
* @deprecate
*/ */
abstract class ORM_OSB extends ORM { abstract class ORM_OSB extends ORM {
/**
* @var string Database to connect to
*/
protected $_db = 'default';
// Rules to assist with site ID and getting next record ID for inserts.
public function rules() {
return array(
'id'=>array(
array('ORM_OSB::get_next_id',array(':model',':field')),
),
'site_id'=>array(
array('ORM_OSB::set_site_id',array(':model',':field')),
),
);
}
public function config($key) {
$mc = Config::instance()->module_config($this->_object_name);
return empty($mc[$key]) ? '' : $mc[$key];
}
/**
* Get Next record id
*
* @param array Validate object
* @param string Primary Key
*/
final public static function get_next_id($model,$field) {
if (! is_null($model->$field))
return TRUE;
$model->_changed[$field] = $field;
$ido = ORM::factory('Module')
->where('name','=',$model->_table_name)
->find();
if (! $ido->loaded())
throw new Kohana_Exception('Problem getting record_id for :table',array(':table'=>$model->_table_name));
$model->$field = $ido->record_id->next_id($ido->id);
return TRUE;
}
public function keyget($column,$key=NULL) {
if (is_null($key) OR ! is_array($this->$column))
return $this->$column;
else
return array_key_exists($key,$this->$column) ? $this->{$column}[$key] : NULL;
}
final public function mid() {
return ORM::factory('Module',array('name'=>$this->_table_name));
}
/**
* Set the site ID attribute for each row update
*/
final public static function set_site_id($model,$field) {
if (! is_null($model->$field))
return TRUE;
$model->_changed[$field] = $field;
$model->$field = Company::instance()->site();
return TRUE;
}
/**
* Function help to find records that are active
*/
public function list_active($active=TRUE) {
$x=($active ? $this->_where_active() : $this);
return $x->find_all();
}
public function list_count($active=TRUE) {
$x=($active ? $this->_where_active() : $this);
return $x->find_all()->count();
}
} }
?>

View File

@ -36,6 +36,7 @@ return array
'table_prefix' => 'ab_', 'table_prefix' => 'ab_',
'charset' => 'utf8', 'charset' => 'utf8',
'caching' => FALSE, 'caching' => FALSE,
'compress' => FALSE,
'profiling' => TRUE, 'profiling' => TRUE,
), ),
); );

@ -1 +1 @@
Subproject commit 53873600c1b517628ed3a108c2d9316cf3be89b2 Subproject commit 0a7e8b349df4e965b30b3de3af3c23b6bdee40b6

View File

@ -0,0 +1,18 @@
<!-- o = Model Account -->
<?php echo Block::factory()
->title(sprintf('Invoices Due Account: %s (%s)',$o->accnum(),$o->invoice->list_due_total(TRUE)))
->title_icon('fa fa-money')
->span(6)
->body(Table::factory()
->data($o->invoice->list_due())
->columns(array(
'id'=>'ID',
'due_date'=>'Date Due',
'total(TRUE)'=>'Invoice Total',
'due(TRUE)'=>'Amount Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
?>

@ -1 +1 @@
Subproject commit 05d132c4be583a31642d2f03dec1e149f194f6f4 Subproject commit 6a33249a95ea484dd60470edc3b38f85ff5e1340

View File

@ -107,7 +107,7 @@ class Model_Payment extends ORM_OSB {
*/ */
public function subitems($type='ALL') { public function subitems($type='ALL') {
if (! $this->_sub_items_sorted) { if (! $this->_sub_items_sorted) {
Sort::MAsort($this->_sub_items,'invoice_id'); Sort::MAsort($this->_sub_items,array('invoice_id'));
$this->_sub_items_sorted = TRUE; $this->_sub_items_sorted = TRUE;
} }

View File

@ -0,0 +1,16 @@
<!-- o = Model_Account -->
<?php echo Block::factory()
->title(sprintf('Active Service for Account: %s',$o->accnum()))
->title_icon('fa-server')
->span(6)
->body(Table::factory()
->data($o->service->list_active())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
?>

View File

@ -0,0 +1,17 @@
<!-- o = Model Account -->
<?php echo Block::factory()
->title(sprintf('Services Expiring for Account: %s',$o->accnum()))
->title_icon('fa fa-level-down')
->span(6)
->body(Table::factory()
->data($o->service->list_expiring())
->columns(array(
'id'=>'ID',
'service_name(60)'=>'Service',
'expire(TRUE)'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
?>