Skip to content

Commit

Permalink
Add Default Warehouse to user
Browse files Browse the repository at this point in the history
  • Loading branch information
wdammak committed Feb 15, 2019
1 parent b44acd1 commit d31aadf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion htdocs/user/class/user.class.php
Expand Up @@ -173,6 +173,8 @@ class User extends CommonObject

public $default_c_exp_tax_cat;
public $default_range;

public $fk_warehouse;

public $fields = array(
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
Expand Down Expand Up @@ -248,6 +250,7 @@ function fetch($id = '', $login = '', $sid = '', $loadpersonalconf = 0, $entity
$sql.= " u.weeklyhours,";
$sql.= " u.color,";
$sql.= " u.dateemployment, u.dateemploymentend,";
$sql.= " u.fk_warehouse,";
$sql.= " u.ref_int, u.ref_ext,";
$sql.= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode
$sql.= " c.code as country_code, c.label as country,";
Expand Down Expand Up @@ -368,6 +371,7 @@ function fetch($id = '', $login = '', $sid = '', $loadpersonalconf = 0, $entity

$this->default_range = $obj->default_range;
$this->default_c_exp_tax_cat = $obj->default_c_exp_tax_cat;
$this->fk_warehouse = $obj->fk_warehouse;

// Protection when module multicompany was set, admin was set to first entity and then, the module was disabled,
// in such case, this admin user must be admin for ALL entities.
Expand Down Expand Up @@ -1482,6 +1486,7 @@ function update($user, $notrigger = 0, $nosyncmember = 0, $nosyncmemberpass = 0,
$this->color = empty($this->color)?'':$this->color;
$this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment;
$this->dateemploymentend = empty($this->dateemploymentend)?'':$this->dateemploymentend;
$this->fk_warehouse = trim(empty($this->fk_warehouse)?'':$this->fk_warehouse);

// Check parameters
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
Expand Down Expand Up @@ -1539,6 +1544,7 @@ function update($user, $notrigger = 0, $nosyncmember = 0, $nosyncmemberpass = 0,
$sql.= ", entity = '".$this->db->escape($this->entity)."'";
$sql.= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null');
$sql.= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null');
$sql.= ", fk_warehouse = ".($this->fk_warehouse?"'".$this->db->escape($this->fk_warehouse)."'":"null");

$sql.= " WHERE rowid = ".$this->id;

Expand Down Expand Up @@ -1977,7 +1983,7 @@ function send_password($user, $password = '', $changelater = 0)
dol_syslog(get_class($this)."::send_password changelater is on, url=".$url);
}

$mailfile = new CMailFile(
$mailfile = new CMailFile(
$subject,
$this->email,
$conf->global->MAIN_MAIL_EMAIL_FROM,
Expand Down

0 comments on commit d31aadf

Please sign in to comment.