This commit is contained in:
Mireya Serrano 2026-05-24 18:58:11 +02:00
parent c3c5b22b12
commit 411ad0a7d3
2 changed files with 10 additions and 3 deletions

View File

@ -143,10 +143,16 @@ public class DolibarrClient {
if (matches != null && !matches.isEmpty()) {
DolibarrThirdpartyDto existing = matches.get(0);
if (address != null && (existing.address() == null || existing.address().isBlank())) {
boolean nameChanged = !name.equals(existing.name());
boolean addressMissing = address != null && (existing.address() == null || existing.address().isBlank());
if (nameChanged || addressMissing) {
String updatedAddress = addressMissing ? address : existing.address();
String updatedZip = addressMissing ? zip : existing.zip();
String updatedCity = addressMissing ? city : existing.city();
DolibarrThirdpartyDto updated = new DolibarrThirdpartyDto(
existing.id(), existing.name(), existing.email(), existing.client(),
existing.codeClient(), address, zip, city, existing.idCountry(), existing.phone());
existing.id(), name, existing.email(), existing.client(),
existing.codeClient(), updatedAddress, updatedZip, updatedCity,
existing.idCountry(), existing.phone());
restClient.put()
.uri("/thirdparties/{id}", existing.id())
.body(updated)

View File

@ -263,6 +263,7 @@ public class PrestashopClient {
.uri(u -> u.path("/addresses")
.queryParam("ws_key", wsKey)
.queryParam("output_format", "JSON")
.queryParam("display", "full")
.queryParam("filter[id_customer]", id)
.build())
.retrieve()