diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9d90520e1d7..9787802691e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -820,7 +820,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"; $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"; @@ -860,6 +861,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); @@ -872,7 +874,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; @@ -2674,6 +2677,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 dbb26408b6f..50f18de82f5 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,"; - $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity"; + $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"; $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"; @@ -121,6 +121,7 @@ class box_services_contracts extends ModeleBoxes $contractlinestatic->label=$objp->label; $contractlinestatic->description=$objp->description; $contractlinestatic->type=$objp->type; + $contratlignestatic->product_type = $objp->product_type; $contractlinestatic->product_id=$objp->product_id; $contractlinestatic->product_ref=$objp->product_ref; @@ -164,21 +165,21 @@ class box_services_contracts extends ModeleBoxes $productstatic->type=$objp->ptype; $productstatic->ref=$objp->product_ref; $productstatic->entity=$objp->pentity; - $productstatic->label=$objp->plabel; + $productstatic->label=$objp->product_label; $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 1b578da172f..8aa83f9b76e 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -367,10 +367,11 @@ class pdf_standard extends ModeleExpenseReport $curY = $nexY; $pdf->startTransaction(); $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails); - $pageposafter=$pdf->getPage(); + $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) { // There is a pagebreak $pdf->rollbackTransaction(true); + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; if (empty($showpricebeforepagebreak)) { @@ -587,7 +588,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 5e93397fe66..5a7a087a1ff 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