Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
bf95deef24
13 changed files with 142 additions and 150 deletions
|
|
@ -9,10 +9,10 @@
|
|||
*/
|
||||
return [
|
||||
// # Issue statistics:
|
||||
// PhanTypeMismatchArgument : 600+ occurrences
|
||||
// PhanTypeMismatchArgument : 540+ occurrences
|
||||
// PhanUndeclaredProperty : 460+ occurrences
|
||||
// PhanTypeMismatchArgumentNullable : 190+ occurrences
|
||||
// PhanTypeMismatchProperty : 140+ occurrences
|
||||
// PhanTypeMismatchArgumentNullable : 180+ occurrences
|
||||
// PhanTypeMismatchProperty : 130+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 100+ occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 20+ occurrences
|
||||
// PhanTypeInvalidDimOffset : 20+ occurrences
|
||||
|
|
@ -405,18 +405,10 @@ return [
|
|||
'htdocs/fichinter/stats/index.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/filefunc.inc.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fourn/card.php' => ['PhanTypeMismatchProperty'],
|
||||
'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/class/fournisseur.facture-rec.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/fourn/class/fournisseur.facture-rec.ligne.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/fourn/class/fournisseur.facture.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/fourn/class/fournisseur.facture.ligne.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/fourn/class/fournisseur.orderline.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/fourn/class/fournisseur.product.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
|
||||
'htdocs/fourn/commande/card.php' => ['PhanTypeMismatchDimAssignment', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/commande/dispatch.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
|
||||
'htdocs/fourn/facture/card-rec.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/commande/card.php' => ['PhanTypeMismatchDimAssignment', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/facture/card-rec.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/facture/card.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/fourn/facture/paiement.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fourn/facture/rapport.php' => ['PhanTypeMismatchArgument'],
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ if (empty($reshook)) {
|
|||
if ($action == 'update_extras' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
|
|
|
|||
|
|
@ -1530,7 +1530,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
$sql = "UPDATE ".$this->db->prefix()."commande_fournisseur";
|
||||
$sql .= " SET fk_statut=".self::STATUS_ORDERSENT.", fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."', ";
|
||||
$sql .= " note_private='".$this->db->escape($newnoteprivate)."'";
|
||||
$sql .= " note_private='".$this->db->escape((string) $newnoteprivate)."'";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::commande", LOG_DEBUG);
|
||||
|
|
@ -1999,7 +1999,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
* @param ?int $date_end Date end of service
|
||||
* @param array<string,null|int|float|string> $array_options extrafields array
|
||||
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param int|string $pu_ht_devise Amount in currency
|
||||
* @param float $pu_ht_devise Amount in currency
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @param int $rang Rank
|
||||
|
|
@ -2087,7 +2087,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
// We use 'none' instead of $ref_supplier, because fourn_ref may not exists anymore. So we will take the first supplier price ok.
|
||||
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
|
||||
$result = $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', (isset($this->fk_soc) ? $this->fk_soc : $this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
|
||||
$result = $prod->get_buyprice($fk_prod_fourn_price, (float) $qty, $fk_product, 'none', (isset($this->fk_soc) ? $this->fk_soc : $this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
|
||||
|
||||
// If supplier order created from sales order, we take best supplier price
|
||||
// If $pu (defined previously from pu_ht or pu_ttc) is not defined at all, we also take the best supplier price
|
||||
|
|
@ -2131,7 +2131,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
// Predefine quantity according to packaging
|
||||
if (getDolGlobalString('PRODUCT_USE_SUPPLIER_PACKAGING')) {
|
||||
$prod = new Product($this->db);
|
||||
$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', (empty($this->fk_soc) ? $this->socid : $this->fk_soc));
|
||||
$prod->get_buyprice($fk_prod_fourn_price, (float) $qty, $fk_product, 'none', (empty($this->fk_soc) ? $this->socid : $this->fk_soc));
|
||||
|
||||
if ($qty < $prod->packaging) {
|
||||
$qty = (float) $prod->packaging;
|
||||
|
|
@ -2164,7 +2164,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$tabprice = calcul_price_total((float) $qty, $pu, $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, (float) $pu_ht_devise);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
|
|
@ -2330,7 +2330,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
$sql = "INSERT INTO ".$this->db->prefix()."receptiondet_batch";
|
||||
$sql .= " (fk_element, fk_product, qty, fk_entrepot, fk_user, datec, fk_elementdet, status, comment, eatby, sellby, batch, fk_reception) VALUES";
|
||||
$sql .= " ('".$this->id."','".$product."','".$qty."',".($entrepot > 0 ? "'".$entrepot."'" : "null").",'".$user->id."','".$this->db->idate($now)."','".$fk_commandefourndet."', ".$dispatchstatus.", '".$this->db->escape($comment)."', ";
|
||||
$sql .= ($eatby ? "'".$this->db->idate($eatby)."'" : "null").", ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", ".($batch ? "'".$this->db->escape($batch)."'" : "null").", ".($fk_reception > 0 ? "'".$this->db->escape($fk_reception)."'" : "null");
|
||||
$sql .= ($eatby ? "'".$this->db->idate($eatby)."'" : "null").", ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", ".($batch ? "'".$this->db->escape($batch)."'" : "null").", ".($fk_reception > 0 ? "'".$this->db->escape((string) $fk_reception)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::dispatchProduct", LOG_DEBUG);
|
||||
|
|
@ -3090,7 +3090,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$tabprice = calcul_price_total($qty, (float) $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, (float) $pu_ht_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
|
@ -3186,7 +3186,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
// Mise a jour info denormalisees au niveau facture
|
||||
if ($result >= 0) {
|
||||
$this->update_price('1', 'auto');
|
||||
$this->update_price(1, 'auto');
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2023-2024 Nick Fragoulis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -333,10 +333,10 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Create a predefined supplier invoice
|
||||
*
|
||||
* @param User $user User object
|
||||
* @param int $facFournId Id invoice
|
||||
* @param int $notrigger No trigger
|
||||
* @return int Return integer <0 if KO, id of invoice created if OK
|
||||
* @param User $user User object
|
||||
* @param int $facFournId Id invoice
|
||||
* @param int<0,1> $notrigger No trigger
|
||||
* @return int Return integer <0 if KO, id of invoice created if OK
|
||||
*/
|
||||
public function create($user, $facFournId, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -403,7 +403,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
$sql .= ', generate_pdf';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= "'".$this->db->escape($this->title)."'";
|
||||
$sql .= ", ".($this->subtype ? "'".$this->db->escape($this->subtype)."'" : "null");
|
||||
$sql .= ", ".($this->subtype ? "'".$this->db->escape((string) $this->subtype)."'" : "null");
|
||||
$sql .= ", '".$this->db->escape($this->ref_supplier)."'";
|
||||
$sql .= ", ".((int) $conf->entity);
|
||||
$sql .= ", ".((int) $facfourn_src->socid);
|
||||
|
|
@ -565,8 +565,8 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Update fourn_invoice_rec.
|
||||
*
|
||||
* @param User $user User
|
||||
* @param int $notrigger No trigger
|
||||
* @param User $user User
|
||||
* @param int<0,1> $notrigger No trigger
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = 0)
|
||||
|
|
@ -575,7 +575,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET";
|
||||
$sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ;
|
||||
$sql .= " subtype=".(isset($this->subtype) ? $this->db->escape($this->subtype) : "null").",";
|
||||
$sql .= " subtype=".(isset($this->subtype) ? $this->db->escape((string) $this->subtype) : "null").",";
|
||||
$sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
|
||||
$sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ',';
|
||||
if (!empty($this->socid) && $this->socid > 0) {
|
||||
|
|
@ -884,10 +884,10 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Delete template invoice
|
||||
*
|
||||
* @param User $user User that delete.
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param User $user User that delete.
|
||||
* @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = 0, $idwarehouse = -1)
|
||||
{
|
||||
|
|
@ -955,8 +955,8 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
* @param float $qty Quantity
|
||||
* @param float $remise_percent Percentage discount of the line
|
||||
* @param float $txtva Taux de tva force, sinon -1
|
||||
* @param int $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param int $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param float $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param float $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int<0,1> $type Type of line (0=product, 1=service)
|
||||
* @param int $date_start Date start
|
||||
|
|
@ -964,8 +964,8 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
* @param int $info_bits VAT npr or not ?
|
||||
* @param int $special_code Special code
|
||||
* @param int $rang Position of line
|
||||
* @param string $fk_unit Unit
|
||||
* @param int $pu_ht_devise Unit price in currency
|
||||
* @param ?int $fk_unit Unit
|
||||
* @param float $pu_ht_devise Unit price in currency
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
* @throws Exception
|
||||
*/
|
||||
|
|
@ -1018,7 +1018,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$tabprice = calcul_price_total((float) $qty, (float) $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
|
@ -1079,7 +1079,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
$sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' ' . (int) $facid; // source supplier invoice id
|
||||
$sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null');
|
||||
$sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape((string) $fk_product) . "'" : 'null');
|
||||
$sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null');
|
||||
$sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null');
|
||||
$sql .= ", '" . $this->db->escape($desc) . "'";
|
||||
|
|
@ -1150,7 +1150,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
* @param int $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param int $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int<0,1> $type Type of line (0=product, 1=service)
|
||||
* @param int $date_start Date start
|
||||
* @param int $date_end Date end
|
||||
* @param int $info_bits Bits of type of lines
|
||||
|
|
@ -1214,7 +1214,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$tabprice = calcul_price_total((float) $qty, (float) $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, (float) $pu_ht_devise);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
|
|
@ -1289,9 +1289,9 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Return next reference of invoice not already used (or last reference)
|
||||
*
|
||||
* @param Societe $soc Thirdparty object
|
||||
* @param string $mode 'next' for next value or 'last' for last value
|
||||
* @return string free ref or last ref
|
||||
* @param Societe $soc Thirdparty object
|
||||
* @param 'next'|'last' $mode 'next' for next value or 'last' for last value
|
||||
* @return string free ref or last ref
|
||||
*/
|
||||
public function getNextNumRef($soc, $mode = 'next')
|
||||
{
|
||||
|
|
@ -1315,7 +1315,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Return if maximum number of generation is reached
|
||||
*
|
||||
* @return boolean False by default, True if maximum number of generation is reached
|
||||
* @return bool False by default, True if maximum number of generation is reached
|
||||
*/
|
||||
public function isMaxNbGenReached()
|
||||
{
|
||||
|
|
@ -1507,13 +1507,13 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Return clickable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto Add picto into link
|
||||
* @param string $option Where point the link
|
||||
* @param int $max Maxlength of ref
|
||||
* @param int $short 1=Return just URL
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $withpicto Add picto into link
|
||||
* @param string $option Where point the link
|
||||
* @param int<0,max> $max Maxlength of ref
|
||||
* @param int<0,1> $short 1=Return just URL
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int<0,1> $notooltip 1=Disable tooltip
|
||||
* @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values when clicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
|
||||
|
|
@ -1585,8 +1585,8 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Return label of object status
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
|
||||
* @param integer $alreadypaid Not used on recurring invoices
|
||||
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
|
||||
* @param int<-1,1> $alreadypaid Not used on recurring invoices
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function getLibStatut($mode = 0, $alreadypaid = -1)
|
||||
|
|
@ -1598,10 +1598,10 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Return label of a status
|
||||
*
|
||||
* @param int $recur Is it a recurring invoice ?
|
||||
* @param int<0,1> $recur Is it a recurring invoice ?
|
||||
* @param int $status Id status (suspended or not)
|
||||
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
|
||||
* @param int $alreadypaid Not used for recurring invoices
|
||||
* @param int<-1,1> $alreadypaid Not used for recurring invoices
|
||||
* @param int $type Type invoice
|
||||
* @param int $nbofopendirectdebitorcredittransfer @unused-param Nb of open direct debit or credit transfer
|
||||
* @return string Label of status
|
||||
|
|
@ -1880,9 +1880,9 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Update frequency and unit
|
||||
*
|
||||
* @param ?int $frequency value of frequency
|
||||
* @param string $unit unit of frequency (d, m, y)
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param ?int $frequency value of frequency
|
||||
* @param 'd'|'m'|'y' $unit unit of frequency (d, m, y)
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setFrequencyAndUnit($frequency, $unit)
|
||||
{
|
||||
|
|
@ -1986,8 +1986,8 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Update the auto validate flag of invoice
|
||||
*
|
||||
* @param int $validate 0 to create in draft, 1 to create and validate invoice
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param int<0,1> $validate 0 to create in draft, 1 to create and validate invoice
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setAutoValidate($validate)
|
||||
{
|
||||
|
|
@ -2014,8 +2014,8 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
/**
|
||||
* Update the auto generate documents
|
||||
*
|
||||
* @param int $validate 0 no document, 1 to generate document
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param int<0,1> $validate 0 no document, 1 to generate document
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setGeneratePdf($validate)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2023-2024 Nick Fragoulis
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
*
|
||||
|
|
@ -340,9 +340,9 @@ class FactureFournisseurLigneRec extends CommonInvoiceLine
|
|||
$sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'";
|
||||
$sql .= ', tva_tx = ' . price2num($this->tva_tx);
|
||||
$sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx);
|
||||
$sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'";
|
||||
$sql .= ", localtax1_type = '" . $this->db->escape((string) $this->localtax1_type) . "'";
|
||||
$sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx);
|
||||
$sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'";
|
||||
$sql .= ", localtax2_type = '" . $this->db->escape((string) $this->localtax2_type) . "'";
|
||||
if (empty($this->skip_update_total)) {
|
||||
$sql .= ', total_ht = ' . price2num($this->total_ht);
|
||||
$sql .= ', total_tva = ' . price2num($this->total_tva);
|
||||
|
|
@ -356,7 +356,7 @@ class FactureFournisseurLigneRec extends CommonInvoiceLine
|
|||
$sql .= ", info_bits = " . ((int) $this->info_bits);
|
||||
$sql .= ', special_code =' . (int) $this->special_code;
|
||||
$sql .= ', rang = ' . (int) $this->rang;
|
||||
$sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
|
||||
$sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape((string) $this->fk_unit)."'" : 'null');
|
||||
$sql .= ', fk_user_modif = ' . (int) $user->id;
|
||||
$sql .= ' WHERE rowid = ' . (int) $this->id;
|
||||
|
||||
|
|
|
|||
|
|
@ -579,13 +579,13 @@ class FactureFournisseur extends CommonInvoice
|
|||
$sql .= ", '".$this->db->escape($this->ref_supplier)."'";
|
||||
$sql .= ", '".$this->db->escape($this->ref_ext)."'";
|
||||
$sql .= ", ".((int) $this->entity);
|
||||
$sql .= ", '".$this->db->escape($this->type)."'";
|
||||
$sql .= ", '".$this->db->escape((string) $this->type)."'";
|
||||
$sql .= ", ".((int) $this->subtype);
|
||||
$sql .= ", '".$this->db->escape(isset($this->label) ? $this->label : (isset($this->libelle) ? $this->libelle : ''))."'";
|
||||
$sql .= ", ".((int) $this->socid);
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", '".$this->db->idate($this->date)."'";
|
||||
$sql .= ", ".($this->vat_reverse_charge != '' ? ((int) $this->db->escape($this->vat_reverse_charge)) : 0);
|
||||
$sql .= ", ".($this->vat_reverse_charge != '' ? ((int) $this->vat_reverse_charge) : 0);
|
||||
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null");
|
||||
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : "null");
|
||||
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "null");
|
||||
|
|
@ -784,7 +784,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
$result_insert = $this->addline(
|
||||
$_facrec->lines[$i]->desc ? $_facrec->lines[$i]->desc : $_facrec->lines[$i]->description,
|
||||
$_facrec->lines[$i]->pu_ht,
|
||||
$tva_tx,
|
||||
(float) $tva_tx,
|
||||
$localtax1_tx,
|
||||
$localtax2_tx,
|
||||
$_facrec->lines[$i]->qty,
|
||||
|
|
@ -1281,7 +1281,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
$sql .= " fk_user_author=".(isset($this->author) ? ((int) $this->author) : "null").",";
|
||||
$sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? ((int) $this->fk_user_valid) : "null").",";
|
||||
$sql .= " fk_facture_source=".($this->fk_facture_source ? ((int) $this->fk_facture_source) : "null").",";
|
||||
$sql .= " vat_reverse_charge = ".($this->vat_reverse_charge != '' ? ((int) $this->db->escape($this->vat_reverse_charge)) : 0).",";
|
||||
$sql .= " vat_reverse_charge = ".($this->vat_reverse_charge != '' ? ((int) $this->vat_reverse_charge) : 0).",";
|
||||
$sql .= " fk_projet=".(!empty($this->fk_project) ? ((int) $this->fk_project) : "null").",";
|
||||
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : "null").",";
|
||||
$sql .= " date_lim_reglement=".(dol_strlen((string) $this->date_echeance) != 0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').",";
|
||||
|
|
@ -2161,7 +2161,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
|
||||
// We use 'none' instead of $ref_supplier, because $ref_supplier may not exists anymore. So we will take the first supplier price ok.
|
||||
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
|
||||
$result = $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
|
||||
$result = $prod->get_buyprice($fk_prod_fourn_price, (float) $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
|
||||
if ($result > 0) {
|
||||
if (empty($pu)) {
|
||||
$pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice
|
||||
|
|
@ -2223,7 +2223,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_devise);
|
||||
$tabprice = calcul_price_total((float) $qty, $pu, $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
|
@ -2348,18 +2348,18 @@ class FactureFournisseur extends CommonInvoice
|
|||
* @param int $id Id of line invoice
|
||||
* @param string $desc Description of line
|
||||
* @param float $pu Prix unitaire (HT ou TTC selon price_base_type)
|
||||
* @param float $vatrate VAT Rate (Can be '8.5', '8.5 (ABC)')
|
||||
* @param float|string $vatrate VAT Rate (Can be '8.5', '8.5 (ABC)')
|
||||
* @param float $txlocaltax1 LocalTax1 Rate
|
||||
* @param float $txlocaltax2 LocalTax2 Rate
|
||||
* @param float $qty Quantity
|
||||
* @param int $idproduct Id produit
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $info_bits Miscellaneous information of line
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int<0,1> $type Type of line (0=product, 1=service)
|
||||
* @param float $remise_percent Percentage discount of the line
|
||||
* @param int $notrigger Disable triggers
|
||||
* @param int|string $date_start Date start of service
|
||||
* @param int|string $date_end Date end of service
|
||||
* @param int<0,1> $notrigger Disable triggers
|
||||
* @param int|'' $date_start Date start of service
|
||||
* @param int|'' $date_end Date end of service
|
||||
* @param array<string,mixed> $array_options extrafields array
|
||||
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param float $pu_devise Amount in currency
|
||||
|
|
@ -2421,7 +2421,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
$vatrate = preg_replace('/\s*\(.*\)/', '', (string) $vatrate); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_devise);
|
||||
$tabprice = calcul_price_total((float) $qty, (float) $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, (float) $pu_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
|
@ -2512,7 +2512,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
$this->errors[] = $line->error;
|
||||
} else {
|
||||
// Update total price into invoice record
|
||||
$res = $this->update_price('1', 'auto', 0, $this->thirdparty);
|
||||
$res = $this->update_price(1, 'auto', 0, $this->thirdparty);
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
|
@ -2521,9 +2521,9 @@ class FactureFournisseur extends CommonInvoice
|
|||
/**
|
||||
* Delete a detail line from database
|
||||
*
|
||||
* @param int $rowid Id of line to delete
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param int $rowid Id of line to delete
|
||||
* @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function deleteLine($rowid, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -2855,17 +2855,17 @@ class FactureFournisseur extends CommonInvoice
|
|||
}
|
||||
|
||||
/**
|
||||
* Return clickable name (with picto eventually)
|
||||
* Return clickable name (with optional picto)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param string $option Where point the link
|
||||
* @param int $max Max length of shown ref
|
||||
* @param int $short 1=Return just URL
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $addlinktonotes Add link to show notes
|
||||
* @return string String with URL
|
||||
* @param int<0,1> $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param string $option Where point the link
|
||||
* @param int $max Max length of shown ref
|
||||
* @param int<0,1> $short 1=Return just URL
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int<0,1> $notooltip 1=Disable tooltip
|
||||
* @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int<0,1> $addlinktonotes Add link to show notes
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
|
||||
{
|
||||
|
|
@ -2978,8 +2978,8 @@ class FactureFournisseur extends CommonInvoice
|
|||
* Return next reference of supplier invoice not already used (or last reference)
|
||||
* according to numbering module defined into constant INVOICE_SUPPLIER_ADDON_NUMBER
|
||||
*
|
||||
* @param Societe $soc Thirdparty object
|
||||
* @param string $mode 'next' for next value or 'last' for last value
|
||||
* @param Societe $soc Thirdparty object
|
||||
* @param 'next'|'last' $mode 'next' for next value or 'last' for last value
|
||||
* @return string|-1 Returns free reference or last reference, or '' or -1 if error
|
||||
*/
|
||||
public function getNextNumRef($soc, $mode = 'next')
|
||||
|
|
@ -3167,10 +3167,10 @@ class FactureFournisseur extends CommonInvoice
|
|||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User that clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @param int $invertdetail Reverse sign of amounts for lines
|
||||
* @return int New id of clone
|
||||
* @param User $user User that clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @param int<0,1> $invertdetail Reverse sign of amounts for lines
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone(User $user, $fromid, $invertdetail = 0)
|
||||
{
|
||||
|
|
@ -3244,13 +3244,13 @@ class FactureFournisseur extends CommonInvoice
|
|||
/**
|
||||
* Create a document onto disk according to template model.
|
||||
*
|
||||
* @param string $modele Force template to use ('' to not force)
|
||||
* @param Translate $outputlangs Object lang a utiliser pour traduction
|
||||
* @param int $hidedetails Hide details of lines
|
||||
* @param int $hidedesc Hide description
|
||||
* @param int $hideref Hide ref
|
||||
* @param string $modele Force template to use ('' to not force)
|
||||
* @param Translate $outputlangs Object lang a utiliser pour traduction
|
||||
* @param int<0,1> $hidedetails Hide details of lines
|
||||
* @param int<0,1> $hidedesc Hide description
|
||||
* @param int<0,1> $hideref Hide ref
|
||||
* @param ?array<string,mixed> $moreparams Array to provide more information
|
||||
* @return int<-1,1> Return integer <0 if KO, 0 if nothing done, >0 if OK
|
||||
* @return int<-1,1> Return integer <0 if KO, 0 if nothing done, >0 if OK
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
||||
{
|
||||
|
|
@ -3422,8 +3422,8 @@ class FactureFournisseur extends CommonInvoice
|
|||
/**
|
||||
* Change the option VAT reverse charge
|
||||
*
|
||||
* @param int $vatreversecharge 0 = Off, 1 = On
|
||||
* @return int 1 if OK, 0 if KO
|
||||
* @param int<0,1> $vatreversecharge 0 = Off, 1 = On
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function setVATReverseCharge($vatreversecharge)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2023 Nick Fragoulis
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -525,8 +525,8 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||
$sql .= ", tva_tx = ".price2num($this->tva_tx);
|
||||
$sql .= ", localtax1_tx = ".price2num($this->localtax1_tx);
|
||||
$sql .= ", localtax2_tx = ".price2num($this->localtax2_tx);
|
||||
$sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'";
|
||||
$sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql .= ", localtax1_type = '".$this->db->escape((string) $this->localtax1_type)."'";
|
||||
$sql .= ", localtax2_type = '".$this->db->escape((string) $this->localtax2_type)."'";
|
||||
$sql .= ", total_ht = ".price2num($this->total_ht);
|
||||
$sql .= ", tva= ".price2num($this->total_tva);
|
||||
$sql .= ", total_localtax1= ".price2num($this->total_localtax1);
|
||||
|
|
@ -694,7 +694,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||
$sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
||||
$sql .= ')';
|
||||
$sql .= " VALUES (".$this->fk_facture_fourn.",";
|
||||
$sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape($this->fk_parent_line)."'" : "null").",";
|
||||
$sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape((string) $this->fk_parent_line)."'" : "null").",";
|
||||
$product_label
|
||||
= !empty($this->product_label)
|
||||
? $this->product_label :
|
||||
|
|
@ -708,8 +708,8 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||
$sql .= " ".price2num($this->tva_tx).",";
|
||||
$sql .= " ".price2num($this->localtax1_tx).",";
|
||||
$sql .= " ".price2num($this->localtax2_tx).",";
|
||||
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
|
||||
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
|
||||
$sql .= " '".$this->db->escape((string) $this->localtax1_type)."',";
|
||||
$sql .= " '".$this->db->escape((string) $this->localtax2_type)."',";
|
||||
$sql .= ' '.((!empty($this->fk_product) && $this->fk_product > 0) ? $this->fk_product : "null").',';
|
||||
$sql .= " ".((int) $this->product_type).",";
|
||||
$sql .= " ".price2num($this->remise_percent).",";
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* Copyright (C) 2021 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2024 Solution Libre SAS <contact@solution-libre.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -358,11 +358,11 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||
} else {
|
||||
$sql .= "null,";
|
||||
}
|
||||
$sql .= "'".$this->db->escape($this->product_type)."',";
|
||||
$sql .= (int) $this->special_code . ",";
|
||||
$sql .= "'".$this->db->escape($this->rang)."',";
|
||||
$sql .= "'".$this->db->escape($this->qty)."', ";
|
||||
$sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").",";
|
||||
$sql .= "'".$this->db->escape((string) $this->product_type)."',";
|
||||
$sql .= ((int) $this->special_code) . ",";
|
||||
$sql .= "'".$this->db->escape((string) $this->rang)."',";
|
||||
$sql .= "'".$this->db->escape((string) $this->qty)."', ";
|
||||
$sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape((string) $this->vat_src_code)."'").",";
|
||||
$sql .= " ".price2num($this->tva_tx).", ";
|
||||
$sql .= " ".price2num($this->localtax1_tx).",";
|
||||
$sql .= " ".price2num($this->localtax2_tx).",";
|
||||
|
|
@ -374,7 +374,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||
$sql .= " ".price2num($this->total_localtax1).",";
|
||||
$sql .= " ".price2num($this->total_localtax2).",";
|
||||
$sql .= " ".price2num($this->total_ttc).",";
|
||||
$sql .= ($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : "null");
|
||||
$sql .= ($this->fk_unit ? "'".$this->db->escape((string) $this->fk_unit)."'" : "null");
|
||||
$sql .= ", ".($this->fk_multicurrency ? ((int) $this->fk_multicurrency) : "null");
|
||||
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||
$sql .= ", ".($this->multicurrency_subprice ? price2num($this->multicurrency_subprice) : '0');
|
||||
|
|
@ -453,7 +453,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||
$sql .= ", qty='".price2num($this->qty)."'";
|
||||
$sql .= ", date_start=".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null");
|
||||
$sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
|
||||
$sql .= ", info_bits='".$this->db->escape($this->info_bits)."'";
|
||||
$sql .= ", info_bits='".$this->db->escape((string) $this->info_bits)."'";
|
||||
$sql .= ", total_ht='".price2num($this->total_ht)."'";
|
||||
$sql .= ", total_tva='".price2num($this->total_tva)."'";
|
||||
$sql .= ", total_localtax1='".price2num($this->total_localtax1)."'";
|
||||
|
|
@ -461,7 +461,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||
$sql .= ", total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql .= ", product_type=".$this->product_type;
|
||||
$sql .= ", special_code=".(!empty($this->special_code) ? $this->special_code : 0);
|
||||
$sql .= ($this->fk_unit ? ", fk_unit='".$this->db->escape($this->fk_unit)."'" : ", fk_unit=null");
|
||||
$sql .= ($this->fk_unit ? ", fk_unit='".$this->db->escape((string) $this->fk_unit)."'" : ", fk_unit=null");
|
||||
|
||||
// Multicurrency
|
||||
$sql .= ", multicurrency_subprice=".price2num($this->multicurrency_subprice);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* Copyright (C) 2016-2023 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -228,7 +228,7 @@ class ProductFournisseur extends Product
|
|||
public $fourn_barcode;
|
||||
|
||||
/**
|
||||
* @var string $supplier_barcode - Supplier barcode
|
||||
* @var string - Supplier barcode
|
||||
*/
|
||||
public $supplier_barcode;
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ class ProductFournisseur extends Product
|
|||
public $fourn_fk_barcode_type;
|
||||
|
||||
/**
|
||||
* @var string $supplier_fk_barcode_type - Supplier barcode type
|
||||
* @var string - Supplier barcode type
|
||||
*/
|
||||
public $supplier_fk_barcode_type;
|
||||
|
||||
|
|
@ -534,7 +534,7 @@ class ProductFournisseur extends Product
|
|||
$sql .= " fk_availability = ".((int) $availability).",";
|
||||
$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 .= " multicurrency_tx = ".(isset($multicurrency_tx) ? "'".$this->db->escape((string) $multicurrency_tx)."'" : '1').",";
|
||||
$sql .= " fk_multicurrency = ".(isset($fk_multicurrency) ? (int) $fk_multicurrency : 'null').",";
|
||||
$sql .= " multicurrency_code = ".(isset($multicurrency_code) ? "'".$this->db->escape($multicurrency_code)."'" : 'null').",";
|
||||
$sql .= " entity = ".((int) $conf->entity).",";
|
||||
|
|
@ -550,7 +550,7 @@ class ProductFournisseur extends Product
|
|||
$sql .= " delivery_time_days = ".($delivery_time_days != '' ? ((int) $delivery_time_days) : 'null').",";
|
||||
$sql .= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
||||
$sql .= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
||||
$sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
||||
$sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape((string) $fk_barcode_type)."'");
|
||||
if (getDolGlobalString('PRODUCT_USE_SUPPLIER_PACKAGING')) {
|
||||
$sql .= ", packaging = ".(empty($packaging) ? 1 : $packaging);
|
||||
}
|
||||
|
|
@ -586,7 +586,7 @@ class ProductFournisseur extends Product
|
|||
}
|
||||
// End call triggers
|
||||
if (!$error && !getDolGlobalString('PRODUCT_PRICE_SUPPLIER_NO_LOG')) {
|
||||
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrency, $multicurrency_code);
|
||||
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, (float) $multicurrency_unitBuyPrice, $multicurrency_tx, (int) $fk_multicurrency, $multicurrency_code);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -621,8 +621,8 @@ class ProductFournisseur extends Product
|
|||
$sql .= ") values(";
|
||||
$sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_tx) ? "'".$this->db->escape($multicurrency_tx)."'" : '1').",";
|
||||
$sql .= (isset($fk_multicurrency) ? "'".$this->db->escape($fk_multicurrency)."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_tx) ? "'".$this->db->escape((string) $multicurrency_tx)."'" : '1').",";
|
||||
$sql .= (isset($fk_multicurrency) ? "'".$this->db->escape((string) $fk_multicurrency)."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_code) ? "'".$this->db->escape($multicurrency_code)."'" : 'null').",";
|
||||
$sql .= " '".$this->db->idate($now)."',";
|
||||
$sql .= " ".((int) $this->id).",";
|
||||
|
|
@ -644,9 +644,9 @@ class ProductFournisseur extends Product
|
|||
$sql .= ($delivery_time_days != '' ? ((int) $delivery_time_days) : 'null').",";
|
||||
$sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
||||
$sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
||||
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
||||
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape((string) $fk_barcode_type)."'");
|
||||
if (getDolGlobalString('PRODUCT_USE_SUPPLIER_PACKAGING')) {
|
||||
$sql .= ", ".(empty($this->packaging) ? '1' : "'".$this->db->escape($this->packaging)."'");
|
||||
$sql .= ", ".(empty($this->packaging) ? '1' : "'".$this->db->escape((string) $this->packaging)."'");
|
||||
}
|
||||
$sql .= ")";
|
||||
|
||||
|
|
@ -681,7 +681,7 @@ class ProductFournisseur extends Product
|
|||
if (!$error && !getDolGlobalString('PRODUCT_PRICE_SUPPLIER_NO_LOG')) {
|
||||
// Add record into log table
|
||||
// $this->product_fourn_price_id must be set
|
||||
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrency, $multicurrency_code);
|
||||
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, (float) $multicurrency_unitBuyPrice, $multicurrency_tx, (int) $fk_multicurrency, $multicurrency_code);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -1522,8 +1522,8 @@ class ProductFournisseur extends Product
|
|||
$sql .= "values(";
|
||||
$sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_tx) ? "'".$this->db->escape($multicurrency_tx)."'" : '1').",";
|
||||
$sql .= (isset($fk_multicurrency) ? "'".$this->db->escape($fk_multicurrency)."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_tx) ? "'".$this->db->escape((string) $multicurrency_tx)."'" : '1').",";
|
||||
$sql .= (isset($fk_multicurrency) ? "'".$this->db->escape((string) $fk_multicurrency)."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_code) ? "'".$this->db->escape($multicurrency_code)."'" : 'null').",";
|
||||
$sql .= "'".$this->db->idate($datec)."',";
|
||||
$sql .= " ".((int) $this->product_fourn_price_id).",";
|
||||
|
|
|
|||
|
|
@ -708,7 +708,7 @@ if (empty($reshook)) {
|
|||
$price_base_type = 'HT';
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'CU');
|
||||
|
||||
$result = $object->addline($desc, (float) $pu_ht, (float) $qty, (float) $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, (float) $pu_ttc, $type, 0, 0, $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise);
|
||||
$result = $object->addline($desc, (float) $pu_ht, (float) $qty, (float) $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, (float) $pu_ttc, $type, 0, 0, $date_start, $date_end, $array_options, $fk_unit, (float) $pu_ht_devise);
|
||||
}
|
||||
|
||||
//print "xx".$tva_tx; exit;
|
||||
|
|
@ -1298,7 +1298,7 @@ if (empty($reshook)) {
|
|||
|
||||
|
||||
if ($action == 'update_extras' && $permissiontoadd) {
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
|
|
@ -2430,7 +2430,7 @@ if ($action == 'create') {
|
|||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER_ORDER);
|
||||
$arrayselected=[];
|
||||
$arrayselected = [];
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive
|
|||
if ($product > 0) {
|
||||
$mouv->origin = &$object;
|
||||
$mouv->setOrigin($object->element, $object->id);
|
||||
$result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch);
|
||||
$result = $mouv->livraison($user, $product, $entrepot, $qty, (float) $price, $comment, '', (int) $eatby, (int) $sellby, $batch);
|
||||
if ($result < 0) {
|
||||
$errors = $mouv->errors;
|
||||
$error++;
|
||||
|
|
@ -495,13 +495,13 @@ if ($action == 'updateline' && $permissiontoreceive && empty($cancel)) {
|
|||
if ($product > 0) {
|
||||
$mouv->origin = &$object;
|
||||
$mouv->setOrigin($object->element, $object->id);
|
||||
$result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch);
|
||||
$result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', (int) $eatby, (int) $sellby, $batch);
|
||||
if ($result < 0) {
|
||||
$errors = $mouv->errors;
|
||||
$error++;
|
||||
} else {
|
||||
$mouv->origin = &$object;
|
||||
$result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, $comment, $eatby, $sellby, $batch);
|
||||
$result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, $comment, (int) $eatby, (int) $sellby, $batch);
|
||||
if ($result < 0) {
|
||||
$errors = $mouv->errors;
|
||||
$error++;
|
||||
|
|
@ -588,7 +588,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
if ($action != 'classify' && $caneditproject) {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ if (empty($reshook)) {
|
|||
setEventMessages($line->error, $line->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'update_extras' && $permissiontoadd) {
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
|
|
@ -698,7 +698,7 @@ if (empty($reshook)) {
|
|||
setEventMessages($mesg, null, 'errors');
|
||||
} else {
|
||||
// Insert line
|
||||
$result = $object->addline($idprod, (string) $ref_fournisseur, $label, $desc, $pu_ht, $pu_ttc, (float) $qty, $remise_percent, (float) $tva_tx, $localtax1_tx, $localtax2_tx, $price_base_type, $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1, (string) $fk_unit);
|
||||
$result = $object->addline($idprod, (string) $ref_fournisseur, $label, $desc, $pu_ht, $pu_ttc, (float) $qty, $remise_percent, (float) $tva_tx, $localtax1_tx, $localtax2_tx, $price_base_type, $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1, $fk_unit);
|
||||
|
||||
if ($result > 0) {
|
||||
$object->fetch($object->id); // Reload lines
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2023 Nick Fragoulis
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -1230,7 +1230,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
|
||||
$amount_ttc_diff = $amountdeposit[0];
|
||||
$amount_ttc_diff = array_key_exists(0, $amountdeposit) ? $amountdeposit[0] : 0;
|
||||
}
|
||||
|
||||
foreach ($amountdeposit as $tva => $amount) {
|
||||
|
|
@ -2038,7 +2038,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
if ($action == 'update_extras' && $usercancreate) {
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue