Merge remote-tracking branch 'upstream/develop' into Squiz.Scope.MethodScope.Missing

This commit is contained in:
Frédéric FRANCE 2019-02-27 14:21:15 +01:00
commit 49cbaed569
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
15 changed files with 257 additions and 34 deletions

View File

@ -354,6 +354,22 @@ class Documents extends DolibarrApi
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
}
else if ($modulepart == 'produit' || $modulepart == 'product')
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$object = new Product($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
throw new RestException(404, 'Product not found');
}
$upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product');
}
else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';

View File

@ -88,7 +88,11 @@ $search_all=trim(GETPOST("search_all", 'alpha'));
$search=array();
foreach($object->fields as $key => $val)
{
<<<<<<< HEAD
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
=======
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
>>>>>>> upstream/develop
}
if (empty($action) && empty($id) && empty($ref)) $action='view';
@ -119,11 +123,15 @@ if (empty($reshook))
$permissiontoadd = $user->rights->bom->write;
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/bom/bom_list.php', 1);
$backurlforlist = dol_buildpath('/bom/bom_list.php', 1);
if (empty($backtopage)) {
if (empty($id)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/bom/bom_card.php', 1).($id > 0 ? $id : '__ID__');
<<<<<<< HEAD
}
=======
}
>>>>>>> upstream/develop
$triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, delete or clone

View File

@ -718,7 +718,7 @@ if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'],$_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder);

View File

@ -3682,6 +3682,75 @@ class Form
return $num;
}
/**
* Return a HTML select list of establishment
*
* @param string $selected Id establishment pre-selected
* @param string $htmlname Name of select zone
* @param int $statut Status of searched establishment (0=open, 1=closed, 2=both)
* @param string $filtre To filter list
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib To add more attribute on select
* @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...)
*/
function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '')
{
// phpcs:enable
global $langs, $conf;
$langs->load("admin");
$num = 0;
$sql = "SELECT rowid, name, fk_country, status, entity";
$sql.= " FROM ".MAIN_DB_PREFIX."establishment";
$sql.= " WHERE 1=1";
if ($statut != 2) $sql.= " AND status = '".$statut."'";
if ($filtre) $sql.=" AND ".$filtre;
$sql.= " ORDER BY name";
dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
if ($num)
{
print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1))
{
print '<option value="-1">&nbsp;</option>';
}
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if ($selected == $obj->rowid)
{
print '<option value="'.$obj->rowid.'" selected>';
}
else
{
print '<option value="'.$obj->rowid.'">';
}
print trim($obj->name);
if ($statut == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
print '</option>';
$i++;
}
print "</select>";
}
else
{
if ($statut == 0) print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
else print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
}
}
else {
dol_print_error($this->db);
}
}
/**
* Display form to select bank account
*

View File

@ -3081,7 +3081,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithoutext == 'jabber') {
$fakey = 'fa-comment-o';
}
elseif ($pictowithoutext == 'skype') {
elseif (in_array($pictowithoutext, array('skype', 'twitter', 'facebook', 'linkedin'))) {
$fakey = 'fa-'.$pictowithoutext;
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa = 'fab';
}

View File

@ -78,7 +78,7 @@ dol_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user");
$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status";
$sql.= " FROM ".MAIN_DB_PREFIX."establishment as e";
$sql.= " WHERE e.entity = ".$conf->entity;
$sql.= " WHERE e.entity IN (".getEntity('establishment').')';
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($limit+1, $offset);

View File

@ -208,6 +208,7 @@ class Establishment extends CommonObject
$sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null');
$sql .= ", status = ".$this->db->escape($this->status);
$sql .= ", fk_user_mod = " . $user->id;
$sql .= ", entity = " . $this->entity;
$sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
@ -230,7 +231,7 @@ class Establishment extends CommonObject
*/
public function fetch($id)
{
$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id,";
$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id, e.entity,";
$sql.= ' c.code as country_code, c.label as country';
$sql.= " FROM ".MAIN_DB_PREFIX."establishment as e";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON e.fk_country = c.rowid';
@ -249,6 +250,7 @@ class Establishment extends CommonObject
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->status = $obj->status;
$this->entity = $obj->entity;
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_code;
@ -352,7 +354,7 @@ class Establishment extends CommonObject
*/
public function info($id)
{
$sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod';
$sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity';
$sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e';
$sql.= ' WHERE e.rowid = '.$id;
@ -389,6 +391,37 @@ class Establishment extends CommonObject
dol_print_error($this->db);
}
}
/**
* Get on record Establishment
*
* @param int $id Id of record
* @return obj
*/
function getEstablishment($id)
{
$sql = 'SELECT e.rowid, e.name, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity';
$sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e';
$sql.= ' WHERE e.rowid = '.$id;
dol_syslog(get_class($this)."::fetch info", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
{
$obj = $this->db->fetch_object($result);
}
$this->db->free($result);
}
else
{
dol_print_error($this->db);
}
return $obj;
}
/**
* Return clicable name (with picto eventually)
@ -414,6 +447,34 @@ class Establishment extends CommonObject
if ($withpicto != 2) $result.=$link.$this->name.$linkend;
return $result;
}
/**
* Return clicable name (with picto eventually)
*
* @param int $id Id of record
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string String with URL
*/
function getNomUrlParent($id = 0, $withpicto = 0)
{
global $langs;
$result='';
$obj = $this->getEstablishment(($id>0)?$id:$conf->entity);
$link = '<a href="'.DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$obj->rowid.'">';
$linkend='</a>';
$picto='building';
$label=$langs->trans("Show").': '.$obj->name;
if ($withpicto) $result.=($link.img_object($label, $picto).$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.$obj->name.$linkend;
return $result;
}
/**
* Return account country code

View File

@ -92,8 +92,7 @@ elseif ($action == 'add')
$object->status = GETPOST('status', 'int');
$object->fk_user_author = $user->id;
$object->datec = dol_now();
$object->entity = GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity;
$id = $object->create($user);
@ -141,6 +140,7 @@ elseif ($action == 'update')
$object->country_id = GETPOST('country_id', 'int');
$object->fk_user_mod = $user->id;
$object->status = GETPOST('status', 'int');
$object->entity = GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity;
$result = $object->update($user);
@ -190,6 +190,14 @@ if ($action == 'create')
print '<td><input name="name" id="name" size="32" value="' . GETPOST("name", "alpha") . '"></td>';
print '</tr>';
// Parent
print '<tr>';
print '<td>'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).'</td>';
print '<td class="maxwidthonsmartphone">';
print $form->selectEstablishments(GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity, 'entity', 1);
print '</td>';
print '</tr>';
// Address
print '<tr>';
print '<td>'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>';
@ -202,7 +210,7 @@ if ($action == 'create')
print '<tr>';
print '<td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td>';
print '<td>';
print $formcompany->select_ziptown(
print $formcompany->select_ziptown(
GETPOST('zipcode', 'alpha'),
'zipcode',
array (
@ -218,7 +226,7 @@ print $formcompany->select_ziptown(
print '<tr>';
print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td>';
print '<td>';
print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array (
print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array (
'zipcode',
'selectcountry_id'
));
@ -282,6 +290,12 @@ if (($id || $ref) && $action == 'edit')
// Name
print '<tr><td>'.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="name" id="name" class="flat" size="32" value="'.$object->name.'">';
print '</td></tr>';
// Parent
print '<tr><td>'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).'</td>';
print '<td class="maxwidthonsmartphone">';
print $form->selectEstablishments($object->entity>0?$object->entity:$conf->entity, 'entity', 1);
print '</td></tr>';
// Address
@ -292,12 +306,12 @@ if (($id || $ref) && $action == 'edit')
// Zipcode / Town
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->zip, 'zipcode', array (
print $formcompany->select_ziptown($object->zip, 'zipcode', array (
'town',
'selectcountry_id'
), 6) . '</tr>';
print '<tr><td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->town, 'town', array (
print $formcompany->select_ziptown($object->town, 'town', array (
'zipcode',
'selectcountry_id'
)) . '</td></tr>';
@ -366,6 +380,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td>'.$object->name.'</td>';
print '</tr>';
// Parent
print '<tr>';
print '<td class="titlefield">'.$langs->trans("Parent").'</td>';
print '<td>'.$object->getNomUrlParent($object->entity).'</td>';
print '</tr>';
// Address
print '<tr>';

View File

@ -885,7 +885,6 @@ LineNb=Line no.
IncotermLabel=Incoterms
TabLetteringCustomer=Customer lettering
TabLetteringSupplier=Vendor lettering
# Week day
Monday=Monday
Tuesday=Tuesday
Wednesday=Wednesday
@ -965,3 +964,4 @@ SelectAThirdPartyFirst=Select a third party first...
YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode
Inventory=Inventory
AnalyticCode=Analytic code
TMenuMRP=MRP

View File

@ -109,3 +109,4 @@ UserLogoff=User logout
UserLogged=User logged
DateEmployment=Employment Start Date
DateEmploymentEnd=Employment End Date
CantDisableYourself=You can disable your own user record

View File

@ -54,19 +54,19 @@ if ($query=="cat")
$dir = $upload_dir.'/'.$pdir;
foreach ($object->liste_photos($dir) as $key => $obj)
{
if ($obj['photo_vignette'])
{
if ($obj['photo_vignette'])
{
$filename=$obj['photo_vignette'];
}
else
{
$filename=$obj['photo'];
}
$file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename);
header('Location: '.$file);
exit;
$filename=$obj['photo_vignette'];
}
else
{
$filename=$obj['photo'];
}
$file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename);
header('Location: '.$file);
exit;
}
header('Location: ../../public/theme/common/nophoto.png');
}
elseif ($query=="pro")
@ -81,7 +81,6 @@ elseif ($query=="pro")
$file = array_pop($match);
if ($file=="") header('Location: ../../public/theme/common/nophoto.png');
else header('Location: '.$file);
}
else
{

View File

@ -271,7 +271,7 @@ body {
.thumbstat { font-weight: bold !important; }
th a { font-weight: <?php echo ($useboldtitle?'bold':'normal'); ?> !important; }
a.tab { font-weight: bold !important; }
a.tab { font-weight: 500 !important; }
a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; }
a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); }

View File

@ -264,7 +264,7 @@ body {
.thumbstat { font-weight: bold !important; }
th a { font-weight: <?php echo ($useboldtitle?'bold':'normal'); ?> !important; }
a.tab { font-weight: bold !important; }
a.tab { font-weight: 500 !important; }
a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; }
a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); }

View File

@ -48,6 +48,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
@ -91,7 +92,7 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
if ($user->id <> $id && ! $canreaduser) accessforbidden();
// Load translation files required by page
$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm'));
$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks'));
$object = new User($db);
$extrafields = new ExtraFields($db);
@ -238,6 +239,8 @@ if (empty($reshook)) {
$dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth'), GETPOST('dateemploymentendday'), GETPOST('dateemploymentendyear'));
$object->dateemploymentend = $dateemploymentend;
$object->fk_warehouse = GETPOST('fk_warehouse', 'int');
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) {
@ -386,6 +389,11 @@ if (empty($reshook)) {
$dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth', 'int'), GETPOST('dateemploymentendday', 'int'), GETPOST('dateemploymentendyear', 'int'));
$object->dateemploymentend = $dateemploymentend;
if (! empty($conf->stock->enabled))
{
$object->fk_warehouse = GETPOST('fk_warehouse', 'int');
}
if (! empty($conf->multicompany->enabled))
{
if (! empty($_POST["superadmin"]))
@ -642,6 +650,7 @@ $form = new Form($db);
$formother=new FormOther($db);
$formcompany = new FormCompany($db);
$formfile = new FormFile($db);
if (! empty($conf->stock->enabled)) $formproduct = new FormProduct($db);
llxHeader('', $langs->trans("UserCard"));
@ -1185,6 +1194,13 @@ if ($action == 'create' || $action == 'adduserldap')
print '<input class="maxwidth200" type="text" name="job" value="'.GETPOST('job').'">';
print '</td></tr>';
// Default warehouse
if (! empty($conf->stock->enabled))
{
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1);
print '</td></tr>';
}
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)))
@ -1538,6 +1554,17 @@ else
print '<td>'.$object->job.'</td>';
print '</tr>'."\n";
// Default warehouse
if (! empty($conf->stock->enabled))
{
require_once DOL_DOCUMENT_ROOT .'/product/stock/class/entrepot.class.php';
$warehousestatic=new Entrepot($db);
$warehousestatic->fetch($object->fk_warehouse);
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print $warehousestatic->getNomUrl();
print '</td></tr>';
}
//$childids = $user->getAllChildIds(1);
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
@ -1801,18 +1828,25 @@ else
}
}
// Activer
// Enable user
if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=enable">'.$langs->trans("Reactivate").'</a></div>';
}
// Desactiver
// Disable user
if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&amp;id='.$object->id.'">'.$langs->trans("DisableUser").'</a></div>';
}
else
{
if ($user->id == $id)
{
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("CantDisableYourself").'">'.$langs->trans("DisableUser").'</a></div>';
}
}
// Delete
if ($user->id <> $id && $candisableuser &&
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
@ -2556,6 +2590,15 @@ else
}
print '</td></tr>';
// Default warehouse
if (! empty($conf->stock->enabled))
{
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1);
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit').'">'.$langs->trans("AddWarehouse").'</a>';
print '</td></tr>';
}
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)))
{

View File

@ -175,6 +175,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'),
'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'),
@ -249,6 +251,7 @@ class User extends CommonObject
$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,";
@ -350,9 +353,9 @@ class User extends CommonObject
$this->thm = $obj->thm;
$this->tjm = $obj->tjm;
$this->salary = $obj->salary;
$this->salaryextra = $obj->salaryextra;
$this->salaryextra = $obj->salaryextra;
$this->weeklyhours = $obj->weeklyhours;
$this->color = $obj->color;
$this->color = $obj->color;
$this->dateemployment = $this->db->jdate($obj->dateemployment);
$this->dateemploymentend = $this->db->jdate($obj->dateemploymentend);
@ -361,8 +364,8 @@ class User extends CommonObject
$this->datelastlogin = $this->db->jdate($obj->datel);
$this->datepreviouslogin = $this->db->jdate($obj->datep);
$this->societe_id = $obj->fk_soc; // deprecated
$this->contact_id = $obj->fk_socpeople; // deprecated
$this->societe_id = $obj->fk_soc; // deprecated
$this->contact_id = $obj->fk_socpeople; // deprecated
$this->socid = $obj->fk_soc;
$this->contactid = $obj->fk_socpeople;
$this->fk_member = $obj->fk_member;
@ -370,6 +373,7 @@ class User extends CommonObject
$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.
@ -1484,6 +1488,7 @@ class User extends CommonObject
$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))
@ -1542,6 +1547,7 @@ class User extends CommonObject
$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;