diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 0e4d7932856..3c916fd2b29 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1216,6 +1216,7 @@ else if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) { $tmpcode=$object->code_client; + if (empty($tmpcode) && ! empty($object->oldcopy->code_client)) $tmpcode=$object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); print ''; } @@ -1248,7 +1249,7 @@ else if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { $tmpcode=$object->code_fournisseur; - if (empty($tmpcode) && ! empty($object->oldcopy->code_fournisseur)) $tmpcode=$object->oldcopy->code_fournisseur; + if (empty($tmpcode) && ! empty($object->oldcopy->code_fournisseur)) $tmpcode=$object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1); print ''; }