Commit f7e19f3c authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #17109 TIME 0:40 add required otp sign position

parent ceab5878
......@@ -522,6 +522,7 @@
"manage_customizationAdmin": "Personnaliser la page de connexion",
"internalUserOtpMsg": "<b>{{user}}</b> sera converti en utilisateur externe, vous ne pourrez plus choisir les autres modes de signature.",
"externalUser": "Role externe",
"external": "Externe"
"external": "Externe",
"otpSignaturePositionMandatory": "La position de signature pour les utilisateurs externes est obligatoire."
}
}
......@@ -12,6 +12,7 @@ import { NotificationService } from '../service/notification.service';
import { SignaturesContentService } from '../service/signatures.service';
import { SignaturePositionComponent } from './signature-position/signature-position.component';
import { ActionsService } from '../service/actions.service';
import { FunctionsService } from '../service/functions.service';
@Component({
templateUrl: 'indexation.component.html',
......@@ -42,7 +43,8 @@ export class IndexationComponent implements OnInit {
public alertController: AlertController,
public datePipe: DatePipe,
public modalController: ModalController,
public actionsService: ActionsService
public actionsService: ActionsService,
private functionsService: FunctionsService
) { }
ngOnInit(): void { }
......@@ -102,7 +104,7 @@ export class IndexationComponent implements OnInit {
const obj: any = await this.appVisaWorkflow.formatData(element);
element = obj;
});
}
}
resolve(true);
}),
catchError((err: any) => {
......@@ -185,6 +187,7 @@ export class IndexationComponent implements OnInit {
}).then(async (load: HTMLIonLoadingElement) => {
load.present();
const objTosend = this.formatData(data.note);
this.hasEmptyOtpSignaturePosition();
for (let index = 0; index < objTosend.length; index++) {
await this.saveDocument(objTosend[index], index);
if (objTosend[0].workflow[0].userId === this.authService.user.id) {
......@@ -379,12 +382,25 @@ export class IndexationComponent implements OnInit {
this.notificationService.error('lang.workflowUserstMandatory');
this.menu.open('right-menu');
return false;
}
else if (this.appVisaWorkflow.getCurrentWorkflow().filter((user: any) => user.userId === null && user.noConnector !== undefined).length > 0) {
} else if (this.appVisaWorkflow.getCurrentWorkflow().filter((user: any) => user.userId === null && user.noConnector !== undefined).length > 0) {
this.notificationService.error('lang.noConnector');
return false;
} else if (this.hasEmptyOtpSignaturePosition()) {
this.notificationService.error('lang.otpSignaturePositionMandatory');
return false;
} else {
return true;
}
}
hasEmptyOtpSignaturePosition() {
const workflow = this.formatData(null)[0].workflow;
const isSign = /_sign_/g;
const hasEmptyPosition = workflow.filter((item: any) => item.signaturePositions.length === 0 && !this.functionsService.empty(item.externalInformations) && item.mode.match(isSign) !== null).length > 0;
return hasEmptyPosition;
}
}
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