Avoid a useless select
This commit is contained in:
parent
f8a55362f6
commit
c6a071622a
@ -463,11 +463,17 @@ class Facture extends CommonInvoice
|
||||
$this->status = 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) && empty($this->multicurrency_tx)) {
|
||||
list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
||||
if (!empty($this->multicurrency_code)) {
|
||||
// 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);
|
||||
} else {
|
||||
// original rate multicurrency_tx and multicurrency_code are set, we use them
|
||||
$this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||
}
|
||||
} else {
|
||||
$this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||
$this->fk_multicurrency = 0;
|
||||
}
|
||||
if (empty($this->fk_multicurrency)) {
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user