Skip to content

Commit

Permalink
Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 8, 2018
2 parents c55f83b + e92a63b commit 27dcf18
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion htdocs/societe/class/societe.class.php
Expand Up @@ -885,6 +885,24 @@ function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmod
// We don't check when update called during a create because verify was already done.
// For a merge, we suppose source data is clean and a customer code of a deleted thirdparty must be accepted into a target thirdparty with empty code without duplicate error
$result = $this->verify();

// If there is only one error and error is ErrorBadCustomerCodeSyntax and we don't change customer code, we allow the update
// So we can update record that were using and old numbering rule.
if (is_array($this->errors))
{
if (in_array('ErrorBadCustomerCodeSyntax', $this->errors) && is_object($this->oldcopy) && $this->oldcopy->code_client == $this->code_client)
{
if (($key = array_search('ErrorBadCustomerCodeSyntax', $this->errors)) !== false) unset($this->errors[$key]); // Remove error message
}
if (in_array('ErrorBadSupplierCodeSyntax', $this->errors) && is_object($this->oldcopy) && $this->oldcopy->code_fournisseur == $this->code_fournisseur)
{
if (($key = array_search('ErrorBadSupplierCodeSyntax', $this->errors)) !== false) unset($this->errors[$key]); // Remove error message
}
if (empty($this->errors)) // If there is no more error, we can make like if there is no error at all
{
$result = 0;
}
}
}

if ($result >= 0)
Expand Down Expand Up @@ -1534,7 +1552,7 @@ function delete($id, User $fuser=null, $call_trigger=1)
dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR);
}
}

// Remove links to subsidiaries companies
if (! $error)
{
Expand Down

0 comments on commit 27dcf18

Please sign in to comment.