Improvements to invoice display and other misc items
This commit is contained in:
@@ -73,10 +73,10 @@ class Config extends Kohana_Config {
|
||||
|
||||
/**
|
||||
* Show a date using a site configured format
|
||||
* @note We need this function here, since we call static:: methods, which need to resolve to the child class.
|
||||
* @note We need this function here, since we call self:: methods, which need to resolve to the child class.
|
||||
*/
|
||||
public static function datetime($date) {
|
||||
return sprintf('%s %s',static::date($date),static::time($date));
|
||||
return sprintf('%s %s',self::date($date),self::time($date));
|
||||
}
|
||||
|
||||
public static function language() {
|
||||
@@ -96,13 +96,13 @@ class Config extends Kohana_Config {
|
||||
}
|
||||
|
||||
public static function logo() {
|
||||
return HTML::image(static::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
|
||||
return HTML::image(self::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
|
||||
}
|
||||
|
||||
public static function logo_uri($protocol=NULL) {
|
||||
list ($path,$suffix) = explode('.',static::$logo);
|
||||
list ($path,$suffix) = explode('.',self::$logo);
|
||||
|
||||
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),$protocol);
|
||||
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>self::sitename())),$protocol);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,7 +138,7 @@ class Config extends Kohana_Config {
|
||||
}
|
||||
|
||||
public static function module_exist($module) {
|
||||
return array_key_exists(strtolower($module),static::modules()) ? TRUE : FALSE;
|
||||
return array_key_exists(strtolower($module),self::modules()) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -43,7 +43,7 @@ class Menu {
|
||||
if (empty($result[$mmo->id]))
|
||||
$result[$mmo->id] = $mmo;
|
||||
|
||||
return static::collapse($result);
|
||||
return self::collapse($result);
|
||||
}
|
||||
|
||||
public static function ul(array $result,array $append=NULL,$sub=FALSE) {
|
||||
@@ -51,7 +51,7 @@ class Menu {
|
||||
|
||||
foreach ($result as $k => $v)
|
||||
if (is_array($v)) {
|
||||
$output .= sprintf('<li class="dropdown-submenu">%s%s',HTML::anchor('#',$k,array('nocg'=>TRUE)),static::ul($v,NULL,TRUE).'</li>');
|
||||
$output .= sprintf('<li class="dropdown-submenu">%s%s',HTML::anchor('#',$k,array('nocg'=>TRUE)),self::ul($v,NULL,TRUE).'</li>');
|
||||
} else
|
||||
$output .= '<li>'.HTML::anchor($v->url(),$v->menu_display(),array('tabindex'=>-1,'nocg'=>TRUE)).'</li>';
|
||||
|
||||
|
@@ -173,10 +173,12 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
list($fn,$ln) = explode(' ',$term,2);
|
||||
|
||||
$this->where_open()
|
||||
->where_open()
|
||||
->where('first_name','like','%'.$fn.'%')
|
||||
->and_where('last_name','like','%'.$ln.'%')
|
||||
->where_close()
|
||||
->or_where('company','like','%'.$term.'%');
|
||||
->or_where('company','like','%'.$term.'%')
|
||||
->where_close();
|
||||
|
||||
} elseif (is_numeric($term)) {
|
||||
$this->where('id','like','%'.$term.'%');
|
||||
|
@@ -42,7 +42,10 @@ class Model_Module extends ORM_OSB {
|
||||
* @param $id PK of Model
|
||||
*/
|
||||
public function instance($id=NULL) {
|
||||
return ORM::factory(ucwords($this->name),$id);
|
||||
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() {
|
||||
|
@@ -205,10 +205,6 @@ abstract class ORM_OSB extends ORM {
|
||||
return array_key_exists($key,$this->$column) ? $this->{$column}[$key] : NULL;
|
||||
}
|
||||
|
||||
final public function module() {
|
||||
return ORM::factory(Kohana::classname($this->name));
|
||||
}
|
||||
|
||||
final public function mid() {
|
||||
return ORM::factory('Module',array('name'=>$this->_table_name));
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ abstract class StaticList {
|
||||
* @param string Default value to populate in the Form input.
|
||||
*/
|
||||
public static function form($name,$default='',$addblank=FALSE,array $attributes=NULL) {
|
||||
$table = static::factory()->_table();
|
||||
$table = self::factory()->_table();
|
||||
|
||||
if ($addblank)
|
||||
$table = array_merge(array(''=>' '),$table);
|
||||
@@ -56,11 +56,11 @@ abstract class StaticList {
|
||||
* Lists our available keys
|
||||
*/
|
||||
public static function keys() {
|
||||
return array_keys(static::factory()->_table());
|
||||
return array_keys(self::factory()->_table());
|
||||
}
|
||||
|
||||
public static function table() {
|
||||
return static::factory()->_table();
|
||||
return self::factory()->_table();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -13,24 +13,26 @@ class StaticList_ItemType extends StaticList {
|
||||
protected function _table() {
|
||||
return array(
|
||||
0=>_('Product/Service Charge'), // Line Charge Topic on Invoice, eg: Service Name
|
||||
1=> _('Hardware'),
|
||||
2=> _('Service Relocation Fee'),
|
||||
3=> _('Service Change Fee'),
|
||||
4=> _('Service Connection Fee'),
|
||||
1=>_('Hardware'),
|
||||
2=>_('Service Relocation Fee'),
|
||||
3=>_('Service Change Fee'),
|
||||
4=>_('Service Connection Fee'),
|
||||
5=>_('Excess Usage'), // Excess Service Item, of item 0
|
||||
6=> _('Service Cancellation Fee'),
|
||||
6=>_('Service Cancellation Fee'),
|
||||
7=>_('Extra Product/Service Charge'), // Service Billing in advance
|
||||
124=>_('Late Payment Fee'),
|
||||
125=>_('Payment Fee'), // Payment processing fee
|
||||
126=> _('Rounding'),
|
||||
127=> _('Late Payment Fee'),
|
||||
126=>_('Other'),
|
||||
127=>_('Rounding'),
|
||||
);
|
||||
}
|
||||
|
||||
public static function get($value) {
|
||||
return static::factory()->_get($value);
|
||||
return self::factory()->_get($value);
|
||||
}
|
||||
|
||||
public static function index($key) {
|
||||
return array_search($key,static::factory()->table());
|
||||
return array_search($key,self::factory()->table());
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -19,7 +19,7 @@ class StaticList_PriceType extends StaticList {
|
||||
}
|
||||
|
||||
public static function get($value) {
|
||||
return static::factory()->_get($value);
|
||||
return self::factory()->_get($value);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -23,7 +23,7 @@ class StaticList_RecurSchedule extends StaticList {
|
||||
}
|
||||
|
||||
public static function get($value) {
|
||||
return static::factory()->_get($value);
|
||||
return self::factory()->_get($value);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -18,7 +18,7 @@ class StaticList_RecurType extends StaticList {
|
||||
}
|
||||
|
||||
public static function get($value) {
|
||||
return static::factory()->_get($value);
|
||||
return self::factory()->_get($value);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -23,7 +23,7 @@ class StaticList_SweepType extends StaticList {
|
||||
}
|
||||
|
||||
public static function get($value) {
|
||||
return static::factory()->_get($value);
|
||||
return self::factory()->_get($value);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -22,7 +22,7 @@ class StaticList_Title extends StaticList {
|
||||
}
|
||||
|
||||
public static function get($value) {
|
||||
return static::factory()->_get($value);
|
||||
return self::factory()->_get($value);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -23,7 +23,7 @@ class StaticList_YesNo extends StaticList {
|
||||
|
||||
return $format ? View::factory(Config::theme().'/label/bool')
|
||||
->set('label',$value ? 'label-success' : '')
|
||||
->set('column',static::factory()->_get($value)) : $value;
|
||||
->set('column',self::factory()->_get($value)) : $value;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -57,7 +57,7 @@ class URL extends Kohana_URL {
|
||||
public static function navbar() {
|
||||
$result = array();
|
||||
|
||||
foreach (array_reverse(static::$method_directory) as $k=>$v)
|
||||
foreach (array_reverse(self::$method_directory) as $k=>$v)
|
||||
switch ($k) {
|
||||
case 'admin': $result[$k] = array('name'=>'Administrator','icon'=>'icon-globe');
|
||||
break;
|
||||
|
Reference in New Issue
Block a user