Theme work with focusbusiness and baseadmin
Improvements to NAVBAR, updates to StaticList methods, other minor items Enable product category rendering and other minor improvements Added ADSL-large category price plan
This commit is contained in:
@@ -35,7 +35,7 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::display',array(':value')),
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -50,7 +50,14 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
* Get the groups that an account belongs to
|
||||
*/
|
||||
public function groups() {
|
||||
return $this->group->where_active()->find_all();
|
||||
$result = array();
|
||||
|
||||
foreach ($this->group->where_active()->find_all() as $go)
|
||||
foreach ($go->list_parentgrps(TRUE) as $cgo)
|
||||
if (empty($result[$cgo->id]))
|
||||
$result[$cgo->id] = $cgo;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,6 +107,27 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
return $alo->saved();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will extract the available methods for this account
|
||||
* This is used both for menu options and method security
|
||||
*/
|
||||
public function methods() {
|
||||
static $result = array();
|
||||
|
||||
// @todo We may want to optimise this with some session caching.
|
||||
if ($result)
|
||||
return $result;
|
||||
|
||||
foreach ($this->groups() as $go)
|
||||
foreach ($go->module_method->find_all() as $mmo)
|
||||
if (empty($result[$mmo->id]))
|
||||
$result[$mmo->id] = $mmo;
|
||||
|
||||
Sort::MAsort($result,'module->name,name');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an account name
|
||||
*/
|
||||
|
@@ -10,6 +10,8 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Country extends ORM_OSB {
|
||||
protected $_form = array('id'=>'id','value'=>'name');
|
||||
|
||||
public function currency() {
|
||||
return ORM::factory('Currency')->where('country_id','=',$this->id)->find();
|
||||
}
|
||||
|
@@ -10,5 +10,6 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Currency extends ORM_OSB {
|
||||
protected $_form = array('id'=>'id','value'=>'name');
|
||||
}
|
||||
?>
|
||||
|
@@ -33,7 +33,7 @@ class Model_Group extends Model_Auth_RoleDefault {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::display',array(':value')),
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class Model_Module extends ORM_OSB {
|
||||
array('strtoupper',array(':value')),
|
||||
),
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::display',array(':value')),
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -10,6 +10,10 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Module_Method extends ORM_OSB {
|
||||
// This module doesnt keep track of column updates automatically
|
||||
protected $_created_column = FALSE;
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
// Relationships
|
||||
protected $_belongs_to = array(
|
||||
'module'=>array(),
|
||||
@@ -25,19 +29,24 @@ class Model_Module_Method extends ORM_OSB {
|
||||
'name'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'menu_display'=>array(
|
||||
array('StaticList_YesNo::display',array(':value')),
|
||||
),
|
||||
);
|
||||
/**
|
||||
* Calculate the description for this method on any menu link
|
||||
*/
|
||||
public function menu_display() {
|
||||
// @todo The test for value equal 1 is for legacy, remove when all updated.
|
||||
if ($this->menu_display AND $this->menu_display != 1)
|
||||
return $this->menu_display;
|
||||
else
|
||||
return sprintf('%s: %s',$this->module->name,$this->name);
|
||||
}
|
||||
|
||||
// This module doesnt keep track of column updates automatically
|
||||
protected $_created_column = FALSE;
|
||||
protected $_updated_column = FALSE;
|
||||
public function url() {
|
||||
if (! preg_match('/_/',$this->name))
|
||||
return NULL;
|
||||
|
||||
// Return the method name.
|
||||
public function name() {
|
||||
return sprintf('%s::%s',$this->module->name,$this->name);
|
||||
list($type,$action) = preg_split('/_/',$this->name,2);
|
||||
|
||||
return URL::link($type,$this->module->name.'/'.$action);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user