Merge branch 'feature/doc-optional-items' into dev
Build Docker Image / Docker-Build (push) Successful in 2m54s
Build Docker Image / Clean-Registry (push) Successful in 6s

This commit is contained in:
2026-07-21 20:42:53 +02:00
16 changed files with 128 additions and 11 deletions
@@ -124,13 +124,16 @@ public class SqliteDb extends BaseDb implements AccountDb {
db.setAutoCommit(false);
Query.delete().from(TABLE_TAGS_TRANSACTIONS).where(TRANSACTION_ID,equal(transaction.id())).execute(db);
Query.delete().from(TABLE_TRANSACTIONS).where(ID,equal(transaction.id())).execute(db);
db.setAutoCommit(true);
return transaction;
} catch (SQLException e){
try {
db.rollback();
} catch (SQLException ignored){};
throw failedToDropObject(transaction);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
@@ -67,9 +67,16 @@ public class SqliteDb extends BaseDb implements ContactDb{
db.setAutoCommit(false);
Query.delete().from(TABLE_CONTACTS).where(ID,equal(contact.id())).execute(db);
Query.delete().from(TABLE_CONTACTS_USERS).where(CONTACT_ID,equal(contact.id())).execute(db);
db.setAutoCommit(true);
} catch (SQLException e){
try {
db.rollback();
} catch (SQLException ignored){};
throw failedToDropObject(t(CONTACT_WITH_ID, ID,contact.id())).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
@@ -69,9 +69,15 @@ CREATE TABLE IF NOT EXISTS {0} ( {1} VARCHAR(255) PRIMARY KEY, {2} VARCHAR(255)
update(table).set(STATUS).where(STATUS,equal(20)).prepare(db).apply(40).execute();
update(table).set(STATUS).where(STATUS,equal(10)).prepare(db).apply(20).execute();
update(table).set(STATUS).where(STATUS,equal(0)).prepare(db).apply(10).execute();
db.setAutoCommit(true);
} catch (SQLException e) {
try {
db.rollback();
} catch (SQLException ignored) {}
throw new RuntimeException(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
}
@@ -198,11 +198,17 @@ CREATE TABLE IF NOT EXISTS {0} (
rs.close();
delete().from(TABLE_POSITIONS).where(DOCUMENT_ID,equal(docId)).execute(db);
delete().from(TABLE_DOCUMENTS).where(ID,equal(docId)).execute(db);
db.setAutoCommit(true);
if (number != null) return number;
throw failedToDropObject(t(DOCUMENT_WITH_ID, ID,docId));
} catch (SQLException e){
try {
db.rollback();
} catch (SQLException ignored){};
throw failedToDropObject(t(DOCUMENT_WITH_ID, ID,docId)).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
@@ -217,10 +223,16 @@ CREATE TABLE IF NOT EXISTS {0} (
stmt.setLong(2,pos);
stmt.execute();
stmt.close();
db.setAutoCommit(true);
return pos;
} catch (SQLException e) {
try {
db.rollback();
} catch (SQLException ignored){};
throw failedToDropObjectFromObject(POSITION,pos,t(Text.DOCUMENT),docId).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
@@ -582,9 +594,15 @@ CREATE TABLE IF NOT EXISTS {0} (
update(TABLE_POSITIONS).set(POS).where(DOCUMENT_ID,equal(docId)).where(POS,equal(pair.left())).prepare(db).apply(-pair.right()).close();
update(TABLE_POSITIONS).set(POS).where(DOCUMENT_ID,equal(docId)).where(POS,equal(pair.right())).prepare(db).apply(pair.left()).close();
update(TABLE_POSITIONS).set(POS).where(DOCUMENT_ID,equal(docId)).where(POS,equal(-pair.right())).prepare(db).apply(pair.right()).close();
db.setAutoCommit(true);
} catch (SQLException e) {
try {
db.rollback();
} catch (SQLException ignored){};
throw databaseException(FAILED_TO_SWITCH_POSITIONS,"a",pair.left(),"b",pair.right(),docId).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
return pair;
}
+7 -1
View File
@@ -1,6 +1,7 @@
<script>
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import { t } from '../../translations.svelte';
import LineEditor from '../../Components/LineEditor.svelte';
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
@@ -23,13 +24,17 @@
function movedown(){
movePos(pos.number,1);
}
async function toggleOptional(ev){
const ok = await submit(`${prefix}.optional`,!pos.optional);
if (ok) pos.optional = !pos.optional;
}
</script>
<style>
.move{
vertical-align: middle;
}
tr > *:nth-child(1){
text-align: right;
}
@@ -66,6 +71,7 @@
<span onclick={moveup}>⏫</span>
{/if}
<span onclick={() => drop(pos.number)}>❌</span>
<span class="symbol" onclick={toggleOptional} title={t(pos.optional?'optional position':'fixed position')}>{pos.optional?'':''}</span>
<span onclick={movedown}>⏬</span>
{/if}
</td>
@@ -63,10 +63,16 @@ public class SqliteDb extends BaseDb implements StockDb {
rs.close();
if (propertyId == null || propertyId == 0) throw failedToStoreObject(t(PROPERTY));
insertInto(TABLE_ITEM_PROPERTIES,ITEM_ID,PROPERTY_ID,VALUE).values(itemId,propertyId,value).execute(db).close();
db.setAutoCommit(true);
return new Property(propertyId,name,value,unit);
} catch (SQLException e) {
try {
db.rollback();
} catch (SQLException ignored){};
throw failedToStoreObject(t(PROPERTY)).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
@@ -601,13 +607,16 @@ public class SqliteDb extends BaseDb implements StockDb {
replaceLocationsTable();
replaceItemsTable();
replaceItemPropsTable();
db.setAutoCommit(true);
} catch (Exception e) {
try {
db.rollback();
} catch (SQLException ignored) {
}
throw databaseException(FAILED_TO_UPDATE_OBJECT, OBJECT, t(TABLE_WITH_NAME,NAME,TABLE_LOCATIONS)).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
@@ -340,7 +340,6 @@ CREATE TABLE IF NOT EXISTS {0} (
var addQuery = replaceInto(TABLE_TASK_DEPENDENCIES, TASK_ID, REQUIRED_TASK_ID);
for (var reqId : task.requiredTasksIds()) addQuery.values(task.id(), reqId);
addQuery.execute(db).close();
db.setAutoCommit(true);
}
task.clean(REQUIRED_TASKS_IDS);
@@ -354,7 +353,14 @@ CREATE TABLE IF NOT EXISTS {0} (
}
return task;
} catch (SQLException e){
try {
db.rollback();
} catch (SQLException ignored){};
throw failedToStoreObject(task.name()).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
@@ -84,10 +84,16 @@ CREATE TABLE IF NOT EXISTS {0} (
db.setAutoCommit(false);
Query.delete().from(TABLE_TASK_TIMES).where(TIME_ID,equal(timeId)).execute(db);
Query.delete().from(TABLE_TIMES).where(ID,equal(timeId)).execute(db);
db.setAutoCommit(false);
return timeId;
} catch (SQLException e) {
try {
db.rollback();
} catch (SQLException ignored) {}
throw failedToDropObject(t(TIME_WITH_ID, ID,timeId)).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}
+2
View File
@@ -167,6 +167,7 @@
"filter": "Filter",
"filter by tags": "Nach Tags filtern",
"first_transaction": "erste Transaktion",
"fixed position": "fester Posten",
"footer": "Fuß-Text",
"foreign_id": "externe Kennung",
"forgot_pass" : "Password vergessen?",
@@ -279,6 +280,7 @@
"oidc_Login" : "Anmeldung mit OIDC",
"old_password": "altes Passwort",
"option": "Option",
"optional position": "optionaler Posten",
"options": "Optionen",
"organization": "Organisation",
"other party": "Gegenseite",
+2
View File
@@ -167,6 +167,7 @@
"filter": "filter",
"filter by tags": "filter by tags",
"first_transaction": "first transaction",
"fixed position": "fixed position",
"footer": "footer",
"foreign_id": "external ID",
"forgot_pass" : "forgot password?",
@@ -279,6 +280,7 @@
"oidc_Login" : "Login via OIDC",
"old_password": "old password",
"option": "option",
"optional position": "optional position",
"options": "options",
"organization": "organization",
"other party": "other party",
@@ -341,6 +341,14 @@ tr:hover .taglist .tag button {
color: yellow;
}
.positions tr:nth-child(2n){
border-bottom-color: red;
}
.positions tbody tr:last-child{
border-top-color: red;
}
@media screen and (max-width: 900px) {
#app nav a{
background: black;
@@ -390,6 +390,7 @@ span.timetracking {
table{
min-width: 30vw;
border-collapse: collapse;
}
.start_end{
@@ -485,6 +486,14 @@ select.autocomplete{
width: calc(100% - 50px);
}
.positions tr:nth-child(2n){
border-bottom: 1px solid;
}
.positions tbody tr:last-child{
border-top: 3px solid;
}
@media screen and (min-width: 900px) {
#app nav > button.symbol{
display: none;
@@ -337,6 +337,14 @@ code,
color: black;
}
.positions tr:nth-child(2n){
border-bottom-color: gold;
}
.positions tbody tr:last-child{
border-top-color: gold;
}
@media screen and (max-width: 900px) {
#app nav a{
background: black;
@@ -484,6 +484,7 @@ span.timetracking {
table{
min-width: 30vw;
border-collapse: collapse;
}
.start_end{
@@ -589,6 +590,14 @@ select.autocomplete{
width: calc(100% - 50px);
}
.positions tr:nth-child(2n){
border-bottom: 1px solid;
}
.positions tbody tr:last-child{
border-top: 3px solid;
}
@media screen and (min-width: 900px) {
#app nav > button.symbol{
display: none;
@@ -288,6 +288,15 @@ tr:hover .taglist .tag button {
background: cyan;
}
.positions tr:nth-child(2n){
border-bottom-color: blue;
}
.positions tbody tr:last-child{
border-top-color: blue;
}
@media screen and (max-width: 900px) {
#app nav a{
background: white;
@@ -483,6 +483,7 @@ span.timetracking {
table{
min-width: 30vw;
border-collapse: collapse;
}
.start_end{
@@ -578,6 +579,14 @@ select.autocomplete{
width: calc(100% - 50px);
}
.positions tr:nth-child(2n){
border-bottom: 1px solid;
}
.positions tbody tr:last-child{
border-top: 3px solid;
}
@media screen and (min-width: 900px) {
#app nav > button.symbol{
display: none;