Fix phpstan

This commit is contained in:
Laurent Destailleur 2024-09-26 00:22:19 +02:00
parent 93747bdf23
commit 2aea634669
4 changed files with 27 additions and 8 deletions

View File

@ -179,7 +179,12 @@ class ProductFournisseur extends Product
public $reputations = array();
// Multicurreny
/**
* @var int ID of multicurrency
*/
public $fourn_multicurrency_id;
public $fourn_multicurrency_code;
public $fourn_multicurrency_tx;
public $fourn_multicurrency_price;
@ -489,7 +494,7 @@ class ProductFournisseur extends Product
$sql .= " multicurrency_price = ".(isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
$sql .= " multicurrency_unitprice = ".(isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
$sql .= " multicurrency_tx = ".(isset($multicurrency_tx) ? "'".$this->db->escape($multicurrency_tx)."'" : '1').",";
$sql .= " fk_multicurrency = ".(isset($fk_multicurrency) ? "'".$this->db->escape($fk_multicurrency)."'" : 'null').",";
$sql .= " fk_multicurrency = ".(isset($fk_multicurrency) ? (int) $fk_multicurrency : 'null').",";
$sql .= " multicurrency_code = ".(isset($multicurrency_code) ? "'".$this->db->escape($multicurrency_code)."'" : 'null').",";
$sql .= " entity = ".$conf->entity.",";
$sql .= " tva_tx = ".price2num($tva_tx).",";
@ -915,7 +920,7 @@ class ProductFournisseur extends Product
$this->fourn_multicurrency_price = 0;
$this->fourn_multicurrency_unitprice = 0;
$this->fourn_multicurrency_tx = 0;
$this->fourn_multicurrency_id = '';
$this->fourn_multicurrency_id = 0;
$this->fourn_multicurrency_code = '';
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";

View File

@ -579,8 +579,14 @@ if (empty($reshook)) {
// Get vat rate
$tva_npr = 0;
if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority)
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha'));
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha'));
$tmpidprodfournprice = GETPOST('idprodfournprice', 'alpha'); // can be an id of price, or -1, -2, -99 or 'idprod_...'
if (is_numeric($tmpidprodfournprice) && (int) $tmpidprodfournprice > 0) {
$tmpidprodfournprice = (int) $tmpidprodfournprice;
} else {
$tmpidprodfournprice = 0;
}
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $tmpidprodfournprice);
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $tmpidprodfournprice);
if (empty($tva_tx)) {
$tva_npr = 0;
}

View File

@ -1708,8 +1708,15 @@ if (empty($reshook)) {
// Get vat rate
if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority)
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha'));
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha'));
$tmpidprodfournprice = GETPOST('idprodfournprice', 'alpha'); // can be an id of price, or -1, -2, -99 or 'idprod_...'
if (is_numeric($tmpidprodfournprice) && (int) $tmpidprodfournprice > 0) { 
$tmpidprodfournprice = (int) $tmpidprodfournprice;
} else {
$tmpidprodfournprice = 0;
}
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $tmpidprodfournprice);
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $tmpidprodfournprice);
}
if (empty($tva_tx) || empty($tva_npr)) {
$tva_npr = 0;

View File

@ -212,7 +212,8 @@ if ($action == 'order' && GETPOST('valid') && $user->hasRight('fournisseur', 'co
$line->total_tva = $line->total_ht * $tva;
$line->total_ttc = $line->total_ht + $line->total_tva;
$line->remise_percent = (float) $productsupplier->remise_percent;
$line->ref_fourn = $productsupplier->ref_supplier;
$line->ref_fourn = $productsupplier->ref_supplier; // deprecated
$line->ref_supplier = $productsupplier->ref_supplier;
$line->type = $productsupplier->type;
$line->fk_unit = $productsupplier->fk_unit;
@ -275,7 +276,7 @@ if ($action == 'order' && GETPOST('valid') && $user->hasRight('fournisseur', 'co
null,
0,
$line->fk_unit,
$line->multicurrency_subprice ?? 0
$line->multicurrency_subprice
);
}
if ($result < 0) {