Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f0dced606 | ||
|
|
d4feda141e | ||
|
|
b0096ad5f4 | ||
|
|
6fe8cb4b1d | ||
|
|
51a9f9272e | ||
|
|
722a6ae97e | ||
|
|
e614880d71 | ||
|
|
c8ad603fca | ||
|
|
767e918aa5 |
@@ -16,7 +16,7 @@ public interface AccountDb {
|
|||||||
|
|
||||||
Collection<UmbrellaUser> getMembers(long accountId);
|
Collection<UmbrellaUser> getMembers(long accountId);
|
||||||
|
|
||||||
Optional<Transaction> lastTransaction(long accountId, String source, String destination, Double amount);
|
Optional<Transaction> lastTransaction(long accountId, String source, String dest, double amount);
|
||||||
|
|
||||||
Collection<Account> listAccounts(long userId);
|
Collection<Account> listAccounts(long userId);
|
||||||
|
|
||||||
|
|||||||
@@ -311,11 +311,12 @@ public class AccountingModule extends BaseHandler implements AccountingService {
|
|||||||
var source = src.get(src.has(Field.ID) ? Field.ID : Field.DISPLAY).toString();
|
var source = src.get(src.has(Field.ID) ? Field.ID : Field.DISPLAY).toString();
|
||||||
if (!json.has(Field.DESTINATION)) throw missingField(Field.DESTINATION);
|
if (!json.has(Field.DESTINATION)) throw missingField(Field.DESTINATION);
|
||||||
if (!(json.get(Field.DESTINATION) instanceof JSONObject dst)) throw invalidField(Field.SOURCE,JSON);
|
if (!(json.get(Field.DESTINATION) instanceof JSONObject dst)) throw invalidField(Field.SOURCE,JSON);
|
||||||
String destination = dst.has(Field.ID) ? dst.get(Field.ID).toString() : dst.has(Field.DISPLAY) ? dst.get(Field.DISPLAY).toString() : null;
|
var dest = dst.get(dst.has(Field.ID) ? Field.ID : Field.DISPLAY).toString();
|
||||||
Double amount = null;
|
if (!json.has(Field.AMOUNT)) throw missingField(Field.AMOUNT);
|
||||||
if (json.has(Field.AMOUNT) && json.get(Field.AMOUNT) instanceof Number amt) amount = amt.doubleValue();
|
if (!(json.get(Field.AMOUNT) instanceof Number amt)) throw invalidField(Field.AMOUNT,Text.NUMBER);
|
||||||
|
var amount = amt.doubleValue();
|
||||||
|
|
||||||
var transaction = accountDb.lastTransaction(accountId, source, destination, amount);
|
var transaction = accountDb.lastTransaction(accountId, source, dest, amount);
|
||||||
return transaction.isPresent() ? sendContent(ex,transaction.get()) : notFound(ex);
|
return transaction.isPresent() ? sendContent(ex,transaction.get()) : notFound(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,42 +173,22 @@ public class SqliteDb extends BaseDb implements AccountDb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<Transaction> lastTransaction(long accountId, String source, String destination, Double amount) {
|
public Optional<Transaction> lastTransaction(long accountId, String source, String dest, double amount) {
|
||||||
try {
|
try {
|
||||||
var query = select(ALL).from(TABLE_TRANSACTIONS).where(ACCOUNT,equal(accountId));
|
var rs = select(ALL).from(TABLE_TRANSACTIONS)
|
||||||
if (source != null) query = query.where(SOURCE,equal(source));
|
.where(ACCOUNT,equal(accountId)).where(SOURCE,equal(source)).where(DESTINATION,equal(dest)).where(AMOUNT,equal(amount))
|
||||||
if (destination != null) query = query.where(DESTINATION,equal(destination));
|
.sort(ID+" DESC")
|
||||||
if (amount != null) query = query.where(AMOUNT,equal(amount));
|
.limit(1)
|
||||||
var rs = query.sort(ID+" DESC").limit(1).exec(db);
|
.exec(db);
|
||||||
Transaction ta = null;
|
Transaction ta = null;
|
||||||
if (rs.next()) ta = Transaction.of(rs);
|
if (rs.next()) ta = Transaction.of(rs);
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
if (ta == null && amount != null) { // try to search by amount, ignore source and dest
|
|
||||||
rs = select(ALL).from(TABLE_TRANSACTIONS).where(ACCOUNT, equal(accountId)).where(AMOUNT, equal(amount))
|
|
||||||
.sort(ID + " DESC").limit(1).exec(db);
|
|
||||||
if (rs.next()) ta = Transaction.of(rs);
|
|
||||||
rs.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ta == null && source != null && destination != null) { // try to search by amount, ignore source and dest
|
|
||||||
rs = select(ALL).from(TABLE_TRANSACTIONS)
|
|
||||||
.where(SOURCE,equal(source))
|
|
||||||
.where(DESTINATION,equal(destination))
|
|
||||||
.where(ACCOUNT, equal(accountId))
|
|
||||||
.sort(ID + " DESC").limit(1).exec(db);
|
|
||||||
if (rs.next()) ta = Transaction.of(rs);
|
|
||||||
rs.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ta != null){
|
if (ta != null){
|
||||||
var tags = ta.tags();
|
var tags = ta.tags();
|
||||||
rs = select(TAG).from(TABLE_TAGS_TRANSACTIONS).leftJoin(TAG_ID,TABLE_TAGS,ID).where(TRANSACTION_ID,equal(ta.id())).exec(db);
|
rs = select(TAG).from(TABLE_TAGS_TRANSACTIONS).leftJoin(TAG_ID,TABLE_TAGS,ID).where(TRANSACTION_ID,equal(ta.id())).exec(db);
|
||||||
while (rs.next()) tags.add(rs.getString(1));
|
while (rs.next()) tags.add(rs.getString(1));
|
||||||
rs.close();
|
rs.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullable(ta);
|
return nullable(ta);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw failedToSearchDb(t(Text.ACCOUNTING));
|
throw failedToSearchDb(t(Text.ACCOUNTING));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import static de.srsoftware.umbrella.core.constants.Module.BOOKMARK;
|
|||||||
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
||||||
|
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
|
import de.srsoftware.umbrella.core.constants.Text;
|
||||||
import de.srsoftware.umbrella.core.model.Bookmark;
|
import de.srsoftware.umbrella.core.model.Bookmark;
|
||||||
import de.srsoftware.umbrella.core.model.Translatable;
|
import de.srsoftware.umbrella.core.model.Translatable;
|
||||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||||
@@ -22,19 +23,42 @@ public class BookmarkEvent extends Event<Bookmark> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable describe() {
|
public Translatable describeCreate(boolean verbose) {
|
||||||
return switch (eventType()){
|
return t(Text.CREATE_BOOKMARK_DESCRIPTION,Field.URL,payload().url(),Field.DESCRIPTION,payload().comment());
|
||||||
case CREATE -> t("New bookmark created");
|
|
||||||
case DELETE -> t("The bookmark '{url}' has been deleted", Field.URL, payload().url());
|
|
||||||
case UPDATE -> t("Bookmark updated");
|
|
||||||
default -> null;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable subject() {
|
public Translatable describeDelete(boolean verbose) {
|
||||||
return describe();
|
return t(Text.DELETE_BOOKMARK_DESCRIPTION, Field.DESCRIPTION, payload().comment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Translatable describeMemberAdded(boolean verbose) {
|
||||||
|
return t(Text.MEMBER_ADDED_TO_BM_DESC,Field.DESCRIPTION,payload().comment());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Translatable describeUpdate(boolean verbose) {
|
||||||
|
return t(Text.UPDATE_BM_DESCRIPTION, Field.USER, initiator().name());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Translatable subjectCreate() {
|
||||||
|
return t(Text.CREATE_BOOKMARK_SUBJECT,Field.USER,initiator().name());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Translatable subjectDelete() {
|
||||||
|
return t(Text.DELETE_BOOKMARK_SUBJECT, Field.USER, initiator().name(), Field.URL, payload().url());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Translatable subjectMemberAdded() {
|
||||||
|
return t(Text.MEMBER_ADDED_TO_BM_SUBJ,Field.USER, initiator().name(), Field.URL, payload().url());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Translatable subjectUpdate() {
|
||||||
|
return t(Text.UPDATE_BM_SUBJECT,Field.URL, payload().url(), Field.DESCRIPTION, diff().orElse(""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
package de.srsoftware.umbrella.messagebus.events;
|
package de.srsoftware.umbrella.messagebus.events;
|
||||||
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
|
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
||||||
import static java.util.Optional.*;
|
import static java.util.Optional.*;
|
||||||
|
|
||||||
import de.srsoftware.tools.Diff;
|
import de.srsoftware.tools.Diff;
|
||||||
import de.srsoftware.tools.Mappable;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import de.srsoftware.umbrella.core.model.Translatable;
|
import de.srsoftware.umbrella.core.model.Translatable;
|
||||||
|
import de.srsoftware.umbrella.core.model.UmbrellaObject;
|
||||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -14,15 +16,15 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public abstract class Event<Payload extends Mappable> {
|
public abstract class Event<Payload extends UmbrellaObject> {
|
||||||
|
|
||||||
public enum EventType {
|
public enum EventType {
|
||||||
CREATE,
|
CREATE,
|
||||||
MEMBER_ADDED,
|
MEMBER_ADDED,
|
||||||
UPDATE,
|
UPDATE,
|
||||||
DELETE;
|
DELETE;
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
private final UmbrellaUser initiator;
|
private final UmbrellaUser initiator;
|
||||||
private final String module;
|
private final String module;
|
||||||
private final Payload payload;
|
private final Payload payload;
|
||||||
@@ -47,7 +49,19 @@ public abstract class Event<Payload extends Mappable> {
|
|||||||
|
|
||||||
public abstract Collection<UmbrellaUser> audience();
|
public abstract Collection<UmbrellaUser> audience();
|
||||||
|
|
||||||
public abstract Translatable describe();
|
public Translatable describe(boolean verbose) {
|
||||||
|
return switch (eventType()){
|
||||||
|
case CREATE -> describeCreate(verbose);
|
||||||
|
case DELETE -> describeDelete(verbose);
|
||||||
|
case MEMBER_ADDED -> describeMemberAdded(verbose);
|
||||||
|
case UPDATE -> describeUpdate(verbose);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Translatable describeCreate(boolean verbose);
|
||||||
|
public abstract Translatable describeDelete(boolean verbose);
|
||||||
|
public abstract Translatable describeMemberAdded(boolean verbose);
|
||||||
|
public abstract Translatable describeUpdate(boolean verbose);
|
||||||
|
|
||||||
private Map<String, Object> dropMarkdown(Map<String, Object> map) {
|
private Map<String, Object> dropMarkdown(Map<String, Object> map) {
|
||||||
var result = new HashMap<String, Object>();
|
var result = new HashMap<String, Object>();
|
||||||
@@ -98,6 +112,10 @@ public abstract class Event<Payload extends Mappable> {
|
|||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long objectId() {
|
||||||
|
return payload.id();
|
||||||
|
};
|
||||||
|
|
||||||
protected Map<String, Object> oldData() {
|
protected Map<String, Object> oldData() {
|
||||||
return oldData;
|
return oldData;
|
||||||
}
|
}
|
||||||
@@ -106,5 +124,18 @@ public abstract class Event<Payload extends Mappable> {
|
|||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Translatable subject();
|
public Translatable subject() {
|
||||||
|
return switch (eventType()){
|
||||||
|
case CREATE -> subjectCreate();
|
||||||
|
case DELETE -> subjectDelete();
|
||||||
|
case MEMBER_ADDED -> subjectMemberAdded();
|
||||||
|
case UPDATE -> subjectUpdate();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Translatable subjectCreate();
|
||||||
|
public abstract Translatable subjectDelete();
|
||||||
|
public abstract Translatable subjectMemberAdded();
|
||||||
|
public abstract Translatable subjectUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,25 +24,8 @@ public class ItemEvent extends Event<Item>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable describe() {
|
public long objectId() {
|
||||||
return switch (eventType()){
|
return payload().id();
|
||||||
case CREATE -> describeCreate();
|
|
||||||
case null, default -> null;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeCreate() {
|
|
||||||
var loc = payload().location().resolve().name();
|
|
||||||
return t("{user} added \"{item}\" to \"{location}\"", USER,initiator().name(), ITEM, payload().name(), LOCATION, loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Translatable subject() {
|
|
||||||
var loc = payload().location().resolve().name();
|
|
||||||
return switch (eventType()){
|
|
||||||
case CREATE -> t("A new item has been added to \"{location}\":",LOCATION,loc);
|
|
||||||
case null, default -> null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/* © SRSoftware 2025 */
|
||||||
|
package de.srsoftware.umbrella.messagebus.events;
|
||||||
|
|
||||||
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
|
import static java.time.ZoneOffset.UTC;
|
||||||
|
|
||||||
|
import de.srsoftware.umbrella.core.model.Translatable;
|
||||||
|
import de.srsoftware.umbrella.core.model.UmbrellaObject;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class JournalEntry extends UmbrellaObject {
|
||||||
|
|
||||||
|
LocalDateTime timestamp;
|
||||||
|
long userId, entityId;
|
||||||
|
String action, module;
|
||||||
|
Translatable description;
|
||||||
|
|
||||||
|
public JournalEntry(long id, LocalDateTime timestamp, long userId, String module, long entityId, String action, Translatable description){
|
||||||
|
super(id);
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
this.userId = userId;
|
||||||
|
this.module = module;
|
||||||
|
this.entityId = entityId;
|
||||||
|
this.action = action;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
public static JournalEntry of(ResultSet rs) throws SQLException {
|
||||||
|
var id = rs.getLong(ID);
|
||||||
|
var timestamp = LocalDateTime.ofEpochSecond(rs.getLong(TIMESTAMP),0, UTC);
|
||||||
|
var userId = rs.getLong(USER_ID);
|
||||||
|
var module = rs.getString(MODULE);
|
||||||
|
var entityId = rs.getLong(ENTITY_ID);
|
||||||
|
var action = rs.getString(ACTION);
|
||||||
|
var json = new JSONObject(rs.getString(DESCRIPTION));
|
||||||
|
var message = json.getString(TEXT);
|
||||||
|
var fills = json.getJSONObject(DATA).toMap();
|
||||||
|
|
||||||
|
return new JournalEntry(id, timestamp, userId, module, entityId, action, new Translatable(message,fills));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long userId(){
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> toMap(String lang){
|
||||||
|
return map(
|
||||||
|
TIMESTAMP, timestamp,
|
||||||
|
USER_ID, userId,
|
||||||
|
MODULE, module,
|
||||||
|
ENTITY_ID, entityId,
|
||||||
|
ACTION, action,
|
||||||
|
DESCRIPTION, description.translate(lang)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> toMap() {
|
||||||
|
return toMap(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,28 +36,27 @@ public class ProjectEvent extends Event<Project>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable describe() {
|
public Translatable describe(boolean verbose) {
|
||||||
return switch (eventType()){
|
return switch (eventType()){
|
||||||
case CREATE -> describeCreate();
|
case CREATE -> describeCreate(verbose);
|
||||||
case DELETE -> t("The project '{project}' has been deleted by {user}", Field.PROJECT, payload().name(), USER, initiator().name());
|
case DELETE -> t("The project '{project}' has been deleted by {user}", Field.PROJECT, payload().name(), USER, initiator().name());
|
||||||
case MEMBER_ADDED -> describeMemberAdded();
|
case MEMBER_ADDED -> describeMemberAdded();
|
||||||
case UPDATE -> describeUpdate();
|
case UPDATE -> describeUpdate();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeCreate() {
|
private Translatable describeCreate(boolean verbose) {
|
||||||
var head = t("You have been added to the new project '{project}', created by {user}:\n\n{body}", Field.PROJECT, payload().name(), BODY, payload().description(), USER, initiator().name());
|
var description = t("{user} created a new project \"{project}\"",USER,initiator().name(),Field.PROJECT,payload().name());
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
if (verbose) description = t("{title}:\n\n{description}", TITLE,description, DESCRIPTION, payload().description());
|
||||||
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeMemberAdded() {
|
private Translatable describeMemberAdded() {
|
||||||
var head = t("'{name}' has been added to '{object}' by '{user}'.",NAME,newMember.name(),Field.OBJECT,payload().name(),USER,initiator().name());
|
return t("\"{name}\" has been added to \"{object}\" by \"{user}\"",NAME,newMember.name(),Field.OBJECT,payload().name(),USER,initiator().name());
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeUpdate() {
|
private Translatable describeUpdate() {
|
||||||
var head = t("Changes in project '{project}':\n\n{body}",Field.PROJECT,payload().name(),BODY,diff().orElse(""));
|
return t("Changes in project '{project}':\n\n{body}",Field.PROJECT,payload().name(),BODY,diff().orElse(""));
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,8 +73,9 @@ public class ProjectEvent extends Event<Project>{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable link() {
|
@Override
|
||||||
return t("You can view/edit this project at {base_url}/project/{id}/view",ID,payload().id());
|
public long objectId() {
|
||||||
|
return payload().id();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -39,16 +39,16 @@ public class TaskEvent extends Event<Task>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable describe() {
|
public Translatable describe(boolean verbose) {
|
||||||
return switch (eventType()){
|
return switch (eventType()){
|
||||||
case CREATE -> describeCreate();
|
case CREATE -> describeCreate(verbose);
|
||||||
case DELETE -> t("The task '{task}' has been deleted by {user}",Field.TASK, payload().name(), USER, initiator().name());
|
case DELETE -> t("The task '{task}' has been deleted by {user}",Field.TASK, payload().name(), USER, initiator().name());
|
||||||
case MEMBER_ADDED -> describeMemberAdded();
|
case MEMBER_ADDED -> describeMemberAdded();
|
||||||
case UPDATE -> describeUpdate();
|
case UPDATE -> describeUpdate();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeCreate() {
|
private Translatable describeCreate(boolean verbose) {
|
||||||
String parentName = null;
|
String parentName = null;
|
||||||
var pid = payload().parentTaskId();
|
var pid = payload().parentTaskId();
|
||||||
if (pid != null) {
|
if (pid != null) {
|
||||||
@@ -60,18 +60,17 @@ public class TaskEvent extends Event<Task>{
|
|||||||
if (project != null) parentName = project.name();
|
if (project != null) parentName = project.name();
|
||||||
}
|
}
|
||||||
if (parentName == null) parentName = "?";
|
if (parentName == null) parentName = "?";
|
||||||
var head = t("'{task}' has been added to '{object}':\n\n{body}", Field.TASK, payload().name(), OBJECT, parentName, BODY, payload().description());
|
var description = t("\"{name}\" has been added to \"{object}\" by \"{user}\"", NAME,payload().name(), OBJECT, parentName, USER, initiator().name());
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
if (verbose) description = t("{title}:\n\n{description}", TITLE,description, DESCRIPTION,payload().description());
|
||||||
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeMemberAdded() {
|
private Translatable describeMemberAdded() {
|
||||||
var head = t("'{name}' has been added to '{object}' by '{user}'.",NAME,newMember.name(), OBJECT,payload().name(),USER,initiator().name());
|
return t("\"{name}\" has been added to \"{object}\" by \"{user}\"",NAME,newMember.name(), OBJECT,payload().name(),USER,initiator().name());
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeUpdate() {
|
private Translatable describeUpdate() {
|
||||||
var head = t("Changes in task '{task}':\n\n{body}",Field.TASK,payload().name(),BODY,diff().orElse(""));
|
return t("Changes in task '{task}':\n\n{body}",Field.TASK,payload().name(),BODY,diff().orElse(""));
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,10 +91,6 @@ public class TaskEvent extends Event<Task>{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable link() {
|
|
||||||
return t("You can view/edit this task at {base_url}/task/{id}/view",ID,payload().id());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable subject() {
|
public Translatable subject() {
|
||||||
return switch (eventType()){
|
return switch (eventType()){
|
||||||
|
|||||||
@@ -34,32 +34,38 @@ public class TransactionEvent extends Event<Transaction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable describe() {
|
public Translatable describe(boolean verbose) {
|
||||||
var user = initiator().name();
|
var user = initiator().name();
|
||||||
var type = t(Text.TRANSACTION);
|
var type = t(Text.TRANSACTION);
|
||||||
var entity = payload().purpose();
|
var entity = payload().purpose();
|
||||||
return switch (eventType()){
|
return switch (eventType()){
|
||||||
case CREATE -> describeDetail();
|
case CREATE, DELETE -> describeDetail();
|
||||||
case DELETE -> describeDetail();
|
|
||||||
case UPDATE -> describeUpdate();
|
case UPDATE -> describeUpdate();
|
||||||
case null, default -> t("TODO"); // TODO
|
case null, default -> t("TODO"); // TODO
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeUpdate() {
|
private Translatable describeUpdate() {
|
||||||
var head = t("Changes in {type} '{entity}':\n\n{body}",Field.TYPE,t(Text.TRANSACTION),Field.ENTITY,oldData().get(PURPOSE),BODY,diff().orElse(""));
|
return t("Changes in {type} '{entity}':\n\n{body}",Field.TYPE,t(Text.TRANSACTION),Field.ENTITY,oldData().get(PURPOSE),BODY,diff().orElse(""));
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeDetail(){
|
private Translatable describeDetail(){
|
||||||
var tr = payload();
|
var transaction = payload();
|
||||||
|
|
||||||
var message = "{source}: {source_name}\n{destination}: {dest_name}\n{amount}: {value}\n{purpose}: {purpose_val}\n\n{link}";
|
return t("{source}: {source_name}\n{destination}: {dest_name}\n{amount}: {value}\n{purpose}: {purpose_val}",
|
||||||
return t(message,SOURCE,t(Text.SOURCE), "source_name",tr.source(), DESTINATION,t(Text.DESTINATION),"dest_name",tr.destination(), AMOUNT,t(Text.AMOUNT), VALUE,tr.amount(), PURPOSE,t(Text.PURPOSE),"purpose_val",tr.purpose(),"link",link());
|
SOURCE,t(Text.SOURCE),
|
||||||
|
"source_name",transaction.source(),
|
||||||
|
DESTINATION, t(Text.DESTINATION),
|
||||||
|
"dest_name", transaction.destination(),
|
||||||
|
AMOUNT, t(Text.AMOUNT),
|
||||||
|
VALUE, transaction.amount(),
|
||||||
|
PURPOSE, t(Text.PURPOSE),
|
||||||
|
"purpose_val",transaction.purpose());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable link() {
|
@Override
|
||||||
return t("You can view/edit this transaction at {base_url}/account/{id}", ID, payload().accountId());
|
public long objectId() {
|
||||||
|
return payload().id();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class WikiEvent extends Event<WikiPage>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable describe() {
|
public Translatable describe(boolean verbose) {
|
||||||
return switch (eventType()){
|
return switch (eventType()){
|
||||||
case CREATE -> describeCreate();
|
case CREATE -> describeCreate();
|
||||||
case DELETE -> describeDelete();
|
case DELETE -> describeDelete();
|
||||||
@@ -46,8 +46,7 @@ public class WikiEvent extends Event<WikiPage>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Translatable describeCreate(){
|
public Translatable describeCreate(){
|
||||||
var head = t("New wiki page {name} has been created");
|
return t("New wiki page {name} has been created");
|
||||||
return t("{head}:\n\n{object}\n\n{link}","head",head,OBJECT,payload().content(),"link",link());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Translatable describeDelete(){
|
public Translatable describeDelete(){
|
||||||
@@ -55,20 +54,18 @@ public class WikiEvent extends Event<WikiPage>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Translatable describeMemberAdded(){
|
public Translatable describeMemberAdded(){
|
||||||
var head = t("'{name}' has been added to '{object}' by '{user}'.",NAME,newMember.name(), OBJECT,payload().title(),USER,initiator().name());
|
return t("\"{name}\" has been added to \"{object}\" by \"{user}\"",NAME,newMember.name(), OBJECT,payload().title(),USER,initiator().name());
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable describeUpdate() {
|
private Translatable describeUpdate() {
|
||||||
var head = t("Changes in wiki page '{id}':\n\n{body}",Field.ID,payload().title(),BODY,diff().orElse(""));
|
return t("Changes in wiki page '{id}':\n\n{body}",Field.ID,payload().title(),BODY,diff().orElse(""));
|
||||||
return t("{head}\n\n{link}","head",head,"link",link());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Translatable link() {
|
@Override
|
||||||
return t("You can view/edit this wiki page at {base_url}/wiki/{id}/view",ID,payload().id());
|
public long objectId() {
|
||||||
|
return payload().id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable subject() {
|
public Translatable subject() {
|
||||||
return switch (eventType()){
|
return switch (eventType()){
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import de.srsoftware.umbrella.core.model.Session;
|
|||||||
import de.srsoftware.umbrella.core.model.Token;
|
import de.srsoftware.umbrella.core.model.Token;
|
||||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ public interface UserService {
|
|||||||
void dropSession(Token token) throws UmbrellaException;
|
void dropSession(Token token) throws UmbrellaException;
|
||||||
Session extend(Session session) throws UmbrellaException;
|
Session extend(Session session) throws UmbrellaException;
|
||||||
Map<Long, UmbrellaUser> list(Integer start, Integer limit, Collection<Long> ids) throws UmbrellaException;
|
Map<Long, UmbrellaUser> list(Integer start, Integer limit, Collection<Long> ids) throws UmbrellaException;
|
||||||
|
HashMap<Long,UmbrellaUser> loader();
|
||||||
Session load(Token token) throws UmbrellaException;
|
Session load(Token token) throws UmbrellaException;
|
||||||
UmbrellaUser load(Session session) throws UmbrellaException;
|
UmbrellaUser load(Session session) throws UmbrellaException;
|
||||||
Optional<UmbrellaUser> load(EmailAddress email) throws UmbrellaException;
|
Optional<UmbrellaUser> load(EmailAddress email) throws UmbrellaException;
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ public class Field {
|
|||||||
public static final String ITEM = "item";
|
public static final String ITEM = "item";
|
||||||
public static final String ITEM_CODE = "item_code";
|
public static final String ITEM_CODE = "item_code";
|
||||||
|
|
||||||
|
public static final String JOURNAL = "journal";
|
||||||
|
|
||||||
public static final String KEY = "key";
|
public static final String KEY = "key";
|
||||||
|
|
||||||
public static final String LANGUAGE = "language";
|
public static final String LANGUAGE = "language";
|
||||||
|
|||||||
@@ -19,10 +19,14 @@ public class Text {
|
|||||||
public static final String CONTACT = "Contact";
|
public static final String CONTACT = "Contact";
|
||||||
public static final String CONTACTS = "contacts";
|
public static final String CONTACTS = "contacts";
|
||||||
public static final String CONTACT_WITH_ID = "contact ({id})";
|
public static final String CONTACT_WITH_ID = "contact ({id})";
|
||||||
|
public static final String CREATE_BOOKMARK_SUBJECT = "create_bookmark_subject";
|
||||||
|
public static final String CREATE_BOOKMARK_DESCRIPTION = "create_bookmark_description";
|
||||||
public static final String CUSTOMER = "customer";
|
public static final String CUSTOMER = "customer";
|
||||||
public static final String CUSTOMER_SETTINGS = "customer settings";
|
public static final String CUSTOMER_SETTINGS = "customer settings";
|
||||||
|
|
||||||
public static final String DESTINATION = "destination";
|
public static final String DESTINATION = "destination";
|
||||||
|
public static final String DELETE_BOOKMARK_DESCRIPTION = "The deleted bookmark was described as:\n{description}";
|
||||||
|
public static final String DELETE_BOOKMARK_SUBJECT = "{user} deleted {url}";
|
||||||
public static final String DOCUMENT = "document";
|
public static final String DOCUMENT = "document";
|
||||||
public static final String DOCUMENTS = "documents";
|
public static final String DOCUMENTS = "documents";
|
||||||
public static final String DOCUMENT_TYPE_ID = "document type id";
|
public static final String DOCUMENT_TYPE_ID = "document type id";
|
||||||
@@ -30,6 +34,7 @@ public class Text {
|
|||||||
|
|
||||||
public static final String EMAILS_FOR_RECEIVER = "emails for {email}";
|
public static final String EMAILS_FOR_RECEIVER = "emails for {email}";
|
||||||
public static final String EVALUATION = "evaluation";
|
public static final String EVALUATION = "evaluation";
|
||||||
|
public static final String EVENT_LIST = "event list";
|
||||||
|
|
||||||
public static final String FILES = "files";
|
public static final String FILES = "files";
|
||||||
|
|
||||||
@@ -42,6 +47,8 @@ public class Text {
|
|||||||
public static final String LOGIN_SERVICE = "login service";
|
public static final String LOGIN_SERVICE = "login service";
|
||||||
public static final String LONG = "Long";
|
public static final String LONG = "Long";
|
||||||
|
|
||||||
|
public static final String MEMBER_ADDED_TO_BM_DESC = "Description:\n{description}";
|
||||||
|
public static final String MEMBER_ADDED_TO_BM_SUBJ = "{user} shared {url}";
|
||||||
public static final String MESSAGE = "message";
|
public static final String MESSAGE = "message";
|
||||||
public static final String MESSAGES = "messages";
|
public static final String MESSAGES = "messages";
|
||||||
|
|
||||||
@@ -95,6 +102,8 @@ public class Text {
|
|||||||
|
|
||||||
public static final String UNIT_PRICE = "unit price";
|
public static final String UNIT_PRICE = "unit price";
|
||||||
public static final String UNKNOWN_FIELD = "unknown field: {id}";
|
public static final String UNKNOWN_FIELD = "unknown field: {id}";
|
||||||
|
public static final String UPDATE_BM_DESCRIPTION = "{user} updated bookmark";
|
||||||
|
public static final String UPDATE_BM_SUBJECT = "{url} was changed:\n{description}";
|
||||||
public static final String USER = "user";
|
public static final String USER = "user";
|
||||||
public static final String USERS = "users";
|
public static final String USERS = "users";
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,27 @@ import static de.srsoftware.umbrella.core.Util.mapMarkdown;
|
|||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
import static java.time.ZoneOffset.UTC;
|
import static java.time.ZoneOffset.UTC;
|
||||||
|
|
||||||
import de.srsoftware.tools.Mappable;
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public record Bookmark(long urlId, String url, String comment, LocalDateTime timestamp, Collection<String> tags) implements Mappable {
|
public final class Bookmark extends UmbrellaObject {
|
||||||
|
private final String url;
|
||||||
|
private final String comment;
|
||||||
|
private final LocalDateTime timestamp;
|
||||||
|
private final Collection<String> tags;
|
||||||
|
|
||||||
|
public Bookmark(long urlId, String url, String comment, LocalDateTime timestamp, Collection<String> tags) {
|
||||||
|
super(urlId);
|
||||||
|
this.url = url;
|
||||||
|
this.comment = comment;
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
public static Bookmark of(ResultSet rs) throws SQLException {
|
public static Bookmark of(ResultSet rs) throws SQLException {
|
||||||
return new Bookmark(rs.getLong(ID), rs.getString(URL), rs.getString(COMMENT), LocalDateTime.ofEpochSecond(rs.getLong(TIMESTAMP), 0, UTC), new ArrayList<>());
|
return new Bookmark(rs.getLong(ID), rs.getString(URL), rs.getString(COMMENT), LocalDateTime.ofEpochSecond(rs.getLong(TIMESTAMP), 0, UTC), new ArrayList<>());
|
||||||
@@ -25,12 +37,59 @@ public record Bookmark(long urlId, String url, String comment, LocalDateTime tim
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> toMap() {
|
public Map<String, Object> toMap() {
|
||||||
return Map.of(
|
return map(
|
||||||
ID, urlId,
|
|
||||||
URL, url,
|
URL, url,
|
||||||
COMMENT, mapMarkdown(comment),
|
COMMENT, mapMarkdown(comment),
|
||||||
TAGS, tags,
|
TAGS, tags,
|
||||||
TIMESTAMP, timestamp.withNano(0)
|
TIMESTAMP, timestamp.withNano(0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long urlId() {
|
||||||
|
return id();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String url() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String comment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime timestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<String> tags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == this) return true;
|
||||||
|
if (obj == null || obj.getClass() != this.getClass()) return false;
|
||||||
|
var that = (Bookmark) obj;
|
||||||
|
return this.urlId() == that.urlId() &&
|
||||||
|
Objects.equals(this.url, that.url) &&
|
||||||
|
Objects.equals(this.comment, that.comment) &&
|
||||||
|
Objects.equals(this.timestamp, that.timestamp) &&
|
||||||
|
Objects.equals(this.tags, that.tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(urlId(), url, comment, timestamp, tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Bookmark[" +
|
||||||
|
"urlId=" + urlId() + ", " +
|
||||||
|
"url=" + url + ", " +
|
||||||
|
"comment=" + comment + ", " +
|
||||||
|
"timestamp=" + timestamp + ", " +
|
||||||
|
"tags=" + tags + ']';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ package de.srsoftware.umbrella.core.model;
|
|||||||
import static de.srsoftware.umbrella.core.Util.mapMarkdown;
|
import static de.srsoftware.umbrella.core.Util.mapMarkdown;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
|
|
||||||
import de.srsoftware.tools.Mappable;
|
|
||||||
import de.srsoftware.umbrella.core.api.Owner;
|
import de.srsoftware.umbrella.core.api.Owner;
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -12,16 +11,16 @@ import java.sql.SQLException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class Item implements Mappable {
|
public class Item extends UmbrellaObject {
|
||||||
private long id, ownerNumber; // id is the database key, number the owner-relative id
|
private long ownerNumber; // id is the database key, number the owner-relative id
|
||||||
private Owner owner;
|
private final Owner owner;
|
||||||
private String code, description, name;
|
private String code, description, name;
|
||||||
private Location location;
|
private Location location;
|
||||||
private Collection<Property> properties;
|
private final Collection<Property> properties;
|
||||||
private Set<String> dirtyFields = new HashSet<>();
|
private final Set<String> dirtyFields = new HashSet<>();
|
||||||
|
|
||||||
public Item(long id, Owner owner, long ownerNumber, Location location, String code, String name, String description) {
|
public Item(long id, Owner owner, long ownerNumber, Location location, String code, String name, String description) {
|
||||||
this.id = id;
|
super(id);
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.ownerNumber = ownerNumber;
|
this.ownerNumber = ownerNumber;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
@@ -48,15 +47,6 @@ public class Item implements Mappable {
|
|||||||
return !dirtyFields.isEmpty();
|
return !dirtyFields.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long id(){
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Item id(long newVal) {
|
|
||||||
id = newVal;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location location(){
|
public Location location(){
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
@@ -121,14 +111,13 @@ public class Item implements Mappable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> toMap() {
|
public Map<String, Object> toMap() {
|
||||||
var map = new HashMap<String,Object>();
|
var map = super.map(
|
||||||
map.put(OWNER,owner.toMap());
|
OWNER,owner.toMap(),
|
||||||
map.put(ID,id);
|
LOCATION,location.toMap(),
|
||||||
map.put(LOCATION,location.toMap());
|
Field.CODE,code,
|
||||||
map.put(Field.CODE,code);
|
NAME,name,
|
||||||
map.put(NAME,name);
|
DESCRIPTION,mapMarkdown(description),
|
||||||
map.put(DESCRIPTION,mapMarkdown(description));
|
OWNER_NUMBER,ownerNumber);
|
||||||
map.put(OWNER_NUMBER,ownerNumber);
|
|
||||||
if (properties != null) map.put(PROPERTIES,properties.stream().map(Property::toMap).toList());
|
if (properties != null) map.put(PROPERTIES,properties.stream().map(Property::toMap).toList());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,27 +6,25 @@ import static de.srsoftware.umbrella.core.Util.mapMarkdown;
|
|||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
import static de.srsoftware.umbrella.core.model.Status.PREDEFINED;
|
import static de.srsoftware.umbrella.core.model.Status.PREDEFINED;
|
||||||
|
|
||||||
import de.srsoftware.tools.Mappable;
|
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class Project implements Mappable {
|
public class Project extends UmbrellaObject {
|
||||||
private final Map<Long,Member> members;
|
private final Map<Long,Member> members;
|
||||||
private final Collection<Status> allowedStates;
|
private final Collection<Status> allowedStates;
|
||||||
private boolean showClosed;
|
private boolean showClosed;
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
private int status;
|
private int status;
|
||||||
private String name;
|
private String name;
|
||||||
private final long id;
|
|
||||||
private String description;
|
private String description;
|
||||||
private final Set<String> dirtyFields = new HashSet<>();
|
private final Set<String> dirtyFields = new HashSet<>();
|
||||||
private final Map<String,String> tagColors = new HashMap<>();
|
private final Map<String,String> tagColors = new HashMap<>();
|
||||||
|
|
||||||
public Project(long id, String name, String description, int status, Long companyId, boolean showClosed, Map<Long,Member> members, Collection<Status> allowedStates) {
|
public Project(long id, String name, String description, int status, Long companyId, boolean showClosed, Map<Long,Member> members, Collection<Status> allowedStates) {
|
||||||
this.id = id;
|
super(id);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@@ -67,10 +65,6 @@ public class Project implements Mappable {
|
|||||||
return members.containsKey(user.id());
|
return members.containsKey(user.id());
|
||||||
}
|
}
|
||||||
|
|
||||||
public long id(){
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
return !dirtyFields.isEmpty();
|
return !dirtyFields.isEmpty();
|
||||||
}
|
}
|
||||||
@@ -126,23 +120,21 @@ public class Project implements Mappable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> toMap() {
|
public Map<String, Object> toMap() {
|
||||||
var map = new HashMap<String, Object>();
|
|
||||||
var memberMap = new HashMap<Long,Map<String,Object>>();
|
var memberMap = new HashMap<Long,Map<String,Object>>();
|
||||||
if (members != null) for (var entry : members.entrySet()){
|
if (members != null) for (var entry : members.entrySet()){
|
||||||
memberMap.put(entry.getKey(),entry.getValue().toMap());
|
memberMap.put(entry.getKey(),entry.getValue().toMap());
|
||||||
}
|
}
|
||||||
map.put(ID,id);
|
|
||||||
map.put(NAME,name);
|
|
||||||
map.put(DESCRIPTION,mapMarkdown(description));
|
|
||||||
map.put(STATUS,status);
|
|
||||||
map.put(COMPANY_ID,companyId);
|
|
||||||
map.put(SHOW_CLOSED,showClosed);
|
|
||||||
map.put(MEMBERS,memberMap);
|
|
||||||
var stateMap = new HashMap<Integer,String>();
|
var stateMap = new HashMap<Integer,String>();
|
||||||
for (var state : allowedStates) stateMap.put(state.code(),state.name());
|
for (var state : allowedStates) stateMap.put(state.code(),state.name());
|
||||||
map.put(Field.ALLOWED_STATES,stateMap);
|
return super.map(
|
||||||
map.put(TAG_COLORS,tagColors);
|
NAME,name,
|
||||||
return map;
|
DESCRIPTION,mapMarkdown(description),
|
||||||
|
STATUS,status,
|
||||||
|
COMPANY_ID,companyId,
|
||||||
|
SHOW_CLOSED,showClosed,
|
||||||
|
MEMBERS,memberMap,
|
||||||
|
Field.ALLOWED_STATES,stateMap,
|
||||||
|
TAG_COLORS,tagColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import static de.srsoftware.umbrella.core.constants.Field.*;
|
|||||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
||||||
import static java.lang.System.Logger.Level.WARNING;
|
import static java.lang.System.Logger.Level.WARNING;
|
||||||
|
|
||||||
import de.srsoftware.tools.Mappable;
|
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -15,9 +14,9 @@ import java.time.LocalDate;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class Task implements Mappable {
|
public class Task extends UmbrellaObject {
|
||||||
public static final System.Logger LOG = System.getLogger(Task.class.getSimpleName());
|
public static final System.Logger LOG = System.getLogger(Task.class.getSimpleName());
|
||||||
private final long id, projectId;
|
private final long projectId;
|
||||||
private Long parentTaskId;
|
private Long parentTaskId;
|
||||||
private String description, name;
|
private String description, name;
|
||||||
private final Set<Long> requiredTasksIds;
|
private final Set<Long> requiredTasksIds;
|
||||||
@@ -30,7 +29,7 @@ public class Task implements Mappable {
|
|||||||
private final Set<String> tags = new HashSet<>();
|
private final Set<String> tags = new HashSet<>();
|
||||||
|
|
||||||
public Task (long id, long projectId, Long parentTaskId, String name, String description, int status, Double estimatedTime, LocalDate start, LocalDate dueDate, boolean showClosed, boolean noIndex, Map<Long,Member> members, int priority){
|
public Task (long id, long projectId, Long parentTaskId, String name, String description, int status, Double estimatedTime, LocalDate start, LocalDate dueDate, boolean showClosed, boolean noIndex, Map<Long,Member> members, int priority){
|
||||||
this.id = id;
|
super(id);
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
this.parentTaskId = parentTaskId;
|
this.parentTaskId = parentTaskId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -82,10 +81,6 @@ public class Task implements Mappable {
|
|||||||
return members.containsKey(user.id());
|
return members.containsKey(user.id());
|
||||||
}
|
}
|
||||||
|
|
||||||
public long id(){
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
return !dirtyFields.isEmpty();
|
return !dirtyFields.isEmpty();
|
||||||
}
|
}
|
||||||
@@ -229,28 +224,27 @@ public class Task implements Mappable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,Object> toMap(boolean renderMarkdown){
|
public Map<String,Object> toMap(boolean renderMarkdown){
|
||||||
var map = new HashMap<String,Object>();
|
|
||||||
var memberMap = new HashMap<Long,Map<String,Object>>();
|
var memberMap = new HashMap<Long,Map<String,Object>>();
|
||||||
if (members != null) for (var entry : members.entrySet()){
|
if (members != null) for (var entry : members.entrySet()){
|
||||||
memberMap.put(entry.getKey(),entry.getValue().toMap());
|
memberMap.put(entry.getKey(),entry.getValue().toMap());
|
||||||
}
|
}
|
||||||
map.put(ID, id);
|
return map(
|
||||||
map.put(PROJECT_ID, projectId);
|
PROJECT_ID, projectId,
|
||||||
map.put(PARENT_TASK_ID, parentTaskId);
|
PARENT_TASK_ID, parentTaskId,
|
||||||
map.put(PRIORITY,priority);
|
PRIORITY,priority,
|
||||||
map.put(NAME, name);
|
NAME, name,
|
||||||
map.put(DESCRIPTION, renderMarkdown ? mapMarkdown(description) : Map.of(SOURCE,description));
|
DESCRIPTION, renderMarkdown ? mapMarkdown(description) : Map.of(SOURCE,description),
|
||||||
map.put(STATUS, status);
|
STATUS, status,
|
||||||
map.put(EST_TIME, estimatedTime);
|
EST_TIME, estimatedTime,
|
||||||
map.put(START_DATE,start);
|
START_DATE,start,
|
||||||
map.put(DUE_DATE,dueDate);
|
DUE_DATE,dueDate,
|
||||||
map.put(NO_INDEX,noIndex);
|
NO_INDEX,noIndex,
|
||||||
map.put(MEMBERS,memberMap);
|
MEMBERS,memberMap,
|
||||||
map.put(REQUIRED_TASKS_IDS,requiredTasksIds);
|
REQUIRED_TASKS_IDS,requiredTasksIds,
|
||||||
map.put(SHOW_CLOSED,showClosed);
|
SHOW_CLOSED,showClosed,
|
||||||
map.put(TOTAL_PRIO,totalPrio());
|
TOTAL_PRIO,totalPrio(),
|
||||||
map.put(TAGS,tags);
|
TAGS,tags
|
||||||
return map;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package de.srsoftware.umbrella.core.model;
|
|||||||
|
|
||||||
import static java.text.MessageFormat.format;
|
import static java.text.MessageFormat.format;
|
||||||
|
|
||||||
import de.srsoftware.tools.Mappable;
|
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -14,17 +13,17 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class Transaction implements Mappable {
|
public class Transaction extends UmbrellaObject {
|
||||||
private long accountId, id;
|
private final long accountId;
|
||||||
private LocalDateTime date;
|
private LocalDateTime date;
|
||||||
private IdOrString source, destination;
|
private IdOrString source, destination;
|
||||||
private double amount;
|
private double amount;
|
||||||
private String purpose;
|
private String purpose;
|
||||||
private Set<String> tags;
|
private final Set<String> tags;
|
||||||
private HashSet<String> dirtyFields = new HashSet<>();
|
private final HashSet<String> dirtyFields = new HashSet<>();
|
||||||
|
|
||||||
public Transaction(long id, long accountId, LocalDateTime date, IdOrString source, IdOrString destination, double amount, String purpose, Set<String> tags){
|
public Transaction(long id, long accountId, LocalDateTime date, IdOrString source, IdOrString destination, double amount, String purpose, Set<String> tags){
|
||||||
this.id = id;
|
super(id);
|
||||||
this.accountId = accountId;
|
this.accountId = accountId;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.source = source;
|
this.source = source;
|
||||||
@@ -77,10 +76,6 @@ public class Transaction implements Mappable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long id(){
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDirty(){
|
public boolean isDirty(){
|
||||||
return !dirtyFields.isEmpty();
|
return !dirtyFields.isEmpty();
|
||||||
}
|
}
|
||||||
@@ -123,8 +118,7 @@ public class Transaction implements Mappable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> toMap() {
|
public Map<String, Object> toMap() {
|
||||||
return Map.of(
|
return super.map(
|
||||||
Field.ID, id,
|
|
||||||
Field.ACCOUNT, accountId,
|
Field.ACCOUNT, accountId,
|
||||||
Field.DATE, date.toLocalDate(),
|
Field.DATE, date.toLocalDate(),
|
||||||
Field.SOURCE, source.toMap(),
|
Field.SOURCE, source.toMap(),
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ package de.srsoftware.umbrella.core.model;
|
|||||||
|
|
||||||
import static de.srsoftware.tools.Optionals.*;
|
import static de.srsoftware.tools.Optionals.*;
|
||||||
|
|
||||||
|
import de.srsoftware.tools.Mappable;
|
||||||
import de.srsoftware.umbrella.core.ModuleRegistry;
|
import de.srsoftware.umbrella.core.ModuleRegistry;
|
||||||
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Translatable {
|
public class Translatable implements Mappable {
|
||||||
protected final String message;
|
protected final String message;
|
||||||
private final Map<String, Object> fills;
|
private final Map<String, Object> fills;
|
||||||
private final HashMap<String,String> translated = new HashMap<>();
|
private final HashMap<String,String> translated = new HashMap<>();
|
||||||
@@ -40,6 +42,11 @@ public class Translatable {
|
|||||||
return new Translatable(message,args);
|
return new Translatable(message,args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> toMap() {
|
||||||
|
return Map.of(Field.TEXT,message,Field.DATA,fills);
|
||||||
|
}
|
||||||
|
|
||||||
public String translate(String language){
|
public String translate(String language){
|
||||||
var translation = language == null ? null : translated.get(language);
|
var translation = language == null ? null : translated.get(language);
|
||||||
if (translation == null){
|
if (translation == null){
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/* © SRSoftware 2025 */
|
||||||
|
package de.srsoftware.umbrella.core.model;
|
||||||
|
|
||||||
|
import de.srsoftware.tools.Mappable;
|
||||||
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public abstract class UmbrellaObject implements Mappable {
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
public UmbrellaObject(long id){
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long id(){
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Map<String, Object> map(Object ... keysAndValues) {
|
||||||
|
if (keysAndValues.length % 2 != 0) throw new InvalidParameterException("Expected even number of keys and parameters!");
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put(Field.ID,id);
|
||||||
|
for (var idx = 0; idx<keysAndValues.length; idx+=2) map.put(keysAndValues[idx].toString(),keysAndValues[idx+1]);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String path(){
|
||||||
|
return getClass().getSimpleName().toLowerCase()+"/"+id()+"/view";
|
||||||
|
}
|
||||||
|
|
||||||
|
public UmbrellaObject setId(long newValue){
|
||||||
|
id = newValue;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,16 +10,14 @@ import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
|||||||
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
||||||
import static java.lang.String.join;
|
import static java.lang.String.join;
|
||||||
|
|
||||||
import de.srsoftware.tools.Mappable;
|
|
||||||
import de.srsoftware.umbrella.core.api.UserService;
|
import de.srsoftware.umbrella.core.api.UserService;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class WikiPage implements Mappable {
|
public class WikiPage extends UmbrellaObject {
|
||||||
|
|
||||||
private final long id;
|
|
||||||
private String title;
|
private String title;
|
||||||
private int version;
|
private int version;
|
||||||
private final Set<Integer> versions = new TreeSet<>();
|
private final Set<Integer> versions = new TreeSet<>();
|
||||||
@@ -29,7 +27,7 @@ public class WikiPage implements Mappable {
|
|||||||
private boolean guestAllowed = false;
|
private boolean guestAllowed = false;
|
||||||
|
|
||||||
public WikiPage(long id, String title, int version, String content) {
|
public WikiPage(long id, String title, int version, String content) {
|
||||||
this.id = id;
|
super(id);
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@@ -60,10 +58,6 @@ public class WikiPage implements Mappable {
|
|||||||
dirtyFields.add(GUEST_ALLOWED);
|
dirtyFields.add(GUEST_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long id(){
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDirty(String field) {
|
public boolean isDirty(String field) {
|
||||||
return dirtyFields.contains(field);
|
return dirtyFields.contains(field);
|
||||||
}
|
}
|
||||||
@@ -146,8 +140,7 @@ public class WikiPage implements Mappable {
|
|||||||
var memberMap = new HashMap<Long,Map<String,Object>>();
|
var memberMap = new HashMap<Long,Map<String,Object>>();
|
||||||
for (var entry : members.entrySet()) memberMap.put(entry.getKey(),entry.getValue().toMap());
|
for (var entry : members.entrySet()) memberMap.put(entry.getKey(),entry.getValue().toMap());
|
||||||
|
|
||||||
return Map.of(
|
return map(
|
||||||
ID,id,
|
|
||||||
CONTENT,mapMarkdown(content),
|
CONTENT,mapMarkdown(content),
|
||||||
GUEST_ALLOWED,guestAllowed,
|
GUEST_ALLOWED,guestAllowed,
|
||||||
MEMBERS,memberMap,
|
MEMBERS,memberMap,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { error, yikes } from '../../warn.svelte';
|
import { error, yikes } from '../../warn.svelte';
|
||||||
import { t } from '../../translations.svelte';
|
import { t } from '../../translations.svelte';
|
||||||
|
|
||||||
import EntryForm from './add_entry_new.svelte';
|
import EntryForm from './add_entry.svelte';
|
||||||
import Transaction from './transaction.svelte';
|
import Transaction from './transaction.svelte';
|
||||||
|
|
||||||
let { id } = $props();
|
let { id } = $props();
|
||||||
@@ -173,5 +173,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<EntryForm {account} {onSave} {users} />
|
<EntryForm {account} {onSave} />
|
||||||
{/if}
|
{/if}
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
<script>
|
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
|
||||||
|
|
||||||
import { t } from '../../translations.svelte';
|
|
||||||
import { api, post } from '../../urls.svelte';
|
|
||||||
import { error, yikes } from '../../warn.svelte';
|
|
||||||
import { user } from '../../user.svelte';
|
|
||||||
import Autocomplete from '../../Components/Autocomplete.svelte';
|
|
||||||
import Tags from '../tags/TagList.svelte';
|
|
||||||
|
|
||||||
let defaultAccount = {
|
|
||||||
id : 0,
|
|
||||||
name : '',
|
|
||||||
currency : ''
|
|
||||||
};
|
|
||||||
let { account = defaultAccount, new_account = false, onSave = () => {}, users } = $props();
|
|
||||||
|
|
||||||
let entry = $state({
|
|
||||||
account,
|
|
||||||
date : new Date().toISOString().substring(0, 10),
|
|
||||||
source : {
|
|
||||||
display: user.name,
|
|
||||||
id: user.id
|
|
||||||
},
|
|
||||||
destination : {},
|
|
||||||
amount : 0.0,
|
|
||||||
purpose : {},
|
|
||||||
tags : []
|
|
||||||
});
|
|
||||||
let router = useTinyRouter();
|
|
||||||
|
|
||||||
async function dst_selected(destination){
|
|
||||||
destination = JSON.parse(JSON.stringify(destination));
|
|
||||||
let source = JSON.parse(JSON.stringify(entry.source));
|
|
||||||
const url = api(`accounting/${entry.account.id}/tags`)
|
|
||||||
const res = await post(url,{source,destination});
|
|
||||||
if (res.ok) {
|
|
||||||
yikes();
|
|
||||||
const json = await res.json();
|
|
||||||
await proposePurpose();
|
|
||||||
entry.tags = json;
|
|
||||||
} else error(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
function focusOnEnter(ev,id){
|
|
||||||
if (ev.key == 'Enter') {
|
|
||||||
proposePurpose();
|
|
||||||
document.getElementById(id).focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getAccountTags(text){
|
|
||||||
if (!text) return [];
|
|
||||||
const url = api(`accounting/${entry.account.id}/tags`)
|
|
||||||
return await getProposals(text,url);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getDestinations(text){
|
|
||||||
const url = api('accounting/destinations');
|
|
||||||
return await getProposals(text,url);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getProposals(text,url){
|
|
||||||
const res = await post(url,text);
|
|
||||||
if (res.ok){
|
|
||||||
yikes();
|
|
||||||
const input = await res.json();
|
|
||||||
return Object.values(input).map(mapDisplay);
|
|
||||||
} else {
|
|
||||||
error(res);
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function getPurposes(text) {
|
|
||||||
const url = api('accounting/purposes');
|
|
||||||
return await getProposals(text,url);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getSources(text){
|
|
||||||
const url = api('accounting/sources');
|
|
||||||
return await getProposals(text,url);
|
|
||||||
}
|
|
||||||
|
|
||||||
function gotoTags(purpose){
|
|
||||||
document.getElementById('new_tag_input');
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDisplay(object){
|
|
||||||
if (object.display){
|
|
||||||
return object;
|
|
||||||
} else if (object.name) {
|
|
||||||
return {...object, display: object.name};
|
|
||||||
} else {
|
|
||||||
return { display : object }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function proposePurpose(){
|
|
||||||
console.log('proposePurpose()');
|
|
||||||
const amount = entry.amount;
|
|
||||||
const source = entry.source;
|
|
||||||
const destination = entry.destination;
|
|
||||||
const url = api(`accounting/${account.id}/purposes`);
|
|
||||||
const res = await post(url,{source,destination,amount});
|
|
||||||
if (res.ok) {
|
|
||||||
yikes();
|
|
||||||
var lastTransaction = await res.json();
|
|
||||||
console.log({lastTransaction,users:JSON.parse(JSON.stringify(users))});
|
|
||||||
entry.purpose = { display: lastTransaction.purpose};
|
|
||||||
entry.tags = lastTransaction.tags;
|
|
||||||
if (lastTransaction.source.value){
|
|
||||||
if (users[lastTransaction.source.value]){
|
|
||||||
let user = users[lastTransaction.source.value];
|
|
||||||
entry.source = { id : +lastTransaction.source.value, display : user.name };
|
|
||||||
} else entry.source = { display: lastTransaction.source.value };
|
|
||||||
}
|
|
||||||
if (lastTransaction.destination.value){
|
|
||||||
if (users[lastTransaction.destination.value]){
|
|
||||||
let user = users[lastTransaction.destination.value];
|
|
||||||
entry.destination = { id : +lastTransaction.destination.value, display : user.name };
|
|
||||||
} else entry.destination = { display: lastTransaction.destination.value };
|
|
||||||
}
|
|
||||||
} else error(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function save(){
|
|
||||||
let data = {
|
|
||||||
...entry,
|
|
||||||
purpose: entry.purpose.display
|
|
||||||
}
|
|
||||||
let url = api('accounting');
|
|
||||||
let res = await post(url, data);
|
|
||||||
if (res.ok) {
|
|
||||||
yikes();
|
|
||||||
if (new_account){
|
|
||||||
router.navigate('/accounting');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//entry.tags = [];
|
|
||||||
onSave();
|
|
||||||
document.getElementById('date-input').focus();
|
|
||||||
} else error(res);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
hr{
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
border: 0;
|
|
||||||
height: 1px;
|
|
||||||
align-self: center;
|
|
||||||
background: red;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<fieldset class="grid2 new_transaction">
|
|
||||||
{#if new_account}
|
|
||||||
<legend>{t('create_new_object',{object:t('account')})}</legend>
|
|
||||||
<span style="display:none"></span>
|
|
||||||
<span>{t('account name')}</span>
|
|
||||||
<span>
|
|
||||||
<input type="text" bind:value={entry.account.name} />
|
|
||||||
</span>
|
|
||||||
<span>{t('currency')}</span>
|
|
||||||
<span>
|
|
||||||
<input type="text" bind:value={entry.account.currency} />
|
|
||||||
</span>
|
|
||||||
<hr/>
|
|
||||||
<span style="grid-column-end: span 2">{t('first transaction')}</span>
|
|
||||||
{:else}
|
|
||||||
<legend>{t('add_object',{object:t('transaction')})}</legend>
|
|
||||||
<span style="display:none"></span>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<span>{t('date')}</span>
|
|
||||||
<span>
|
|
||||||
<input type="date" bind:value={entry.date} id="date-input" />
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span>{t('amount')}</span>
|
|
||||||
<span>
|
|
||||||
<input type="number" bind:value={entry.amount} onkeyup={e => focusOnEnter(e,'source-input')} /> {entry.account.currency}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span>{t('source')}</span>
|
|
||||||
<Autocomplete bind:candidate={entry.source} getCandidates={getSources} id="source-input" />
|
|
||||||
|
|
||||||
<span>{t('destination')}</span>
|
|
||||||
<Autocomplete bind:candidate={entry.destination} getCandidates={getDestinations} onSelect={dst_selected} />
|
|
||||||
|
|
||||||
|
|
||||||
<span>{t('purpose')}</span>
|
|
||||||
<Autocomplete bind:candidate={entry.purpose} getCandidates={getPurposes} onCommit={gotoTags} id="purpose_input" />
|
|
||||||
|
|
||||||
<span>{t('tags')}</span>
|
|
||||||
<Tags getCandidates={getAccountTags} module={null} bind:tags={entry.tags} onEmptyCommit={save} />
|
|
||||||
|
|
||||||
<span></span>
|
|
||||||
<span>
|
|
||||||
<button onclick={save}>{t('save')}</button>
|
|
||||||
</span>
|
|
||||||
</fieldset>
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<script>
|
||||||
|
import { api, get } from '../../urls.svelte';
|
||||||
|
import { error, yikes } from '../../warn.svelte';
|
||||||
|
import { t } from '../../translations.svelte';
|
||||||
|
let { module, entityId } = $props();
|
||||||
|
|
||||||
|
let data = $state({journal:[]});
|
||||||
|
|
||||||
|
async function loadJournal(){
|
||||||
|
const url = api(`journal/${module}/${entityId}`);
|
||||||
|
const res = await get(url);
|
||||||
|
if (res.ok) {
|
||||||
|
data = await res.json();
|
||||||
|
} else error(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
$effect(loadJournal);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{#each data.journal as entry (entry.id)}
|
||||||
|
<li>
|
||||||
|
<span class="date">{entry.timestamp.replace('T',' ')}</span>
|
||||||
|
<span class="actor">{data.user_list[entry.user_id].name}</span>:
|
||||||
|
<span class="action">{t(entry.action)}</span>
|
||||||
|
<pre>{entry.description}</pre>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
{#each locations as location}
|
{#each locations as location}
|
||||||
<li onclick={e => toggleChildren(e, location)}
|
<li onclick={e => toggleChildren(e, location)}
|
||||||
class="{location.locations?'expanded':'collapsed'} {location.highlight?'highlight':null}"
|
class="{location.locations?'expanded':'collapsed'} {location.highlight?'highlight':null} {selected && selected.id == location.id?'selected':null}"
|
||||||
draggable={true}
|
draggable={true}
|
||||||
ondragover={e => drag_over(e,location)}
|
ondragover={e => drag_over(e,location)}
|
||||||
ondrop={e => onDrop(e,location)}
|
ondrop={e => onDrop(e,location)}
|
||||||
|
|||||||
@@ -130,10 +130,6 @@
|
|||||||
onMount(load);
|
onMount(load);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
|
||||||
<title>Umbrella – {t('Easylist')}: {tag}</title>
|
|
||||||
</svelte:head>
|
|
||||||
|
|
||||||
<h2>{t('tasks_for_tag',{tag:decodeURI(tag)})}</h2>
|
<h2>{t('tasks_for_tag',{tag:decodeURI(tag)})}</h2>
|
||||||
|
|
||||||
<div class="easylist">
|
<div class="easylist">
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import { timetrack } from '../../user.svelte.js';
|
import { timetrack } from '../../user.svelte.js';
|
||||||
import { now } from '../../time.svelte';
|
import { now } from '../../time.svelte';
|
||||||
|
|
||||||
|
import Journal from '../journal/related.svelte';
|
||||||
import LineEditor from '../../Components/LineEditor.svelte';
|
import LineEditor from '../../Components/LineEditor.svelte';
|
||||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||||
import ParentSelector from './ParentSelector.svelte';
|
import ParentSelector from './ParentSelector.svelte';
|
||||||
@@ -367,6 +368,11 @@
|
|||||||
<div>
|
<div>
|
||||||
<Notes module="task" entity_id={id} />
|
<Notes module="task" entity_id={id} />
|
||||||
</div>
|
</div>
|
||||||
|
<h3>{t('Journal')}</h3>
|
||||||
|
<div>
|
||||||
|
<Journal module="task" entityId={id} />
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
package de.srsoftware.umbrella.journal;
|
package de.srsoftware.umbrella.journal;
|
||||||
|
|
||||||
import de.srsoftware.umbrella.messagebus.events.Event;
|
import de.srsoftware.umbrella.messagebus.events.Event;
|
||||||
|
import de.srsoftware.umbrella.messagebus.events.JournalEntry;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface JournalDb {
|
public interface JournalDb {
|
||||||
void logEvent(Event<?> event);
|
void logEvent(Event<?> event);
|
||||||
|
|
||||||
|
List<JournalEntry> list(String module, long entityId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,29 @@
|
|||||||
package de.srsoftware.umbrella.journal;
|
package de.srsoftware.umbrella.journal;
|
||||||
|
|
||||||
import static de.srsoftware.umbrella.core.ConnectionProvider.connect;
|
import static de.srsoftware.umbrella.core.ConnectionProvider.connect;
|
||||||
|
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
|
||||||
|
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.invalidField;
|
||||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.missingField;
|
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.missingField;
|
||||||
import static de.srsoftware.umbrella.journal.Constants.CONFIG_DATABASE;
|
import static de.srsoftware.umbrella.journal.Constants.CONFIG_DATABASE;
|
||||||
import static de.srsoftware.umbrella.messagebus.MessageBus.messageBus;
|
import static de.srsoftware.umbrella.messagebus.MessageBus.messageBus;
|
||||||
import static java.lang.System.Logger.Level.DEBUG;
|
import static java.lang.System.Logger.Level.DEBUG;
|
||||||
|
|
||||||
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
import de.srsoftware.configuration.Configuration;
|
import de.srsoftware.configuration.Configuration;
|
||||||
|
import de.srsoftware.tools.Path;
|
||||||
|
import de.srsoftware.tools.SessionToken;
|
||||||
import de.srsoftware.umbrella.core.BaseHandler;
|
import de.srsoftware.umbrella.core.BaseHandler;
|
||||||
import de.srsoftware.umbrella.core.ModuleRegistry;
|
import de.srsoftware.umbrella.core.ModuleRegistry;
|
||||||
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
|
import de.srsoftware.umbrella.core.constants.Text;
|
||||||
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||||
|
import de.srsoftware.umbrella.core.model.Token;
|
||||||
import de.srsoftware.umbrella.messagebus.EventListener;
|
import de.srsoftware.umbrella.messagebus.EventListener;
|
||||||
import de.srsoftware.umbrella.messagebus.events.Event;
|
import de.srsoftware.umbrella.messagebus.events.Event;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
public class JournalModule extends BaseHandler implements EventListener {
|
public class JournalModule extends BaseHandler implements EventListener {
|
||||||
@@ -26,6 +39,35 @@ public class JournalModule extends BaseHandler implements EventListener {
|
|||||||
messageBus().register(this);
|
messageBus().register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doGet(Path path, HttpExchange ex) throws IOException {
|
||||||
|
addCors(ex);
|
||||||
|
try {
|
||||||
|
Optional<Token> token = SessionToken.from(ex).map(Token::of);
|
||||||
|
var user = userService().loadUser(token);
|
||||||
|
if (user.isEmpty()) return unauthorized(ex);
|
||||||
|
var module = path.pop();
|
||||||
|
if (module == null) throw missingField(Field.MODULE);
|
||||||
|
var head = path.pop();
|
||||||
|
if (head == null) throw missingField(Field.ENTITY_ID);
|
||||||
|
try {
|
||||||
|
var entityId = Long.parseLong(head);
|
||||||
|
var entries = journalDb.list(module, entityId);
|
||||||
|
var loader = userService().loader();
|
||||||
|
var userMap = new HashMap<Long,Object>();
|
||||||
|
for (var entry : entries) userMap.put(entry.userId(),loader.get(entry.userId()).toMap());
|
||||||
|
return sendContent(ex,Map.of(
|
||||||
|
Field.USER_LIST,userMap,
|
||||||
|
Field.JOURNAL,entries.stream().map(entry -> entry.toMap(user.get().language())).toList()
|
||||||
|
));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw invalidField(Field.ENTITY_ID, Text.NUMBER);
|
||||||
|
}
|
||||||
|
} catch (UmbrellaException e) {
|
||||||
|
return send(ex, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event<?> event) {
|
public void onEvent(Event<?> event) {
|
||||||
LOG.log(DEBUG,"{0} @ {1} (by {2})",event.eventType(),event.module(),event.initiator().name());
|
LOG.log(DEBUG,"{0} @ {1} (by {2})",event.eventType(),event.module(),event.initiator().name());
|
||||||
|
|||||||
@@ -1,18 +1,27 @@
|
|||||||
/* © SRSoftware 2025 */
|
/* © SRSoftware 2025 */
|
||||||
package de.srsoftware.umbrella.journal;
|
package de.srsoftware.umbrella.journal;
|
||||||
|
|
||||||
|
import static de.srsoftware.tools.jdbc.Condition.equal;
|
||||||
|
import static de.srsoftware.tools.jdbc.Query.SelectQuery.ALL;
|
||||||
import static de.srsoftware.tools.jdbc.Query.insertInto;
|
import static de.srsoftware.tools.jdbc.Query.insertInto;
|
||||||
|
import static de.srsoftware.tools.jdbc.Query.select;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.databaseException;
|
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
||||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.failedToCreateTable;
|
|
||||||
import static de.srsoftware.umbrella.journal.Constants.ERROR_WRITE_EVENT;
|
import static de.srsoftware.umbrella.journal.Constants.ERROR_WRITE_EVENT;
|
||||||
import static de.srsoftware.umbrella.journal.Constants.TABLE_JOURNAL;
|
import static de.srsoftware.umbrella.journal.Constants.TABLE_JOURNAL;
|
||||||
import static java.text.MessageFormat.format;
|
import static java.text.MessageFormat.format;
|
||||||
|
|
||||||
import de.srsoftware.umbrella.core.BaseDb;
|
import de.srsoftware.umbrella.core.BaseDb;
|
||||||
|
import de.srsoftware.umbrella.core.constants.Text;
|
||||||
import de.srsoftware.umbrella.messagebus.events.Event;
|
import de.srsoftware.umbrella.messagebus.events.Event;
|
||||||
|
import de.srsoftware.umbrella.messagebus.events.JournalEntry;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class SqliteDb extends BaseDb implements JournalDb{
|
public class SqliteDb extends BaseDb implements JournalDb{
|
||||||
public SqliteDb(Connection connection) {
|
public SqliteDb(Connection connection) {
|
||||||
@@ -33,13 +42,15 @@ public class SqliteDb extends BaseDb implements JournalDb{
|
|||||||
var sql = """
|
var sql = """
|
||||||
CREATE TABLE IF NOT EXISTS {0} (
|
CREATE TABLE IF NOT EXISTS {0} (
|
||||||
{1} INTEGER PRIMARY KEY,
|
{1} INTEGER PRIMARY KEY,
|
||||||
{2} INTEGER,
|
{2} LONG NOT NULL,
|
||||||
{3} VARCHAR(255) NOT NULL,
|
{3} INTEGER,
|
||||||
{4} VARCHAR(16) NOT NULL,
|
{4} VARCHAR(255) NOT NULL,
|
||||||
{5} TEXT
|
{5} VARCHAR(255),
|
||||||
|
{6} VARCHAR(16) NOT NULL,
|
||||||
|
{7} TEXT
|
||||||
);
|
);
|
||||||
""";
|
""";
|
||||||
sql = format(sql,TABLE_JOURNAL,ID,USER_ID,MODULE,ACTION,DESCRIPTION);
|
sql = format(sql,TABLE_JOURNAL,ID,TIMESTAMP,USER_ID,MODULE,ENTITY_ID,ACTION,DESCRIPTION);
|
||||||
try {
|
try {
|
||||||
db.prepareStatement(sql).execute();
|
db.prepareStatement(sql).execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -47,11 +58,26 @@ public class SqliteDb extends BaseDb implements JournalDb{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JournalEntry> list(String module, long entityId) {
|
||||||
|
try {
|
||||||
|
var rs = select(ALL).from(TABLE_JOURNAL).where(MODULE, equal(module)).where(ENTITY_ID,equal(entityId)).exec(db);
|
||||||
|
var list = new ArrayList<JournalEntry>();
|
||||||
|
while (rs.next()) list.add(JournalEntry.of(rs));
|
||||||
|
rs.close();
|
||||||
|
return list;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw failedToLoadObject(Text.EVENT_LIST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logEvent(Event<?> event) {
|
public void logEvent(Event<?> event) {
|
||||||
try {
|
try {
|
||||||
insertInto(TABLE_JOURNAL,USER_ID,MODULE,ACTION,DESCRIPTION)
|
var timestamp = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC);
|
||||||
.values(event.initiator().id(), event.module(), event.eventType(), event.describe())
|
var description = new JSONObject(event.describe(false).toMap()).toString(2);
|
||||||
|
insertInto(TABLE_JOURNAL,TIMESTAMP,USER_ID,MODULE,ENTITY_ID,ACTION,DESCRIPTION)
|
||||||
|
.values(timestamp,event.initiator().id(), event.module(), event.objectId(), event.eventType(), description)
|
||||||
.execute(db).close();
|
.execute(db).close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw databaseException(ERROR_WRITE_EVENT,event.eventType(),event.initiator().name());
|
throw databaseException(ERROR_WRITE_EVENT,event.eventType(),event.initiator().name());
|
||||||
|
|||||||
@@ -172,7 +172,11 @@ public class MessageSystem extends BaseHandler implements PostBox, EventListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event<?> event) {
|
public void onEvent(Event<?> event) {
|
||||||
var message = new TranslatableMessage(event.initiator(),event.subject(),event.describe(),null);
|
var description = event.describe(true);
|
||||||
|
var payload = event.payload();
|
||||||
|
var location = t("You can view/edit this {object} at {base_url}/{path}", OBJECT,t(payload.getClass().getSimpleName()), PATH,payload.path());
|
||||||
|
var body = t("{description}\n\n{location}", DESCRIPTION,description, LOCATION,location);
|
||||||
|
var message = new TranslatableMessage(event.initiator(),event.subject(),body,null);
|
||||||
var audience = new HashSet<>(event.audience());
|
var audience = new HashSet<>(event.audience());
|
||||||
audience.remove(event.initiator());
|
audience.remove(event.initiator());
|
||||||
send(new Envelope<>(0,message,audience));
|
send(new Envelope<>(0,message,audience));
|
||||||
|
|||||||
@@ -476,7 +476,10 @@ public class SqliteDb extends BaseDb implements StockDb {
|
|||||||
var rs = insertInto(TABLE_ITEMS, OWNER, OWNER_NUMBER, Field.CODE, NAME, DESCRIPTION, LOCATION_ID)
|
var rs = insertInto(TABLE_ITEMS, OWNER, OWNER_NUMBER, Field.CODE, NAME, DESCRIPTION, LOCATION_ID)
|
||||||
.values(item.owner().dbCode(), number, item.code(), item.name(), item.description(), item.location().id())
|
.values(item.owner().dbCode(), number, item.code(), item.name(), item.description(), item.location().id())
|
||||||
.execute(db).getGeneratedKeys();
|
.execute(db).getGeneratedKeys();
|
||||||
if (rs.next()) item.id(rs.getLong(1)).ownerNumber(number);
|
if (rs.next()) {
|
||||||
|
item.setId(rs.getLong(1));
|
||||||
|
item.ownerNumber(number);
|
||||||
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw failedToStoreObject(item.name()).causedBy(e);
|
throw failedToStoreObject(item.name()).causedBy(e);
|
||||||
|
|||||||
@@ -72,7 +72,10 @@
|
|||||||
"CUSTOMER-NUMBER": "Kundennummer",
|
"CUSTOMER-NUMBER": "Kundennummer",
|
||||||
"customer_number_prefix": "Präfix für Kundennummer",
|
"customer_number_prefix": "Präfix für Kundennummer",
|
||||||
"create": "anlegen",
|
"create": "anlegen",
|
||||||
|
"create_bookmark_description": "{url} was annotated with:\n{description}",
|
||||||
|
"create_bookmark_subject": "{user} created new bookmark",
|
||||||
"create_new_object": "{object} neu anlegen",
|
"create_new_object": "{object} neu anlegen",
|
||||||
|
"created_wiki_page":
|
||||||
"CREATE_USERS": "Nutzer anlegen",
|
"CREATE_USERS": "Nutzer anlegen",
|
||||||
"create_pdf": "PDF erzeugen",
|
"create_pdf": "PDF erzeugen",
|
||||||
"created_with": "erzeugt mit {tool} von {producer}",
|
"created_with": "erzeugt mit {tool} von {producer}",
|
||||||
@@ -87,12 +90,14 @@
|
|||||||
"data_sent": "Daten übermittelt",
|
"data_sent": "Daten übermittelt",
|
||||||
"date": "Datum",
|
"date": "Datum",
|
||||||
"delete": "löschen",
|
"delete": "löschen",
|
||||||
|
"delete_bookmark_subject": "{user} deleted {url}",
|
||||||
"delete_object": "{object} löschen",
|
"delete_object": "{object} löschen",
|
||||||
"DELETE_USERS": "Nutzer löschen",
|
"DELETE_USERS": "Nutzer löschen",
|
||||||
"deletes_nested": "Das wird auch alle enthaltenen Dateien löschen!",
|
"deletes_nested": "Das wird auch alle enthaltenen Dateien löschen!",
|
||||||
"delivery_date": "Lieferdatum",
|
"delivery_date": "Lieferdatum",
|
||||||
"depends_on": "hängt ab von",
|
"depends_on": "hängt ab von",
|
||||||
"description": "Beschreibung",
|
"description": "Beschreibung",
|
||||||
|
"Description:\n{description}": "Beschreibung:\n{description}",
|
||||||
"destination": "Ziel",
|
"destination": "Ziel",
|
||||||
"detail": "Details",
|
"detail": "Details",
|
||||||
"directory": "Verzeichnis",
|
"directory": "Verzeichnis",
|
||||||
@@ -257,7 +262,7 @@
|
|||||||
"my files": "Meine Dateien",
|
"my files": "Meine Dateien",
|
||||||
|
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"'{name}' has been added to '{object}' by '{user}'.": "'{name}' wurde von {user} zu '{object}' hinzugefügt.",
|
"\"{name}\" has been added to \"{object}\" by \"{user}\"": "„{name}“ wurde von „{user}“ zu „{object}“ hinzugefügt",
|
||||||
"net_price": "Nettopreis",
|
"net_price": "Nettopreis",
|
||||||
"net_sum": "Netto-Summe",
|
"net_sum": "Netto-Summe",
|
||||||
"new_contact": "neuer Kontakt",
|
"new_contact": "neuer Kontakt",
|
||||||
@@ -438,9 +443,11 @@
|
|||||||
"update": "aktualisieren",
|
"update": "aktualisieren",
|
||||||
"UPDATE_USERS" : "Nutzer aktualisieren",
|
"UPDATE_USERS" : "Nutzer aktualisieren",
|
||||||
"upload_file": "Datei hochladen",
|
"upload_file": "Datei hochladen",
|
||||||
|
"{url} was changed:\n{description}": "{url} wurde geändert:\n{description}",
|
||||||
"user": "Benutzer",
|
"user": "Benutzer",
|
||||||
"user ({id})": "Benutzer ({id})",
|
"user ({id})": "Benutzer ({id})",
|
||||||
"{user} added a new transaction: {entity}": "{user} hat einen neuen Umsatz hinzugefügt: {entity}",
|
"{user} added a new transaction: {entity}": "{user} hat einen neuen Umsatz hinzugefügt: {entity}",
|
||||||
|
"{user} shared {url}": "{user} teilte {url}",
|
||||||
"{user} updated the transaction '{entity}'": "{user} hat den Umsatz „{entity}“ aktualisiert",
|
"{user} updated the transaction '{entity}'": "{user} hat den Umsatz „{entity}“ aktualisiert",
|
||||||
"user_list": "Benutzer-Liste",
|
"user_list": "Benutzer-Liste",
|
||||||
"user_module" : "Umbrella User-Verwaltung",
|
"user_module" : "Umbrella User-Verwaltung",
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
"my files": "my files",
|
"my files": "my files",
|
||||||
|
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"'{name}' has been added to '{object}' by '{user}'.": "'{name}' has been added to '{object}' by '{user}'.",
|
"\"{name}\" has been added to \"{object}\" by \"{user}\"": "\"{name}\" has been added to \"{object}\" by \"{user}\"",
|
||||||
"net_price": "net price",
|
"net_price": "net price",
|
||||||
"net_sum": "net sum",
|
"net_sum": "net sum",
|
||||||
"new_contact": "new contact",
|
"new_contact": "new contact",
|
||||||
|
|||||||
@@ -161,6 +161,21 @@ public class UserModule extends BaseHandler implements UserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<Long, UmbrellaUser> loader() {
|
||||||
|
return new HashMap<Long, UmbrellaUser>(){
|
||||||
|
@Override
|
||||||
|
public UmbrellaUser get(Object key) {
|
||||||
|
if (key instanceof Long id){
|
||||||
|
var user = super.get(id);
|
||||||
|
if (user == null) put(id, user = loadUser(id));
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UmbrellaUser loadUser(long userId) throws UmbrellaException {
|
public UmbrellaUser loadUser(long userId) throws UmbrellaException {
|
||||||
return users.load(userId);
|
return users.load(userId);
|
||||||
|
|||||||
@@ -349,6 +349,10 @@ tr:hover .taglist .tag button {
|
|||||||
border-top-color: red;
|
border-top-color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.locations .selected span{
|
||||||
|
background: brown;
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
@media screen and (max-width: 900px) {
|
@media screen and (max-width: 900px) {
|
||||||
#app nav a{
|
#app nav a{
|
||||||
background: black;
|
background: black;
|
||||||
|
|||||||
@@ -345,6 +345,10 @@ code,
|
|||||||
border-top-color: gold;
|
border-top-color: gold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.locations .selected span{
|
||||||
|
background: gold;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
@media screen and (max-width: 900px) {
|
@media screen and (max-width: 900px) {
|
||||||
#app nav a{
|
#app nav a{
|
||||||
background: black;
|
background: black;
|
||||||
|
|||||||
@@ -296,7 +296,10 @@ tr:hover .taglist .tag button {
|
|||||||
border-top-color: blue;
|
border-top-color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.locations .selected span{
|
||||||
|
background: #afffff;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
@media screen and (max-width: 900px) {
|
@media screen and (max-width: 900px) {
|
||||||
#app nav a{
|
#app nav a{
|
||||||
background: white;
|
background: white;
|
||||||
|
|||||||
Reference in New Issue
Block a user