Commit 0e56f22f authored by Benjamin Graillot's avatar Benjamin Graillot

Merge branch 'divers_fix' into 'dev'

Divers fix

See merge request federez/re2o!290
parents d3271c5c f2c13201
......@@ -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()
......@@ -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)
......@@ -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(),
......
......@@ -33,6 +33,7 @@ CHOICES_USER = (
('0', _("Active")),
('1', _("Disabled")),
('2', _("Archived")),
('3', _("Not Yet Active")),
)
CHOICES_AFF = (
......
......@@ -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]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment