This commit is contained in:
+24
@@ -9120,6 +9120,30 @@ def admin_add_invoice_correction(borrow_id):
|
||||
if client:
|
||||
client.close()
|
||||
|
||||
@app.route('/admin/items/<item_id>/resolve_repair', methods=['POST'])
|
||||
def admin_resolve_repair(item_id):
|
||||
"""Flask-Route für die Reparatur-Aktionen (repair, replace, delete)."""
|
||||
if 'username' not in session:
|
||||
flash('Bitte melden Sie sich an, um fortzufahren.', 'error')
|
||||
return redirect(url_for('login'))
|
||||
|
||||
current_permissions = us.get_effective_permissions(session['username'])
|
||||
if not current_permissions['pages'].get('admin_inventory', False):
|
||||
flash('Ihnen fehlen die nötigen Berechtigungen für diese Aktion.', 'error')
|
||||
return redirect(url_for('home_admin'))
|
||||
|
||||
action = request.form.get('action_type', 'repair')
|
||||
new_code_4 = request.form.get('new_code_4', '')
|
||||
current_user = session.get('username', 'admin')
|
||||
|
||||
success, message = resolve_repaired_item(item_id, action, new_code_4, current_user)
|
||||
|
||||
if success:
|
||||
flash(message, 'success')
|
||||
else:
|
||||
flash(message, 'error')
|
||||
|
||||
return redirect(url_for('library_inventory_admin'))
|
||||
|
||||
def resolve_repaired_item(item_id, action, new_code_4="", current_user="admin"):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user