diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e0319d25..b51754e5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,16 @@ and this project adheres to * date versioning for test releases ## Unreleased + + +* [person]: AddPersons: allow creation of person or thirdparty only (no users) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422) +* [person]: AddPersons: allow creation of person or thirdparty depending on allowed types (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422) +* [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422) +* [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber) +* [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449) * [person] accompanying course: filter suggested entities by open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/415) [activity] can click through the cross icon for removing person in concerned group (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476) [activity] correct associated persons by considering only open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476) - - * [person_resources]: Renderboxes used to display person/thirdparty info (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/465) ## Test releases diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 0e6cd549b..4ccafa8c2 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -139,12 +139,10 @@ class Address private $point; /** - * @var PostalCode - * * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") * @Groups({"write"}) */ - private $postcode; + private ?PostalCode $postcode; /** * @var string|null diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue index 2ca73b92c..e351109a8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -260,8 +260,7 @@ export default { editPane: false, datePane: false, loading: false, - success: false, - dirty: false + success: false }, errors: [], defaultz: { @@ -537,17 +536,19 @@ export default { checkErrors() { this.errors = []; - if (this.flag.dirty) { - if (this.entity.selected.country === null) { - this.errors.push("Un pays doit être sélectionné."); - } + if (this.entity.selected.country === null) { + this.errors.push("Un pays doit être sélectionné."); + } + if (this.entity.selected.city === null) { + this.errors.push("Une ville doit être sélectionnée."); + } else { if (Object.keys(this.entity.selected.city).length === 0) { this.errors.push("Une ville doit être sélectionnée."); } - if (!this.entity.selected.isNoAddress) { - if (this.entity.selected.address.street === null || this.entity.selected.address.streetNumber === null) { - this.errors.push("Une adresse doit être sélectionnée."); - } + } + if (!this.entity.selected.isNoAddress) { + if (this.entity.selected.address.street === null || this.entity.selected.address.street === '' || this.entity.selected.address.streetNumber === null || this.entity.selected.address.streetNumber === '') { + this.errors.push("Une adresse doit être sélectionnée."); } } }, @@ -567,7 +568,7 @@ export default { this.entity.selected.country = this.context.edit ? this.entity.address.country : {}; this.entity.selected.postcode = this.context.edit ? this.entity.address.postcode : {}; - this.entity.selected.city = {}; + this.entity.selected.city = this.context.edit ? this.entity.address.postcode : {}; this.entity.selected.address = {}; this.entity.selected.address.street = this.context.edit ? this.entity.address.street: null; @@ -583,6 +584,8 @@ export default { this.entity.selected.writeNew.address = this.context.edit && this.entity.address.addressReference === null && this.entity.address.street.length > 0 this.entity.selected.writeNew.postcode = false // NB: this used to be this.context.edit, but think it was erroneous; console.log('!! just set writeNew.postcode to', this.entity.selected.writeNew.postcode); + + this.checkErrors(); }, /* diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue index ae134c88e..18e0caca3 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue @@ -111,11 +111,9 @@ export default { this.entity.selected.address.streetNumber = value.streetNumber; this.entity.selected.writeNew.address = false; this.updateMapCenter(value.point); - this.flag.dirty = true; this.checkErrors(); }, remove() { - this.flag.dirty = true; this.entity.selected.address = {}; this.checkErrors(); }, @@ -158,7 +156,6 @@ export default { this.entity.selected.address.street = addr.street; this.entity.selected.address.streetNumber = addr.number; this.entity.selected.writeNew.address = true; - this.flag.dirty = true; this.checkErrors(); } }, diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue index d0ff5c086..ca5d01b50 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue @@ -125,11 +125,9 @@ export default { if (value.center) { this.updateMapCenter(value.center); } - this.flag.dirty = true; this.checkErrors(); }, remove() { - this.flag.dirty = true; this.entity.selected.city = {}; this.checkErrors(); }, diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue index 09ba8421d..6e64b2985 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue @@ -51,7 +51,6 @@ export default { init() { if (this.value !== undefined) { this.selectCountry(this.value); - this.flag.dirty = false; } }, selectCountryByCode(countryCode) { @@ -67,7 +66,6 @@ export default { this.checkErrors(); }, remove() { - this.flag.dirty = true; this.entity.selected.country = null; this.checkErrors(); }, diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue index 5279880bc..503ca5b33 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue @@ -157,6 +157,7 @@ export default { set(value) { console.log('isNoAddress value', value); this.entity.selected.isNoAddress = value; + this.checkErrors(); }, get() { return this.entity.selected.isNoAddress; diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue index 24f69a9fe..061d728a0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue @@ -1,6 +1,6 @@