Signed document can't be validated if the original is deleted
Steps:
- Upload document.pdf and request a signature
- Sign the document
- Validate the document, all works ok
- Delete the original document (not the signed one)
- Validate the document, it fails (document not found)
I've observed the table oc_libresign_file, there is a field for the signed document (signed_node_id) and another for the original document (node_id). It has sense meanwhile the document is not totally signed but when it's signed the node_id should not be relevant.
When I delete the original document (step 4) the register in the oc_libresing_file is also deleted so the signed document can't be validated, although exists.
Don't know if it's a bug or a standard behavior, but for me has no sense to have a document that can't be validated if the original document does not exists.
Hi @tasagore this behavior is expected, but make sense that you saw.
Origin of problem:
If I request to sign a document, don't sign, and after this delete the document, will have a register in table libresign_file and will get error in all places that will be necessary get the file because the file don't exist more. To solve this problem I implemented a listener https://github.com/LibreSign/libresign/blob/346d389f44b334ba0cbc08333f77ed8b32b59b7a/lib/AppInfo/Application.php#L32 to delete the register when the file is deleted.
I think that to solve, could verify the status before the above described event and if the status is equal to signed, only set node_id to null and don't delete the file.
Will be necessary to check if we will have side effects after do this change.
I guess you will not have side effects. I've made a small process that do exactly that, when a document status is signed I set node_id to null and after that delete the original document (I need that behavior) and all runs fine.
Hi @tasagore I already did the fix but don't create a new release of app. This fix will come maybe in the next weekend.
Fixed, I recommend to use server with version 25