Fixes to the updates for the invpoice processing, Fix is a duplication error for admin_mark_invoice_paid
Release Inventarsystem / release-docker (push) Successful in 2m18s
Release Inventarsystem / release-docker (push) Successful in 2m18s
This commit is contained in:
+7
-8
@@ -93,6 +93,7 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
import Web.modules.database.settings as cfg
|
||||
from Web.modules.database.settings import MongoClient
|
||||
from tenant import get_tenant_context, get_tenant_db, get_tenant_trial_status, purge_expired_trial_tenants
|
||||
from pymongo.errors import DuplicateKeyError
|
||||
|
||||
|
||||
app = Flask(__name__, static_folder='static') # Correctly set static folder
|
||||
@@ -8759,11 +8760,13 @@ def admin_create_invoice(borrow_id):
|
||||
def admin_mark_invoice_paid(borrow_id):
|
||||
"""Mark an existing invoice as paid."""
|
||||
if 'username' not in session:
|
||||
flash('Ihnen ist es nicht gestattet auf dieser Internetanwendung, die eben besuchte Adrrese zu nutzen, versuchen sie es erneut nach dem sie sich mit einem berechtigten Nutzer angemeldet haben!', 'error')
|
||||
flash(
|
||||
'Ihnen ist es nicht gestattet auf dieser Internetanwendung, die eben besuchte Adrrese zu nutzen, versuchen sie es erneut nach dem sie sich mit einem berechtigten Nutzer angemeldet haben!',
|
||||
'error')
|
||||
return redirect(url_for('login'))
|
||||
|
||||
current_permissions = us.get_effective_permissions(session['username'])
|
||||
|
||||
|
||||
if not current_permissions['pages'].get('admin_borrowings', False):
|
||||
flash('Ihnen fehlen die nötigen Berechtigungen, um diese Aktion auszuführen.', 'error')
|
||||
return redirect(url_for('home_admin'))
|
||||
@@ -8840,8 +8843,8 @@ def admin_mark_invoice_paid(borrow_id):
|
||||
|
||||
|
||||
@app.route('/admin/borrowings/<borrow_id>/invoice/pay', methods=['POST'])
|
||||
def admin_mark_invoice_paid(borrow_id):
|
||||
"""Mark invoice as paid."""
|
||||
def admin_pay_invoice_extended(borrow_id): # <--- HIER GEÄNDERT (Eindeutiger Funktionsname)
|
||||
"""Mark invoice as paid and complete borrowing if active."""
|
||||
if 'username' not in session:
|
||||
flash('Ihnen ist es nicht gestattet, versuchen sie es erneut nach Anmeldung!', 'error')
|
||||
return redirect(url_for('login'))
|
||||
@@ -8870,7 +8873,6 @@ def admin_mark_invoice_paid(borrow_id):
|
||||
now = datetime.datetime.now()
|
||||
update_fields = {'LastUpdated': now}
|
||||
|
||||
# Rechnung auf bezahlt setzen
|
||||
if invoice_data.get('paid') is not True:
|
||||
update_fields.update({
|
||||
'InvoiceData.paid': True,
|
||||
@@ -8878,14 +8880,12 @@ def admin_mark_invoice_paid(borrow_id):
|
||||
'InvoiceData.paid_by': session.get('username', ''),
|
||||
})
|
||||
|
||||
# Ausleihe abschließen, falls noch aktiv
|
||||
if borrow_doc.get('Status') == 'active':
|
||||
update_fields['Status'] = 'completed'
|
||||
update_fields['End'] = now
|
||||
|
||||
ausleihungen.update_one({'_id': borrow_doc['_id']}, {'$set': update_fields})
|
||||
|
||||
# Logging
|
||||
try:
|
||||
db['system_logs'].insert_one({
|
||||
'type': 'invoice_paid',
|
||||
@@ -8918,7 +8918,6 @@ def admin_mark_invoice_paid(borrow_id):
|
||||
if client:
|
||||
client.close()
|
||||
|
||||
|
||||
@app.route('/admin/items/<item_id>/repair', methods=['POST'])
|
||||
def mark_damage_repaired(item_id):
|
||||
"""Mark item as repaired and make it available again."""
|
||||
|
||||
Reference in New Issue
Block a user