diff --git a/bin/backend/controls/userData/UserData.js b/bin/backend/controls/userData/UserData.js index da3a3d9bf805329eb89b77ac8a3000a2d00e0c1b..50c07b5fa5a5cbb41742851a5a19d51456a7893a 100644 --- a/bin/backend/controls/userData/UserData.js +++ b/bin/backend/controls/userData/UserData.js @@ -438,7 +438,18 @@ define('package/quiqqer/erp/bin/backend/controls/userData/UserData', [ return; } - let defaultAddress = addresses[0]; + let defaultAddress = false; + + for (let i = 0; i < addresses.length; i++) { + if (addresses[i].default) { + defaultAddress = addresses[i]; + break; + } + } + + if (!defaultAddress) { + defaultAddress = addresses[0]; + } // Set address data this.$setDataByAddress(defaultAddress); @@ -854,6 +865,18 @@ define('package/quiqqer/erp/bin/backend/controls/userData/UserData', [ parts.push(address.lastname); } + // E-Mail address + const emailAddresses = JSON.decode(address.mail); + + if (emailAddresses.length) { + const contactEmail = emailAddresses[0].trim(); + + if (contactEmail !== '') { + this.$ContactEmail.value = contactEmail; + this.setAttribute('contactEmail', contactEmail); + } + } + this.$ContactPerson.value = parts.join(' ').trim(); this.setAttribute('contactPerson', this.$ContactPerson.value); },