浏览代码

QUAL Standardize code. Renamed ID of user properties into ->user_xxx_id

Laurent Destailleur 1 年之前
父节点
当前提交
a318031034
共有 70 个文件被更改,包括 168 次插入335 次删除
  1. 4 1
      ChangeLog
  2. 1 0
      htdocs/accountancy/class/accountingaccount.class.php
  3. 1 0
      htdocs/adherents/class/adherent.class.php
  4. 1 0
      htdocs/asset/class/assetmodel.class.php
  5. 3 0
      htdocs/bom/class/bom.class.php
  6. 0 6
      htdocs/bookcal/class/availabilities.class.php
  7. 0 6
      htdocs/bookcal/class/calendar.class.php
  8. 0 4
      htdocs/categories/class/categorie.class.php
  9. 2 0
      htdocs/comm/action/class/actioncomm.class.php
  10. 4 3
      htdocs/comm/mailing/class/mailing.class.php
  11. 3 10
      htdocs/comm/propal/class/propal.class.php
  12. 2 3
      htdocs/commande/class/commande.class.php
  13. 3 11
      htdocs/compta/bank/class/account.class.php
  14. 3 10
      htdocs/compta/bank/class/paymentvarious.class.php
  15. 1 0
      htdocs/compta/deplacement/class/deplacement.class.php
  16. 3 10
      htdocs/compta/facture/class/facture-rec.class.php
  17. 7 21
      htdocs/compta/facture/class/facture.class.php
  18. 4 10
      htdocs/compta/paiement/class/paiement.class.php
  19. 0 1
      htdocs/compta/prelevement/class/rejetprelevement.class.php
  20. 3 16
      htdocs/compta/sociales/class/chargesociales.class.php
  21. 2 12
      htdocs/compta/tva/class/tva.class.php
  22. 2 12
      htdocs/contact/class/contact.class.php
  23. 3 7
      htdocs/contrat/class/contrat.class.php
  24. 10 10
      htdocs/core/class/commonobject.class.php
  25. 2 0
      htdocs/core/class/fiscalyear.class.php
  26. 0 6
      htdocs/core/class/timespent.class.php
  27. 2 2
      htdocs/core/lib/functions2.lib.php
  28. 1 0
      htdocs/cron/class/cronjob.class.php
  29. 1 0
      htdocs/emailcollector/class/emailcollector.class.php
  30. 1 0
      htdocs/emailcollector/class/emailcollectoraction.class.php
  31. 1 0
      htdocs/emailcollector/class/emailcollectorfilter.class.php
  32. 1 0
      htdocs/eventorganization/class/conferenceorbooth.class.php
  33. 1 0
      htdocs/eventorganization/class/conferenceorboothattendee.class.php
  34. 5 22
      htdocs/expensereport/class/expensereport.class.php
  35. 4 10
      htdocs/expensereport/class/paymentexpensereport.class.php
  36. 6 17
      htdocs/fichinter/class/fichinter.class.php
  37. 7 15
      htdocs/fourn/class/fournisseur.commande.class.php
  38. 4 13
      htdocs/fourn/class/fournisseur.facture.class.php
  39. 4 12
      htdocs/fourn/class/paiementfourn.class.php
  40. 3 13
      htdocs/holiday/class/holiday.class.php
  41. 1 0
      htdocs/hrm/class/establishment.class.php
  42. 1 0
      htdocs/hrm/class/evaluation.class.php
  43. 1 0
      htdocs/hrm/class/evaluationdet.class.php
  44. 1 0
      htdocs/hrm/class/job.class.php
  45. 1 0
      htdocs/hrm/class/position.class.php
  46. 1 0
      htdocs/hrm/class/skill.class.php
  47. 1 0
      htdocs/hrm/class/skilldet.class.php
  48. 1 0
      htdocs/hrm/class/skillrank.class.php
  49. 1 0
      htdocs/knowledgemanagement/class/knowledgerecord.class.php
  50. 1 0
      htdocs/loan/class/loan.class.php
  51. 20 5
      htdocs/modulebuilder/template/class/myobject.class.php
  52. 1 0
      htdocs/mrp/class/mo.class.php
  53. 1 0
      htdocs/partnership/class/partnership.class.php
  54. 1 0
      htdocs/partnership/class/partnership_type.class.php
  55. 3 12
      htdocs/product/class/product.class.php
  56. 3 13
      htdocs/product/class/productfournisseurprice.class.php
  57. 3 15
      htdocs/product/inventory/class/inventory.class.php
  58. 3 8
      htdocs/projet/class/project.class.php
  59. 1 0
      htdocs/recruitment/class/recruitmentcandidature.class.php
  60. 1 0
      htdocs/recruitment/class/recruitmentjobposition.class.php
  61. 1 0
      htdocs/salaries/class/salary.class.php
  62. 1 0
      htdocs/societe/class/companypaymentmode.class.php
  63. 4 2
      htdocs/societe/class/societe.class.php
  64. 0 1
      htdocs/societe/class/societeaccount.class.php
  65. 3 11
      htdocs/supplier_proposal/class/supplier_proposal.class.php
  66. 1 1
      htdocs/ticket/class/cticketcategory.class.php
  67. 1 1
      htdocs/webhook/class/target.class.php
  68. 3 3
      htdocs/webservices/server_thirdparty.php
  69. 1 0
      htdocs/workstation/class/workstation.class.php
  70. 1 0
      htdocs/zapier/class/hook.class.php

+ 4 - 1
ChangeLog

@@ -24,11 +24,14 @@ Following changes may create regressions for some external modules, but were nec
 * The duplicated and deprecated property ->date_livraison that was renamed into ->delivery_date has been completely removed.
 * The property ->user_close to store ID of closing user has been renamed into ->user_closing_id.
 * The property ->user_validation to store ID of user validating has been renamed into ->user_validation_id.
+* The property ->user_creation to store ID of user of creation has been renamed into ->user_creation_id.
+* The property ->user_modification to store ID of user of modification has been renamed into ->user_modification_id.
+* The duplicate property ->user_creat, ->date_creat, ->date_valid has been removed  
 * The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead.
 * The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog()
 * Recheck setup of your module workflow to see if you need to enable the new setting to have shipment set to billed automatically when
   an invoice from a shipment is validated (and if your process is to make invoice on shipment and not on order), because this setup has changed.
-* It was possible to use a variable $soc or $right inside a php code condition of some extrafields properties, this is no more true (this 2 variables are no more defined globaly).
+* It was possible to use a variable $soc or $right inside a php code condition of some extrafields properties, this is no more true (this 2 variables are no more global variables).
 
 
 

+ 1 - 0
htdocs/accountancy/class/accountingaccount.class.php

@@ -599,6 +599,7 @@ class AccountingAccount extends CommonObject
 		if ($resql) {
 			if ($this->db->num_rows($resql)) {
 				$obj = $this->db->fetch_object($resql);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_author;

+ 1 - 0
htdocs/adherents/class/adherent.class.php

@@ -2884,6 +2884,7 @@ class Adherent extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_author;

+ 1 - 0
htdocs/asset/class/assetmodel.class.php

@@ -733,6 +733,7 @@ class AssetModel extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 3 - 0
htdocs/bom/class/bom.class.php

@@ -1280,6 +1280,7 @@ class BOM extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;
@@ -2073,7 +2074,9 @@ class BOMLine extends CommonObjectLine
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
+
 				$this->user_creation_id = $obj->fk_user_creat;
 				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);

+ 0 - 6
htdocs/bookcal/class/availabilities.class.php

@@ -932,14 +932,8 @@ class Availabilities extends CommonObject
 
 				$this->user_creation_id = $obj->fk_user_creat;
 				$this->user_modification_id = $obj->fk_user_modif;
-				if (!empty($obj->fk_user_valid)) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
-				if (!empty($obj->datev)) {
-					$this->date_validation   = empty($obj->datev) ? '' : $this->db->jdate($obj->datev);
-				}
 			}
 
 			$this->db->free($result);

+ 0 - 6
htdocs/bookcal/class/calendar.class.php

@@ -958,14 +958,8 @@ class Calendar extends CommonObject
 
 				$this->user_creation_id = $obj->fk_user_creat;
 				$this->user_modification_id = $obj->fk_user_modif;
-				if (!empty($obj->fk_user_valid)) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
-				if (!empty($obj->datev)) {
-					$this->date_validation   = empty($obj->datev) ? '' : $this->db->jdate($obj->datev);
-				}
 			}
 
 			$this->db->free($result);

+ 0 - 4
htdocs/categories/class/categorie.class.php

@@ -343,8 +343,6 @@ class Categorie extends CommonObject
 	 */
 	public function fetch($id, $label = '', $type = null, $ref_ext = '')
 	{
-		global $conf;
-
 		// Check parameters
 		if (empty($id) && empty($label) && empty($ref_ext)) {
 			$this->error = "No category to search for";
@@ -389,8 +387,6 @@ class Categorie extends CommonObject
 				$this->date_modification = $this->db->jdate($res['tms']);
 				$this->user_creation_id = (int) $res['fk_user_creat'];
 				$this->user_modification_id = (int) $res['fk_user_modif'];
-				$this->user_creation = (int) $res['fk_user_creat'];
-				$this->user_modification = (int) $res['fk_user_modif'];
 
 				// Retrieve all extrafield
 				// fetch optionals attributes and labels

+ 2 - 0
htdocs/comm/action/class/actioncomm.class.php

@@ -1496,7 +1496,9 @@ class ActionComm extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->id;
+
 				$this->user_creation_id = $obj->fk_user_author;
 				$this->user_modification_id = $obj->fk_user_mod;
 				$this->date_creation     = $this->db->jdate($obj->datec);

+ 4 - 3
htdocs/comm/mailing/class/mailing.class.php

@@ -128,6 +128,7 @@ class Mailing extends CommonObject
 
 	/**
 	 * @var int id of user create
+	 * @deprecated
 	 */
 	public $user_creation;
 
@@ -139,6 +140,7 @@ class Mailing extends CommonObject
 
 	/**
 	 * @var int id of user validate
+	 * @deprecated
 	 */
 	public $user_validation;
 
@@ -413,9 +415,8 @@ class Mailing extends CommonObject
 				$this->email_replyto = $obj->email_replyto;
 				$this->email_errorsto = $obj->email_errorsto;
 
-				$this->user_creat = $obj->fk_user_creat;
-				$this->user_creation = $obj->fk_user_creat;
-				$this->user_validation = $obj->fk_user_valid;
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_validation_id = $obj->fk_user_valid;
 
 				$this->date_creat = $this->db->jdate($obj->date_creat);
 				$this->date_creation = $this->db->jdate($obj->date_creat);

+ 3 - 10
htdocs/comm/propal/class/propal.class.php

@@ -3350,13 +3350,8 @@ class Propal extends CommonObject
 				$this->date_signature    = $this->db->jdate($obj->date_signature);
 				$this->date_cloture      = $this->db->jdate($obj->date_cloture);
 
-				$cuser = new User($this->db);
-				$cuser->fetch($obj->fk_user_author);
-				$this->user_creation = $cuser;
-
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_validation_id = $obj->fk_user_valid;
 
 				if ($obj->fk_user_signature) {
 					$user_signature = new User($this->db);
@@ -3364,9 +3359,7 @@ class Propal extends CommonObject
 					$this->user_signature = $user_signature;
 				}
 
-				if ($obj->fk_user_cloture) {
-					$this->user_closing_id = $obj->fk_user_cloture;
-				}
+				$this->user_closing_id = $obj->fk_user_cloture;
 			}
 			$this->db->free($result);
 		} else {

+ 2 - 3
htdocs/commande/class/commande.class.php

@@ -1911,7 +1911,6 @@ class Commande extends CommonOrder
 				$this->user_creation_id = $obj->fk_user_author;
 				$this->user_validation_id = $obj->fk_user_valid;
 				$this->user_modification_id = $obj->fk_user_modif;
-				$this->user_modification    = $obj->fk_user_modif;	// deprecated
 				$this->total_ht				= $obj->total_ht;
 				$this->total_tva			= $obj->total_tva;
 				$this->total_localtax1		= $obj->total_localtax1;
@@ -1920,8 +1919,8 @@ class Commande extends CommonOrder
 				$this->date = $this->db->jdate($obj->date_commande);
 				$this->date_commande		= $this->db->jdate($obj->date_commande);
 				$this->date_creation		= $this->db->jdate($obj->date_creation);
-				$this->date_validation = $this->db->jdate($obj->date_valid);
-				$this->date_modification = $this->db->jdate($obj->tms);
+				$this->date_validation      = $this->db->jdate($obj->date_valid);
+				$this->date_modification    = $this->db->jdate($obj->tms);
 				$this->source				= $obj->source;
 				$this->billed				= $obj->billed;
 				$this->note = $obj->note_private; // deprecated

+ 3 - 11
htdocs/compta/bank/class/account.class.php

@@ -2530,19 +2530,11 @@ class AccountLine extends CommonObjectLine
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
-				$this->id = $obj->rowid;
 
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
-				if ($obj->fk_user_rappro) {
-					$ruser = new User($this->db);
-					$ruser->fetch($obj->fk_user_rappro);
-					$this->user_rappro = $ruser;
-				}
+				$this->id = $obj->rowid;
 
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_rappro = $obj->fk_user_rappro;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);
 				//$this->date_rappro       = $obj->daterappro;    // Not yet managed

+ 3 - 10
htdocs/compta/bank/class/paymentvarious.class.php

@@ -744,18 +744,11 @@ class PaymentVarious extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
+				$this->user_creation = $obj->fk_user_author;
+				$this->user_modif = $obj->fk_user_modif;
 				$this->date_creation = $this->db->jdate($obj->datec);
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modif = $muser;
-				}
 				$this->date_modif = $this->db->jdate($obj->tms);
 			}
 			$this->db->free($result);

+ 1 - 0
htdocs/compta/deplacement/class/deplacement.class.php

@@ -457,6 +457,7 @@ class Deplacement extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_author;

+ 3 - 10
htdocs/compta/facture/class/facture-rec.class.php

@@ -1673,18 +1673,11 @@ class FactureRec extends CommonInvoice
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
 
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);
 			}

+ 7 - 21
htdocs/compta/facture/class/facture.class.php

@@ -133,13 +133,6 @@ class Facture extends CommonInvoice
 	 */
 	public $fk_user_valid;
 
-	/**
-	 * @var int ID
-	 * @deprecated
-	 * @see $fk_user_modif
-	 */
-	public $user_modification;
-
 	/**
 	 * @var int ID
 	 */
@@ -2203,9 +2196,9 @@ class Facture extends CommonInvoice
 				$this->note = $obj->note_private; // deprecated
 				$this->note_private = $obj->note_private;
 				$this->note_public			= $obj->note_public;
-				$this->user_creation_id     = $obj->fk_user_author; // deprecated
-				$this->user_validation_id   = $obj->fk_user_valid; // deprecated
-				$this->user_modification    = $obj->fk_user_modif; // deprecated
+				$this->user_creation_id     = $obj->fk_user_author;
+				$this->user_validation_id   = $obj->fk_user_valid;
+				$this->user_modification_id = $obj->fk_user_modif;
 				$this->fk_user_author       = $obj->fk_user_author;
 				$this->fk_user_valid        = $obj->fk_user_valid;
 				$this->fk_user_modif        = $obj->fk_user_modif;
@@ -4655,18 +4648,11 @@ class Facture extends CommonInvoice
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
-				if ($obj->fk_user_closing) {
-					$this->user_closing_id = $obj->fk_user_closing;
-				}
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_validation_id = $obj->fk_user_valid;
+				$this->user_closing_id = $obj->fk_user_closing;
 
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);

+ 4 - 10
htdocs/compta/paiement/class/paiement.class.php

@@ -1016,17 +1016,11 @@ class Paiement extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
-				if ($obj->fk_user_creat) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_creat);
-					$this->user_creation = $cuser;
-				}
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
+
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->tms);
 			}

+ 0 - 1
htdocs/compta/prelevement/class/rejetprelevement.class.php

@@ -146,7 +146,6 @@ class RejetPrelevement
 		$result = $this->db->query($sql);
 
 		if (!$result) {
-			dol_syslog("RejetPrelevement::create Erreur 4");
 			dol_syslog("RejetPrelevement::create Erreur 4 $sql");
 			$error++;
 		}

+ 3 - 16
htdocs/compta/sociales/class/chargesociales.class.php

@@ -710,22 +710,9 @@ class ChargeSociales extends CommonObject
 
 				$this->id = $obj->rowid;
 
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
-
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
-
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
-
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_modification_id = $obj->fk_user_modif;
+				$this->user_validation_id = $obj->fk_user_valid;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);
 				$this->date_validation   = $this->db->jdate($obj->datev);

+ 2 - 12
htdocs/compta/tva/class/tva.class.php

@@ -822,18 +822,8 @@ class Tva extends CommonObject
 
 				$this->id = $obj->rowid;
 
-				if ($obj->fk_user_creat) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_creat);
-					$this->user_creation = $cuser;
-				}
-
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
-
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->tms);
 				$this->import_key        = $obj->import_key;

+ 2 - 12
htdocs/contact/class/contact.class.php

@@ -1348,18 +1348,8 @@ class Contact extends CommonObject
 
 				$this->id = $obj->rowid;
 
-				if ($obj->fk_user_creat) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_creat);
-					$this->user_creation = $cuser;
-				}
-
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
-
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->tms);
 			}

+ 3 - 7
htdocs/contrat/class/contrat.class.php

@@ -151,6 +151,7 @@ class Contrat extends CommonObject
 
 	/**
 	 * @var User 	Object user that create the contract. Set by the info method.
+	 * @deprecated
 	 */
 	public $user_creation;
 
@@ -2157,14 +2158,9 @@ class Contrat extends CommonObject
 				$obj = $this->db->fetch_object($result);
 
 				$this->id = $obj->rowid;
-
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
-
 				$this->ref = (!$obj->ref) ? $obj->rowid : $obj->ref;
+
+				$this->user_creation_id = $obj->fk_user_author;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->date_modification);
 			}

+ 10 - 10
htdocs/core/class/commonobject.class.php

@@ -587,14 +587,14 @@ abstract class CommonObject
 	public $date_cloture; // Date closing (tms field)
 
 	/**
-	 * @var User|int	User author/creation
-	 * @TODO Merge with user_creation
+	 * @var User	User author/creation
+	 * @deprecated	Store only id in user_creation_id
 	 */
 	public $user_author;
 
 	/**
-	 * @var User|int	User author/creation
-	 * @TODO Remove type id
+	 * @var User	User author/creation
+	 * @deprecated
 	 */
 	public $user_creation;
 
@@ -604,14 +604,14 @@ abstract class CommonObject
 	public $user_creation_id;
 
 	/**
-	 * @var User|int	User of validation
-	 * @TODO Merge with user_validation
+	 * @var User	User of validation
+	 * @deprecated
 	 */
 	public $user_valid;
 
 	/**
-	 * @var User|int	User of validation
-	 * @TODO Remove type id
+	 * @var User	User of validation
+	 * @deprecated
 	 */
 	public $user_validation;
 
@@ -626,8 +626,8 @@ abstract class CommonObject
 	public $user_closing_id;
 
 	/**
-	 * @var User|int	User last modifier
-	 * @TODO Remove type id
+	 * @var User	User last modifier
+	 * @deprecated
 	 */
 	public $user_modification;
 

+ 2 - 0
htdocs/core/class/fiscalyear.class.php

@@ -446,7 +446,9 @@ class Fiscalyear extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
+
 				$this->user_creation_id = $obj->fk_user_author;
 				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);

+ 0 - 6
htdocs/core/class/timespent.class.php

@@ -902,14 +902,8 @@ class TimeSpent extends CommonObject
 
 				$this->user_creation_id = $obj->fk_user_creat;
 				$this->user_modification_id = $obj->fk_user_modif;
-				if (!empty($obj->fk_user_valid)) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
-				if (!empty($obj->datev)) {
-					$this->date_validation   = empty($obj->datev) ? '' : $this->db->jdate($obj->datev);
-				}
 			}
 
 			$this->db->free($result);

+ 2 - 2
htdocs/core/lib/functions2.lib.php

@@ -259,7 +259,7 @@ function dol_print_object_info($object, $usetable = 0)
 			}
 		} else {
 			$userstatic = new User($db);
-			$userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation);
+			$userstatic->fetch($object->user_creation_id);
 			if ($userstatic->id) {
 				print $userstatic->getNomUrl(-1, '', 0, 0, 0);
 			} else {
@@ -314,7 +314,7 @@ function dol_print_object_info($object, $usetable = 0)
 			}
 		} else {
 			$userstatic = new User($db);
-			$userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification);
+			$userstatic->fetch($object->user_modification_id);
 			if ($userstatic->id) {
 				print $userstatic->getNomUrl(-1, '', 0, 0, 0);
 			} else {

+ 1 - 0
htdocs/cron/class/cronjob.class.php

@@ -1113,6 +1113,7 @@ class Cronjob extends CommonObject
 		if ($resql) {
 			if ($this->db->num_rows($resql)) {
 				$obj = $this->db->fetch_object($resql);
+
 				$this->id = $obj->rowid;
 
 				$this->user_modification_id = $obj->fk_user_mod;

+ 1 - 0
htdocs/emailcollector/class/emailcollector.class.php

@@ -681,6 +681,7 @@ class EmailCollector extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/emailcollector/class/emailcollectoraction.class.php

@@ -432,6 +432,7 @@ class EmailCollectorAction extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/emailcollector/class/emailcollectorfilter.class.php

@@ -446,6 +446,7 @@ class EmailCollectorFilter extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/eventorganization/class/conferenceorbooth.class.php

@@ -720,6 +720,7 @@ class ConferenceOrBooth extends ActionComm
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/eventorganization/class/conferenceorboothattendee.class.php

@@ -950,6 +950,7 @@ class ConferenceOrBoothAttendee extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 5 - 22
htdocs/expensereport/class/expensereport.class.php

@@ -844,28 +844,11 @@ class ExpenseReport extends CommonObject
 				$this->date_validation = $this->db->jdate($obj->datev);
 				$this->date_approbation = $this->db->jdate($obj->datea);
 
-				$cuser = new User($this->db);
-				$cuser->fetch($obj->fk_user_author);
-				$this->user_creation = $cuser;
-
-				if ($obj->fk_user_creation) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_creation);
-					$this->user_creation = $cuser;
-				}
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
-				if ($obj->fk_user_modification) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modification);
-					$this->user_modification = $muser;
-				}
-				if ($obj->fk_user_approve) {
-					$auser = new User($this->db);
-					$auser->fetch($obj->fk_user_approve);
-					$this->user_approve = $auser;
-				}
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_creation_id = $obj->fk_user_creation;
+				$this->user_validation_id = $obj->fk_user_valid;
+				$this->user_modification_id = $obj->fk_user_modification;
+				$this->user_approve_id = $obj->fk_user_approve;
 			}
 			$this->db->free($resql);
 		} else {

+ 4 - 10
htdocs/expensereport/class/paymentexpensereport.class.php

@@ -693,17 +693,11 @@ class PaymentExpenseReport extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
-				if ($obj->fk_user_creat) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_creat);
-					$this->user_creation = $cuser;
-				}
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
+
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->tms);
 			}

+ 6 - 17
htdocs/fichinter/class/fichinter.class.php

@@ -479,7 +479,7 @@ class Fichinter extends CommonObject
 				$this->fk_contrat = $obj->fk_contrat;
 				$this->entity = $obj->entity;
 
-				$this->user_creation = $obj->fk_user_author;
+				$this->user_creation_id = $obj->fk_user_author;
 
 				$this->extraparams = (array) json_decode($obj->extraparams, true);
 
@@ -726,12 +726,10 @@ class Fichinter extends CommonObject
 	 */
 	public function getAmount()
 	{
-		global $db;
-
 		$amount = 0;
 
-		$this->author = new User($db);
-		$this->author->fetch($this->user_creation);
+		$this->author = new User($this->db);
+		$this->author->fetch($this->user_creation_id);
 
 		$thm = $this->author->thm;
 
@@ -1017,18 +1015,9 @@ class Fichinter extends CommonObject
 				$this->date_modification = $this->db->jdate($obj->date_modification);
 				$this->date_validation   = $this->db->jdate($obj->datev);
 
-				$cuser = new User($this->db);
-				$cuser->fetch($obj->fk_user_author);
-				$this->user_creation = $cuser;
-
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
-				if ($obj->fk_user_modification) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modification);
-					$this->user_modification = $muser;
-				}
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_validation_id = $obj->fk_user_valid;
+				$this->user_modification_id = $obj->fk_user_modification;
 			}
 			$this->db->free($resql);
 		} else {

+ 7 - 15
htdocs/fourn/class/fournisseur.commande.class.php

@@ -3094,22 +3094,14 @@ class CommandeFournisseur extends CommonOrder
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
-				if ($obj->fk_user_author) {
-					$this->user_creation_id = $obj->fk_user_author;
-				}
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
-				if ($obj->fk_user_modif) {
-					$this->user_modification_id = $obj->fk_user_modif;
-				}
-				if ($obj->fk_user_approve) {
-					$this->user_approve_id = $obj->fk_user_approve;
-				}
-				if ($obj->fk_user_approve2) {
-					$this->user_approve_id2 = $obj->fk_user_approve2;
-				}
+
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_validation_id = $obj->fk_user_valid;
+				$this->user_modification_id = $obj->fk_user_modif;
+				$this->user_approve_id = $obj->fk_user_approve;
+				$this->user_approve_id2 = $obj->fk_user_approve2;
 
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);

+ 4 - 13
htdocs/fourn/class/fournisseur.facture.class.php

@@ -2540,19 +2540,10 @@ class FactureFournisseur extends CommonInvoice
 				$obj = $this->db->fetch_object($result);
 
 				$this->id = $obj->rowid;
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
+
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_validation_id = $obj->fk_user_valid;
+				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);
 				//$this->date_validation   = $obj->datev; // This field is not available. Should be store into log table and using this function should be replaced with showing content of log (like for supplier orders)

+ 4 - 12
htdocs/fourn/class/paiementfourn.class.php

@@ -519,7 +519,7 @@ class PaiementFourn extends Paiement
 	 */
 	public function info($id)
 	{
-		$sql = 'SELECT c.rowid, datec, fk_user_author as fk_user_creat, tms';
+		$sql = 'SELECT c.rowid, datec, fk_user_author as fk_user_creat, tms as fk_user_modif';
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c';
 		$sql .= ' WHERE c.rowid = '.((int) $id);
 
@@ -528,18 +528,10 @@ class PaiementFourn extends Paiement
 			$num = $this->db->num_rows($resql);
 			if ($num) {
 				$obj = $this->db->fetch_object($resql);
-				$this->id = $obj->rowid;
 
-				if ($obj->fk_user_creat) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_creat);
-					$this->user_creation = $cuser;
-				}
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
+				$this->id = $obj->rowid;
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->tms);
 			}

+ 3 - 13
htdocs/holiday/class/holiday.class.php

@@ -2299,19 +2299,9 @@ class Holiday extends CommonObject
 				$this->date_validation = $this->db->jdate($obj->datev);
 				$this->date_approval = $this->db->jdate($obj->datea);
 
-				if (!empty($obj->fk_user_creation)) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_creation);
-					$this->user_creation = $cuser;
-				}
-				if (!empty($obj->fk_user_valid)) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
-				if (!empty($obj->fk_user_modification)) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modification);
-					$this->user_modification = $muser;
-				}
+				$this->user_creation_id = $obj->fk_user_creation;
+				$this->user_validation_id = $obj->fk_user_valid;
+				$this->user_modification_id = $obj->fk_user_modification;
 
 				if ($obj->status == Holiday::STATUS_APPROVED || $obj->status == Holiday::STATUS_CANCELED) {
 					if ($obj->fk_user_approval_done) {

+ 1 - 0
htdocs/hrm/class/establishment.class.php

@@ -408,6 +408,7 @@ class Establishment extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_author;

+ 1 - 0
htdocs/hrm/class/evaluation.class.php

@@ -875,6 +875,7 @@ class Evaluation extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/hrm/class/evaluationdet.class.php

@@ -849,6 +849,7 @@ class EvaluationLine extends CommonObjectLine
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/hrm/class/job.class.php

@@ -885,6 +885,7 @@ class Job extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/hrm/class/position.class.php

@@ -933,6 +933,7 @@ class Position extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/hrm/class/skill.class.php

@@ -929,6 +929,7 @@ class Skill extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/hrm/class/skilldet.class.php

@@ -837,6 +837,7 @@ class Skilldet extends CommonObjectLine
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/hrm/class/skillrank.class.php

@@ -876,6 +876,7 @@ class SkillRank extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/knowledgemanagement/class/knowledgerecord.class.php

@@ -930,6 +930,7 @@ class KnowledgeRecord extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/loan/class/loan.class.php

@@ -683,6 +683,7 @@ class Loan extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_author;

+ 20 - 5
htdocs/modulebuilder/template/class/myobject.class.php

@@ -1011,8 +1011,19 @@ class MyObject extends CommonObject
 	public function info($id)
 	{
 		$sql = "SELECT rowid,";
-		$sql .= " date_creation as datec, tms as datem,";
-		$sql .= " fk_user_creat, fk_user_modif";
+		$sql .= " date_creation as datec, tms as datem";
+		if (!empty($this->fields['date_validation'])) {
+			$sql .= ", date_validation as datev";
+		}
+		if (!empty($this->fields['fk_user_creat'])) {
+			$sql .= ", fk_user_creat";
+		}
+		if (!empty($this->fields['fk_user_modif'])) {
+			$sql .= ", fk_user_modif";
+		}
+		if (!empty($this->fields['fk_user_valid'])) {
+			$sql .= ", fk_user_valid";
+		}
 		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
 		$sql .= " WHERE t.rowid = ".((int) $id);
 
@@ -1023,9 +1034,13 @@ class MyObject extends CommonObject
 
 				$this->id = $obj->rowid;
 
-				$this->user_creation_id = $obj->fk_user_creat;
-				$this->user_modification_id = $obj->fk_user_modif;
-				if (!empty($obj->fk_user_valid)) {
+				if (!empty($this->fields['fk_user_creat'])) {
+					$this->user_creation_id = $obj->fk_user_creat;
+				}
+				if (!empty($this->fields['fk_user_modif'])) {
+					$this->user_modification_id = $obj->fk_user_modif;
+				}
+				if (!empty($this->fields['fk_user_valid'])) {
 					$this->user_validation_id = $obj->fk_user_valid;
 				}
 				$this->date_creation     = $this->db->jdate($obj->datec);

+ 1 - 0
htdocs/mrp/class/mo.class.php

@@ -1524,6 +1524,7 @@ class Mo extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/partnership/class/partnership.class.php

@@ -1111,6 +1111,7 @@ class Partnership extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/partnership/class/partnership_type.class.php

@@ -396,6 +396,7 @@ class PartnershipType extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 3 - 12
htdocs/product/class/product.class.php

@@ -6412,20 +6412,11 @@ class Product extends CommonObject
 				$obj = $this->db->fetch_object($result);
 
 				$this->id = $obj->rowid;
+				$this->ref = $obj->ref;
 
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_modification_id = $obj->fk_user_modif;
 
-				if ($obj->fk_user_modif) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_modification = $muser;
-				}
-
-				$this->ref = $obj->ref;
 				$this->date_creation     = $this->db->jdate($obj->date_creation);
 				$this->date_modification = $this->db->jdate($obj->date_modification);
 			}

+ 3 - 13
htdocs/product/class/productfournisseurprice.class.php

@@ -711,24 +711,14 @@ class ProductFournisseurPrice extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
-				$this->id = $obj->rowid;
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
 
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
+				$this->id = $obj->rowid;
 
-				if ($obj->fk_user_cloture) {
-					$this->user_closing_id = $obj->fk_user_cloture;
-				}
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_validation_id = $obj->fk_user_valid;
 
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);
-				$this->date_validation   = $this->db->jdate($obj->datev);
 			}
 
 			$this->db->free($result);

+ 3 - 15
htdocs/product/inventory/class/inventory.class.php

@@ -721,21 +721,9 @@ class Inventory extends CommonObject
 
 				$this->id = $obj->rowid;
 
-				if ($obj->fk_user_creat > 0) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_creat);
-					$this->user_creation = $cuser;
-				}
-
-				if ($obj->fk_user_modif > 0) {
-					$muser = new User($this->db);
-					$muser->fetch($obj->fk_user_modif);
-					$this->user_creation = $muser;
-				}
-
-				if ($obj->fk_user_valid > 0) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
+				$this->user_validation_id = $obj->fk_user_valid;
 
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);

+ 3 - 8
htdocs/projet/class/project.class.php

@@ -2336,16 +2336,11 @@ class Project extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
-				if ($obj->fk_user_author) {
-					$cuser = new User($this->db);
-					$cuser->fetch($obj->fk_user_author);
-					$this->user_creation = $cuser;
-				}
 
-				if (!empty($obj->fk_user_cloture)) {
-					$this->user_closing_id   = $obj->fk_user_cloture;
-				}
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_closing_id   = $obj->fk_user_cloture;
 
 				$this->date_creation     = $this->db->jdate($obj->datec);
 				$this->date_modification = $this->db->jdate($obj->datem);

+ 1 - 0
htdocs/recruitment/class/recruitmentcandidature.class.php

@@ -880,6 +880,7 @@ class RecruitmentCandidature extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/recruitment/class/recruitmentjobposition.class.php

@@ -947,6 +947,7 @@ class RecruitmentJobPosition extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/salaries/class/salary.class.php

@@ -618,6 +618,7 @@ class Salary extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_author;

+ 1 - 0
htdocs/societe/class/companypaymentmode.class.php

@@ -540,6 +540,7 @@ class CompanyPaymentMode extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 4 - 2
htdocs/societe/class/societe.class.php

@@ -553,6 +553,7 @@ class Societe extends CommonObject
 	/**
 	 * User that made last update
 	 * @var User
+	 * @deprecated
 	 */
 	public $user_modification;
 
@@ -565,6 +566,7 @@ class Societe extends CommonObject
 	/**
 	 * User that created the thirdparty
 	 * @var User
+	 * @deprecated
 	 */
 	public $user_creation;
 
@@ -1890,8 +1892,8 @@ class Societe extends CommonObject
 
 				$this->date_creation     = $this->db->jdate($obj->date_creation);
 				$this->date_modification = $this->db->jdate($obj->date_modification);
-				$this->user_creation     = $obj->fk_user_creat;
-				$this->user_modification = $obj->fk_user_modif;
+				$this->user_creation_id     = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
 
 				$this->address = $obj->address;
 				$this->zip 			= $obj->zip;

+ 0 - 1
htdocs/societe/class/societeaccount.class.php

@@ -572,7 +572,6 @@ class SocieteAccount extends CommonObject
 				$obj = $this->db->fetch_object($result);
 				$this->id = $obj->rowid;
 
-
 				$this->user_creation_id = $obj->fk_user_creat;
 				$this->user_modification_id = $obj->fk_user_modif;
 				$this->date_creation     = $this->db->jdate($obj->datec);

+ 3 - 11
htdocs/supplier_proposal/class/supplier_proposal.class.php

@@ -2113,17 +2113,9 @@ class SupplierProposal extends CommonObject
 				$this->date_validation   = $this->db->jdate($obj->datev);
 				$this->date_cloture      = $this->db->jdate($obj->dateo);
 
-				$cuser = new User($this->db);
-				$cuser->fetch($obj->fk_user_author);
-				$this->user_creation = $cuser;
-
-				if ($obj->fk_user_valid) {
-					$this->user_validation_id = $obj->fk_user_valid;
-				}
-
-				if ($obj->fk_user_cloture) {
-					$this->user_closing_id = $obj->fk_user_cloture;
-				}
+				$this->user_creation_id = $obj->fk_user_author;
+				$this->user_validation_id = $obj->fk_user_valid;
+				$this->user_closing_id = $obj->fk_user_cloture;
 			}
 			$this->db->free($result);
 		} else {

+ 1 - 1
htdocs/ticket/class/cticketcategory.class.php

@@ -623,8 +623,8 @@ class CTicketCategory extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
-				$this->id = $obj->rowid;
 
+				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;
 				$this->user_modification_id = $obj->fk_user_modif;

+ 1 - 1
htdocs/webhook/class/target.class.php

@@ -867,8 +867,8 @@ class Target extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
-				$this->id = $obj->rowid;
 
+				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;
 				$this->user_modification_id = $obj->fk_user_modif;

+ 3 - 3
htdocs/webservices/server_thirdparty.php

@@ -352,11 +352,11 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar
 						'supplier' => $thirdparty->fournisseur,
 						'customer_code' => $thirdparty->code_client,
 						'supplier_code' => $thirdparty->code_fournisseur,
-						'customer_code_accountancy' => $thirdparty->code_compta,
+						'customer_code_accountancy' => $thirdparty->code_compta_client,
 						'supplier_code_accountancy' => $thirdparty->code_compta_fournisseur,
-						'user_creation' => $thirdparty->user_creation,
+						'user_creation_id' => $thirdparty->user_creation_id,
 						'date_creation' => dol_print_date($thirdparty->date_creation, 'dayhourrfc'),
-						'user_modification' => $thirdparty->user_modification,
+						'user_modification_id' => $thirdparty->user_modification_id,
 						'date_modification' => dol_print_date($thirdparty->date_modification, 'dayhourrfc'),
 						'address' => $thirdparty->address,
 						'zip' => $thirdparty->zip,

+ 1 - 0
htdocs/workstation/class/workstation.class.php

@@ -752,6 +752,7 @@ class Workstation extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;

+ 1 - 0
htdocs/zapier/class/hook.class.php

@@ -634,6 +634,7 @@ class Hook extends CommonObject
 		if ($result) {
 			if ($this->db->num_rows($result)) {
 				$obj = $this->db->fetch_object($result);
+
 				$this->id = $obj->rowid;
 
 				$this->user_creation_id = $obj->fk_user_creat;