Commit 1b47e037 authored by Valentin Samir's avatar Valentin Samir

[objets] Compte crans et initialisation du solde

parent 12e8103d
......@@ -915,6 +915,7 @@ class proprio(CransLdapObject):
if os.path.exists("/var/mail/" + login):
raise ValueError('Création du compte impossible : /var/mail/%s existant' % str(login))
self._modifs['objectClass'] = [u'adherent', u'cransAccount', u'posixAccount', u'shadowAccount']
self['uid' ] = [login]
self['homeDirectory'] = [home]
self['mail'] = [login + u"@crans.org"]
......@@ -922,10 +923,10 @@ class proprio(CransLdapObject):
if crans_utils.mailexist(calias):
calias = login
self['canonicalAlias'] = [calias]
self._modifs['objectClass'] = [u'adherent', u'cransAccount', u'posixAccount', u'shadowAccount']
self['cn'] = [ fn + u' ' + ln ]
self['loginShell'] = [unicode(shell)]
self['userPassword'] = [unicode(hash_pass)]
self["solde"] = 0.0
if uidNumber:
if self.conn.search(u'(uidNumber=%s)' % uidNumber):
......@@ -950,8 +951,10 @@ class proprio(CransLdapObject):
def solde(self, operation, comment):
self['historique'].append(comment)
raise EnvironmentError("Il faut implémenter des locks sur le solde avant d'écrire la fonction solde dans la classe proprio de lc_ldap")
if self['solde']:
self['solde'][0]+=float(operation)
else:
self['solde']=float(operation)
def may_be(self, what, liste=None):
"""Teste si liste peut faire ce qui est dans what, pour
......
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