Fixing Bug in Lieferschein

This commit is contained in:
BlubbFish 2020-05-29 16:07:42 +02:00
parent 6a91888426
commit 2d7555d3b0

View File

@ -5,6 +5,7 @@
* Copyright (C) 2008 Chiptronik
* Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2020 Philip Schell <dev@blubbfish.net>
* 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
@ -39,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
class pdf_thwlieferschein extends ModelePDFDeliveryOrder
{
/**
/**
* @var DoliDb Database handler
*/
public $db;
@ -63,13 +64,13 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.5 = array(5, 5)
*/
public $phpmin = array(5, 5);
public $phpmin = array(5, 5);
/**
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr';
public $version = 'dolibarr';
/**
* @var int page_largeur
@ -118,7 +119,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
* @param DoliDB $db Database handler
*/
public function __construct($db) {
global $conf,$langs,$mysoc;
global $conf, $langs, $mysoc;
// Translations
$langs->loadLangs(array("main", "bills", "sendings", "companies"));
@ -129,50 +130,51 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
// Page size for A4 format
$this->type = 'pdf';
$formatarray=pdf_getFormat();
$formatarray = pdf_getFormat();
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
$this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
$this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_codeproduitservice = 1; // Display product-service code
$this->franchise=!$mysoc->tva_assuj;
$this->franchise =! $mysoc->tva_assuj;
// Get source company
$this->emetteur=$mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined
$this->emetteur = $mysoc;
if (empty($this->emetteur->country_code)) {
$this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined
}
// Define position of columns
$this->posxdesc=$this->marge_gauche+1;
$this->posxcomm=145;
$this->posxdesc = $this->marge_gauche+1;
$this->posxcomm = 145;
//$this->posxtva=112;
//$this->posxup=126;
$this->posxqty=170;
$this->posxremainingqty=195;
$this->posxqty = 170;
$this->posxremainingqty = 195;
//$this->posxdiscount=162;
//$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxcomm-=20;
$this->posxcomm -= 20;
//$this->posxtva-=20;
//$this->posxup-=20;
$this->posxqty-=20;
$this->posxqty -= 20;
//$this->posxdiscount-=20;
//$this->postotalht-=20;
}
$this->tva=array();
$this->atleastoneratenotnull=0;
$this->atleastonediscount=0;
}
$this->tva = array();
$this->atleastoneratenotnull = 0;
$this->atleastonediscount = 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
@ -187,9 +189,11 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
*/
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) {
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
global $user, $langs, $conf, $mysoc, $hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
if (! is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
@ -341,7 +345,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
if(empty($object->note_public)) {
$object->note_public = $hinweis_wichtig;
} else {
$object->note_public = $hinweis_wichtig + "<br><br>" + $object->note_public;
$object->note_public = $hinweis_wichtig."<br><br>".$object->note_public;
}
// Affiche notes