Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ public Notifier getByUuidAndTime(String uuid, Instant time) {

final Timestamp timestamp = Timestamp.from(time);

final String sql = "SELECT * FROM ("
+ "SELECT * FROM (SELECT * FROM notifier_history b WHERE b.uuid = :uuid AND changedate <= CAST(:changeDate AS TIMESTAMP) ORDER BY changedate DESC LIMIT 1) "
+ "UNION SELECT * FROM notifier a WHERE a.uuid = :uuid) "
+ "WHERE uuid = :uuid AND changedate <= CAST(:changeDate AS TIMESTAMP) ORDER BY changedate DESC LIMIT 1;";
final String sql = "SELECT " + "a.id AS id, a.uuid AS uuid," + "COALESCE(b.changedate, a.changedate) AS changedate,"
+ "a.creationdate AS creationdate, a.change_user_id AS change_user_id,"
+ "COALESCE(b.registrationnumber, a.registrationnumber) AS registrationnumber," + "COALESCE(b.firstname, a.firstname) AS firstname,"
+ "COALESCE(b.lastname, a.lastname) AS lastname," + "COALESCE(b.address, a.address) AS address," + "COALESCE(b.email, a.email) AS email,"
+ "COALESCE(b.phone, a.phone) AS phone, "+ "COALESCE(b.agentfirstname, a.agentfirstname) AS agentfirstname, "
+ "COALESCE(b.agentlastname, a.agentlastname) AS agentlastname "+ "FROM notifier a " + "LEFT JOIN " + "(SELECT * FROM notifier_history "
+ "WHERE uuid = :uuid AND changedate <= CAST(:changeDate AS TIMESTAMP) " + "ORDER BY changedate DESC LIMIT 1" + ") b ON a.uuid = b.uuid "
+ "WHERE a.uuid = :uuid";

Query query = em.createNativeQuery(sql, Notifier.class);
query.setParameter("uuid", uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ public void editNotifier(CaseDataDto caze, Runnable callback, boolean isEditAllo
return;
}

// We only edit the current version
NotifierDto notifier =
FacadeProvider.getNotifierFacade().getByUuidAndTime(caze.getNotifier().getUuid(), caze.getNotifier().getVersionDate().toInstant());
FacadeProvider.getNotifierFacade().getByUuid(caze.getNotifier().getUuid());
TherapyDto therapy = caze.getTherapy();

openEditWindow(
Expand Down
Loading