New: Option to set Third Party Customer Code equal to Member Reference

when using the function of creating third parties from members, you are able to set the customer code equal to the existing member reference by setting the parameter THIRDPARTY_CUSTOMERCODE_EQUALS_MEMBERREF
This commit is contained in:
iLLixM 2025-02-16 18:54:51 +01:00
parent 574273bbf3
commit 92a8fcccfe

View File

@ -4486,7 +4486,11 @@ class Societe extends CommonObject
$this->entity = $member->entity;
$this->client = 1; // A member is a customer by default
$this->code_client = ($customercode ? $customercode : -1);
if (getDolGlobalString('THIRDPARTY_CUSTOMERCODE_EQUALS_MEMBERREF')) {
$this->code_client = $member->ref; // set Customer Code equal to existing Member Reference
} else {
$this->code_client = ($customercode ? $customercode : -1); // set new auto-incremented Customer Code
}
$this->code_fournisseur = '-1';
$this->typent_code = ($member->morphy == 'phy' ? 'TE_PRIVATE' : 0);
$this->typent_id = $this->typent_code ? dol_getIdFromCode($this->db, $this->typent_code, 'c_typent', 'id', 'code') : 0;