- Translations completed for Front-End, Configs (e.g. Forms) and free text.
- Allowed_languages and default_language now part of Tenant Make iso Tenant - Introduction of Translation into Traicie Selection Specialist
This commit is contained in:
@@ -106,20 +106,20 @@ def create_app(config_file=None):
|
||||
from flask_login import current_user
|
||||
import datetime
|
||||
|
||||
app.logger.debug(f"Before request - URL: {request.url}")
|
||||
app.logger.debug(f"Before request - Session permanent: {session.permanent}")
|
||||
# app.logger.debug(f"Before request - URL: {request.url}")
|
||||
# app.logger.debug(f"Before request - Session permanent: {session.permanent}")
|
||||
|
||||
# Log session expiry tijd als deze bestaat
|
||||
if current_user.is_authenticated:
|
||||
# Controleer of sessie permanent is (nodig voor PERMANENT_SESSION_LIFETIME)
|
||||
if not session.permanent:
|
||||
session.permanent = True
|
||||
app.logger.debug("Session marked as permanent (enables 60min timeout)")
|
||||
# app.logger.debug("Session marked as permanent (enables 60min timeout)")
|
||||
|
||||
# Log wanneer sessie zou verlopen
|
||||
if '_permanent' in session:
|
||||
expires_at = datetime.datetime.now() + app.permanent_session_lifetime
|
||||
app.logger.debug(f"Session will expire at: {expires_at} (60 min from now)")
|
||||
# if '_permanent' in session:
|
||||
# expires_at = datetime.datetime.now() + app.permanent_session_lifetime
|
||||
# app.logger.debug(f"Session will expire at: {expires_at} (60 min from now)")
|
||||
|
||||
@app.route('/debug/session')
|
||||
def debug_session():
|
||||
|
||||
@@ -16,7 +16,6 @@ class SessionDefaultsForm(FlaskForm):
|
||||
|
||||
# Tenant Defaults
|
||||
tenant_name = StringField('Tenant Name', validators=[DataRequired()])
|
||||
default_language = SelectField('Default Language', choices=[], validators=[DataRequired()])
|
||||
|
||||
# Partner Defaults
|
||||
partner_name = StringField('Partner Name', validators=[DataRequired()])
|
||||
|
||||
@@ -59,7 +59,6 @@ def session_defaults():
|
||||
form = SessionDefaultsForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
session['default_language'] = form.default_language.data
|
||||
if form.catalog.data:
|
||||
catalog_id = int(form.catalog.data)
|
||||
catalog = tenant_session.query(Catalog).get(catalog_id)
|
||||
|
||||
@@ -453,9 +453,6 @@ class DynamicFormBase(FlaskForm):
|
||||
else:
|
||||
render_kw['class'] = 'color-field'
|
||||
|
||||
|
||||
current_app.logger.debug(f"render_kw for {full_field_name}: {render_kw}")
|
||||
|
||||
# Create the field
|
||||
field_kwargs.update({
|
||||
'label': label,
|
||||
|
||||
@@ -18,8 +18,6 @@ class TenantForm(FlaskForm):
|
||||
code = StringField('Code', validators=[DataRequired()], render_kw={'readonly': True})
|
||||
type = SelectField('Tenant Type', validators=[Optional()], default='Active')
|
||||
website = StringField('Website', validators=[DataRequired(), Length(max=255)])
|
||||
# language fields
|
||||
default_language = SelectField('Default Language', choices=[], validators=[DataRequired()])
|
||||
# invoicing fields
|
||||
currency = SelectField('Currency', choices=[], validators=[DataRequired()])
|
||||
# Timezone
|
||||
@@ -32,8 +30,6 @@ class TenantForm(FlaskForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TenantForm, self).__init__(*args, **kwargs)
|
||||
# initialise language fields
|
||||
self.default_language.choices = [(lang, lang.lower()) for lang in current_app.config['SUPPORTED_LANGUAGES']]
|
||||
# initialise currency field
|
||||
self.currency.choices = [(curr, curr) for curr in current_app.config['SUPPORTED_CURRENCIES']]
|
||||
# initialise timezone
|
||||
@@ -53,8 +49,6 @@ class EditTenantForm(FlaskForm):
|
||||
code = StringField('Code', validators=[DataRequired()], render_kw={'readonly': True})
|
||||
type = SelectField('Tenant Type', validators=[Optional()], default='Active')
|
||||
website = StringField('Website', validators=[DataRequired(), Length(max=255)])
|
||||
# language fields
|
||||
default_language = SelectField('Default Language', choices=[], validators=[DataRequired()])
|
||||
# invoicing fields
|
||||
currency = SelectField('Currency', choices=[], validators=[DataRequired()])
|
||||
# Timezone
|
||||
@@ -69,8 +63,6 @@ class EditTenantForm(FlaskForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(EditTenantForm, self).__init__(*args, **kwargs)
|
||||
# initialise language fields
|
||||
self.default_language.choices = [(lang, lang.lower()) for lang in current_app.config['SUPPORTED_LANGUAGES']]
|
||||
# initialise currency field
|
||||
self.currency.choices = [(curr, curr) for curr in current_app.config['SUPPORTED_CURRENCIES']]
|
||||
# initialise timezone
|
||||
@@ -212,14 +204,17 @@ class EditTenantMakeForm(DynamicFormBase):
|
||||
active = BooleanField('Active', validators=[Optional()], default=True)
|
||||
website = StringField('Website', validators=[DataRequired(), Length(max=255)])
|
||||
logo_url = StringField('Logo URL', validators=[Optional(), Length(max=255)])
|
||||
default_language = SelectField('Default Language', choices=[], validators=[DataRequired()])
|
||||
allowed_languages = SelectMultipleField('Allowed Languages', choices=[], validators=[Optional()])
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(EditTenantMakeForm, self).__init__(*args, **kwargs)
|
||||
# Initialiseer de taalopties met taalcodes en vlaggen
|
||||
lang_details = current_app.config['SUPPORTED_LANGUAGE_DETAILS']
|
||||
self.allowed_languages.choices = [(details['iso 639-1'], f"{details['flag']} {details['iso 639-1']}")
|
||||
for name, details in lang_details.items()]
|
||||
choices = [(details['iso 639-1'], f"{details['flag']} {details['iso 639-1']}")
|
||||
for name, details in lang_details.items()]
|
||||
self.allowed_languages.choices = choices
|
||||
self.default_language.choices = choices
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -309,7 +309,6 @@ def handle_tenant_selection():
|
||||
|
||||
# set tenant information in the session
|
||||
session['tenant'] = the_tenant.to_dict()
|
||||
session['default_language'] = the_tenant.default_language
|
||||
# remove catalog-related items from the session
|
||||
session.pop('catalog_id', None)
|
||||
session.pop('catalog_name', None)
|
||||
@@ -706,8 +705,9 @@ def edit_tenant_make(tenant_make_id):
|
||||
form = EditTenantMakeForm(request.form, obj=tenant_make)
|
||||
|
||||
# Initialiseer de allowed_languages selectie met huidige waarden
|
||||
if tenant_make.allowed_languages:
|
||||
form.allowed_languages.data = tenant_make.allowed_languages
|
||||
if request.method == 'GET':
|
||||
if tenant_make.allowed_languages:
|
||||
form.allowed_languages.data = tenant_make.allowed_languages
|
||||
|
||||
customisation_config = cache_manager.customisations_config_cache.get_config("CHAT_CLIENT_CUSTOMISATION")
|
||||
form.add_dynamic_fields("configuration", customisation_config, tenant_make.chat_customisation_options)
|
||||
@@ -717,7 +717,9 @@ def edit_tenant_make(tenant_make_id):
|
||||
form.populate_obj(tenant_make)
|
||||
tenant_make.chat_customisation_options = form.get_dynamic_data("configuration")
|
||||
# Verwerk allowed_languages als array
|
||||
current_app.logger.debug(f"Allowed languages: {form.allowed_languages.data}")
|
||||
tenant_make.allowed_languages = form.allowed_languages.data if form.allowed_languages.data else None
|
||||
current_app.logger.debug(f"Updated allowed languages: {tenant_make.allowed_languages}")
|
||||
|
||||
# Update logging information
|
||||
update_logging_information(tenant_make, dt.now(tz.utc))
|
||||
|
||||
Reference in New Issue
Block a user