Hi everyone,
I am currently trying to synchronize the customer numbers of linked third party objects to the membership number in the membership module. I would like to use the API for this, as almost a hundred entries need to be adjusted.
Unfortunately, setting a changed value for the “Customer Code” [key code_client] does not work as expected. The “Customer Code” remains unchanged despite the successful API call. For debugging purposes, I also set the third party alias with the new value for the customer number. That works.
Dolibarr Version is 20.0.1
Hi @hansem,
thank you for the explanation and the reference to the specific lines of code.
It is possible to change the customer number easily via the web front end. Changed entries are validated according to system specifications, see screenshot.
Am I right in assuming that the parameter $allowmodcodeclient = 0 applies to all update calls apart from the direct change in the Third-party web frontend?
Is there a technical or organizational reason why a modification to the “client code” cannot be initiated via API call? I assume that validation is also carried out here, as in the web frontend.
According to eldy’s comment: “No reason to not being able to edit customer code from api, surely a bug…”
What’s wrong with setting the two parameters $allowmodcodeclient and $allowmodcodefournisseur to “1” by default in api_thirdparties.class.php? This also was suggested in “REST api thirdparties update does ignore code_compta field · Issue #18146 · Dolibarr/dolibarr · GitHub”
Since the third-party object already exists as the API update-call is sent, it should not have any influence on the auto-generation of code_client or code_compta.
To verify the behavior, I adjusted the named line in api_thirdparties.class.php. The fourth parameter was set to 1.
if ($this->company->update($id, DolibarrApiAccess::$user, 1, 1, ‘’, ‘update’, 1) 0) {
After that, changing an existing “Customer Code” via API worked as expected.