// Format definitions

This commit is contained in:
rMalie
2011-12-13 13:41:54 +00:00
parent d189fd8ed0
commit 1506dc39b3
71 changed files with 710 additions and 1791 deletions
+19 -35
View File
@@ -67,10 +67,6 @@ class EmployeeCore extends ObjectModel
public $remote_addr;
/**
* @see ObjectModel::$definition
*/
@@ -78,20 +74,22 @@ class EmployeeCore extends ObjectModel
'table' => 'employee',
'primary' => 'id_employee',
'fields' => array(
'lastname' => array('type' => 'FILL_ME', 'validate' => 'isName', 'required' => true, 'size' => 32),
'firstname' => array('type' => 'FILL_ME', 'validate' => 'isName', 'required' => true, 'size' => 32),
'email' => array('type' => 'FILL_ME', 'validate' => 'isEmail', 'required' => true, 'size' => 128),
'id_lang' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt', 'required' => true),
'passwd' => array('type' => 'FILL_ME', 'validate' => 'isPasswdAdmin', 'required' => true, 'size' => 32),
'active' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'id_profile' => array('type' => 'FILL_ME', 'validate' => 'isInt', 'required' => true),
'bo_color' => array('type' => 'FILL_ME', 'validate' => 'isColor', 'size' => 32),
'bo_theme' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'size' => 32),
'bo_show_screencast' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128),
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswdAdmin', 'required' => true, 'size' => 32),
'last_passwd_gen' => array('type' => self::TYPE_STRING),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'id_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'bo_color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 32),
'bo_theme' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32),
'bo_show_screencast' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'stats_date_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'stats_date_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
protected $webserviceParameters = array(
'fields' => array(
'id_lang' => array('xlink_resource' => 'languages'),
@@ -102,33 +100,19 @@ class EmployeeCore extends ObjectModel
),
);
public function getFields()
/**
* @see ObjectModel::getFields()
* @return array
*/
public function getFields()
{
$this->validateFields();
$fields['id_profile'] = (int)$this->id_profile;
$fields['id_lang'] = (int)$this->id_lang;
$fields['lastname'] = pSQL($this->lastname);
$fields['firstname'] = pSQL(Tools::ucfirst($this->firstname));
$fields['email'] = pSQL($this->email);
$fields['passwd'] = pSQL($this->passwd);
$fields['last_passwd_gen'] = pSQL($this->last_passwd_gen);
if (empty($this->stats_date_from))
$this->stats_date_from = date('Y-m-d 00:00:00');
$fields['stats_date_from'] = pSQL($this->stats_date_from);
if (empty($this->stats_date_to))
$this->stats_date_to = date('Y-m-d 23:59:59');
$fields['stats_date_to'] = pSQL($this->stats_date_to);
$fields['bo_color'] = pSQL($this->bo_color);
$fields['bo_theme'] = pSQL($this->bo_theme);
$fields['bo_show_screencast'] = (int)$this->bo_show_screencast;
$fields['active'] = (int)$this->active;
return $fields;
return parent::getFields();
}
public function add($autodate = true, $null_values = true)