From 64a9d81dd8b8b25d3073e94ebc9a40ac2f5ddce0 Mon Sep 17 00:00:00 2001 From: supertom01 Date: Mon, 2 Oct 2023 20:00:18 +0200 Subject: [PATCH 1/2] Send an email for newly enrolled members --- .../members/templates/members/new_member.mail | 12 +++++++++ amelie/members/views.py | 27 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 amelie/members/templates/members/new_member.mail diff --git a/amelie/members/templates/members/new_member.mail b/amelie/members/templates/members/new_member.mail new file mode 100644 index 0000000..251a148 --- /dev/null +++ b/amelie/members/templates/members/new_member.mail @@ -0,0 +1,12 @@ +{% extends "iamailer/email_basic.mail" %} +{% load i18n htmlify only %} + +{% block subject %}{% blocktrans %}[Inter-Actief] Welcome human!{% endblocktrans %}{% endblock %} + +{% block content %}{% htmlify %}{% blocktrans %}Dear{% endblocktrans %} {{ recipient.first_name }}, + +{% blocktrans %}Hereby, Vadim would like to welcome you to our beautiful association. May the cookie corner credit be in your favour.{% endblocktrans %} + +{% blocktrans %}Kind regards, + +The board of Inter-Actief{% endblocktrans %}{% endhtmlify %}{% endblock %} diff --git a/amelie/members/views.py b/amelie/members/views.py index 8ffc78f..70601ce 100644 --- a/amelie/members/views.py +++ b/amelie/members/views.py @@ -31,6 +31,7 @@ from django.views.generic.edit import DeleteView, FormView from amelie.claudia.models import Mapping, ExtraPerson +from amelie.iamailer import MailTask from amelie.members.forms import PersonDataForm, StudentNumberForm, \ RegistrationFormPersonalDetails, RegistrationFormStepMemberContactDetails, \ RegistrationFormStepParentsContactDetails, RegistrationFormStepFreshmenStudyDetails, \ @@ -48,6 +49,7 @@ from amelie.tools.encodings import normalize_to_ascii from amelie.tools.http import HttpResponseSendfile, HttpJSONResponse from amelie.tools.logic import current_academic_year_with_holidays, current_association_year +from amelie.tools.mail import PersonRecipient from amelie.tools.mixins import DeleteMessageMixin, RequireBoardMixin from amelie.tools.pdf import pdf_separator_page, pdf_membership_page, pdf_authorization_page @@ -392,6 +394,17 @@ def person_anonymize(request, id, slug): return render(request, 'person_anonymization_success.html', {'person': person}) +def send_new_member_email(person: Person): + """ + Send an email to a new member. This function is used for each type of member. + """ + template_name = "members/new_member.mail" + task = MailTask(template_name=template_name) + task.add_recipient(PersonRecipient(person, context={'membership': person.membership})) + + task.send() + + class RegisterNewGeneralWizardView(RequireBoardMixin, SessionWizardView): template_name = "person_registration_form_general.html" form_list = [RegistrationFormPersonalDetails, RegistrationFormStepMemberContactDetails, @@ -500,6 +513,9 @@ def done(self, form_list, **kwargs): begin=datetime.date(cleaned_data['generation'], 9, 1)) study_period.save() + # Send an email confirming the new enrolment + send_new_member_email(person) + # Render the enrollment forms to PDF for printing from amelie.tools.pdf import pdf_enrollment_form buffer = BytesIO() @@ -609,6 +625,9 @@ def done(self, form_list, **kwargs): link_code = get_oauth_link_code(person) send_oauth_link_code_email(self.request, person, link_code) + # Send an email confirming the new enrolment + send_new_member_email(person) + # Render the enrollment forms to PDF for printing from amelie.tools.pdf import pdf_enrollment_form buffer = BytesIO() @@ -716,6 +735,9 @@ def done(self, form_list, **kwargs): employee = Employee(person=person, number=cleaned_data['employee_number']) employee.save() + # Send an email confirming the new enrolment + send_new_member_email(person) + # Render the enrollment forms to PDF for printing from amelie.tools.pdf import pdf_enrollment_form buffer = BytesIO() @@ -838,6 +860,9 @@ def done(self, form_list, **kwargs): dogroup=cleaned_data['dogroup']) study_period.save() + # Send an email confirming the new enrolment + send_new_member_email(person) + # Render the enrollment forms to PDF for printing from amelie.tools.pdf import pdf_enrollment_form buffer = BytesIO() @@ -1073,6 +1098,8 @@ def get(self, request, *args, **kwargs): # Delete the pre-enrollment pre_enrollment.delete() + send_new_member_email(person) + # Set message messages.info(self.request, "Pre-registration of {} activated!".format(person.incomplete_name())) From 05d726260e53c93bb159e499169ccd456f632162 Mon Sep 17 00:00:00 2001 From: supertom01 Date: Mon, 3 Feb 2025 22:21:25 +0100 Subject: [PATCH 2/2] Add new member email (english only) --- .../members/templates/members/new_member.mail | 43 ++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/amelie/members/templates/members/new_member.mail b/amelie/members/templates/members/new_member.mail index 251a148..46aadc5 100644 --- a/amelie/members/templates/members/new_member.mail +++ b/amelie/members/templates/members/new_member.mail @@ -1,12 +1,45 @@ {% extends "iamailer/email_basic.mail" %} {% load i18n htmlify only %} -{% block subject %}{% blocktrans %}[Inter-Actief] Welcome human!{% endblocktrans %}{% endblock %} +{% block subject %}{% blocktrans %}[Inter-Actief] Welcome to our association{% endblocktrans %}{% endblock %} -{% block content %}{% htmlify %}{% blocktrans %}Dear{% endblocktrans %} {{ recipient.first_name }}, +{% block content %}{% htmlify %}{% blocktrans %}Dear{% endblocktrans %} {{ recipient.first_name }} -{% blocktrans %}Hereby, Vadim would like to welcome you to our beautiful association. May the cookie corner credit be in your favour.{% endblocktrans %} +{% blocktrans %}Welcome to {% endblocktrans %}I.C.T.S.V. Inter-{% onlyhtml %}{% endonlyhtml %}Actief{% onlyhtml %}{% endonlyhtml %},{% blocktrans %} the study association for Business Information Technology and Technical Computer Science at the UT! With this mail, we want to give a quick rundown of the various options we offer our members, which are spread over three main points: {% endblocktrans %} -{% blocktrans %}Kind regards, +{% endhtmlify %}{% onlyhtml %}{% endonlyhtml %} +{% onlyplain %} * {% translate "Education" %}: {% blocktrans %}Since we are, of course, a study association, we try to assist our members as much as possible with their studies. This includes discounted study book sales, study evenings, and a database of practice exams from previous years. We also help find tutors for members who are looking for one and help amplify feedback and complaints about the study.{% endblocktrans %} + * {% translate "Career" %}: {% blocktrans %}We also act as a contact point between students and companies. Through activities such as workshops, lunch lectures and an annual symposium, students can get acquainted with the various career options available after their studies. (Or possibly even find a part-time job during their studies!){% endblocktrans %} + * {% translate "Social" %}: {% blocktrans %}Since it's also important to wind down, we organise many fun activities where you can get to know your fellow students. These range from having casual drinks together every Tuesday to sports activities, trips to other countries, and even a yearly puzzle week.{% endblocktrans %} +{% endonlyplain %}{% htmlify %} -The board of Inter-Actief{% endblocktrans %}{% endhtmlify %}{% endblock %} +{% blocktrans %}Our association is located in the {% endblocktrans %}Inter-{% onlyhtml %}{% endonlyhtml %}Actief{% onlyhtml %}{% endonlyhtml %}{% blocktrans %} room, which can be found on the balcony above Educafé (where the Starbucks is located). Here, the board is present every day and can be approached with any questions or complaints you might have. We also have {% endblocktrans %}{% onlyhtml %}{% endonlyhtml %}{% translate "free coffee/tea" %}{% onlyhtml %}{% endonlyhtml %}{% blocktrans %} and a little 'Cookie Corner', where we sell snacks without a profit margin, and, of course, you can always just come by to relax for a bit. {% endblocktrans %} + +{% blocktrans %}We can only provide these services with the help of our active members, who join {% endblocktrans %}{% onlyhtml %}{% endonlyhtml %}{% translate "committees" %}{% onlyhtml %}{% endonlyhtml %}{% blocktrans %} to take care of various tasks in our association, such as organising activities and keeping our systems online. Would you be interested in joining a committee yourself? Then, be sure to check out our committee market! We organise one around the start of the first and third modules, and you can always contact our {% endblocktrans %}{% onlyhtml %}{% endonlyhtml %}{% translate "officer of internal affairs" %}{% onlyhtml %}{% endonlyhtml %},{% blocktrans %} to help you find a fun committee that suits you. {% endblocktrans %} + +{% blocktrans %}If you have any questions, you can always contact the board through the following channels:{% endblocktrans %} + +{% onlyhtml %}{% endonlyhtml %}{% onlyplain %} + * {% translate "Telephone" %}: +53 489 3756 + * {% translate "Email" %}: contact@inter-actief.net + * {% translate "Website" %}: https://www.inter-actief.utwente.nl/ +{% endonlyplain %} + +{% blocktrans %}If you don’t want to miss out on any {% endblocktrans %}Inter-{% onlyhtml %}{% endonlyhtml %}Actief{% onlyhtml %}{% endonlyhtml %}-{% blocktrans %}related news and announcements, be sure to check out our {% endblocktrans %}{% onlyhtml %}{% endonlyhtml %}{% translate "socials" %}{% onlyhtml %}{% endonlyhtml %}: + +{% onlyhtml %}{% endonlyhtml %}{% onlyplain %} + * {% blocktrans %}Our WhatsApp community{% endblocktrans %}: https://ictsv.nl/wa + * {% translate "Discord" %}: https://ictsv.nl/discord + * {% translate "Instagram" %}: @inter.actief + * {% translate "LinkedIn" %}: https://www.linkedin.com/company/i.c.t.s.v.-inter-actief/ +{% endonlyplain %} + +{% blocktrans %}Hopefully, we’ll see you around soon!{% endblocktrans %} + +{% blocktrans %}With kind regards, + +The board of {% endblocktrans %}I.C.T.S.V. Inter-{% onlyhtml %}{% endonlyhtml %}Actief{% onlyhtml %}{% endonlyhtml %}{% endhtmlify %}{% endblock %}