aktiv-inaktiv der Lizenzen ist gefixt
Dieser Commit ist enthalten in:
@@ -65,22 +65,22 @@ def toggle_license(license_id):
|
||||
if not license_data:
|
||||
return jsonify({'error': 'Lizenz nicht gefunden'}), 404
|
||||
|
||||
new_status = not license_data['active']
|
||||
new_status = not license_data['is_active']
|
||||
|
||||
# Update status
|
||||
cur.execute("UPDATE licenses SET active = %s WHERE id = %s", (new_status, license_id))
|
||||
cur.execute("UPDATE licenses SET is_active = %s WHERE id = %s", (new_status, license_id))
|
||||
conn.commit()
|
||||
|
||||
# Log change
|
||||
log_audit('TOGGLE', 'license', license_id,
|
||||
old_values={'active': license_data['active']},
|
||||
new_values={'active': new_status})
|
||||
old_values={'is_active': license_data['is_active']},
|
||||
new_values={'is_active': new_status})
|
||||
|
||||
return jsonify({'success': True, 'active': new_status})
|
||||
return jsonify({'success': True, 'is_active': new_status})
|
||||
|
||||
except Exception as e:
|
||||
conn.rollback()
|
||||
logging.error(f"Fehler beim Umschalten der Lizenz: {str(e)}")
|
||||
logging.error(f"Fehler beim Umschalten der Lizenz: {str(e)}", exc_info=True)
|
||||
return jsonify({'error': 'Fehler beim Umschalten der Lizenz'}), 500
|
||||
finally:
|
||||
cur.close()
|
||||
@@ -104,8 +104,8 @@ def bulk_activate_licenses():
|
||||
# Update all selected licenses
|
||||
cur.execute("""
|
||||
UPDATE licenses
|
||||
SET active = true
|
||||
WHERE id = ANY(%s) AND active = false
|
||||
SET is_active = true
|
||||
WHERE id = ANY(%s) AND is_active = false
|
||||
RETURNING id
|
||||
""", (license_ids,))
|
||||
|
||||
@@ -115,7 +115,7 @@ def bulk_activate_licenses():
|
||||
# Log changes
|
||||
for license_id in updated_ids:
|
||||
log_audit('BULK_ACTIVATE', 'license', license_id,
|
||||
new_values={'active': True})
|
||||
new_values={'is_active': True})
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
@@ -148,8 +148,8 @@ def bulk_deactivate_licenses():
|
||||
# Update all selected licenses
|
||||
cur.execute("""
|
||||
UPDATE licenses
|
||||
SET active = false
|
||||
WHERE id = ANY(%s) AND active = true
|
||||
SET is_active = false
|
||||
WHERE id = ANY(%s) AND is_active = true
|
||||
RETURNING id
|
||||
""", (license_ids,))
|
||||
|
||||
@@ -159,7 +159,7 @@ def bulk_deactivate_licenses():
|
||||
# Log changes
|
||||
for license_id in updated_ids:
|
||||
log_audit('BULK_DEACTIVATE', 'license', license_id,
|
||||
new_values={'active': False})
|
||||
new_values={'is_active': False})
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
@@ -451,10 +451,10 @@ def quick_edit_license(license_id):
|
||||
new_values['valid_until'] = data['valid_until']
|
||||
|
||||
if 'active' in data:
|
||||
updates.append("active = %s")
|
||||
updates.append("is_active = %s")
|
||||
params.append(bool(data['active']))
|
||||
old_values['active'] = current_license['active']
|
||||
new_values['active'] = bool(data['active'])
|
||||
old_values['is_active'] = current_license['is_active']
|
||||
new_values['is_active'] = bool(data['active'])
|
||||
|
||||
if not updates:
|
||||
return jsonify({'error': 'Keine Änderungen angegeben'}), 400
|
||||
@@ -797,7 +797,7 @@ def global_search():
|
||||
try:
|
||||
# Suche in Lizenzen
|
||||
cur.execute("""
|
||||
SELECT id, license_key, customer_name, active
|
||||
SELECT id, license_key, customer_name, is_active
|
||||
FROM licenses
|
||||
WHERE license_key ILIKE %s
|
||||
OR customer_name ILIKE %s
|
||||
@@ -810,7 +810,7 @@ def global_search():
|
||||
'id': row[0],
|
||||
'license_key': row[1],
|
||||
'customer_name': row[2],
|
||||
'active': row[3]
|
||||
'is_active': row[3]
|
||||
})
|
||||
|
||||
# Suche in Kunden
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren