Changes to reflekt the right inventar and bibliothek item fields
Release Inventarsystem / release-docker (push) Successful in 2m17s
Release Inventarsystem / release-docker (push) Successful in 2m17s
This commit is contained in:
+17
-18
@@ -6383,8 +6383,8 @@ def is_library_item(item):
|
||||
@app.route('/item_edit/<id>', methods=['GET', 'POST'])
|
||||
def item_edit(id):
|
||||
"""
|
||||
Complete endpoint for editing items. Automatically detects whether the item
|
||||
is a Library item (ItemType != 'other') or an Inventory item (ItemType == 'other').
|
||||
Complete endpoint for editing items. Processes Filters 1-3 for ALL items,
|
||||
and applies Library-specific fields when the item is a Library item.
|
||||
"""
|
||||
if 'username' not in session:
|
||||
if request.method == 'POST' and request.is_json:
|
||||
@@ -6410,7 +6410,7 @@ def item_edit(id):
|
||||
flash('Element in der Datenbank nicht gefunden.', 'error')
|
||||
return redirect(url_for('home_admin'))
|
||||
|
||||
# Determine item type classification
|
||||
# Determine item classification
|
||||
library_module_active = cfg.MODULES.is_enabled('library')
|
||||
is_lib_item = it.is_library_item(current_item)
|
||||
show_library_features = library_module_active and is_lib_item
|
||||
@@ -6457,7 +6457,12 @@ def item_edit(id):
|
||||
anschaffungs_kosten = sanitize_form_value(request.form.get('anschaffungskosten'))
|
||||
reservierbar = 'reservierbar' in request.form
|
||||
|
||||
# Barcodes
|
||||
# System Filters 1, 2, and 3 (Processed for ALL items)
|
||||
filter1 = expand_filter_selection(sanitize_form_value(request.form.getlist('filter')), 1)
|
||||
filter2 = expand_filter_selection(sanitize_form_value(request.form.getlist('filter2')), 2)
|
||||
filter3 = sanitize_form_value(request.form.getlist('filter3'))
|
||||
|
||||
# Barcodes & Group Codes
|
||||
code_4 = sanitize_form_value(request.form.get('code_4'))
|
||||
individual_codes_raw = request.form.get('individual_codes', '')
|
||||
|
||||
@@ -6494,26 +6499,18 @@ def item_edit(id):
|
||||
|
||||
# Type-specific processing
|
||||
if show_library_features:
|
||||
# --- LIBRARY ITEM ---
|
||||
# --- LIBRARY ITEM SPECIFICS ---
|
||||
isbn_raw = sanitize_form_value(request.form.get('isbn', ''))
|
||||
item_isbn = normalize_and_validate_isbn(isbn_raw) if isbn_raw else ''
|
||||
item_type = sanitize_form_value(request.form.get('item_type_input', 'Buch'))
|
||||
library_category = sanitize_form_value(request.form.get('library_category', ''))
|
||||
|
||||
filter1 = current_item.get('Filter', [])
|
||||
filter2 = current_item.get('Filter2', [])
|
||||
filter3 = current_item.get('Filter3', [])
|
||||
images = current_item.get('Images', [])
|
||||
else:
|
||||
# --- INVENTORY ITEM ---
|
||||
# --- INVENTORY ITEM SPECIFICS ---
|
||||
item_isbn = current_item.get('ISBN', '')
|
||||
item_type = 'other' # Standard type for inventory items
|
||||
item_type = 'other'
|
||||
library_category = current_item.get('library_category', '')
|
||||
|
||||
filter1 = expand_filter_selection(sanitize_form_value(request.form.getlist('filter')), 1)
|
||||
filter2 = expand_filter_selection(sanitize_form_value(request.form.getlist('filter2')), 2)
|
||||
filter3 = sanitize_form_value(request.form.getlist('filter3'))
|
||||
|
||||
# Manage images for Inventory Mode
|
||||
images_to_keep = request.form.getlist('existing_images')
|
||||
original_images = current_item.get('Images', [])
|
||||
@@ -6555,14 +6552,14 @@ def item_edit(id):
|
||||
except Exception as e:
|
||||
app.logger.error(f"Image error for item {id}: {e}")
|
||||
|
||||
# Auto-add new location to predefined locations list if applicable
|
||||
# Auto-add location to predefined locations list if applicable
|
||||
if ort and ort not in it.get_predefined_locations():
|
||||
it.add_predefined_location(ort)
|
||||
|
||||
# Sync series/group barcode IDs
|
||||
# Sync group barcodes
|
||||
it.sync_group_codes(str(id), code_4, individual_codes)
|
||||
|
||||
# Update item in database
|
||||
# Save to MongoDB
|
||||
success = it.update_item(
|
||||
id=str(id),
|
||||
name=name,
|
||||
@@ -6588,6 +6585,8 @@ def item_edit(id):
|
||||
flash('Fehler beim Aktualisieren des Artikels.', 'error')
|
||||
|
||||
return redirect(redirect_target)
|
||||
|
||||
|
||||
@app.route('/update_group', methods=['POST'])
|
||||
def update_group():
|
||||
|
||||
|
||||
Reference in New Issue
Block a user