diff --git a/classes/lnApp/ORM.php b/classes/lnApp/ORM.php index 5966b42..570ca54 100644 --- a/classes/lnApp/ORM.php +++ b/classes/lnApp/ORM.php @@ -77,8 +77,9 @@ abstract class lnApp_ORM extends Kohana_ORM { $result['this'] = $this->object(); - foreach ($this->_sub_items as $o) - $result['sub'][] = $o->dump(); + if (isset($this->_sub_items)) + foreach ($this->_sub_items as $o) + $result['sub'][] = $o->dump(); return $result; } @@ -137,14 +138,17 @@ abstract class lnApp_ORM extends Kohana_ORM { * Return an array of data that can be used in a SELECT statement. * The ID and VALUE is defined in the model for the select. */ - public function list_select($blank=FALSE) { + public function list_select($blank=FALSE,$object=NULL) { $result = array(); + if (is_null($object)) + $object = $this->find_all(); + if ($blank) $result[NULL] = ''; if ($this->_form AND array_intersect(array('id','value'),$this->_form)) - foreach ($this->find_all() as $o) + foreach ($object as $o) $result[$o->{$this->_form['id']}] = $o->resolve($this->_form['value']); return $result; diff --git a/classes/lnApp/Table.php b/classes/lnApp/Table.php index dfbf636..c7149c4 100644 --- a/classes/lnApp/Table.php +++ b/classes/lnApp/Table.php @@ -104,6 +104,10 @@ abstract class lnApp_Table { if (isset($this->postproc[$key]) and $x) { foreach ($this->postproc[$key] as $act => $data) { switch ($act) { + case 'yesno': + $x = StaticList_YesNo::get($x,TRUE); + break; + case 'trim': if (strlen($x) > $data) { $x = sprintf('%s',$x,substr($x,0,$data-3).str_repeat('.',3));