8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-09-27 14:43:08 +00:00

Merge branch 'divers_fix' into 'dev'

Divers fix

See merge request federez/re2o!290
This commit is contained in:
Benjamin Graillot 2018-09-08 21:49:28 +02:00
commit 0e56f22fdf
5 changed files with 17 additions and 5 deletions

View file

@ -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()

View file

@ -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)

View file

@ -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(),

View file

@ -33,6 +33,7 @@ CHOICES_USER = (
('0', _("Active")),
('1', _("Disabled")),
('2', _("Archived")),
('3', _("Not Yet Active")),
)
CHOICES_AFF = (

View file

@ -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]