Signature: add and process returnPath in the signature app

This commit is contained in:
nobohan 2024-09-05 14:11:57 +02:00
parent 0d62d8d1c6
commit 479a02bbc7
2 changed files with 21 additions and 8 deletions

View File

@ -124,9 +124,9 @@
>
{{ $t("cancel") }}
</button>
<button class="btn btn-delete" @click="undoSign">
<a class="btn btn-delete" :href="getReturnPath()">
{{ $t("cancel_signing") }}
</button>
</a>
</div>
</div>
</div>
@ -157,9 +157,7 @@ console.log(PdfWorker); // incredible but this is needed
// pdfjsLib.GlobalWorkerOptions.workerSrc = PdfWorker;
import Modal from "ChillMainAssets/vuejs/_components/Modal.vue";
import {
download_and_decrypt_doc,
} from "../StoredObjectButton/helpers";
import { download_and_decrypt_doc } from "../StoredObjectButton/helpers";
pdfjsLib.GlobalWorkerOptions.workerSrc = "pdfjs-dist/build/pdf.worker.mjs";
@ -215,7 +213,10 @@ const setPage = async (page: number) => {
async function downloadAndOpen(): Promise<Blob> {
let raw;
try {
raw = await download_and_decrypt_doc(signature.storedObject, signature.storedObject.currentVersion);
raw = await download_and_decrypt_doc(
signature.storedObject,
signature.storedObject.currentVersion
);
} catch (e) {
console.error("error while downloading and decrypting document", e);
throw e;
@ -498,6 +499,12 @@ const removeNewZone = async () => {
adding.value = false;
};
const getReturnPath = () =>
window.location.search
? window.location.search.split("?returnPath=")[1] ??
window.location.pathname
: window.location.pathname;
downloadAndOpen();
</script>

View File

@ -377,7 +377,10 @@ class WorkflowController extends AbstractController
$signature = $this->entityManager->getRepository(EntityWorkflowStepSignature::class)->find($signature_id);
if ($signature->getSigner() instanceof User) {
return $this->redirectToRoute('chill_main_workflow_signature_add', ['id' => $signature_id]);
return $this->redirectToRoute('chill_main_workflow_signature_add', [
'id' => $signature_id,
'returnPath' => $request->query->get('returnPath', null),
]);
}
$metadataForm = $this->createForm(WorkflowSignatureMetadataType::class);
@ -401,7 +404,10 @@ class WorkflowController extends AbstractController
$this->entityManager->persist($signature);
$this->entityManager->flush();
return $this->redirectToRoute('chill_main_workflow_signature_add', ['id' => $signature_id]);
return $this->redirectToRoute('chill_main_workflow_signature_add', [
'id' => $signature_id,
'returnPath' => $request->query->get('returnPath', null),
]);
}
return $this->render(