Skip to content
Snippets Groups Projects
Commit 9b6cf7bf authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch...

Merge branch '503-click-on-generate-mail-for-available-multilingual-voucher-template-occurs-in-internal-error' into 'master'

Resolve "click on "Generate Mail" for available multilingual voucher template occurs  in internal error"

Closes #503

See merge request !420
parents c0046b7c 28c9174d
No related branches found
Tags v1.1.0
1 merge request!420Resolve "click on "Generate Mail" for available multilingual voucher template occurs in internal error"
Pipeline #54356 passed
smasch (1.1.0~beta.1-1) unstable; urgency=low
smasch (1.1.0-1) unstable; urgency=medium
* improvement: page size in list of workers can be changed (#400)
* improvement: list of workers contain username (#400)
* improvement: all details in subjects can be switched off in configuration
(#453)
* improvement: after subject type is changed the follow up visits dates are
created based on the current visit time (#384, #299)
* improvement: user can modify/add Subject types with custom follow up schema
(#371)
* improvement: added week day to daily planning main date (#425)
* improvement: possibility to import custom fields data from csv file (#385)
* improvement: added warning in case of printing voucher with no voucher
templates (#451)
* improvement: typos fixed (#467, #469)
* improvement: study contains single configuration item for using vouchers
(#448)
* improvement: logout button is more visible (#393)
* improvement: list of subject visits renders faster in case there are many
subjects in study (#387)
* improvement: when listing vouchers use human readable name (#447)
* improvement: mail templates can use custom field values (#421)
* improvement: possibility to re-enable disabled worker (#405)
* improvement: possibility to add/edit/remove location (#389)
* improvement: possibility to add recurring general appointment (#481)
* improvement: basic support for LDAP authentication added (#380)
* improvement: put current date in the mail template tag examples (#436)
* improvement: remove sorting from columns that do not require sorting in
mail template menu and languages menu (#436)
* improvement: added explanatory tooltip for the column `order` in language
menu (#436)
* improvement: warn the user on invalid date range when creating a
holidays/extra availability (#427)
* improvement: edit/add worker contain tooltip about worker locations (#399)
* improvement: allow to assign empty value to email configuration option so
automatic emails can be turned off (#496)
* small improvement: typos fixed (#489)
* bug fix: impossible to add subject when screening number is disabled (#501)
* bug fix: worker without any location assigned should not see any
appointment (#500)
* bug fix: hard restart of ubuntu was removing /run/smasch/ folder required
to start application
* bug fix: there was no possibility to mark mail template as multilingual
(#499)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 22 Mar 2022 16:00:00 +0200
smasch (1.1.0~beta.0-1) unstable; urgency=low
* improvement: allow to assign empty value to email configuration option so
automatic emails can be turned off (#496)
* small improvement: typos fixed (#489)
* bug fix: removing Location/Room crashed when they were used in the
subject/worker/appointment data (#491)
* bug fix: when study column resigned is disabled then changing data in
subject was not possible (#494)
* bug fix: "---" country removed from Default country in edit subject import
details (#495)
* bug fix: problem with 2 factor auhentication fixed (#486)
* bug fix: problem with 2 factor authentication fixed (#486)
* bug fix: voucher status is displayed properly in edit subject page (#490)
* bug fix: add worker did not contain tooltip about worker locations (#487)
* bug fix: cancel button in edit location pointed to list of languages (#497)
* bug fix: don't allow to create mail template with language for which locale
is not installed (#435)
* bug fix: when editing/adding/listing study subject highlight proper menu
entry (#498)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 3 Feb 2022 16:00:00 +0200
smasch (1.1.0~alpha.0-1) unstable; urgency=low
* improvement: mail templates can use custom field values (#421)
* improvement: possibility to re-enable disabled worker (#405)
* improvement: possibility to add/edit/remove location (#389)
* improvement: possibility to add recurring general appointment (#481)
* improvement: basic support for LDAP authentication added (#380)
* improvement: put current date in the mail template tag examples (#436)
* improvement: remove sorting from columns that do not require sorting in
mail template menu and languages menu (#436)
* improvement: added explanatory tooltip for the column `order` in language
menu (#436)
* improvement: warn the user on invalid date range when creating a
holidays/extra availability (#427)
* improvement: edit/add worker contain tooltip about worker locations (#399)
* improvement: user can modify/add Subject types with custom follow up schema
(#371)
* improvement: added week day to daily planning main date (#425)
* improvement: possibility to import custom fields data from csv file (#385)
* improvement: added warning in case of printing voucher with no voucher
templates (#451)
* improvement: typos fixed (#467, #469)
* improvement: study contains single configuration item for using vouchers
(#448)
* improvement: logout button is more visible (#393)
* improvement: list of subject visits renders faster in case there are many
subjects in study (#387)
* improvement: when listing vouchers use human readable name (#447)
* improvement: page size in list of workers can be changed (#400)
* improvement: list of workers contain username (#400)
* improvement: all details in subjects can be switched off in configuration
(#453)
* improvement: after subject type is changed the follow up visits dates are
created based on the current visit time (#384, #299)
* bug fix: location list in edit/add appointment should be limited to worker
locations (#446)
* bug fix: removing location removed all appointments in this location (#434)
......@@ -107,7 +95,7 @@ smasch (1.1.0~alpha.0-1) unstable; urgency=low
* bug fix: when adding/editing appointment length must be a positive value
(#464, 462)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 29 Oct 2021 13:00:00 +0200
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 30 Mar 2022 09:00:00 +0200
smasch (1.0.2-1) stable; urgency=low
......
......@@ -282,7 +282,7 @@ class MailTemplate(models.Model):
return {}
@staticmethod
def get_subject_replacements(study_subject: StudySubject) -> dict:
def get_subject_replacements(study_subject: StudySubject = None) -> dict:
result = {}
if study_subject is not None:
date_born = date_to_str(study_subject.subject.date_born, DATE_FORMAT_SHORT)
......@@ -321,8 +321,8 @@ class MailTemplate(models.Model):
result["##S_HEALTH_PARTNER_ZIP_CODE##"] = ""
result["##S_HEALTH_PARTNER_CITY##"] = ""
for field in CustomStudySubjectField.objects.filter(study__id=GLOBAL_STUDY_ID).iterator():
result[get_field_id(field)] = study_subject.get_custom_field_value(field.name)
for field in CustomStudySubjectField.objects.filter(study__id=GLOBAL_STUDY_ID).iterator():
result[get_field_id(field)] = study_subject.get_custom_field_value(field.name)
return result
......
......@@ -258,7 +258,7 @@ desired effect
{% block footer %}
<!-- To the right -->
<div class="pull-right hidden-xs">
Version: <strong>1.1.0~beta.1</strong>
Version: <strong>1.1.0</strong>
</div>
<!-- Default to the left -->
......
......@@ -47,7 +47,7 @@
<td>{{ forloop.counter }}</td>
<td>{{ mail_template.get_context_display }}</td>
<td>{% autoescape off %}{{ mail_template.language.image_img }}{% endautoescape %}
{% if not mail_template.language.is_locale_installed %}
{% if mail_template.language and not mail_template.language.is_locale_installed %}
<i class="fa fa-exclamation-triangle" aria-hidden="true"
data-toggle="tooltip" data-placement="top"
title="Locale for this language is not installed on this machine.
......
......@@ -314,6 +314,16 @@ class MailTemplateModelTests(TestCase):
key = get_field_id(field)
self.assertEqual(replacements.get(key, None), "test val", "Wrong value for field {}".format(key))
def test_replacement_for_custom_field_with_no_subject(self):
study = Study.objects.get(id=GLOBAL_STUDY_ID)
field = CustomStudySubjectField.objects.create(study=study,
name="custom-name",
default_value="val123",
type=CUSTOM_FIELD_TYPE_TEXT, possible_values="")
replacements = MailTemplate.get_subject_replacements()
key = get_field_id(field)
self.assertIsNone(replacements.get(key, None), "Wrong value for field {}".format(key))
def test_get_field_id(self):
field = CustomStudySubjectField.objects.create(study=Study.objects.get(id=GLOBAL_STUDY_ID),
name="bla bla-5",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment