mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
fix phpstan empty oldcopy is not falsy (#30049)
* fix phpstan empty olcopy is not falsy * fix phpstan empty olcopy is not falsy * remove code not used --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
7690fd7191
commit
efdc7f92b9
|
|
@ -168,9 +168,6 @@ class pdf_vinci extends ModelePDFMo
|
|||
$hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
|
||||
}
|
||||
|
||||
// Loop on each lines to detect if there is at least one image to show
|
||||
$realpatharray = array();
|
||||
|
||||
if ($conf->mrp->dir_output) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
|
|
@ -340,7 +337,6 @@ class pdf_vinci extends ModelePDFMo
|
|||
while ($i < $pageposafternote) {
|
||||
$pdf->setPage($i);
|
||||
|
||||
|
||||
$pdf->SetDrawColor(128, 128, 128);
|
||||
// Draw note frame
|
||||
if ($i > $pageposbeforenote) {
|
||||
|
|
@ -421,12 +417,6 @@ class pdf_vinci extends ModelePDFMo
|
|||
$prod = new Product($this->db);
|
||||
$prod->fetch($bom->lines[$i]->fk_product);
|
||||
|
||||
// Define size of image if we need it
|
||||
$imglinesize = array();
|
||||
if (!empty($realpatharray[$i])) {
|
||||
$imglinesize = pdf_getSizeForImage($realpatharray[$i]);
|
||||
}
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore = $pdf->getPage();
|
||||
|
|
@ -435,33 +425,6 @@ class pdf_vinci extends ModelePDFMo
|
|||
$posYAfterImage = 0;
|
||||
$posYAfterDescription = 0;
|
||||
|
||||
// We start with Photo of product line
|
||||
if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
|
||||
$pdf->AddPage('', '', true);
|
||||
if (!empty($tplidx)) {
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
$pdf->setPage($pageposbefore + 1);
|
||||
|
||||
$curY = $tab_top_newpage;
|
||||
|
||||
// Allows data in the first page if description is long enough to break in multiples pages
|
||||
if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
|
||||
$showpricebeforepagebreak = 1;
|
||||
} else {
|
||||
$showpricebeforepagebreak = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) {
|
||||
$curX = $this->posxpicture - 1;
|
||||
$pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
|
||||
// $pdf->Image does not increase value return by getY, so we save it manually
|
||||
$posYAfterImage = $curY + $imglinesize['height'];
|
||||
}
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc - 1;
|
||||
$showpricebeforepagebreak = 1;
|
||||
|
|
@ -595,8 +558,6 @@ class pdf_vinci extends ModelePDFMo
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Show square
|
||||
if ($pagenb == $pageposbeforeprintlines) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
|
||||
|
|
@ -1397,25 +1358,6 @@ class pdf_vinci extends ModelePDFMo
|
|||
),
|
||||
);
|
||||
|
||||
$rank = $rank + 10;
|
||||
$this->cols['photo'] = array(
|
||||
'rank' => $rank,
|
||||
'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm
|
||||
'status' => false,
|
||||
'title' => array(
|
||||
'textkey' => 'Photo',
|
||||
'label' => ' '
|
||||
),
|
||||
'content' => array(
|
||||
'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'border-left' => false, // remove left line separator
|
||||
);
|
||||
|
||||
if (getDolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')) {
|
||||
$this->cols['photo']['status'] = true;
|
||||
}
|
||||
|
||||
$rank = $rank + 10;
|
||||
$this->cols['dim'] = array(
|
||||
'rank' => $rank,
|
||||
|
|
|
|||
|
|
@ -1178,7 +1178,7 @@ class Product extends CommonObject
|
|||
|
||||
if ($result >= 0) {
|
||||
// $this->oldcopy should have been set by the caller of update (here properties were already modified)
|
||||
if (empty($this->oldcopy)) {
|
||||
if (is_null($this->oldcopy) || (is_object($this->oldcopy) && $this->oldcopy->isEmpty())) {
|
||||
$this->oldcopy = dol_clone($this, 1);
|
||||
}
|
||||
// Test if batch management is activated on existing product
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2013-2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -385,7 +386,7 @@ class Dolresource extends CommonObject
|
|||
}
|
||||
|
||||
// $this->oldcopy should have been set by the caller of update (here properties were already modified)
|
||||
if (empty($this->oldcopy)) {
|
||||
if (is_null($this->oldcopy) || (is_object($this->oldcopy) && $this->oldcopy->isEmpty())) {
|
||||
$this->oldcopy = dol_clone($this, 2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
|
||||
* Copyright (C) 2023-2024 Patrice Andreani <pandreani@easya.solutions>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user