mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge pull request #11328 from fappels/clean_10_beta
Fix scrutinizer bugs
This commit is contained in:
commit
60e1e89981
|
|
@ -1647,7 +1647,7 @@ class Contrat extends CommonObject
|
|||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($pu_ht, $remise_percent)) < 0)
|
||||
if (($result = $this->defineBuyPrice($pu, $remise_percent)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ class modTcpdfbarcode extends ModeleBarCode
|
|||
|
||||
$_GET["code"]=$code;
|
||||
$_GET["type"]=$encoding;
|
||||
$_GET["height"]=$height;
|
||||
$_GET["readable"]=$readable;
|
||||
|
||||
if ($code) {
|
||||
|
|
@ -166,7 +165,6 @@ class modTcpdfbarcode extends ModeleBarCode
|
|||
|
||||
$_GET["code"]=$code;
|
||||
$_GET["type"]=$encoding;
|
||||
$_GET["height"]=$height;
|
||||
$_GET["readable"]=$readable;
|
||||
|
||||
if ($code) {
|
||||
|
|
|
|||
|
|
@ -117,13 +117,13 @@ class pdf_standard extends ModeleExpenseReport
|
|||
public $emetteur;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs, $mysoc, $user;
|
||||
|
||||
// Translations
|
||||
|
|
@ -172,12 +172,12 @@ class pdf_standard extends ModeleExpenseReport
|
|||
$this->posxup=145;
|
||||
$this->posxqty=168;
|
||||
$this->postotalttc=178;
|
||||
// if (empty($conf->projet->enabled)) {
|
||||
// $this->posxtva-=20;
|
||||
// $this->posxup-=20;
|
||||
// $this->posxqty-=20;
|
||||
// $this->postotalttc-=20;
|
||||
// }
|
||||
// if (empty($conf->projet->enabled)) {
|
||||
// $this->posxtva-=20;
|
||||
// $this->posxup-=20;
|
||||
// $this->posxqty-=20;
|
||||
// $this->postotalttc-=20;
|
||||
// }
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxdate-=20;
|
||||
|
|
@ -196,19 +196,19 @@ class pdf_standard extends ModeleExpenseReport
|
|||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to build pdf onto disk
|
||||
*
|
||||
* @param Object $object Object to generate
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1=OK, 0=KO
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to build pdf onto disk
|
||||
*
|
||||
* @param Object $object Object to generate
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1=OK, 0=KO
|
||||
*/
|
||||
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user, $langs, $conf, $mysoc, $db, $hookmanager;
|
||||
|
|
@ -501,9 +501,9 @@ class pdf_standard extends ModeleExpenseReport
|
|||
$posy=$this->tablePayments($pdf, $object, $posy_start_of_totals, $outputlangs);
|
||||
}
|
||||
|
||||
// Pied de page
|
||||
// Page footer
|
||||
$this->_pagefoot($pdf, $object, $outputlangs);
|
||||
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPage();
|
||||
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
|
|
@ -540,17 +540,17 @@ class pdf_standard extends ModeleExpenseReport
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $linenumber line number
|
||||
* @param int $curY current y position
|
||||
* @param int $default_font_size default siez of font
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return void
|
||||
*/
|
||||
private function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0)
|
||||
/**
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $linenumber line number
|
||||
* @param int $curY current y position
|
||||
* @param int $default_font_size default siez of font
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return void
|
||||
*/
|
||||
private function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0)
|
||||
{
|
||||
global $conf;
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
|
@ -618,7 +618,7 @@ class pdf_standard extends ModeleExpenseReport
|
|||
}
|
||||
$comment .= $object->lines[$linenumber]->comments;
|
||||
$pdf->writeHTMLCell($this->posxtva-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $comment, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show top header of page.
|
||||
|
|
@ -846,7 +846,7 @@ class pdf_standard extends ModeleExpenseReport
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show table for lines
|
||||
|
|
@ -1024,6 +1024,7 @@ class pdf_standard extends ModeleExpenseReport
|
|||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$totalpaid = 0;
|
||||
$i=0;
|
||||
while ($i < $num) {
|
||||
$y+=$tab3_height;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
|
|||
$widthtouse = $maxwidthtouse;
|
||||
$heighttouse = $maxheighttouse;
|
||||
$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;
|
||||
|
||||
|
|
@ -175,9 +175,11 @@ class pdf_tcpdflabel extends CommonStickerGenerator
|
|||
}
|
||||
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%' && $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))
|
||||
{
|
||||
$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
|
||||
{
|
||||
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))
|
||||
{
|
||||
$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);
|
||||
} else {
|
||||
$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
|
||||
|
|
|
|||
|
|
@ -1398,6 +1398,8 @@ class Expedition extends CommonObject
|
|||
$this->total_localtax1 = 0;
|
||||
$this->total_localtax2 = 0;
|
||||
|
||||
$line = new ExpeditionLigne($this->db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
|
@ -2562,8 +2564,6 @@ class ExpeditionLigne extends CommonObjectLine
|
|||
$this->error = 'ErrorMandatoryParametersNotProvided';
|
||||
return -1;
|
||||
}
|
||||
// Clean parameters
|
||||
if (empty($this->entrepot_id)) $this->entrepot_id='null';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
|
@ -2574,7 +2574,7 @@ class ExpeditionLigne extends CommonObjectLine
|
|||
$sql.= ", qty";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $this->fk_expedition;
|
||||
$sql.= ", ".$this->entrepot_id;
|
||||
$sql.= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id);
|
||||
$sql.= ", ".$this->fk_origin_line;
|
||||
$sql.= ", ".$this->qty;
|
||||
$sql.= ")";
|
||||
|
|
|
|||
|
|
@ -247,10 +247,10 @@ class ProductFournisseur extends Product
|
|||
if (empty($supplier_reputation) || $supplier_reputation == -1) $supplier_reputation='';
|
||||
if ($delivery_time_days != '' && ! is_numeric($delivery_time_days)) $delivery_time_days = '';
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$ttx = $tva_tx;
|
||||
$buyprice = $buyprice/(1+($ttx/100));
|
||||
}
|
||||
{
|
||||
$ttx = $tva_tx;
|
||||
$buyprice = $buyprice/(1+($ttx/100));
|
||||
}
|
||||
|
||||
// Multicurrency
|
||||
if ($conf->multicurrency->enabled) {
|
||||
|
|
@ -259,10 +259,10 @@ class ProductFournisseur extends Product
|
|||
|
||||
if (empty($multicurrency_buyprice)) $multicurrency_buyprice=0;
|
||||
if ($multicurrency_price_base_type == 'TTC')
|
||||
{
|
||||
$ttx = $tva_tx;
|
||||
$multicurrency_buyprice = $multicurrency_buyprice/(1+($ttx/100));
|
||||
}
|
||||
{
|
||||
$ttx = $tva_tx;
|
||||
$multicurrency_buyprice = $multicurrency_buyprice/(1+($ttx/100));
|
||||
}
|
||||
$multicurrency_buyprice=price2num($multicurrency_buyprice, 'MU');
|
||||
$multicurrency_unitBuyPrice=price2num($multicurrency_buyprice/$qty, 'MU');
|
||||
|
||||
|
|
@ -369,7 +369,7 @@ class ProductFournisseur extends Product
|
|||
// End call triggers
|
||||
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) {
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -911,21 +911,21 @@ class ProductFournisseur extends Product
|
|||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'product_fournisseur_price'
|
||||
);
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'product_fournisseur_price'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1089,7 +1089,7 @@ class ProductFournisseur extends Product
|
|||
*
|
||||
* @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
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_log(";
|
||||
|
|
|
|||
|
|
@ -59,12 +59,12 @@ class FormProduct
|
|||
* Load in cache array list of warehouses
|
||||
* If fk_product is not 0, we do not use cache
|
||||
*
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* @param string $batch Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''.
|
||||
* @param string $status warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* @param string $batch Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''.
|
||||
* @param string $status warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param boolean $sumStock sum total stock of a warehouse, default true
|
||||
* @param array $exclude warehouses ids to exclude
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
|
|
@ -114,9 +114,9 @@ class FormProduct
|
|||
{
|
||||
$sql.= " AND ps.fk_product = '".$fk_product."'";
|
||||
if (!empty($batch))
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb on pb.fk_product_stock = ps.rowid AND pb.batch = '".$batch."'";
|
||||
}
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb on pb.fk_product_stock = ps.rowid AND pb.batch = '".$batch."'";
|
||||
}
|
||||
}
|
||||
$sql.= " WHERE e.entity IN (".getEntity('stock').")";
|
||||
if (count($warehouseStatus))
|
||||
|
|
@ -173,9 +173,9 @@ class FormProduct
|
|||
* @param String $final_label full label with all parents, separated by ' >> ' (completed on each call)
|
||||
* @return String full label with all parents, separated by ' >> '
|
||||
*/
|
||||
private function get_parent_path($tab, $final_label = '')
|
||||
{
|
||||
//phpcs:enable
|
||||
private function get_parent_path($tab, $final_label = '')
|
||||
{
|
||||
//phpcs:enable
|
||||
if(empty($final_label)) $final_label = $tab['label'];
|
||||
|
||||
if(empty($tab['parent_id'])) return $final_label;
|
||||
|
|
@ -195,9 +195,9 @@ class FormProduct
|
|||
* @param int $selected Id of preselected warehouse ('' for no value, 'ifone'=select value if one value otherwise no value)
|
||||
* @param string $htmlname Name of html select html
|
||||
* @param string $filterstatus warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param int $empty 1=Can be empty, 0 if not
|
||||
* @param int $disabled 1=Select is disabled
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
|
|
@ -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')
|
||||
{
|
||||
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='';
|
||||
$productIdArray = array();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user