diff --git a/src/app/external/messageExchange/controllers/AnnuaryController.php b/src/app/external/messageExchange/controllers/AnnuaryController.php index 96670a48001746ea16b404738e58ce68944e8e5b..c4159b195dbebee4ef5cba0d49f1fbe2b4933ff7 100644 --- a/src/app/external/messageExchange/controllers/AnnuaryController.php +++ b/src/app/external/messageExchange/controllers/AnnuaryController.php @@ -175,10 +175,10 @@ class AnnuaryController $loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'apps/maarch_entreprise/xml/m2m_config.xml']); if (!$loadedXml) { - return ['success' => 'M2M is disabled']; + return ['success' => _M2M_ANNUARY_IS_NOT_SET]; } if (empty($loadedXml->annuaries) || $loadedXml->annuaries->enabled == 'false') { - return ['success' => 'Annuary is disabled']; + return ['success' => _NO_M2M_ANNUARY_AVAILABLE]; } $organization = (string)$loadedXml->annuaries->organization; if (empty($organization)) { diff --git a/src/core/controllers/AutoCompleteController.php b/src/core/controllers/AutoCompleteController.php index ba9534d5e2eaa5ed183f88ba21131afec808197e..a8e514970c7ca2cae6cc4386c30be6756578cb4a 100755 --- a/src/core/controllers/AutoCompleteController.php +++ b/src/core/controllers/AutoCompleteController.php @@ -642,6 +642,8 @@ class AutoCompleteController if (!isset($control['annuaries'])) { if (isset($control['errors'])) { return $response->withStatus(400)->withJson(['errors' => $control['errors']]); + } elseif (isset($control['success'])) { + return $response->withStatus(400)->withJson(['errors' => $control['success']]); } } @@ -702,6 +704,8 @@ class AutoCompleteController if (!isset($control['annuaries'])) { if (isset($control['errors'])) { return $response->withStatus(400)->withJson(['errors' => $control['errors']]); + } elseif (isset($control['success'])) { + return $response->withStatus(400)->withJson(['errors' => $control['success']]); } } diff --git a/src/frontend/app/administration/contact/page/form/contacts-form.component.ts b/src/frontend/app/administration/contact/page/form/contacts-form.component.ts index dac7fea588a9265980d20f981a8a0a3dbdebd52e..dc74988a7ff08919b931764bd14161ba1b7aa511 100644 --- a/src/frontend/app/administration/contact/page/form/contacts-form.component.ts +++ b/src/frontend/app/administration/contact/page/form/contacts-form.component.ts @@ -763,6 +763,12 @@ export class ContactsFormComponent implements OnInit { removeField(field: any) { field.display = !field.display; field.control.reset(); + if (field.id == 'externalId_m2m' && !field.display) { + let indexFieldAnnuaryId = this.contactForm.map(field => field.id).indexOf('externalId_m2m_annuary_id'); + if (indexFieldAnnuaryId > -1) { + this.contactForm[indexFieldAnnuaryId].display = false; + } + } this.checkFilling(); } @@ -770,7 +776,6 @@ export class ContactsFormComponent implements OnInit { this.communicationMeanInfo = this.lang.autocompleteInfo; this.communicationMeanResult = []; let indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('communicationMeans'); - let indexFieldCompany = this.contactForm.map(field => field.id).indexOf('company'); this.contactForm[indexFieldCommunicationMeans].control.valueChanges .pipe( debounceTime(300), @@ -787,6 +792,11 @@ export class ContactsFormComponent implements OnInit { this.communicationMeanResult = data; this.communicationMeanFilteredResult = of(this.communicationMeanResult); this.communicationMeanLoading = false; + }), + catchError((err: any) => { + this.communicationMeanInfo = err.error.errors; + this.communicationMeanLoading = false; + return of(false); }) ).subscribe(); } @@ -823,6 +833,11 @@ export class ContactsFormComponent implements OnInit { this.externalId_m2mResult = data; this.externalId_m2mFilteredResult = of(this.externalId_m2mResult); this.externalId_m2mLoading = false; + }), + catchError((err: any) => { + this.externalId_m2mInfo = err.error.errors; + this.externalId_m2mLoading = false; + return of(false); }) ).subscribe(); }