Merge pull request #6141 from atm-ph/fix_develop_multicurrency_historisation_rate
Fix no historisation of rate
This commit is contained in:
commit
6fa84206aa
@ -451,7 +451,7 @@ class MultiCurrency extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update rate in database
|
* Add new entry into llx_multicurrency_rate to historise
|
||||||
*
|
*
|
||||||
* @param double $rate rate value
|
* @param double $rate rate value
|
||||||
*
|
*
|
||||||
@ -459,15 +459,7 @@ class MultiCurrency extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function updateRate($rate)
|
public function updateRate($rate)
|
||||||
{
|
{
|
||||||
if (is_object($this->rate))
|
return $this->addRate($rate);
|
||||||
{
|
|
||||||
$this->rate->rate = $rate;
|
|
||||||
return $this->rate->update();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $this->addRate($rate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -480,7 +472,7 @@ class MultiCurrency extends CommonObject
|
|||||||
$sql = 'SELECT cr.rowid';
|
$sql = 'SELECT cr.rowid';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr';
|
||||||
$sql.= ' WHERE cr.fk_multicurrency = '.$this->id;
|
$sql.= ' WHERE cr.fk_multicurrency = '.$this->id;
|
||||||
$sql.= ' AND cr.date_sync >= ALL (SELECT cr2.date_sync FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr.rowid = cr2.rowid)';
|
$sql.= ' AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr2.fk_multicurrency = '.$this->id.')';
|
||||||
|
|
||||||
dol_syslog(__METHOD__,LOG_DEBUG);
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user