Skip to content

Commit

Permalink
Merge pull request #484 from EsupPortail/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
dlemaignent authored Jan 28, 2025
2 parents 623cd49 + 1a9a2ee commit 752dec8
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 45 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<relativePath />
</parent>
<groupId>org.esupportail</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public class LiveWorkflowStep {

private Boolean allSignToComplete = false;

private Boolean attachmentAlert = false;

private Boolean attachmentRequire = false;

private Boolean repeatable = false;

@Enumerated(EnumType.STRING)
Expand Down Expand Up @@ -72,6 +76,22 @@ public void setAllSignToComplete(Boolean allSignToComplete) {
this.allSignToComplete = allSignToComplete;
}

public Boolean getAttachmentAlert() {
return attachmentAlert;
}

public void setAttachmentAlert(Boolean attachmentAlert) {
this.attachmentAlert = attachmentAlert;
}

public Boolean getAttachmentRequire() {
return attachmentRequire;
}

public void setAttachmentRequire(Boolean attachmentRequire) {
this.attachmentRequire = attachmentRequire;
}

public Boolean getRepeatable() {
return repeatable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public LiveWorkflowStep createLiveWorkflowStep(SignBook signBook, WorkflowStep w
liveWorkflowStep.setSingleSignWithAnnotation(Objects.requireNonNullElse(step.getSingleSignWithAnnotation(), false));
liveWorkflowStep.setAutoSign(Objects.requireNonNullElse(step.getAutoSign(), false));
liveWorkflowStep.setAllSignToComplete(Objects.requireNonNullElse(step.getAllSignToComplete(), false));
liveWorkflowStep.setAttachmentAlert(Objects.requireNonNullElse(step.getAttachmentAlert(), false));
liveWorkflowStep.setAttachmentRequire(Objects.requireNonNullElse(step.getAttachmentRequire(), false));
if(step.getSignType() == null) {
int minLevel = 2;
if(signService.isSigned(signBook, null)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,21 +1140,31 @@ public String getAllToJSon(String xApikey) throws JsonProcessingException {
public boolean isAttachmentAlert(SignRequest signRequest) {
boolean attachmentAlert = false;
if (signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep().getAttachmentAlert() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep().getAttachmentAlert()
&& signRequest.getAttachments().isEmpty()) {
&& (
(signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep().getAttachmentAlert() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep().getAttachmentAlert())
||
(signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getAttachmentAlert() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getAttachmentAlert())
)
&& signRequest.getAttachments().isEmpty()) {
attachmentAlert = true;
}
return attachmentAlert;
}
public boolean isAttachmentRequire(SignRequest signRequest) {
boolean attachmentRequire = false;
if (signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep() != null
&&signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep().getAttachmentRequire() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep().getAttachmentRequire()
&& signRequest.getAttachments().isEmpty()) {
&& (
(signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep().getAttachmentRequire() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getWorkflowStep().getAttachmentRequire())
||
(signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getAttachmentRequire() != null
&& signRequest.getParentSignBook().getLiveWorkflow().getCurrentStep().getAttachmentRequire())
)
&& signRequest.getAttachments().isEmpty()) {
attachmentRequire = true;
}
return attachmentRequire;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,11 @@ public Workflow computeWorkflow(Long workflowId, List<WorkflowStepDto> steps, St
for (WorkflowStep workflowStep : modelWorkflow.getWorkflowSteps()) {
entityManager.detach(workflowStep);
replaceStepSystemUsers(userEppn, workflowStep);
if (workflowStep.getChangeable() != null && workflowStep.getChangeable()) {
if(!computeForDisplay) {
int finalStep = stepNumber;
Optional<WorkflowStepDto> step = steps.stream().filter(s -> s.getStepNumber() == finalStep).findFirst();
if(step.isPresent()) {
if(!computeForDisplay) {
int finalStep = stepNumber;
Optional<WorkflowStepDto> step = steps.stream().filter(s -> s.getStepNumber() == finalStep).findFirst();
if(step.isPresent()) {
if (workflowStep.getChangeable() != null && workflowStep.getChangeable()) {
List<RecipientWsDto> recipients = step.get().getRecipients();
List<User> users = this.getFavoriteRecipientEmail(stepNumber, recipients);
if (!recipients.isEmpty()) {
Expand All @@ -355,12 +355,27 @@ public Workflow computeWorkflow(Long workflowId, List<WorkflowStepDto> steps, St
workflowStep.getUsers().add(oneUser);
}
}
if (step.get().getAllSignToComplete()) {
workflowStep.setAllSignToComplete(true);
}
if (step.get().getSignType() != null) {
workflowStep.setSignType(step.get().getSignType());
}
}
if (step.get().getAllSignToComplete()) {
workflowStep.setAllSignToComplete(true);
}
if (step.get().getSignType() != null) {
workflowStep.setSignType(step.get().getSignType());
}
if (step.get().getRepeatable() != null) {
workflowStep.setRepeatable(step.get().getRepeatable());
}
if (step.get().getMultiSign() != null) {
workflowStep.setMultiSign(step.get().getMultiSign());
}
if (step.get().getSingleSignWithAnnotation() != null) {
workflowStep.setSingleSignWithAnnotation(step.get().getSingleSignWithAnnotation());
}
if (step.get().getAttachmentAlert() != null) {
workflowStep.setAttachmentAlert(step.get().getAttachmentAlert());
}
if (step.get().getAttachmentRequire() != null) {
workflowStep.setAttachmentRequire(step.get().getAttachmentRequire());
}
}
}
Expand Down Expand Up @@ -703,6 +718,8 @@ public void importWorkflow(SignBook signBook, Workflow workflow, List<WorkflowSt
step.setAutoSign(workflowStep.getAutoSign());
step.setAllSignToComplete(workflowStep.getAllSignToComplete());
step.setSignType(workflowStep.getSignType());
step.setAttachmentAlert(workflowStep.getAttachmentAlert());
step.setAttachmentRequire(workflowStep.getAttachmentRequire());
LiveWorkflowStep newWorkflowStep = liveWorkflowStepService.createLiveWorkflowStep(signBook, workflowStep, step);
signBook.getLiveWorkflow().getLiveWorkflowSteps().add(newWorkflowStep);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class SignRequestWsController {
@Operation(security = @SecurityRequirement(name = "x-api-key"), description = "Création d'une demande de signature")
@PreAuthorize("@wsAccessTokenService.isAllAccess(#xApiKey)")
public ResponseEntity<?> create(@Parameter(description = "Multipart stream du fichier à signer") @RequestParam MultipartFile[] multipartFiles,
@RequestParam(required = false) @Parameter(description = "Multipart stream des pièces jointes") MultipartFile[] attachementMultipartFiles,
@RequestParam(required = false) @Parameter(description = "Paramètres des étapes (objet json)", array = @ArraySchema(schema = @Schema( implementation = WorkflowStepDto.class)), example = "[{\n" +
" \"title\": \"string\",\n" +
" \"workflowId\": 0,\n" +
Expand Down Expand Up @@ -140,6 +141,7 @@ public ResponseEntity<?> create(@Parameter(description = "Multipart stream du fi
if(signRequestIds.isEmpty()) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("-1");
}
signRequestService.addAttachement(attachementMultipartFiles, null, Long.valueOf(signRequestIds.get(0)), createByEppn);
if(json) {
return ResponseEntity.ok(signRequestIds);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ public class WorkflowWsController {

private final RecipientService recipientService;
private final UserService userService;
private final SignRequestService signRequestService;


public WorkflowWsController(WorkflowService workflowService, WorkflowExportService workflowExportService, SignBookService signBookService, RecipientService recipientService, UserService userService) {
public WorkflowWsController(WorkflowService workflowService, WorkflowExportService workflowExportService, SignBookService signBookService, RecipientService recipientService, UserService userService, SignRequestService signRequestService) {
this.workflowService = workflowService;
this.workflowExportService = workflowExportService;
this.signBookService = signBookService;
this.recipientService = recipientService;
this.userService = userService;
this.signRequestService = signRequestService;
}

@CrossOrigin
Expand All @@ -70,6 +72,7 @@ public WorkflowWsController(WorkflowService workflowService, WorkflowExportServi
@PreAuthorize("@wsAccessTokenService.createWorkflowAccess(#id, #xApiKey)")
public ResponseEntity<?> start(@PathVariable Long id,
@RequestParam @Parameter(description = "Multipart stream du fichier à signer") MultipartFile[] multipartFiles,
@RequestParam(required = false) @Parameter(description = "Multipart stream des pièces jointes") MultipartFile[] attachementMultipartFiles,
@RequestParam(required = false) @Parameter(description = "Paramètres des étapes (objet json)", array = @ArraySchema(schema = @Schema( implementation = WorkflowStepDto.class)), example = "[{\n" +
" \"title\": \"string\",\n" +
" \"workflowId\": 0,\n" +
Expand Down Expand Up @@ -142,6 +145,7 @@ public ResponseEntity<?> start(@PathVariable Long id,
if(signRequestIds.isEmpty()) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("-1");
}
signRequestService.addAttachement(attachementMultipartFiles, null, Long.valueOf(signRequestIds.get(0)), createByEppn);
if(json) {
return ResponseEntity.ok(signRequestIds);
} else {
Expand Down
24 changes: 12 additions & 12 deletions src/main/resources/static/js/modules/ui/GlobalUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,18 @@ export class GlobalUi {
show: { effect: "fade", duration: 500 },
hide: { effect: "fade", duration: 500 }
});
$("#tools").tooltip({
disabled: false,
show: { effect: "fade", duration: 500 },
hide: { effect: "fade", duration: 500 },
position: { my: "left top+5" }
});
$("#signButtons").tooltip({
disabled: false,
show: { effect: "fade", duration: 500 },
hide: { effect: "fade", duration: 500 },
position: { my: "left+15 center", at: "right center", collision: "flip" }
});
// $("#tools").tooltip({
// disabled: false,
// show: { effect: "fade", duration: 500 },
// hide: { effect: "fade", duration: 500 },
// position: { my: "left top+5" }
// });
// $("#signButtons").tooltip({
// disabled: false,
// show: { effect: "fade", duration: 500 },
// hide: { effect: "fade", duration: 500 },
// position: { my: "left+15 center", at: "right center", collision: "flip" }
// });
}

initBootBox() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ export class SignUi {
message: "Attention, il est demandé de joindre un document à cette étape avant de signer",
buttons: {
cancel: {
label: '<i class="fa fa-times"></i> Annuler'
label: '<i class="fa fa-times"></i> Retour'
},
confirm: {
label: '<i class="fa fa-check"></i> Continuer'
label: '<i class="fa fa-check"></i> Continuer sans pièce jointe'
}
},
callback: function (result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ export class WorkspacePdf {
if(this.status === "pending") {
this.initFormAction();
}
if(this.currentSignType !== "form") {
if(this.currentSignType !== "form" && this.currentSignType !== "hiddenVisa") {
this.initSignFields();
}
$("div[id^='cross_']").each((index, e) => this.toggleSign(e));
Expand Down Expand Up @@ -1069,7 +1069,7 @@ export class WorkspacePdf {
this.enableCommentMode();
} else {
if(this.signable) {
this.enableSignMode();
document.location.reload();
} else {
this.enableReadMode();
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/static/js/modules/utils/PdfViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@ export class PdfViewer extends EventFactory {
$(this).droppable({
tolerance: "touch",
drop: function( event, ui ) {
if($(event.originalEvent.target).attr("id") != null && $(event.originalEvent.target).attr("id").includes("cross_")) {
$(event.originalEvent.target).addClass("cross-error");
if($(ui.draggable).attr("id") != null && ($(ui.draggable).attr("id").includes("cross_") || $($(ui.draggable).attr("id").includes("border_")))) {
$("#border_" + $(ui.draggable).attr("id").split("_")[1]).addClass("cross-error");
}
},
over: function( event, ui ) {
if($(event.originalEvent.target).attr("id") != null && $(event.originalEvent.target).attr("id").includes("cross_")) {
$(event.originalEvent.target).addClass("cross-error");
if($(ui.draggable).attr("id") != null && ($(ui.draggable).attr("id").includes("cross_") || $($(ui.draggable).attr("id").includes("border_")))) {
$("#border_" + $(ui.draggable).attr("id").split("_")[1]).addClass("cross-error");
}
},
out: function( event, ui ) {
if($(event.originalEvent.target).attr("id") != null && $(event.originalEvent.target).attr("id").includes("cross_")) {
$(event.originalEvent.target).removeClass("cross-error");
if($(ui.draggable).attr("id") != null && ($(ui.draggable).attr("id").includes("cross_") || $($(ui.draggable).attr("id").includes("border_")))) {
$("#border_" + $(ui.draggable).attr("id").split("_")[1]).removeClass("cross-error");
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/static/js/prototypes/SignRequestParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,9 @@ export class SignRequestParams extends EventFactory {
},
stop: function(event, ui) {
self.tools.removeClass("d-none");
if($(event.target).hasClass("cross-error") && self.firstCrossAlert) {
if($(event.originalEvent.target).attr("id") != null && $("#border_" + $(event.originalEvent.target).attr("id").split("_")[1]).hasClass("cross-error") && self.firstCrossAlert) {
self.firstCrossAlert = false;
bootbox.alert("Attention votre signature superpose un autre élément du document (vous pouvez la valider même si elle est de couleur rouge)", null);
bootbox.alert("Attention votre signature superpose un autre élément du document cela pourrait nuire à sa lecture. Vous pourrez tout de même la valider même si elle est de couleur orange", null);
}
if(!self.dropped) {
self.signPageNumber = self.cross.attr("page");
Expand Down

0 comments on commit 752dec8

Please sign in to comment.