Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0

Conflicts:
	htdocs/core/boxes/box_services_contracts.php
	htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
This commit is contained in:
Laurent Destailleur 2020-10-15 21:00:49 +02:00
commit e7992131ec
6 changed files with 21 additions and 13 deletions

View File

@ -825,7 +825,7 @@ class Contrat extends CommonObject
$pos = 0; $pos = 0;
// Selects contract lines related to a product // 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.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_ht,";
$sql .= " d.total_tva,"; $sql .= " d.total_tva,";
@ -838,7 +838,8 @@ class Contrat extends CommonObject
$sql .= " d.fk_user_author,"; $sql .= " d.fk_user_author,";
$sql .= " d.fk_user_ouverture,"; $sql .= " d.fk_user_ouverture,";
$sql .= " d.fk_user_cloture,"; $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 .= " 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 .= " WHERE d.fk_contrat = ".$this->id;
$sql .= " ORDER by d.rowid ASC"; $sql .= " ORDER by d.rowid ASC";
@ -878,6 +879,7 @@ class Contrat extends CommonObject
$line->total_ttc = $objp->total_ttc; $line->total_ttc = $objp->total_ttc;
$line->fk_product = (($objp->fk_product > 0) ? $objp->fk_product : 0); $line->fk_product = (($objp->fk_product > 0) ? $objp->fk_product : 0);
$line->info_bits = $objp->info_bits; $line->info_bits = $objp->info_bits;
$line->type = $objp->type;
$line->fk_fournprice = $objp->fk_fournprice; $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); $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->ref = $objp->product_ref; // deprecated
$line->product_ref = $objp->product_ref; // Product Ref $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->product_label = $objp->product_label; // Product Label
$line->description = $objp->description; $line->description = $objp->description;
@ -2677,6 +2680,7 @@ class ContratLigne extends CommonObjectLine
*/ */
public $description; public $description;
public $product_type; // 0 for product, 1 for service
public $product_ref; public $product_ref;
public $product_label; public $product_label;

View File

@ -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 = "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 .= " 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 .= " 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 .= " 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."contrat as c ON s.rowid = c.fk_soc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $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->type = $objp->type;
$contractlinestatic->product_id = $objp->product_id; $contractlinestatic->product_id = $objp->product_id;
$contractlinestatic->product_ref = $objp->product_ref; $contractlinestatic->product_ref = $objp->product_ref;
$contratlignestatic->product_type = $objp->product_type;
$contractstatic->id = $objp->rowid; $contractstatic->id = $objp->rowid;
$contractstatic->ref = $objp->ref; $contractstatic->ref = $objp->ref;
@ -166,27 +167,27 @@ class box_services_contracts extends ModeleBoxes
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
$productstatic->id = $objp->product_id; $productstatic->id = $objp->product_id;
$productstatic->type = $objp->ptype; $productstatic->type = $objp->product_type;
$productstatic->ref = $objp->product_ref; $productstatic->ref = $objp->product_ref;
$productstatic->entity = $objp->pentity; $productstatic->entity = $objp->pentity;
$productstatic->label = $objp->plabel; $productstatic->label = $objp->product_label;
$productstatic->status = $objp->tosell; $productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy; $productstatic->status_buy = $objp->tobuy;
$text = $productstatic->getNomUrl(1, '', 20); $text = $productstatic->getNomUrl(1, '', 20);
if ($objp->plabel) if ($objp->product_label)
{ {
$text .= ' - '; $text .= ' - ';
//$productstatic->ref=$objp->label; //$productstatic->ref=$objp->label;
//$text .= $productstatic->getNomUrl(0,'',16); //$text .= $productstatic->getNomUrl(0,'',16);
$text .= $objp->plabel; $text .= $objp->product_label;
} }
$description = $objp->description; $description = $objp->description;
// Add description in form // Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) if (!empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
//$text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'<br>'.dol_htmlentitiesbr($objp->description):''; //$text .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc $description = ''; // Already added into main visible desc
} }

View File

@ -372,6 +372,7 @@ class pdf_standard extends ModeleExpenseReport
if ($pageposafter > $pageposbefore) { if ($pageposafter > $pageposbefore) {
// There is a pagebreak // There is a pagebreak
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
$pageposafter = $pageposbefore; $pageposafter = $pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
if (empty($showpricebeforepagebreak)) { if (empty($showpricebeforepagebreak)) {
@ -588,7 +589,7 @@ class pdf_standard extends ModeleExpenseReport
{ {
global $conf; global $conf;
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetTextColor(0, 0, 0);
// Accountancy piece // Accountancy piece
$pdf->SetXY($this->posxpiece, $curY); $pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment - $this->posxpiece - 0.8, 4, $this->posxpiece - 1, $curY, $linenumber + 1, 0, 1); $pdf->writeHTMLCell($this->posxcomment - $this->posxpiece - 0.8, 4, $this->posxpiece - 1, $curY, $linenumber + 1, 0, 1);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (c) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (c) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016-2020 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname);
} }
$this->fetch_optionals();
$this->lines = array(); $this->lines = array();
$result = $this->fetch_lines(); $result = $this->fetch_lines();

View File

@ -1149,7 +1149,7 @@ class TCPDF_FONTS {
$subsetglyphs[$g] = true; $subsetglyphs[$g] = true;
} }
} }
} }
break; break;
} }
case 6: { // Format 6: Trimmed table mapping case 6: { // Format 6: Trimmed table mapping

View File

@ -53,7 +53,7 @@ create table llx_contratdet
total_localtax1 double(24,8) DEFAULT 0, -- Total Local tax 1 de la ligne 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_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 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 info_bits integer DEFAULT 0, -- TVA NPR ou non
buy_price_ht double(24,8) DEFAULT NULL, -- buying price buy_price_ht double(24,8) DEFAULT NULL, -- buying price