Skip to content

Commit

Permalink
Fix: do not loose country_code after update
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 21, 2018
1 parent d38c68e commit cd94318
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions htdocs/societe/class/societe.class.php
Expand Up @@ -1071,10 +1071,26 @@ function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmod
$resql=$this->db->query($sql);
if ($resql)
{
unset($this->country_code); // We clean this because it may have been changed after an update of country_id
unset($this->country);
unset($this->state_code);
unset($this->state);
if (is_object($this->oldcopy)) // If we have information on old values
{
if ($this->oldcopy->country_id != $this->country_id)
{
unset($this->country_code);
unset($this->country);
}
if ($this->oldcopy->state_id != $this->state_id)
{
unset($this->state_code);
unset($this->state);
}
}
else
{
unset($this->country_code); // We clean this, in the doubt, because it may have been changed after an update of country_id
unset($this->country);
unset($this->state_code);
unset($this->state);
}

$nbrowsaffected = $this->db->affected_rows($resql);

Expand Down

0 comments on commit cd94318

Please sign in to comment.