Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Besoin): Ajout d'un template de mail transactionnel quand le besoin est suivi par un partenaire commercial #1533

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from django.db import migrations


def create_template(apps, schema_editor):
TemplateTransactional = apps.get_model("conversations", "TemplateTransactional")
TemplateTransactional.objects.create(
name="Dépôt de besoin : auteur : notification quand son besoin a été validé et pris en charge par les partenaires commerciaux",
code="TENDERS_AUTHOR_CONFIRMATION_VALIDATED_COMMERCIAL_PARTNERS",
description="Envoyé à l'auteur du besoin lorsque son besoin a été validé et qu'il n'est pas envoyé aux structures mais proposé aux partenaires commerciaux",
)


class Migration(migrations.Migration):
dependencies = [
("tenders", "0093_alter_tender_send_to_commercial_partners_only"),
]

operations = [
migrations.RunPython(create_template),
SebastienReuiller marked this conversation as resolved.
Show resolved Hide resolved
]
2 changes: 1 addition & 1 deletion lemarche/www/dashboard_siaes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def get_success_url(self):
return reverse_lazy("dashboard_siaes:siae_edit_activities", args=[self.kwargs.get("slug")])

def get_success_message(self, cleaned_data):
return mark_safe(f"Votre activité <strong>{cleaned_data['sector_group']}</strong> a été crée avec succès.")
return mark_safe(f"Votre activité <strong>{cleaned_data['sector_group']}</strong> a été créée avec succès.")


class SiaeEditActivitiesEditView(SiaeMemberRequiredMixin, SuccessMessageMixin, UpdateView):
Expand Down
8 changes: 7 additions & 1 deletion lemarche/www/tenders/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,13 @@ def send_confirmation_published_email_to_author(tender: Tender):
"""
Send email to the author when the tender is published to the siaes
"""
email_template = TemplateTransactional.objects.get(code="TENDERS_AUTHOR_CONFIRMATION_VALIDATED")

template_code = (
"TENDERS_AUTHOR_CONFIRMATION_VALIDATED_COMMERCIAL_PARTNERS"
if tender.send_to_commercial_partners_only
else "TENDERS_AUTHOR_CONFIRMATION_VALIDATED"
)
email_template = TemplateTransactional.objects.get(code=template_code)
recipient_list = whitelist_recipient_list([tender.author.email])
if len(recipient_list):
recipient_email = recipient_list[0]
Expand Down
Loading