From 01a370dcf29b088cac9eaa5eeb2e857b22815062 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 8 Oct 2015 16:31:33 +1100 Subject: [PATCH] Enabled defaults to ORM::display(), if values dont have a value --- classes/lnApp/ORM.php | 5 ++++- classes/lnApp/Site.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/lnApp/ORM.php b/classes/lnApp/ORM.php index db95e53..ba1eeb9 100644 --- a/classes/lnApp/ORM.php +++ b/classes/lnApp/ORM.php @@ -190,10 +190,13 @@ abstract class lnApp_ORM extends Kohana_ORM { /** * Return a formated columns, as per the model definition */ - public function display($column) { + public function display($column,$default='') { // Trigger a load of the record. $value = $this->__get($column); + if (! $value) + $value = $default; + // If some of our fields need to be formated for display purposes. if (! $this->_formated AND $this->_display_filters) $this->_format(); diff --git a/classes/lnApp/Site.php b/classes/lnApp/Site.php index 745e41d..c0b9a9b 100644 --- a/classes/lnApp/Site.php +++ b/classes/lnApp/Site.php @@ -21,7 +21,7 @@ abstract class lnApp_Site { * Show a date using a site configured format */ public static function Date($date) { - return (is_null($date) OR ! $date) ? '' : date(Kohana::$config->load('config')->date_format,$date); + return (is_null($date) OR ! is_numeric($date)) ? $date : date(Kohana::$config->load('config')->date_format,$date); } /**