diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 58be7fdcb45..579efd5ddc5 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -825,7 +825,7 @@ class Contrat extends CommonObject
$pos = 0;
// Selects contract lines related to a product
- $sql = "SELECT p.label as product_label, p.description as product_desc, p.ref as product_ref,";
+ $sql = "SELECT p.label as product_label, p.description as product_desc, p.ref as product_ref, p.fk_product_type as product_type,";
$sql .= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
$sql .= " d.total_ht,";
$sql .= " d.total_tva,";
@@ -838,7 +838,8 @@ class Contrat extends CommonObject
$sql .= " d.fk_user_author,";
$sql .= " d.fk_user_ouverture,";
$sql .= " d.fk_user_cloture,";
- $sql .= " d.fk_unit";
+ $sql .= " d.fk_unit,";
+ $sql .= " d.product_type as type";
$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as d LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
$sql .= " WHERE d.fk_contrat = ".$this->id;
$sql .= " ORDER by d.rowid ASC";
@@ -878,6 +879,7 @@ class Contrat extends CommonObject
$line->total_ttc = $objp->total_ttc;
$line->fk_product = (($objp->fk_product > 0) ? $objp->fk_product : 0);
$line->info_bits = $objp->info_bits;
+ $line->type = $objp->type;
$line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
@@ -890,7 +892,8 @@ class Contrat extends CommonObject
$line->ref = $objp->product_ref; // deprecated
$line->product_ref = $objp->product_ref; // Product Ref
- $line->product_desc = $objp->product_desc; // Product Description
+ $line->product_type = $objp->product_type; // Product Type
+ $line->product_desc = $objp->product_desc; // Product Description
$line->product_label = $objp->product_label; // Product Label
$line->description = $objp->description;
@@ -2677,6 +2680,7 @@ class ContratLigne extends CommonObjectLine
*/
public $description;
+ public $product_type; // 0 for product, 1 for service
public $product_ref;
public $product_label;
diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php
index 7d6d2b0ee10..d2008901b09 100644
--- a/htdocs/core/boxes/box_services_contracts.php
+++ b/htdocs/core/boxes/box_services_contracts.php
@@ -91,7 +91,7 @@ class box_services_contracts extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,";
$sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type, cd.date_fin_validite as date_line,";
- $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity, p.tobuy, p.tosell";
+ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as product_type, p.entity, p.tobuy, p.tosell";
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
@@ -125,6 +125,7 @@ class box_services_contracts extends ModeleBoxes
$contractlinestatic->type = $objp->type;
$contractlinestatic->product_id = $objp->product_id;
$contractlinestatic->product_ref = $objp->product_ref;
+ $contratlignestatic->product_type = $objp->product_type;
$contractstatic->id = $objp->rowid;
$contractstatic->ref = $objp->ref;
@@ -166,27 +167,27 @@ class box_services_contracts extends ModeleBoxes
if ($objp->product_id > 0)
{
$productstatic->id = $objp->product_id;
- $productstatic->type = $objp->ptype;
+ $productstatic->type = $objp->product_type;
$productstatic->ref = $objp->product_ref;
$productstatic->entity = $objp->pentity;
- $productstatic->label = $objp->plabel;
+ $productstatic->label = $objp->product_label;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$text = $productstatic->getNomUrl(1, '', 20);
- if ($objp->plabel)
+ if ($objp->product_label)
{
$text .= ' - ';
//$productstatic->ref=$objp->label;
//$text .= $productstatic->getNomUrl(0,'',16);
- $text .= $objp->plabel;
+ $text .= $objp->product_label;
}
$description = $objp->description;
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM))
{
- //$text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'
'.dol_htmlentitiesbr($objp->description):'';
+ //$text .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'
'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc
}
diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
index 955aed73704..d461682805f 100644
--- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
@@ -372,6 +372,7 @@ class pdf_standard extends ModeleExpenseReport
if ($pageposafter > $pageposbefore) {
// There is a pagebreak
$pdf->rollbackTransaction(true);
+
$pageposafter = $pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
if (empty($showpricebeforepagebreak)) {
@@ -588,7 +589,7 @@ class pdf_standard extends ModeleExpenseReport
{
global $conf;
$pdf->SetFont('', '', $default_font_size - 1);
-
+ $pdf->SetTextColor(0, 0, 0);
// Accountancy piece
$pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment - $this->posxpiece - 0.8, 4, $this->posxpiece - 1, $curY, $linenumber + 1, 0, 1);
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 092e29ba642..7bc2ba9fab2 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -4,7 +4,7 @@
* Copyright (C) 2015 Alexandre Spangaro
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (c) 2018 Frédéric France
- * Copyright (C) 2016-2018 Ferran Marcet
+ * Copyright (C) 2016-2020 Ferran Marcet
*
* 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
@@ -600,6 +600,8 @@ class ExpenseReport extends CommonObject
$this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname);
}
+ $this->fetch_optionals();
+
$this->lines = array();
$result = $this->fetch_lines();
diff --git a/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_fonts.php b/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_fonts.php
index 218fb6df1e5..8681dfbdbfa 100644
--- a/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_fonts.php
+++ b/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_fonts.php
@@ -1149,7 +1149,7 @@ class TCPDF_FONTS {
$subsetglyphs[$g] = true;
}
}
- }
+ }
break;
}
case 6: { // Format 6: Trimmed table mapping
diff --git a/htdocs/install/mysql/tables/llx_contratdet.sql b/htdocs/install/mysql/tables/llx_contratdet.sql
index 4705bbab218..cfd965d01c4 100644
--- a/htdocs/install/mysql/tables/llx_contratdet.sql
+++ b/htdocs/install/mysql/tables/llx_contratdet.sql
@@ -53,7 +53,7 @@ create table llx_contratdet
total_localtax1 double(24,8) DEFAULT 0, -- Total Local tax 1 de la ligne
total_localtax2 double(24,8) DEFAULT 0, -- Total Local tax 2 de la ligne
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
- product_type integer DEFAULT 1, -- Product type (1=service by default)
+ product_type integer DEFAULT 1, -- Type of line (1=service by default)
info_bits integer DEFAULT 0, -- TVA NPR ou non
buy_price_ht double(24,8) DEFAULT NULL, -- buying price