Commit 5481bda9 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #18428 TIME 0:45 contact/M2M: split login and password

parent 9f741f53
......@@ -15,6 +15,6 @@
<img src="assets/spinner.gif"/>
</div>
</app-root>
<script src="runtime-es2015.4ac42fef445445e6f3d0.js" type="module"></script><script src="runtime-es5.4ac42fef445445e6f3d0.js" nomodule defer></script><script src="polyfills-es5.8c2a86db22bc37211976.js" nomodule defer></script><script src="polyfills-es2015.f8f86766446f4344eec7.js" type="module"></script><script src="scripts.3f995a62571f9f668311.js" defer></script><script src="main-es2015.02358cbb72b0e882be43.js" type="module"></script><script src="main-es5.02358cbb72b0e882be43.js" nomodule defer></script></body>
<script src="runtime-es2015.4ac42fef445445e6f3d0.js" type="module"></script><script src="runtime-es5.4ac42fef445445e6f3d0.js" nomodule defer></script><script src="polyfills-es5.8c2a86db22bc37211976.js" nomodule defer></script><script src="polyfills-es2015.f8f86766446f4344eec7.js" type="module"></script><script src="scripts.3f995a62571f9f668311.js" defer></script><script src="main-es2015.dc35e0550e41e621c2e3.js" type="module"></script><script src="main-es5.dc35e0550e41e621c2e3.js" nomodule defer></script></body>
</html>
\ No newline at end of file
......@@ -104,7 +104,7 @@
*ngIf="(field.unit === unit.id && unit.id !== 'address') || (field.unit === unit.id && unit.id === 'address' && !addressBANMode)">
<p mat-line class="contact-content" *ngIf="field.display">
<ng-container
*ngIf="field.type === 'string' && field.id !== 'communicationMeans' && field.id !== 'externalId_m2m' && field.id != 'addressCountry'">
*ngIf="field.type === 'string' && field.id !== 'uri' && field.id !== 'externalId_m2m' && field.id != 'addressCountry'">
<mat-form-field>
<input matInput [formControl]="field.control" [placeholder]="field.label"
(blur)="checkCompany(field);checkFilling();" (ngModelChange)="toUpperCase(field, $event)" [required]="field.required">
......@@ -184,7 +184,7 @@
<mat-error *ngIf="field.control.status!=='VALID' && field.control.touched">
{{getErrorMsg(field.control.errors)}}</mat-error>
</ng-container>
<ng-container *ngIf="field.id === 'communicationMeans'">
<ng-container *ngIf="field.id === 'uri'">
<mat-form-field *ngIf="annuaryEnabled">
<input type="text" #autoCompleteInputCommunicationMean
[placeholder]="'lang.searchCommunicationMean' | translate" matInput
......
......@@ -253,7 +253,7 @@ export class ContactsFormComponent implements OnInit {
values: []
},
{
id: 'communicationMeans',
id: 'uri',
unit: 'maarch2maarch',
label: this.translate.instant('lang.communicationMean'),
desc: `${this.translate.instant('lang.communicationMeanDesc')} (${this.translate.instant('lang.see')} <a href="${this.maarch2maarchUrl}" target="_blank">MAARCH2MAARCH</a>)`,
......@@ -264,6 +264,42 @@ export class ContactsFormComponent implements OnInit {
filling: false,
values: []
},
{
id: 'login',
unit: 'maarch2maarch',
label: this.translate.instant('lang.userIdMaarch2Maarch'),
desc: `${this.translate.instant('lang.userIdMaarch2MaarchDesc')}`,
type: 'string',
control: new FormControl(),
required: false,
display: false,
filling: false,
values: []
},
{
id: 'password',
unit: 'maarch2maarch',
label: this.translate.instant('lang.userPasswordMaarch2Maarch'),
desc: `${this.translate.instant('lang.userPasswordMaarch2MaarchDesc')}`,
type: 'string',
control: new FormControl(),
required: false,
display: false,
filling: false,
values: []
},
{
id: 'email_m2m',
unit: 'maarch2maarch',
label: this.translate.instant('lang.email'),
desc: `${this.translate.instant('lang.m2mEmailDesc')}`,
type: 'string',
control: new FormControl(),
required: false,
display: false,
filling: false,
values: []
},
{
id: 'externalId_m2m',
unit: 'maarch2maarch',
......@@ -386,6 +422,9 @@ export class ContactsFormComponent implements OnInit {
exhaustMap(() => this.http.get('../rest/contacts/' + this.contactId)),
map((data: any) => {
// data.civility = this.contactService.formatCivilityObject(data.civility);
if (!this.functions.empty(data.communicationMeans)) {
this.setCommunicationMeans(data.communicationMeans);
}
data.fillingRate = this.contactService.formatFillingObject(data.fillingRate);
return data;
}),
......@@ -706,11 +745,22 @@ export class ContactsFormComponent implements OnInit {
contact['customFields'][element.id.split(/_(.+)/)[1]] = element.control.value;
} else if (element.id.match(regex2) !== null) {
contact['externalId'][element.id.split(/_(.+)/)[1]] = element.control.value;
} else {
} else if (element.utit !== 'maarch2maarch'){
contact[element.id] = element.control.value;
}
});
return contact;
const m2mData: any[] = this.contactForm.filter((element: any) => element.unit === 'maarch2maarch').map((item: any) => ({
id: item.id,
value: item.control.value
}));
const communicationMeans = {
uri: m2mData.find((item: any) => item.id === 'uri').value,
externalId_m2m: m2mData.find((item: any) => item.id === 'externalId_m2m').value,
login: m2mData.find((item: any) => item.id === 'login').value,
password: m2mData.find((item: any) => item.id === 'password').value,
email: m2mData.find((item: any) => item.id === 'email_m2m').value,
};
return { ... contact, communicationMeans};
}
isEmptyUnit(id: string) {
......@@ -797,6 +847,17 @@ export class ContactsFormComponent implements OnInit {
this.addressBANMode = disableBan ? false : true;
}
setCommunicationMeans(communicationMeans: any) {
let indexField = -1;
Object.keys(communicationMeans).forEach(element => {
indexField = this.contactForm.map(field => field.id).indexOf(element);
if (!this.isEmptyValue(communicationMeans[element]) && indexField > -1 && ['uri', 'login'].indexOf(element) > -1) {
this.contactForm[indexField].control.setValue(communicationMeans[element]);
this.contactForm[indexField].display = true;
}
});
}
canDelete(field: any) {
if (field.id === 'company') {
const lastname = this.contactForm.filter(contact => contact.id === 'lastname')[0];
......@@ -836,7 +897,7 @@ export class ContactsFormComponent implements OnInit {
removeField(field: any) {
field.display = !field.display;
field.control.reset();
if ((field.id === 'externalId_m2m' || field.id === 'communicationMeans') && !field.display) {
if ((field.id === 'externalId_m2m' || field.id === 'uri') && !field.display) {
const indexFieldAnnuaryId = this.contactForm.map(item => item.id).indexOf('externalId_m2m_annuary_id');
if (indexFieldAnnuaryId > -1) {
this.contactForm.splice(indexFieldAnnuaryId, 1);
......@@ -848,7 +909,7 @@ export class ContactsFormComponent implements OnInit {
initAutocompleteCommunicationMeans() {
this.communicationMeanInfo = this.translate.instant('lang.autocompleteInfo');
this.communicationMeanResult = [];
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('communicationMeans');
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('uri');
this.contactForm[indexFieldCommunicationMeans].control.valueChanges
.pipe(
debounceTime(300),
......@@ -875,7 +936,7 @@ export class ContactsFormComponent implements OnInit {
}
selectCommunicationMean(ev: any) {
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('communicationMeans');
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('uri');
this.contactForm[indexFieldCommunicationMeans].control.setValue(ev.option.value.communicationValue);
const indexFieldExternalId = this.contactForm.map(field => field.id).indexOf('externalId_m2m');
......@@ -889,7 +950,7 @@ export class ContactsFormComponent implements OnInit {
initAutocompleteExternalIdM2M() {
this.externalId_m2mInfo = this.translate.instant('lang.autocompleteInfo');
this.externalId_m2mResult = [];
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('communicationMeans');
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('uri');
const indexFieldExternalId = this.contactForm.map(field => field.id).indexOf('externalId_m2m');
this.contactForm[indexFieldExternalId].control.valueChanges
.pipe(
......
......@@ -2198,5 +2198,10 @@
"interconnectionTest": "Test the configuration of the <b> Maarch Courrier / Maarch RM interconnection </b> configured in the <b> config.json </b> file",
"interconnectionFailed": "<b>Interconnection with Maarch RM failed.</b> Error when calling Maarch RM server",
"interconnectionSuccess": "<b>Successful interconnection with Maarch RM.</b>",
"startTest": "Start the test"
"startTest": "Start the test",
"userIdMaarch2Maarch": "User identifier",
"userPasswordMaarch2Maarch": "User password",
"userIdMaarch2MaarchDesc": "User ID with a web service account",
"userPasswordMaarch2MaarchDesc": "User password with a web service account",
"m2mEmailDesc": "Used as part of an <b> indirect connection </b> between applications (use of mailings for digital fold)"
}
......@@ -2210,5 +2210,10 @@
"interconnectionTest": "Tester le paramétrage de <b>l'interconnexion Maarch Courrier / Maarch RM</b> configuré dans le fichier <b>config.json</b>",
"interconnectionFailed": "<b>L'interconnexion avec Maarch RM a échouée.</b> Erreur lors de l'appel au serveur Maarch RM",
"interconnectionSuccess": "<b>Interconnexion réussie avec Maarch RM.</b>",
"startTest": "Lancer le test"
"startTest": "Lancer le test",
"userIdMaarch2Maarch": "Identifiant de l'utilisateur",
"userPasswordMaarch2Maarch": "Mot de passe de l'utilisateur",
"userIdMaarch2MaarchDesc": "Identifiant de l'utilisateur avec un compte webservice",
"userPasswordMaarch2MaarchDesc": "Mot de passe de l'utilisateur avec un compte webservice",
"m2mEmailDesc": "Utilisé dans le cadre d'une connexion indirecte entre les applications (utilisation des envois de mail pour le pli numérique)"
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment