From 7424ee1107a78b1634c43e8e054fe474bd5a57a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?=
 <marcosgdf@gmail.com>
Date: Sun, 28 Dec 2014 19:28:25 +0100
Subject: [PATCH] Improving Contrat documentation and fixed some properties
 usage

---
 htdocs/contrat/class/contrat.class.php | 39 ++++++++++++++++++++++++--
 htdocs/install/upgrade2.php            |  2 +-
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 623e7e121f2..9e0005bf3ad 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -89,11 +89,38 @@ class Contrat extends CommonObject
 	var $product;
 
 	/**
+	 * TODO: Which is the correct one?
 	 * Author of the contract
 	 * @var
 	 */
 	var $user_author;
 
+	/**
+	 * TODO: Which is the correct one?
+	 * Author of the contract
+	 * @var User
+	 */
+	public $user_creation;
+
+	/**
+	 * TODO: Which is the correct one?
+	 * Author of the contract
+	 * @var int
+	 */
+	public $fk_user_author;
+
+	/**
+	 * TODO: Which is the correct one?
+	 * Author of the contract
+	 * @var int
+	 */
+	public $user_author_id;
+
+	/**
+	 * @var User
+	 */
+	public $user_cloture;
+
 	/**
 	 * Date of creation
 	 * @var int
@@ -101,7 +128,14 @@ class Contrat extends CommonObject
 	var $date_creation;
 
 	/**
-	 * Date of last update
+	 * Date of last modification
+	 * Not filled until you call ->info()
+	 * @var int
+	 */
+	public $date_modification;
+
+	/**
+	 * Date of validation
 	 * @var int
 	 */
 	var $date_validation;
@@ -1952,7 +1986,6 @@ class Contrat extends CommonObject
 		while ($xnbp < $nbp)
 		{
 			$line=new ContratLigne($this->db);
-			$line->desc=$langs->trans("Description")." ".$xnbp;
 			$line->qty=1;
 			$line->subprice=100;
 			$line->price=100;
@@ -2421,7 +2454,7 @@ class ContratLigne extends CommonObject
 		$sql.= ",total_localtax1=".price2num($this->total_localtax1,'MT')."";
 		$sql.= ",total_localtax2=".price2num($this->total_localtax2,'MT')."";
 		$sql.= ",total_ttc=".price2num($this->total_ttc,'MT')."";
-		$sql.= " WHERE rowid = ".$this->rowid;
+		$sql.= " WHERE rowid = ".$this->id;
 
 		dol_syslog(get_class($this)."::update_total", LOG_DEBUG);
 
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 09f0d507a39..7bee1a38b6b 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -1523,7 +1523,7 @@ function migrate_price_contrat($db,$langs,$conf)
                 // On met a jour les 3 nouveaux champs
                 $contratligne= new ContratLigne($db);
                 //$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis
-                $contratligne->rowid=$rowid;
+                $contratligne->id=$rowid;
 
                 $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,0,'HT',$info_bits,0,$tmpmysoc);
                 $total_ht  = $result[0];
-- 
GitLab