Avoid a useless select
This commit is contained in:
parent
f8a55362f6
commit
c6a071622a
@ -463,12 +463,18 @@ class Facture extends CommonInvoice
|
|||||||
$this->status = self::STATUS_DRAFT;
|
$this->status = self::STATUS_DRAFT;
|
||||||
$this->statut = self::STATUS_DRAFT;
|
$this->statut = self::STATUS_DRAFT;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
if (!empty($this->multicurrency_code)) {
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) {
|
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
|
||||||
|
if (empty($this->multicurrency_tx)) {
|
||||||
|
// If original rate is not set, we take a default value from date
|
||||||
list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
||||||
} else {
|
} else {
|
||||||
|
// original rate multicurrency_tx and multicurrency_code are set, we use them
|
||||||
$this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
$this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$this->fk_multicurrency = 0;
|
||||||
|
}
|
||||||
if (empty($this->fk_multicurrency)) {
|
if (empty($this->fk_multicurrency)) {
|
||||||
$this->multicurrency_code = $conf->currency;
|
$this->multicurrency_code = $conf->currency;
|
||||||
$this->fk_multicurrency = 0;
|
$this->fk_multicurrency = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user