'date_orig','format'=>TRUE); protected $_updated_column = array('column'=>'date_last','format'=>TRUE); // @todo Rules are no longer used? public function rules() { return array( 'id'=>array( array('ORMOSB::get_next_id',array(':validation',':model',':field')), ), 'site_id'=>array( array('ORMOSB::set_site_id',array(':validation',':model',':field')), ), ); } /** * Our child models should provide an invoice display, this is shown * on printed invoices. * * @todo This is no longer used I think? */ public function invoice_display() { throw new Kohana_Exception(':module has not configured an :method, but has made the call',array(':module'=>get_class($this),'method'=>__METHOD__)); } /** * This function will enhance the [Validate::filter], since it always passes * the value as the first argument and sometimes functions need that to not * be the first argument. * * Currently this implements: * [date()][date-ref] * * [date-ref]: http://www.php.net/date * * This function will throw an exception if called without a function * defined. * * @param mixed $val Value to be processed * @param string $func Name of function to call * @param string $arg Other arguments for the function * @todo This has probably changed in KH 3.1 */ final public static function _filters($val,$func,$arg) { switch ($func) { case 'date': return date($arg,$val); default: throw new Exception(sprintf(_('Unknown function: %s (%s,%s)'),$func,$arg,$val)); } } /** * Get Next record id * * @param array Validate object * @param string Primary Key */ public static function get_next_id(Validation $array,$model,$field) { if (! is_null($model->$field)) return TRUE; $model->_changed[$field] = $field; $ido = ORM::factory('module') ->where('name','=',$model->_table_name) ->find(); if (! $ido->loaded()) throw new Kohana_Exception('Problem getting record_id for :table',array(':table'=>$model->_table_name)); $model->$field = $ido->record_id->next_id($ido->id); return TRUE; } public static function set_site_id(Validation $array,$model,$field) { if (! is_null($model->$field)) return TRUE; $model->_changed[$field] = $field; $model->$field = Config::siteid(); return TRUE; } } ?>