Halte die Richtung an der einzelnen Einbindung und mach sie in der Uebersicht waehlbar.
Deploy Development / deploy (push) Successful in 28s
Deploy Development / deploy (push) Successful in 28s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2664021e7f
commit
95381030bc
12 files changed
+185
-52
No files matched your search
+11
-5
@@ -665,10 +665,14 @@ def record_dates(conn, actor: UUID, scope_id: UUID, element_id: UUID, context: C
|
||||
audit(conn, actor, scope_id, "correspondence_recorded", "element", element_id, context)
|
||||
|
||||
|
||||
def chosen_direction(value: str | None) -> str | None:
|
||||
return value if value in ("in", "out", "local") else None
|
||||
|
||||
|
||||
def store_direction(conn, binding_id: UUID, direction: str | None, explicit: bool) -> None:
|
||||
if not explicit:
|
||||
return
|
||||
if direction not in (None, "in", "out"):
|
||||
if direction not in (None, "in", "out", "local"):
|
||||
raise unprocessable("Die Richtung ist ungültig.")
|
||||
conn.execute(
|
||||
"""
|
||||
@@ -703,7 +707,8 @@ def create_note(
|
||||
(element["id"], Json(document)),
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
store_direction(conn, binding["id"], communication_direction, communication_direction in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
audit(conn, actor, scope_id, "note_created", "element", element["id"], rights_context or target)
|
||||
if document_on is not None or sent_on is not None or received_on is not None:
|
||||
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
|
||||
@@ -792,8 +797,8 @@ def create_external(conn, actor: UUID, scope_id: UUID, title: str, source: str,
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
adopted = (detail or {}).get("direction") if source == "imap" else None
|
||||
chosen = communication_direction if communication_direction in ("in", "out") else adopted if adopted in ("in", "out") else None
|
||||
store_direction(conn, binding["id"], chosen, chosen in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction) or (adopted if adopted in ("in", "out") else None)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
|
||||
audit(conn, actor, scope_id, "external_ref_added", "element", element["id"], rights_context or target)
|
||||
return element | {"binding_id": binding["id"]}
|
||||
@@ -837,7 +842,8 @@ def create_file(conn, actor: UUID, scope_id: UUID, title: str, filename: str, da
|
||||
(element["id"], asset_id),
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
store_direction(conn, binding["id"], communication_direction, communication_direction in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
|
||||
audit(conn, actor, scope_id, "file_added", "element", element["id"], rights_context or target)
|
||||
return element | {"binding_id": binding["id"], "asset_id": asset_id}
|
||||
|
||||
Reference in new issue
Block a user