diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index cbf03d727bb93d317b38bd5d01853a8d166ba415..1efd9a200c6eaac4d6930bee04336d274a4a16d0 100755 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -1223,7 +1223,7 @@ class ContactController $contactFields = ContactController::MAPPING_FIELDS; - $contactFields = array_merge($contactFields, $contactCustoms, ['communicationMeans' => 'communication_means']); + $contactFields = array_merge($contactFields, $contactCustoms); $errors = []; foreach ($body['contacts'] as $key => $contact) { diff --git a/src/frontend/app/registeredMails/acknowledgement-reception/acknowledgement-reception.component.html b/src/frontend/app/registeredMails/acknowledgement-reception/acknowledgement-reception.component.html index 358914106fd344064fdf4bef31d71ee662cc17dd..7d0f4d03d73ead8ec3b142d91f361f4cf4d83697 100644 --- a/src/frontend/app/registeredMails/acknowledgement-reception/acknowledgement-reception.component.html +++ b/src/frontend/app/registeredMails/acknowledgement-reception/acknowledgement-reception.component.html @@ -54,7 +54,7 @@ <mat-form-field> <mat-label>{{'lang.registeredMailNumber' | translate}}</mat-label> - <input #numberInput type="text" matInput required (change)="receiveAcknowledgement()" [(ngModel)]="number" formControlName="number"> + <input #numberInput type="text" matInput required [(ngModel)]="number" formControlName="number"> </mat-form-field> <div style="text-align:center;"> diff --git a/src/frontend/app/registeredMails/acknowledgement-reception/acknowledgement-reception.component.ts b/src/frontend/app/registeredMails/acknowledgement-reception/acknowledgement-reception.component.ts index 76c4bdc44bdf9fa82b067f4103097c9a7ff502f1..fe912ff3a672cecb5205fcd26459f93f7a3114f9 100644 --- a/src/frontend/app/registeredMails/acknowledgement-reception/acknowledgement-reception.component.ts +++ b/src/frontend/app/registeredMails/acknowledgement-reception/acknowledgement-reception.component.ts @@ -1,7 +1,7 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms'; -import { catchError, tap } from 'rxjs/operators'; +import {catchError, debounceTime, tap} from 'rxjs/operators'; import { of } from 'rxjs/internal/observable/of'; import { NotificationService } from '../../../service/notification/notification.service'; import { HeaderService } from '../../../service/header.service'; @@ -21,7 +21,7 @@ export class AcknowledgementReceptionComponent implements OnInit { today: Date = new Date(); - type: any; + type: any = 'distributed'; number: any; receivedDate: any = this.today; reason: any; @@ -67,6 +67,11 @@ export class AcknowledgementReceptionComponent implements OnInit { this.loading = false; this.dataSource = new MatTableDataSource([]); this.returnReasons.sort(); + + this.adminFormGroup.controls['number'].valueChanges.pipe( + debounceTime(500), + tap(() => this.receiveAcknowledgement()) + ).subscribe(); } receiveAcknowledgement() { @@ -78,6 +83,9 @@ export class AcknowledgementReceptionComponent implements OnInit { returnReasonOther: this.reasonOther }; + if (this.functions.empty(this.number)) { + return; + } if (this.type === 'distributed') { if (!this.adminFormGroup.get('number').valid) { this.notify.error(this.translate.instant('lang.fieldsNotValid'));