diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index fd0ff2e72da..9f873195465 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -674,7 +674,7 @@ if ($id) { // Can an entry be erased or disabled ? $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + $url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); if ($param) { $url .= '&'.$param; } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index ae92286dfec..d9cb6f6fb7d 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -1,8 +1,9 @@ - * Copyright (C) 2005-2016 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2018 Juanjo Menent +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2018 Juanjo Menent + * Copyright (C) 2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -108,7 +109,7 @@ llxHeader('', $langs->trans("WithdrawalsLines")); $sql = "SELECT p.rowid, p.ref, p.statut as status, p.datec"; $sql .= " , f.rowid as facid, f.ref as invoiceref, f.total_ttc"; -$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.email"; +$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.email"; $sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -139,7 +140,7 @@ if ($search_bon) { } if ($type == 'bank-transfer') { if ($search_code) { - $sql .= natural_search("s.code_fourn", $search_code); + $sql .= natural_search("s.code_fournisseur", $search_code); } } else { if ($search_code) { @@ -172,6 +173,9 @@ if ($result) { $param = "&statut=".urlencode($statut); $param .= "&search_bon=".urlencode($search_bon); + if ($type == 'bank-transfer') { + $param .= '&type=bank-transfer'; + } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } @@ -204,7 +208,7 @@ if ($result) { print ''; print ' '; print ''; - print ''; + print ''; print ' '; print ' '; print ''; @@ -214,8 +218,12 @@ if ($result) { print ''; $columntitle = "WithdrawalsReceipts"; + $columntitlethirdparty = "CustomerCode"; + $columncodethirdparty = "s.code_client"; if ($type == 'bank-transfer') { $columntitle = "BankTransferReceipts"; + $columntitlethirdparty = "SupplierCode"; + $columncodethirdparty = "s.code_fournisseur"; } print ''; @@ -223,7 +231,7 @@ if ($result) { print_liste_field_titre("Line", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Bill", $_SERVER["PHP_SELF"], "f.ref", '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($columntitlethirdparty, $_SERVER["PHP_SELF"], $columncodethirdparty, '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); @@ -256,9 +264,17 @@ if ($result) { print ''; print ''; - print ''; - print img_object($langs->trans("ShowBill"), "bill"); - print ' '.$obj->invoiceref."\n"; + $link_to_bill = '/compta/facture/card.php?facid='; + $link_title = 'Invoice'; + $link_picto = 'bill'; + if ($type == 'bank-transfer') { + $link_to_bill = '/fourn/facture/card.php?facid='; + $link_title = 'SupplierInvoice'; + $link_picto = 'supplier_invoice'; + } + print ''; + print img_object($langs->trans($link_title), $link_picto); + print ' '.$obj->invoiceref."\n"; print ''; print ''; @@ -266,7 +282,15 @@ if ($result) { print $company->getNomUrl(1); print "\n"; - print ''.$obj->code_client."\n"; + + print ''; + $link_to_tab = '/comm/card.php?socid='; + $link_code = $obj->code_client; + if ($type == 'bank-transfer') { + $link_to_tab = '/fourn/card.php?socid='; + $link_code = $obj->code_fournisseur; + } + print ''.$link_code."\n"; print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index c80acb39f8e..ee370b9532e 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -132,6 +132,9 @@ if ($result) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } + if ($type == 'bank-transfer') { + $param .= '&type=bank-transfer'; + } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 4d62f9139b3..66e9241d9f5 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -51,6 +51,12 @@ class RssParser private $current_namespace; + private $initem; + private $intextinput; + private $incontent; + private $inimage; + private $inchannel; + // For parsing with xmlparser public $stack = array(); // parser stack private $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); @@ -254,21 +260,26 @@ class RssParser return -1; } - $xmlparser = xml_parser_create(''); + try { + $xmlparser = xml_parser_create(null); - if (!is_resource($xmlparser) && !is_object($xmlparser)) { - $this->error = "ErrorFailedToCreateParser"; - return -1; + if (!is_resource($xmlparser) && !is_object($xmlparser)) { + $this->error = "ErrorFailedToCreateParser"; + return -1; + } + + xml_set_object($xmlparser, $this); + xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); + xml_set_character_data_handler($xmlparser, 'feed_cdata'); + + $status = xml_parse($xmlparser, $str, false); + + xml_parser_free($xmlparser); + $rss = $this; + //var_dump($status.' '.$rss->_format);exit; + } catch (Exception $e) { + $rss = null; } - - xml_set_object($xmlparser, $this); - xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); - xml_set_character_data_handler($xmlparser, 'feed_cdata'); - - $status = xml_parse($xmlparser, $str); - xml_parser_free($xmlparser); - $rss = $this; - //var_dump($status.' '.$rss->_format);exit; } } @@ -443,7 +454,7 @@ class RssParser // Loop on each category $itemCategory = array(); - if (is_array($item->category)) { + if (!empty($item->category) && is_array($item->category)) { foreach ($item->category as $cat) { $itemCategory[] = (string) $cat; } @@ -514,7 +525,7 @@ class RssParser * @param array $attrs Attributes of tags * @return void */ - public function feed_start_element($p, $element, &$attrs) + public function feed_start_element($p, $element, $attrs) { // phpcs:enable $el = $element = strtolower($element); @@ -681,9 +692,9 @@ class RssParser public function append_content($text) { // phpcs:enable - if ($this->initem) { + if (!empty($this->initem)) { $this->concat($this->current_item[$this->incontent], $text); - } elseif ($this->inchannel) { + } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$this->incontent], $text); } } @@ -700,24 +711,24 @@ class RssParser if (!$el) { return; } - if ($this->current_namespace) { - if ($this->initem) { + if (!empty($this->current_namespace)) { + if (!empty($this->initem)) { $this->concat($this->current_item[$this->current_namespace][$el], $text); - } elseif ($this->inchannel) { + } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$this->current_namespace][$el], $text); - } elseif ($this->intextinput) { + } elseif (!empty($this->intextinput)) { $this->concat($this->textinput[$this->current_namespace][$el], $text); - } elseif ($this->inimage) { + } elseif (!empty($this->inimage)) { $this->concat($this->image[$this->current_namespace][$el], $text); } } else { - if ($this->initem) { + if (!empty($this->initem)) { $this->concat($this->current_item[$el], $text); - } elseif ($this->intextinput) { + } elseif (!empty($this->intextinput)) { $this->concat($this->textinput[$el], $text); - } elseif ($this->inimage) { + } elseif (!empty($this->inimage)) { $this->concat($this->image[$el], $text); - } elseif ($this->inchannel) { + } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$el], $text); } } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 5847d88f026..9b1d78f1694 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -471,7 +471,7 @@ class DoliDBMysqli extends DoliDB */ public function escape($stringtoencode) { - return $this->db->real_escape_string($stringtoencode); + return $this->db->real_escape_string((string) $stringtoencode); } /** @@ -482,7 +482,7 @@ class DoliDBMysqli extends DoliDB */ public function escapeunderscore($stringtoencode) { - return str_replace('_', '\_', $stringtoencode); + return str_replace('_', '\_', (string) $stringtoencode); } /** diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9250251de11..ae69b88f847 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6583,10 +6583,10 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = ' * * @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir') * @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used) - * @param string|null $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444' + * @param string $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444' * @return int < 0 if KO, 0 = already exists, > 0 if OK */ -function dol_mkdir($dir, $dataroot = '', $newmask = null) +function dol_mkdir($dir, $dataroot = '', $newmask = '') { global $conf; @@ -6627,7 +6627,7 @@ function dol_mkdir($dir, $dataroot = '', $newmask = null) dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG); umask(0); - $dirmaskdec = octdec($newmask); + $dirmaskdec = octdec((string) $newmask); if (empty($newmask)) { $dirmaskdec = empty($conf->global->MAIN_UMASK) ? octdec('0755') : octdec($conf->global->MAIN_UMASK); } diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php index ffbd14a88fb..110afe442c2 100644 --- a/htdocs/core/modules/modIncoterm.class.php +++ b/htdocs/core/modules/modIncoterm.class.php @@ -93,7 +93,8 @@ class modIncoterm extends DolibarrModules 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array($conf->incoterm->enabled) + 'tabcond'=>array($conf->incoterm->enabled), + 'tabhelp' => array(array()) ); $this->boxes = array(); // List of boxes diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 47eefb01be9..c714ad452c1 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -263,7 +263,7 @@ if (empty($reshook)) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) { $error++; - setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors'); + setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); } if (!$error) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)) { diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 24432cb7cf1..38f85c6c006 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -482,7 +482,7 @@ if ($resql) { if ($canedit) { print ''.$langs->trans("AddTrip").''; } else { - print ''.$langs->trans("AddTrip").''; + print ''.$langs->trans("AddTrip").''; } print ''; diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index bb8dd4c4efb..7baa5007b3d 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -109,7 +109,7 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '228', 'VO insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '229', 'VS0 - Vennootschap met sociaal oogmerk'); --- France: Extrait de http://www.insee.fr/fr/nom_def_met/nomenclatures/cj/cjniveau2.htm +-- France: Extrait de https://www.insee.fr/fr/information/2028129 insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'11','Artisan Commerçant (EI)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'12','Commerçant (EI)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'13','Artisan (EI)'); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index bfab238dc27..317897e7426 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -345,7 +345,7 @@ KiloBytes=Kilobytes MegaBytes=Megabytes GigaBytes=Gigabytes TeraBytes=Terabytes -UserAuthor=Ceated by +UserAuthor=Created by UserModif=Updated by b=b. Kb=Kb @@ -712,6 +712,7 @@ FeatureDisabled=Feature disabled MoveBox=Move widget Offered=Offered NotEnoughPermissions=You don't have permission for this action +UserNotInHierachy=This action is reserved to the supervisors of this user SessionName=Session name Method=Method Receive=Receive diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 8ea8a575eca..edf0c7647de 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -221,9 +221,9 @@ class modMyModule extends DolibarrModules // Name of columns with primary key (try to always name it 'rowid') 'tabrowid'=>array("rowid", "rowid", "rowid"), // Condition to show each dictionary - 'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled) - // Help tooltip for each fields of the dictionary - 'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp'))) + 'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled), + // Tooltip for every fields of dictionaries: DO NOT PUT AN EMPTY ARRAY + 'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), ...), ); */ diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 9344b418e3e..e1d45fc3471 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -336,7 +336,7 @@ $sql .= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effectiv $sql .= " t.description, t.fk_task_parent"; $sql .= " ,t.budget_amount"; // We'll need these fields in order to filter by categ -if ($search_categ) { +if ($search_categ > 0) { $sql .= ", cs.fk_categorie, cs.fk_project"; } // Add sum fields @@ -356,7 +356,7 @@ $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; // We'll need this table joined to the select in order to filter by categ -if (!empty($search_categ)) { +if ($search_categ > 0) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ } $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index fd82ab6c14e..4ef87e944df 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -751,7 +751,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac if ($permissiontoaddbankaccount) { $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create'); } else { - $morehtmlright = dolGetButtonTitle($langs->trans('Add'), 'NotEnoughPermission', 'fa fa-plus-circle', '', '', -2); + $morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('NotEnoughPermissions'), 'fa fa-plus-circle', '', '', -2); } } else { $morehtmlright = dolGetButtonTitle($langs->trans('Add'), 'AlreadyOneBankAccount', 'fa fa-plus-circle', '', '', -2); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f642fe8fd14..c4f1be97eb8 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -476,7 +476,7 @@ if (empty($reshook)) { $object->lang = GETPOST('default_lang', 'aZ09'); // Do we update also ->entity ? - if (!empty($conf->multicompany->enabled && $user->entity == 0 && !empty($user->admin))) { // If multicompany is not enabled, we never update the entity of a user. + if (!empty($conf->multicompany->enabled) && empty($user->entity) && !empty($user->admin)) { // If multicompany is not enabled, we never update the entity of a user. if (GETPOST('superadmin', 'int')) { $object->entity = 0; } else { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 588dba10a19..fcd1505a402 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1488,8 +1488,8 @@ class User extends CommonObject // Clean parameters $this->setUpperOrLowerCase(); - $this->civility_code = trim($this->civility_code); - $this->login = trim($this->login); + $this->civility_code = trim((string) $this->civility_code); + $this->login = trim((string) $this->login); if (!isset($this->entity)) { $this->entity = $conf->entity; // If not defined, we use default value } @@ -1851,47 +1851,45 @@ class User extends CommonObject dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass); // Clean parameters - $this->civility_code = trim($this->civility_code); - $this->lastname = trim($this->lastname); - $this->firstname = trim($this->firstname); - $this->ref_employee = trim($this->ref_employee); - $this->national_registration_number = trim($this->national_registration_number); - $this->employee = $this->employee ? $this->employee : 0; - $this->login = trim($this->login); - $this->gender = trim($this->gender); - $this->pass = trim($this->pass); - $this->api_key = trim($this->api_key); - $this->address = $this->address ? trim($this->address) : trim($this->address); - $this->zip = $this->zip ? trim($this->zip) : trim($this->zip); - $this->town = $this->town ? trim($this->town) : trim($this->town); + $this->civility_code = trim((string) $this->civility_code); + $this->lastname = trim((string) $this->lastname); + $this->firstname = trim((string) $this->firstname); + $this->ref_employee = trim((string) $this->ref_employee); + $this->national_registration_number = trim((string) $this->national_registration_number); + $this->employee = ($this->employee > 0 ? $this->employee : 0); + $this->login = trim((string) $this->login); + $this->gender = trim((string) $this->gender); + $this->pass = trim((string) $this->pass); + $this->api_key = trim((string) $this->api_key); + $this->address = trim((string) $this->address); + $this->zip = trim((string) $this->zip); + $this->town = trim((string) $this->town); $this->setUpperOrLowerCase(); - $this->state_id = trim($this->state_id); - $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; - $this->office_phone = trim($this->office_phone); - $this->office_fax = trim($this->office_fax); - $this->user_mobile = trim($this->user_mobile); - $this->personal_mobile = trim($this->personal_mobile); - $this->email = trim($this->email); - $this->personal_email = trim($this->personal_email); - $this->job = trim($this->job); - $this->signature = trim($this->signature); - $this->note_public = trim($this->note_public); - $this->note_private = trim($this->note_private); - $this->openid = trim(empty($this->openid) ? '' : $this->openid); // Avoid warning - $this->admin = $this->admin ? $this->admin : 0; - $this->address = empty($this->address) ? '' : $this->address; - $this->zip = empty($this->zip) ? '' : $this->zip; - $this->town = empty($this->town) ? '' : $this->town; - $this->setUpperOrLowerCase(); - $this->accountancy_code = trim($this->accountancy_code); - $this->color = empty($this->color) ? '' : $this->color; - $this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment; - $this->dateemploymentend = empty($this->dateemploymentend) ? '' : $this->dateemploymentend; - $this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity; - $this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity; - $this->birth = trim($this->birth); - $this->fk_warehouse = (int) $this->fk_warehouse; + $this->state_id = ($this->state_id > 0 ? $this->state_id : 0); + $this->country_id = ($this->country_id > 0 ? $this->country_id : 0); + $this->office_phone = trim((string) $this->office_phone); + $this->office_fax = trim((string) $this->office_fax); + $this->user_mobile = trim((string) $this->user_mobile); + $this->personal_mobile = trim((string) $this->personal_mobile); + $this->email = trim((string) $this->email); + $this->personal_email = trim((string) $this->personal_email); + + $this->job = trim((string) $this->job); + $this->signature = trim((string) $this->signature); + $this->note_public = trim((string) $this->note_public); + $this->note_private = trim((string) $this->note_private); + $this->openid = trim((string) $this->openid); + $this->admin = ($this->admin > 0 ? $this->admin : 0); + + $this->accountancy_code = trim((string) $this->accountancy_code); + $this->color = trim((string) $this->color); + $this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment; + $this->dateemploymentend = empty($this->dateemploymentend) ? '' : $this->dateemploymentend; + $this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity; + $this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity; + $this->birth = empty($this->birth) ? '' : $this->birth; + $this->fk_warehouse = (int) $this->fk_warehouse; // Check parameters $badCharUnauthorizedIntoLoginName = getDolGlobalString('MAIN_LOGIN_BADCHARUNAUTHORIZED', ',@<>"\''); @@ -2061,8 +2059,6 @@ class User extends CommonObject $adh->pass = $this->pass; - //$adh->societe = (empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); - $adh->address = $this->address; $adh->town = $this->town; $adh->zip = $this->zip; @@ -2112,8 +2108,6 @@ class User extends CommonObject //$tmpobj->pass=$this->pass; - //$tmpobj->societe=(empty($tmpobj->societe) && $this->societe_id ? $this->societe_id : $tmpobj->societe); - $tmpobj->email = $this->email; $tmpobj->socialnetworks = $this->socialnetworks;