Merge pull request #11328 from fappels/clean_10_beta

Fix scrutinizer bugs
This commit is contained in:
Laurent Destailleur 2019-06-13 10:18:59 +02:00 committed by GitHub
commit 60e1e89981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 92 additions and 91 deletions

View File

@ -1647,7 +1647,7 @@ class Contrat extends CommonObject
// if buy price not defined, define buyprice as configured in margin admin // if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0) if ($this->pa_ht == 0)
{ {
if (($result = $this->defineBuyPrice($pu_ht, $remise_percent)) < 0) if (($result = $this->defineBuyPrice($pu, $remise_percent)) < 0)
{ {
return $result; return $result;
} }

View File

@ -116,7 +116,6 @@ class modTcpdfbarcode extends ModeleBarCode
$_GET["code"]=$code; $_GET["code"]=$code;
$_GET["type"]=$encoding; $_GET["type"]=$encoding;
$_GET["height"]=$height;
$_GET["readable"]=$readable; $_GET["readable"]=$readable;
if ($code) { if ($code) {
@ -166,7 +165,6 @@ class modTcpdfbarcode extends ModeleBarCode
$_GET["code"]=$code; $_GET["code"]=$code;
$_GET["type"]=$encoding; $_GET["type"]=$encoding;
$_GET["height"]=$height;
$_GET["readable"]=$readable; $_GET["readable"]=$readable;
if ($code) { if ($code) {

View File

@ -501,9 +501,9 @@ class pdf_standard extends ModeleExpenseReport
$posy=$this->tablePayments($pdf, $object, $posy_start_of_totals, $outputlangs); $posy=$this->tablePayments($pdf, $object, $posy_start_of_totals, $outputlangs);
} }
// Pied de page // Page footer
$this->_pagefoot($pdf, $object, $outputlangs); $this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPage(); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close(); $pdf->Close();
@ -1024,6 +1024,7 @@ class pdf_standard extends ModeleExpenseReport
if ($resql) if ($resql)
{ {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$totalpaid = 0;
$i=0; $i=0;
while ($i < $num) { while ($i < $num) {
$y+=$tab3_height; $y+=$tab3_height;

View File

@ -154,7 +154,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
$widthtouse = $maxwidthtouse; $widthtouse = $maxwidthtouse;
$heighttouse = $maxheighttouse; $heighttouse = $maxheighttouse;
$logoHeight = $heighttouse; $logoHeight = $heighttouse;
$logoWidth = $heighttouse; $logoWidth = $widthtouse;
//var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit; //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit;
@ -175,9 +175,11 @@ class pdf_tcpdflabel extends CommonStickerGenerator
} }
elseif ($textleft!='' && $textright!='') // left and right part elseif ($textleft!='' && $textright!='') // left and right part
{ {
$logoHeight = $heighttouse/2;
$logoWidth = $widthtouse/2;
if (($textleft == '%LOGO%' || $textleft == '%PHOTO%' || $textleft == '%BARCODE%') && !strstr($textright, '%') ) // left part logo/barcode right part text if (($textleft == '%LOGO%' || $textleft == '%PHOTO%' || $textleft == '%BARCODE%') && !strstr($textright, '%') ) // left part logo/barcode right part text
{ {
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+$xleft, $_PosY+$ytop, $widthtouse/2, 0); if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+$xleft, $_PosY+$ytop, $logoWidth, 0);
elseif ($code && !empty($encoding)) elseif ($code && !empty($encoding))
{ {
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft, $_PosY+$ytop, $widthtouse/2, $heighttouse); $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft, $_PosY+$ytop, $widthtouse/2, $heighttouse);
@ -187,7 +189,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
} }
elseif (($textright == '%LOGO%' || $textright == '%PHOTO%' || $textright == '%BARCODE%') && !strstr($textleft, '%')) // right part logo/barcode left part text elseif (($textright == '%LOGO%' || $textright == '%PHOTO%' || $textright == '%BARCODE%') && !strstr($textleft, '%')) // right part logo/barcode left part text
{ {
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+($widthtouse/2), $_PosY+$ytop, $widthtouse/2, 0); if ($textright == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+($widthtouse/2), $_PosY+$ytop, $logoWidth, 0);
elseif ($code && !empty($encoding)) elseif ($code && !empty($encoding))
{ {
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+($widthtouse/2), $_PosY+$ytop, $widthtouse/2, $heighttouse); $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+($widthtouse/2), $_PosY+$ytop, $widthtouse/2, $heighttouse);
@ -203,7 +205,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft+$logoWidth+1, $_PosY+$ytop, $widthtouse-$logoWidth-1, $heighttouse); $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft+$logoWidth+1, $_PosY+$ytop, $widthtouse-$logoWidth-1, $heighttouse);
} else { } else {
$pdf->SetXY($_PosX+$xleft+$logoWidth+1, $_PosY+$ytop); $pdf->SetXY($_PosX+$xleft+$logoWidth+1, $_PosY+$ytop);
$pdf->MultiCell($widthtouse-$logoWidth1-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); $pdf->MultiCell($widthtouse-$logoWidth-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
} }
} }
elseif ($textright == '%LOGO%') // right part logo left part text/barcode elseif ($textright == '%LOGO%') // right part logo left part text/barcode

View File

@ -1398,6 +1398,8 @@ class Expedition extends CommonObject
$this->total_localtax1 = 0; $this->total_localtax1 = 0;
$this->total_localtax2 = 0; $this->total_localtax2 = 0;
$line = new ExpeditionLigne($this->db);
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@ -2562,8 +2564,6 @@ class ExpeditionLigne extends CommonObjectLine
$this->error = 'ErrorMandatoryParametersNotProvided'; $this->error = 'ErrorMandatoryParametersNotProvided';
return -1; return -1;
} }
// Clean parameters
if (empty($this->entrepot_id)) $this->entrepot_id='null';
$this->db->begin(); $this->db->begin();
@ -2574,7 +2574,7 @@ class ExpeditionLigne extends CommonObjectLine
$sql.= ", qty"; $sql.= ", qty";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= $this->fk_expedition; $sql.= $this->fk_expedition;
$sql.= ", ".$this->entrepot_id; $sql.= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id);
$sql.= ", ".$this->fk_origin_line; $sql.= ", ".$this->fk_origin_line;
$sql.= ", ".$this->qty; $sql.= ", ".$this->qty;
$sql.= ")"; $sql.= ")";

View File

@ -369,7 +369,7 @@ class ProductFournisseur extends Product
// End call triggers // End call triggers
if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG))
{ {
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrenc, $multicurrency_code); $result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrency, $multicurrency_code);
if ($result < 0) { if ($result < 0) {
$error++; $error++;
} }
@ -1089,7 +1089,7 @@ class ProductFournisseur extends Product
* *
* @return int < 0 NOK > 0 OK * @return int < 0 NOK > 0 OK
*/ */
private function logPrice($user, $datec, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrency, $multicurrency_code) private function logPrice($user, $datec, $buyprice, $qty, $multicurrency_buyprice = null, $multicurrency_unitBuyPrice = null, $multicurrency_tx = null, $fk_multicurrency = null, $multicurrency_code = null)
{ {
// Add record into log table // Add record into log table
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_log("; $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_log(";

View File

@ -379,9 +379,9 @@ class FormProduct
*/ */
public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200') public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200')
{ {
global $langs; global $conf, $langs;
dol_syslog(get_class($this)."::selectLot $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $fk_entrepot, $empty_label, $showstock, $forcecombo, $morecss", LOG_DEBUG); dol_syslog(get_class($this)."::selectLot $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $fk_entrepot, $empty_label, $forcecombo, $morecss", LOG_DEBUG);
$out=''; $out='';
$productIdArray = array(); $productIdArray = array();