diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 0b62146b080..f25d0ba69ef 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -804,7 +804,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,";
@@ -817,7 +817,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";
@@ -857,6 +858,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);
@@ -869,7 +871,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;
@@ -2604,6 +2607,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 d528a4d68ca..f87fbd7b282 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 as contractline_status, 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,8 @@ 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;
+
$contractlinestatic->statut = $objp->contractline_status;
$contractstatic->id = $objp->rowid;
@@ -150,27 +152,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 ae1310a924a..003e134faba 100644
--- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
@@ -368,6 +368,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)) {
@@ -570,6 +571,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);
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 3f7caca5890..f020680c110 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
@@ -601,7 +601,7 @@ class ExpenseReport extends CommonObject
$this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname);
}
- $this->lines = array();
+ $this->fetch_optionals();
$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 933fc50ec54..bbe19955e33 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