Changes to habe he template name right and the right correction for the library Item and a parameter mismatch
Release Inventarsystem / release-docker (push) Successful in 2m22s

This commit is contained in:
2026-08-12 12:26:10 +02:00
parent 9452743660
commit d58958db39
3 changed files with 35 additions and 22 deletions
+6 -8
View File
@@ -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. Processes Filters 1-3 for ALL items,
and applies Library-specific fields when the item is a Library item.
Endpoint for editing items. Correctly determines library vs inventory status
and renders Filter 1-3 for ALL item types.
"""
if 'username' not in session:
if request.method == 'POST' and request.is_json:
@@ -6435,8 +6435,9 @@ def item_edit(id):
current_item['IndividualCodes'] = '\n'.join(individual_codes)
# FIXED: Changed 'edit_library.html' to 'item_edit.html'
return render_template(
'edit_library.html',
'item_edit.html',
username=session['username'],
item=current_item,
show_library_features=show_library_features,
@@ -6499,19 +6500,17 @@ def item_edit(id):
# Type-specific processing
if show_library_features:
# --- 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', ''))
images = current_item.get('Images', [])
else:
# --- INVENTORY ITEM SPECIFICS ---
item_isbn = current_item.get('ISBN', '')
item_type = 'other'
library_category = current_item.get('library_category', '')
# Manage images for Inventory Mode
# Manage images for Inventory Items
images_to_keep = request.form.getlist('existing_images')
original_images = current_item.get('Images', [])
images = [img for img in original_images if img in images_to_keep]
@@ -6552,7 +6551,7 @@ def item_edit(id):
except Exception as e:
app.logger.error(f"Image error for item {id}: {e}")
# Auto-add location to predefined locations list if applicable
# Auto-add location if applicable
if ort and ort not in it.get_predefined_locations():
it.add_predefined_location(ort)
@@ -6586,7 +6585,6 @@ def item_edit(id):
return redirect(redirect_target)
@app.route('/update_group', methods=['POST'])
def update_group():