Enabled phpunit, updates for ab_setup, enabled APC, and other todos
This commit is contained in:
@@ -15,6 +15,26 @@ class Config extends lnApp_Config {
|
||||
public $so;
|
||||
public static $no_site_id_tables = array('setup','country','currency','language','tax');
|
||||
|
||||
/** Overloaded methods **/
|
||||
|
||||
public static function date($date) {
|
||||
return date(Config::instance()->loadsite()->so->date_format,($date ? $date : time()));
|
||||
}
|
||||
|
||||
public static function siteid($format=FALSE) {
|
||||
return $format ? sprintf('%02s',Config::instance()->loadsite()->so->id) : Config::instance()->loadsite()->so->id;
|
||||
}
|
||||
|
||||
public static function sitemode() {
|
||||
return Config::instance()->loadsite()->so->status;
|
||||
}
|
||||
|
||||
public static function time($date) {
|
||||
return date(Config::instance()->loadsite()->so->time_format,($date ? $date : time()));
|
||||
}
|
||||
|
||||
/** Local Methods **/
|
||||
|
||||
/**
|
||||
* Load our site configuration from the DB
|
||||
*
|
||||
@@ -25,7 +45,7 @@ class Config extends lnApp_Config {
|
||||
if ($this->so AND $this->so->loaded())
|
||||
return $this;
|
||||
|
||||
$this->so = ORM::factory('setup',array('nonssl_url'=>URL::base('http')));
|
||||
$this->so = ORM::factory('setup',array('url'=>URL::base('http')));
|
||||
|
||||
if (! $this->so->loaded())
|
||||
throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http')));
|
||||
@@ -55,18 +75,6 @@ class Config extends lnApp_Config {
|
||||
return array_key_exists($module,static::modules()) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
public static function sitename() {
|
||||
return Company::name();
|
||||
}
|
||||
|
||||
public static function siteid($format=FALSE) {
|
||||
return $format ? sprintf('%02s',Config::instance()->loadsite()->so->id) : Config::instance()->loadsite()->so->id;
|
||||
}
|
||||
|
||||
public static function sitemode() {
|
||||
return Config::instance()->loadsite()->so->status;
|
||||
}
|
||||
|
||||
public static function copywrite() {
|
||||
return '(c) Open Source Billing Development Team';
|
||||
}
|
||||
|
@@ -11,13 +11,11 @@
|
||||
*/
|
||||
class Currency {
|
||||
public static function display($amount) {
|
||||
// @todo $cid and therefore precision should come from a global session value.
|
||||
return Num::format(Currency::round($amount),2,TRUE);
|
||||
return Num::format($amount,Config::instance()->so->decimal_place,TRUE);
|
||||
}
|
||||
|
||||
public static function round($amount) {
|
||||
// @todo This rounding needs to be system configurable.
|
||||
return Num::round($amount,2);
|
||||
return Num::round($amount,Config::instance()->so->decimal_place);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -22,7 +22,10 @@ abstract class lnApp_Config extends Kohana_Config {
|
||||
* NOTE: Kohana doesnt provide a parent construct for the Kohana_Config class.
|
||||
*/
|
||||
public function __construct() {
|
||||
if (Kohana::$is_cli) {
|
||||
if (defined('PHPUNITTEST'))
|
||||
$_SERVER['SERVER_NAME'] = PHPUNITTEST;
|
||||
|
||||
elseif (Kohana::$is_cli) {
|
||||
if (! $site = CLI::options('site'))
|
||||
throw new Kohana_Exception(_('Cant figure out the site, use --site= for CLI'));
|
||||
else
|
||||
@@ -116,7 +119,7 @@ abstract class lnApp_Config extends Kohana_Config {
|
||||
* Show a date using a site configured format
|
||||
*/
|
||||
public static function datetime($date) {
|
||||
return date(Kohana::config('config.date_format').' '.Kohana::config('config.time_format'),$date);
|
||||
return sprintf('%s %s',static::date($date),static::time($date));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user