changes to the booking procedure
This commit is contained in:
+12
-10
@@ -42,7 +42,6 @@ BOOKING_PACKAGE_MAP = {
|
||||
"terminverwaltung": "Terminverwaltung",
|
||||
"emailversand": "E-Mail Versand",
|
||||
"schultraeger": "Schulträger Angebot",
|
||||
"telefonsupport": "Telefonsupport 20/Monat",
|
||||
}
|
||||
|
||||
BOOKING_FLOW_MAP = {
|
||||
@@ -70,7 +69,6 @@ BOOKING_PRICE_MAP = {
|
||||
"terminverwaltung": 100.0,
|
||||
"emailversand": 50.0,
|
||||
"schultraeger": 0.0,
|
||||
"telefonsupport": 20.0,
|
||||
}
|
||||
BOOKING_ADMIN_EMAIL_FALLBACK = os.environ.get("BOOKING_ADMIN_EMAIL", "").strip()
|
||||
|
||||
@@ -1969,10 +1967,15 @@ def preise():
|
||||
return render_template("preise.html")
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from flask import request, jsonify, session, flash, redirect, url_for, render_template
|
||||
from pymongo.errors import PyMongoError
|
||||
|
||||
|
||||
@app.route('/preise/book-option', methods=['POST'])
|
||||
@login_required
|
||||
def book_option_package():
|
||||
# Supports comma-separated multi-item selection ("packages") and fallback ("package")
|
||||
# Supports both "packages" (multi-select/cart) and "package" (single form)
|
||||
packages_raw = _sanitize_text(request.form.get("packages") or request.form.get("package") or "", 200).lower()
|
||||
booking_flow = _sanitize_text(request.form.get("flow") or "payment", 24).lower()
|
||||
|
||||
@@ -1989,7 +1992,7 @@ def book_option_package():
|
||||
@app.route('/booking/payment', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def booking_payment():
|
||||
# Accepts single or comma-separated packages (e.g. "inventarsystem,terminverwaltung,emailversand")
|
||||
# Accept comma-separated list of items (e.g. "inventarsystem,buecherei,terminverwaltung")
|
||||
packages_str = _sanitize_text(request.values.get("packages") or request.values.get("package") or "", 200).lower()
|
||||
booking_flow = _sanitize_text(request.values.get("flow") or "payment", 24).lower()
|
||||
|
||||
@@ -2002,7 +2005,7 @@ def booking_payment():
|
||||
|
||||
package_list = [p.strip() for p in packages_str.split(',') if p.strip()]
|
||||
|
||||
# Validate each selected article, accumulate labels and total price
|
||||
# Validate each option against BOOKING_PACKAGE_MAP and calculate total price
|
||||
selected_package_names = []
|
||||
total_price = 0.0
|
||||
for pkg in package_list:
|
||||
@@ -2014,9 +2017,9 @@ def booking_payment():
|
||||
flash(f"Ungültige Buchungsoption: {pkg}", "error")
|
||||
return redirect(url_for("preise"))
|
||||
|
||||
# Formatted display string (e.g., "Inventarsystem, Terminplaner")
|
||||
# Combined label string for UI and DB (e.g., "Inventarsystem, Bücherei")
|
||||
selected_package = ", ".join(selected_package_names)
|
||||
package_raw = packages_str # Stores raw keys in DB
|
||||
package_raw = packages_str # Raw keys string for DB
|
||||
|
||||
flow_config = BOOKING_FLOW_MAP[booking_flow]
|
||||
|
||||
@@ -2142,11 +2145,10 @@ def booking_payment():
|
||||
except Exception:
|
||||
provision_port = port
|
||||
|
||||
# Dynamically collect all valid requested modules for multi-article provisioning
|
||||
valid_modules = {"inventarsystem", "buecherei", "terminverwaltung", "emailversand", "starter", "advanced"}
|
||||
# Provision all valid modules found in the list (e.g., "inventarsystem", "buecherei")
|
||||
valid_modules = set(BOOKING_PACKAGE_MAP.keys())
|
||||
modules_to_provision = {pkg for pkg in package_list if pkg in valid_modules}
|
||||
|
||||
# Provision/enable each selected module on the newly created instance
|
||||
for mod in modules_to_provision:
|
||||
try:
|
||||
edit_ok = steering.instance.edit(subdomain, mod)
|
||||
|
||||
Reference in New Issue
Block a user