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