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

View File

@ -377,7 +377,10 @@ class WorkflowController extends AbstractController
$signature = $this->entityManager->getRepository(EntityWorkflowStepSignature::class)->find($signature_id); $signature = $this->entityManager->getRepository(EntityWorkflowStepSignature::class)->find($signature_id);
if ($signature->getSigner() instanceof User) { 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); $metadataForm = $this->createForm(WorkflowSignatureMetadataType::class);
@ -401,7 +404,10 @@ class WorkflowController extends AbstractController
$this->entityManager->persist($signature); $this->entityManager->persist($signature);
$this->entityManager->flush(); $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( return $this->render(