Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0

This commit is contained in:
Laurent Destailleur 2018-11-08 18:43:31 +01:00
commit 27dcf18637

View File

@ -885,6 +885,24 @@ class Societe extends CommonObject
// 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)
@ -1534,7 +1552,7 @@ class Societe extends CommonObject
dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR);
}
}
// Remove links to subsidiaries companies
if (! $error)
{