aaaaaaaa
This commit is contained in:
parent
c3c5b22b12
commit
411ad0a7d3
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue