From d4e7a97fdb54058990ff1f6fa6ebae43d0302179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 17:31:27 +0100 Subject: [PATCH 01/13] Fix: [ bug #1774 ] PHP Fatal error when creating a contract with Product module not enabled --- htdocs/contrat/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index e4a8c644615..274376860da 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1229,8 +1229,10 @@ else /* * Lines of contracts */ - $productstatic=new Product($db); + if ($conf->product->enabled) { + $productstatic=new Product($db); + } $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; From b9d6f2a4963e4265ffe04ffedfafa30776bff8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 17:43:25 +0100 Subject: [PATCH 02/13] Fix: [ bug #1775 ] New lines can be entered after contract validation --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index e4a8c644615..f23ffb33845 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1672,7 +1672,7 @@ else } // Form to add new line - if ($user->rights->contrat->creer && ($object->statut >= 0)) + if ($user->rights->contrat->creer && ($object->statut == 0)) { $dateSelector=1; From 584be6a589e3d55d6c45b50a997a79e9423254c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 17:47:13 +0100 Subject: [PATCH 03/13] Fixed Contrat::fetch --- htdocs/contrat/class/contrat.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 5265f7025c5..8c96727c5aa 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -470,6 +470,18 @@ class Contrat extends CommonObject $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); + /* + * Lines + */ + + $this->lines = array(); + + $result=$this->fetch_lines(); + if ($result < 0) + { + $this->error=$this->db->error(); + return -3; + } return $this->id; } From e70b6714ce475f4dae98abd3bace519988c74668 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Dec 2014 01:10:42 +0100 Subject: [PATCH 04/13] Doxygen (cherry picked from commit 613d1b3) --- htdocs/contrat/class/contrat.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 8c96727c5aa..3b23f739a50 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -59,11 +59,11 @@ class Contrat extends CommonObject var $product; var $user_author; - var $date_creation; - var $date_validation; + var $date_creation; // date of creation + var $date_validation; // date of last update - var $date_contrat; - var $date_cloture; + var $date_contrat; // date when contract was signed + var $date_cloture; // deprecated (we close contract lines, not a contract) var $commercial_signature_id; var $commercial_suivi_id; From cd468b65fdd198f02095ecb3976d22fc62cf9c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 17:55:21 +0100 Subject: [PATCH 05/13] Documented Contrat class --- htdocs/contrat/class/contrat.class.php | 77 ++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 3b23f739a50..f546531a256 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -49,27 +49,94 @@ class Contrat extends CommonObject */ protected $table_ref_field = 'ref'; + /** + * Id of the contract + * @var int + */ var $id; + + /** + * Reference of the contract + * @var string + */ var $ref; + + /** + * External reference of the contract. + * Used by 3rd party services + * @var string + */ var $ref_ext; + + /** + * Supplier reference of the contract + * @var string + */ var $ref_supplier; + + /** + * Client id linked to the contract + * @var int + */ var $socid; var $societe; // Objet societe + + /** + * Status of the contract + * @var int + */ var $statut=0; // 0=Draft, var $product; + /** + * Author of the contract + * @var + */ var $user_author; - var $date_creation; // date of creation - var $date_validation; // date of last update - var $date_contrat; // date when contract was signed - var $date_cloture; // deprecated (we close contract lines, not a contract) + /** + * Date of creation + * @var int + */ + var $date_creation; + + /** + * Date of last update + * @var int + */ + var $date_validation; + + /** + * Date when contract was signed + * @var int + */ + var $date_contrat; + + /** + * Date of contract closure + * @var int + * @deprecated we close contract lines, not a contract + */ + var $date_cloture; var $commercial_signature_id; var $commercial_suivi_id; - var $note; // deprecated + /** + * @deprecated Use note_private or note_public instead + */ + var $note; + + /** + * Private note + * @var string + */ var $note_private; + + /** + * Public note + * @var string + */ var $note_public; var $modelpdf; From 52b8bb350ed5de7d7254a079305ab2aacb499a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 18:10:30 +0100 Subject: [PATCH 06/13] Fixed Contrat::fetch not setting Contrat::date_creation and improved class doc --- htdocs/contrat/class/contrat.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f546531a256..77dde27dd46 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -140,8 +140,13 @@ class Contrat extends CommonObject var $note_public; var $modelpdf; + /** + * @deprecated Use fk_project instead + */ var $fk_projet; + public $fk_project; + var $extraparams=array(); var $lines=array(); @@ -508,7 +513,9 @@ class Contrat extends CommonObject $this->ref_ext = $result["ref_ext"]; $this->statut = $result["statut"]; $this->mise_en_service = $this->db->jdate($result["datemise"]); + $this->date_contrat = $this->db->jdate($result["datecontrat"]); + $this->date_creation = $this->db->jdate($result["datecontrat"]); $this->user_author_id = $result["fk_user_author"]; From df1f931ab8a0c85855903b14e3d1ae5b30da1ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 18:10:41 +0100 Subject: [PATCH 07/13] Fixed: [ bug #1767 ] Contract document is not generated properly --- .../contract/doc/pdf_strato.modules.php | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index be686377ce3..46364b23d0d 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -239,29 +239,9 @@ class pdf_strato extends ModelePDFContract $iniY = $tab_top + 7; $curY = $tab_top + 7; - $nexY = $tab_top + 7; + $nexY = $tab_top + 2; $pdf->SetXY($this->marge_gauche, $tab_top); - $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); - $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8); - - $pdf->SetFont('', '', $default_font_size - 1); - - $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetXY($this->marge_gauche, $tab_top + 8); - $text=$object->description; - if ($object->duree > 0) - { - $totaltime=convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); - $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; - } - $desc=dol_htmlentitiesbr($text,1); - //print $outputlangs->convToOutputCharset($desc); exit; - - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1); - $nexY = $pdf->GetY(); - - $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); $pdf->MultiCell(0, 2, ''); // Set interline to 3. Then writeMultiCell must use 3 also. @@ -285,7 +265,20 @@ class pdf_strato extends ModelePDFContract $pageposbefore=$pdf->getPage(); // Description of product line - $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).''; + + if ($objectligne->datei) { + $datei = dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); + } else { + $datei = $langs->trans("Unknown"); + } + + if ($objectligne->duration) { + $durationi = convertSecondToTime($objectligne->duration); + } else { + $durationi = $langs->trans("Unknown"); + } + + $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); @@ -533,7 +526,7 @@ class pdf_strato extends ModelePDFContract $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_creation,"day",false,$outputlangs,true), '', 'R'); if ($object->client->code_client) { From 7670ae46a6437186041168804ca37703388e4604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 18:56:23 +0100 Subject: [PATCH 08/13] Fix [ bug #1778 ] Cancel button of edit ref. supplier contract card saves changes instead of cancelling --- htdocs/contrat/card.php | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 14a43e59f12..f27d47f2dd5 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Marcos GarcĂ­a * * 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 @@ -718,19 +719,25 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra setEventMessage($object->error,'errors'); } } elseif ($action=='setref_supplier') { - $result = $object->fetch($id); - if ($result < 0) { - setEventMessage($object->errors,'errors'); - } - $object->ref_supplier=GETPOST('ref_supplier','alpha'); - $result = $object->update($user); - if ($result < 0) { - setEventMessage($object->errors,'errors'); - $action='editref_supplier'; - } else { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; + $cancelbutton = GETPOST('cancel'); + + if (!$cancelbutton) { + + $result = $object->fetch($id); + if ($result < 0) { + setEventMessage($object->errors, 'errors'); + } + $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); + + $result = $object->update($user); + if ($result < 0) { + setEventMessage($object->errors, 'errors'); + $action = 'editref_supplier'; + } else { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } } } elseif ($action=='setref') { $object->ref=GETPOST('ref','alpha'); From 0b4bddd738e0897a43bb285d5f8a4b865f153ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 18:57:59 +0100 Subject: [PATCH 09/13] Fix [ bug #1779 ] Undefined variable $localtaxtx1 and $localtaxtx2 in Contrat::updateline --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 77dde27dd46..ea133a86b0d 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1390,7 +1390,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; From ec7bc21e4c2873ebeb7bde8d1d9231d80dc8d0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 19:01:39 +0100 Subject: [PATCH 10/13] Fixed undefined variable $pu_ht --- htdocs/contrat/class/contrat.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ea133a86b0d..df22f1d0469 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1403,19 +1403,19 @@ class Contrat extends CommonObject // TODO A virer // Anciens indicateurs: $price, $remise (a ne plus utiliser) $remise = 0; - $price = price2num(round($pu_ht, 2)); + $price = price2num(round($pu, 2)); if (dol_strlen($remise_percent) > 0) { - $remise = round(($pu_ht * $remise_percent / 100), 2); - $price = $pu_ht - $remise; + $remise = round(($pu * $remise_percent / 100), 2); + $price = $pu - $remise; } if (empty($pa_ht)) $pa_ht=0; // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente if ($pa_ht == 0) { - if ($pu_ht > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) - $pa_ht = $pu_ht * (1 - $remise_percent / 100); + if ($pu > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) + $pa_ht = $pu * (1 - $remise_percent / 100); } $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'"; From ef4d710f788a518e19ffc2d2805023c128d82cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 19:16:14 +0100 Subject: [PATCH 11/13] Improving CommonObject and Contrat documentation --- htdocs/contrat/class/contrat.class.php | 32 +++++++++++++----------- htdocs/core/class/commonobject.class.php | 3 +++ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index df22f1d0469..623e7e121f2 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -149,6 +149,10 @@ class Contrat extends CommonObject var $extraparams=array(); + /** + * Contract lines + * @var ContratLigne[] + */ var $lines=array(); @@ -215,8 +219,8 @@ class Contrat extends CommonObject * * @param User $user Objet User qui active le contrat * @param int $line_id Id de la ligne de detail a activer - * @param timestamp $date Date d'ouverture - * @param timestamp $date_end Date fin prevue + * @param int $date Date d'ouverture + * @param int|string $date_end Date fin prevue * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ @@ -262,7 +266,7 @@ class Contrat extends CommonObject * * @param User $user Objet User qui active le contrat * @param int $line_id Id de la ligne de detail a activer - * @param timestamp $date_end Date fin + * @param int $date_end Date fin * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ @@ -578,7 +582,7 @@ class Contrat extends CommonObject /** * Load lignes array into this->lines * - * @return Array Return array of contract lines + * @return ContratLigne[] Return array of contract lines */ function fetch_lines() { @@ -1183,16 +1187,16 @@ class Contrat extends CommonObject * @param float $txlocaltax2 Local tax 2 rate * @param int $fk_product Id produit * @param float $remise_percent Pourcentage de remise de la ligne - * @param timestamp $date_start Date de debut prevue - * @param timestamp $date_end Date de fin prevue - * @param float $price_base_type HT or TTC + * @param int $date_start Date de debut prevue + * @param int $date_end Date de fin prevue + * @param string $price_base_type HT or TTC * @param float $pu_ttc Prix unitaire TTC * @param int $info_bits Bits de type de lignes * @param int $fk_fournprice Fourn price id * @param int $pa_ht Buying price HT * @return int <0 si erreur, >0 si ok */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) { global $user, $langs, $conf, $mysoc; @@ -1340,20 +1344,20 @@ class Contrat extends CommonObject * @param float $pu Prix unitaire * @param int $qty Quantite * @param float $remise_percent Pourcentage de remise de la ligne - * @param timestamp $date_start Date de debut prevue - * @param timestamp $date_end Date de fin prevue + * @param int $date_start Date de debut prevue + * @param int $date_end Date de fin prevue * @param float $tvatx Taux TVA * @param float $localtax1tx Local tax 1 rate * @param float $localtax2tx Local tax 2 rate - * @param timestamp $date_debut_reel Date de debut reelle - * @param timestamp $date_fin_reel Date de fin reelle - * @param float $price_base_type HT or TTC + * @param int|string $date_debut_reel Date de debut reelle + * @param int|string $date_fin_reel Date de fin reelle + * @param string $price_base_type HT or TTC * @param int $info_bits Bits de type de lignes * @param int $fk_fournprice Fourn price id * @param int $pa_ht Buying price HT * @return int < 0 si erreur, > 0 si ok */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) { global $user, $conf, $langs, $mysoc; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d0e4e086640..ca9461e7deb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -47,6 +47,9 @@ abstract class CommonObject public $array_options=array(); + /** + * @var Societe + */ public $thirdparty; public $linkedObjectsIds; // Loaded by ->fetchObjectLinked From 7424ee1107a78b1634c43e8e054fe474bd5a57a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 19:28:25 +0100 Subject: [PATCH 12/13] 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]; From 2202380bc2a11c27383cdbcf90c9b8eed2c386fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 28 Dec 2014 19:36:43 +0100 Subject: [PATCH 13/13] Improving ContratLigne documentation --- htdocs/contrat/class/contrat.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9e0005bf3ad..a407f0c3a6f 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2055,6 +2055,13 @@ class ContratLigne extends CommonObject var $fk_product; var $statut; // 0 inactive, 4 active, 5 closed var $label; + + /** + * @var string + * @deprecated Use $label instead + */ + public $libelle; + var $description; var $date_commande; var $date_ouverture_prevue; // date start planned @@ -2072,6 +2079,13 @@ class ContratLigne extends CommonObject var $fk_remise_except; var $subprice; // Unit price HT + + /** + * @var float + * @deprecated Use $price_ht instead + */ + public $price; + var $price_ht; var $total_ht;