Skip to content
Snippets Groups Projects
Commit 95c78a51 authored by BEAUVAIS ANTOINE's avatar BEAUVAIS ANTOINE
Browse files

Merge branch 'develop' of git.unistra.fr:erp-sil/back into develop

parents 25b5c863 1fe0b8ae
Branches
1 merge request!39Registry date fix & navbar links
......@@ -6,6 +6,8 @@ import fr.unistra.sil.erp.back.repository.SqliteRepository;
import org.springframework.stereotype.Repository;
import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
......@@ -47,18 +49,19 @@ public class SqliteRegistryRepository extends SqliteRepository implements IRegis
if (rs == null)
return null;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<RegistryEntry> res = new ArrayList<>();
try {
while (rs.next()) {
RegistryEntry r = new RegistryEntry(rs.getInt("id"),
rs.getInt("typeID"), rs.getString("type"),
new Date(rs.getInt("date") * 1000L),
formatter.parse(rs.getString("date")),
rs.getInt("accountId"), rs.getString("account"),
rs.getBigDecimal("debit"), rs.getBigDecimal("credit"),
rs.getString("remarks"));
res.add(r);
}
} catch (SQLException ex) {
} catch (SQLException | ParseException ex) {
Logger.getLogger(this.getClass().getName()).log(
Level.SEVERE, "Failed to fetch results.", ex);
return null;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment