This commit is contained in:
+6
-6
@@ -8832,25 +8832,25 @@ def admin_mark_invoice_paid(borrow_id):
|
|||||||
)
|
)
|
||||||
|
|
||||||
flash('Rechnung wurde als bezahlt markiert.', 'success')
|
flash('Rechnung wurde als bezahlt markiert.', 'success')
|
||||||
return redirect(url_for('admin_borrowings'))
|
return redirect(url_for('library_loans_admin'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
app.logger.error(f"Error marking invoice paid for borrow {borrow_id}: {e}")
|
app.logger.error(f"Error marking invoice paid for borrow {borrow_id}: {e}")
|
||||||
flash('Fehler beim Markieren als bezahlt.', 'error')
|
flash('Fehler beim Markieren als bezahlt.', 'error')
|
||||||
return redirect(url_for('admin_borrowings'))
|
return redirect(url_for('library_loans_admin'))
|
||||||
finally:
|
finally:
|
||||||
if client:
|
if client:
|
||||||
client.close()
|
client.close()
|
||||||
|
|
||||||
|
|
||||||
@app.route('/admin/borrowings/<borrow_id>/invoice/pay', methods=['POST'])
|
@app.route('/admin/borrowings/<borrow_id>/invoice/pay', methods=['POST'])
|
||||||
def admin_pay_invoice_extended(borrow_id): # <--- HIER GEÄNDERT (Eindeutiger Funktionsname)
|
def admin_pay_invoice_extended(borrow_id):
|
||||||
"""Mark invoice as paid and complete borrowing if active."""
|
"""Mark invoice as paid and complete borrowing if active."""
|
||||||
if 'username' not in session:
|
if 'username' not in session:
|
||||||
flash('Ihnen ist es nicht gestattet, versuchen sie es erneut nach Anmeldung!', 'error')
|
flash('Ihnen ist es nicht gestattet, versuchen sie es erneut nach Anmeldung!', 'error')
|
||||||
return redirect(url_for('login'))
|
return redirect(url_for('login'))
|
||||||
|
|
||||||
current_permissions = us.get_effective_permissions(session['username'])
|
current_permissions = us.get_effective_permissions(session['username'])
|
||||||
if not current_permissions['pages'].get('admin_borrowings', False):
|
if not current_permissions['pages'].get('library_loans_admin', False):
|
||||||
flash('Ihnen fehlen die nötigen Berechtigungen.', 'error')
|
flash('Ihnen fehlen die nötigen Berechtigungen.', 'error')
|
||||||
return redirect(request.referrer or url_for('home_admin'))
|
return redirect(request.referrer or url_for('home_admin'))
|
||||||
|
|
||||||
@@ -8863,12 +8863,12 @@ def admin_pay_invoice_extended(borrow_id): # <--- HIER GEÄNDERT (Eindeutiger F
|
|||||||
borrow_doc = ausleihungen.find_one({'_id': ObjectId(borrow_id)})
|
borrow_doc = ausleihungen.find_one({'_id': ObjectId(borrow_id)})
|
||||||
if not borrow_doc:
|
if not borrow_doc:
|
||||||
flash('Ausleihung nicht gefunden.', 'error')
|
flash('Ausleihung nicht gefunden.', 'error')
|
||||||
return redirect(request.referrer or url_for('admin_borrowings'))
|
return redirect(request.referrer or url_for('library_loans_admin'))
|
||||||
|
|
||||||
invoice_data = borrow_doc.get('InvoiceData') or {}
|
invoice_data = borrow_doc.get('InvoiceData') or {}
|
||||||
if not invoice_data:
|
if not invoice_data:
|
||||||
flash('Für diese Ausleihung existiert keine Rechnung.', 'warning')
|
flash('Für diese Ausleihung existiert keine Rechnung.', 'warning')
|
||||||
return redirect(request.referrer or url_for('admin_borrowings'))
|
return redirect(request.referrer or url_for('library_loans_admin'))
|
||||||
|
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
update_fields = {'LastUpdated': now}
|
update_fields = {'LastUpdated': now}
|
||||||
|
|||||||
Reference in New Issue
Block a user