Browse Source

Merge branch 'jd-cron-membership-call-tpl' of jocelyn/coin into master

zorun 9 years ago
parent
commit
ee09c7140c

+ 3 - 3
coin/members/management/commands/call_for_membership_fees.py

@@ -14,8 +14,8 @@ from coin.members.models import Member, MembershipFee
 class Command(BaseCommand):
     args = '[date=2011-07-04]'
     help = """Send a call for membership email to members.
-              A mail is sent when end date of membership 
-              reach the anniversary date, 1 month before and once a month 
+              A mail is sent when end date of membership
+              reach the anniversary date, 1 month before and once a month
               for 3 months.
               By default, today is used to compute relative dates, but a date
               can be passed as argument."""
@@ -51,7 +51,7 @@ class Command(BaseCommand):
         cpt = 0
         with respect_language(settings.LANGUAGE_CODE):
             for member in members:
-                if member.send_call_for_membership_fees_email():
+                if member.send_call_for_membership_fees_email(auto=True):
                     self.stdout.write(
                         'Call for membership fees email was sent to {member} ({email})'.format(
                             member=member, email=member.email))

+ 7 - 3
coin/members/models.py

@@ -263,8 +263,11 @@ class Member(CoinLdapSyncMixin, AbstractUser):
                    body_template='members/emails/welcome_email.html',
                    context={'member': self, 'branding':ISPInfo.objects.first()})
 
-    def send_call_for_membership_fees_email(self):
-        """ Envoi le courriel d'appel à cotisation du membre """
+    def send_call_for_membership_fees_email(self, auto=False):
+        """ Envoie le courriel d'appel à cotisation du membre
+
+        :param auto: is it an auto email? (changes slightly template content)
+        """
         from dateutil.relativedelta import relativedelta
         from coin.isp_database.models import ISPInfo
 
@@ -278,7 +281,8 @@ class Member(CoinLdapSyncMixin, AbstractUser):
                body_template='members/emails/call_for_membership_fees.html',
                context={'member': self, 'branding':ISPInfo.objects.first(),
                         'membership_info_url': settings.MEMBER_MEMBERSHIP_INFO_URL,
-                        'today': datetime.date.today})
+                        'today': datetime.date.today,
+                        'auto_sent': auto})
             # Sauvegarde en base la date du dernier envoi de mail de relance
             self.date_last_call_for_membership_fees_email = timezone.now()
             self.save()

+ 2 - 1
coin/members/templates/members/emails/call_for_membership_fees.html

@@ -8,9 +8,10 @@ le formulaire d'adhésion, tu trouveras toutes les instructions
 à cette adresse :<br />
 {{ membership_info_url }}</p>
 
+{% if auto_sent %}
 <p>Ce courriel automatique est envoyé
 un mois avant la date anniversaire de ton adhésion,
 à la date anniversire et
 une fois par mois pendant les trois mois suivant la date anniversaire.</p>
-
+{% endif %}
 <p>L'équipe de l'association {{ branding.shortname|capfirst }}</p>