Skip to content

Commit

Permalink
fix: regenerate empty PDF on document invalidation like name change
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien authored and fabiengo committed Mar 22, 2024
1 parent 7c2db5e commit 6f9eedb
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ public void resetValidatedDocumentsStatusOfSpecifiedCategoriesToToProcess(List<D
.forEach(document -> {
if (document.getDocumentStatus().equals(DocumentStatus.VALIDATED)
&& categoriesToChange.contains(document.getDocumentCategory())) {
if (Boolean.TRUE == document.getNoDocument() && document.getWatermarkFile() != null){
storageFileRepository.delete(document.getWatermarkFile());
document.setWatermarkFile(null);
}
TransactionalUtil.afterCommit(() -> {
producer.sendDocumentForAnalysis(document);// analysis should be relaunched for update rules
if (Boolean.TRUE == document.getNoDocument()){
producer.sendDocumentForPdfGeneration(document);
}
});
document.setDocumentStatus(DocumentStatus.TO_PROCESS);
document.setDocumentDeniedReasons(null);
documentRepository.save(document);
Expand Down

0 comments on commit 6f9eedb

Please sign in to comment.