Skip to content

Commit

Permalink
PI-1558 Update PSR extension to PDF when complete
Browse files Browse the repository at this point in the history
Previously, an empty PDF would be uploaded to the Alfresco when the initial draft was started.  Following the recent changes, Delius now uploads a .doc file instead as the draft.  However, the filename remains the same after the report is completed.

So currently we end up with a PDF document saved as e.g.
```
Nat Short format pre-sentence report_13102023_112036_Larson_D_X729742.doc
```

This PR updates the extension to .pdf before saving
  • Loading branch information
marcus-bcl committed Oct 12, 2023
1 parent ab8fe13 commit 39555f0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ class DocumentService(
throw ConflictException("Court report ${courtReport.id} not for ${hmppsEvent.personReference.findCrn()}")
}

document.name = document.name.replace(Regex("\\.doc$"), ".pdf")
document.lastSaved = ZonedDateTime.now()
document.lastUpdatedUserId = ServiceContext.servicePrincipal()!!.userId

alfrescoClient.releaseDocument(document.alfrescoId)
alfrescoClient.updateDocument(
document.alfrescoId,
populateBodyValues(hmppsEvent, document, file)
)

document.lastSaved = ZonedDateTime.now()
document.lastUpdatedUserId = ServiceContext.servicePrincipal()!!.userId
}

private fun populateBodyValues(
Expand Down

0 comments on commit 39555f0

Please sign in to comment.