diff --git a/cotisations/utils.py b/cotisations/utils.py index 0211dd40..a8c2768e 100644 --- a/cotisations/utils.py +++ b/cotisations/utils.py @@ -89,7 +89,7 @@ def send_mail_invoice(invoice): 'Votre facture / Your invoice', template.render(ctx), GeneralOption.get_cached_value('email_from'), - [invoice.user.email], + [invoice.user.get_mail], attachments=[('invoice.pdf', pdf, 'application/pdf')] ) mail.send() diff --git a/cotisations/views.py b/cotisations/views.py index 9241f209..4cd76f93 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -836,7 +836,6 @@ def credit_solde(request, user, **_kwargs): else: price_ok = True if price_ok: - invoice.valid = True invoice.save() Vente.objects.create( facture=invoice, @@ -852,6 +851,6 @@ def credit_solde(request, user, **_kwargs): 'balance': user.solde, 'title': _("Refill your balance"), 'action_name': _("Pay"), - 'max_balance': p.payment_method.maximum_balance, + 'max_balance': find_payment_method(p).maximum_balance, }, 'cotisations/facture.html', request) diff --git a/logs/views.py b/logs/views.py index a9fe5418..21e3c470 100644 --- a/logs/views.py +++ b/logs/views.py @@ -254,6 +254,14 @@ def stats_general(request): .count()), Club.objects.filter(state=Club.STATE_ARCHIVE).count() ], + 'not_active_users': [ + _("Not yet active users"), + User.objects.filter(state=User.STATE_NOT_YET_ACTIVE).count(), + (Adherent.objects + .filter(state=Adherent.STATE_NOT_YET_ACTIVE) + .count()), + Club.objects.filter(state=Club.STATE_NOT_YET_ACTIVE).count() + ], 'adherent_users': [ _("Contributing members"), _all_adherent.count(), diff --git a/search/forms.py b/search/forms.py index 6065e799..5c98415f 100644 --- a/search/forms.py +++ b/search/forms.py @@ -33,6 +33,7 @@ CHOICES_USER = ( ('0', _("Active")), ('1', _("Disabled")), ('2', _("Archived")), + ('3', _("Not Yet Active")), ) CHOICES_AFF = ( diff --git a/users/models.py b/users/models.py index 41090ab1..f579148c 100755 --- a/users/models.py +++ b/users/models.py @@ -93,7 +93,7 @@ from preferences.models import OptionalMachine, MailMessageOption def linux_user_check(login): """ Validation du pseudo pour respecter les contraintes unix""" - UNIX_LOGIN_PATTERN = re.compile("^[a-zA-Z0-9-]*[$]?$") + UNIX_LOGIN_PATTERN = re.compile("^[a-zA-Z][a-zA-Z0-9-]*[$]?$") return UNIX_LOGIN_PATTERN.match(login) @@ -374,6 +374,10 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, si il n'est pas défini""" return self.shell or OptionalUser.get_cached_value('shell_default') + @cached_property + def home_directory(self): + return '/home/' + self.pseudo + @cached_property def get_shadow_expire(self): """Return the shadow_expire value for the user""" @@ -581,7 +585,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, user_ldap.name = self.pseudo user_ldap.sn = self.pseudo user_ldap.dialupAccess = str(self.has_access()) - user_ldap.home_directory = '/home/' + self.pseudo + user_ldap.home_directory = self.home_directory user_ldap.mail = self.get_mail user_ldap.given_name = self.surname.lower() + '_'\ + self.name.lower()[:3]