Merge pull request #14281 from ATM-Consulting/11.0_fix_multicurency_option_not_applied
Fix multicurecy option not applied
This commit is contained in:
commit
c699d71abc
@ -416,7 +416,7 @@ class Facture extends CommonInvoice
|
|||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
||||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1271,11 +1271,15 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
// $date_commande is deprecated
|
||||||
|
$date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set
|
||||||
|
if(empty($date)) $date = $now;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($this->source)) $this->source = 0;
|
if (empty($this->source)) $this->source = 0;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date);
|
||||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -359,7 +359,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$remise = $this->remise;
|
$remise = $this->remise;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
||||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -530,7 +530,7 @@ class MultiCurrency extends CommonObject
|
|||||||
$sql1.= " AND m.entity IN (".getEntity('multicurrency').")";
|
$sql1.= " AND m.entity IN (".getEntity('multicurrency').")";
|
||||||
$sql2= '';
|
$sql2= '';
|
||||||
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) $sql2.= ' AND DATE_FORMAT(mc.date_sync, "%Y-%m-%d") = "'.date('Y-m-d', $date_document).'"';
|
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) $sql2.= ' AND DATE_FORMAT(mc.date_sync, "%Y-%m-%d") = "'.date('Y-m-d', $date_document).'"';
|
||||||
$sql3.= ' ORDER BY mc.date_sync DESC LIMIT 1';
|
$sql3 = ' ORDER BY mc.date_sync DESC LIMIT 1';
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql = $db->query($sql1.$sql2.$sql3);
|
$resql = $db->query($sql1.$sql2.$sql3);
|
||||||
|
|||||||
@ -891,7 +891,7 @@ class SupplierProposal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $now);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
$this->multicurrency_code = $conf->currency;
|
$this->multicurrency_code = $conf->currency;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user