2
0
forked from Wavyzz/dolibarr

Clean code

This commit is contained in:
Laurent Destailleur
2020-01-22 14:39:00 +01:00
parent 047c22b708
commit d6a31f60cd
14 changed files with 20 additions and 42 deletions

View File

@@ -160,8 +160,6 @@ class pdf_einstein extends ModelePDFCommandes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$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
@@ -678,13 +676,13 @@ class pdf_einstein extends ModelePDFCommandes
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -160,8 +160,6 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$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
@@ -877,13 +875,13 @@ class pdf_eratosthene extends ModelePDFCommandes
*/
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -155,8 +155,6 @@ class pdf_standard extends ModeleExpenseReport
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->franchise = !$mysoc->tva_assuj;
// Get source company
$this->emetteur=$mysoc;

View File

@@ -171,8 +171,6 @@ class pdf_crabe extends ModelePDFFactures
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$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
@@ -965,14 +963,14 @@ class pdf_crabe extends ModelePDFFactures
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -171,8 +171,6 @@ class pdf_sponge extends ModelePDFFactures
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$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
@@ -1051,14 +1049,14 @@ class pdf_sponge extends ModelePDFFactures
*/
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -42,6 +42,10 @@ abstract class ModelePDFFactures extends CommonDocGenerator
*/
public $error='';
public $atleastonediscount = 0;
public $atleastoneratenotnull = 0;
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules

View File

@@ -142,8 +142,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_codeproduitservice = 1; // Display product-service code
$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

View File

@@ -160,8 +160,6 @@ class pdf_azur extends ModelePDFPropales
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$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
@@ -866,13 +864,13 @@ class pdf_azur extends ModelePDFPropales
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -159,8 +159,6 @@ class pdf_cyan extends ModelePDFPropales
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$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
@@ -978,13 +976,13 @@ class pdf_cyan extends ModelePDFPropales
*/
public function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -152,8 +152,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->franchise = !$mysoc->tva_assuj;
// Define column position
$this->posxdesc = $this->marge_gauche + 1;
$this->posxtva = 112;

View File

@@ -153,8 +153,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$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
@@ -835,11 +833,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -153,8 +153,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$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
@@ -732,11 +730,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -142,8 +142,6 @@ class pdf_standard extends ModelePDFSuppliersPayments
$this->option_logo = 1; // Affiche logo
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->franchise=!$mysoc->tva_assuj;
// Define column position
$this->posxdate=$this->marge_gauche+1;
$this->posxreffacturefourn=30;

View File

@@ -150,8 +150,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
$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