ajout du listage des adresses emails
This commit is contained in:
parent
d7987bb048
commit
e6fab3be32
@ -17,39 +17,22 @@ from operator import itemgetter
|
||||
class GetEmailsController(AuthenticatedBaseController):
|
||||
|
||||
@expose("brie.templates.getemails.index")
|
||||
def index(self):
|
||||
residences = []
|
||||
rooms_stats = dict()
|
||||
members_stats = dict()
|
||||
residences_ldap = Residences.get_residences(self.user)
|
||||
for residence_ldap in residences_ldap:
|
||||
residence_dn = residence_ldap.uniqueMember.first()
|
||||
residence_name = residence_ldap.cn.first()
|
||||
residences.append(residence_name)
|
||||
members_stats[residence_name] = CotisationComputes.members_status_from_residence(self.user, residence_dn)
|
||||
members_stats[residence_name]['number_of_cotisation_paid_members'] = len(members_stats[residence_name]['cotisation_paid_members'])
|
||||
members_stats[residence_name]['number_of_cotisation_late_members'] = len(members_stats[residence_name]['cotisation_late_members'])
|
||||
members_stats[residence_name]['number_of_no_cotisation_members'] = len(members_stats[residence_name]['no_cotisation_members'])
|
||||
members_stats[residence_name]['number_of_old_members'] = len(members_stats[residence_name]['old_members'])
|
||||
members_stats[residence_name]['number_of_current_members'] = members_stats[residence_name]['number_of_cotisation_paid_members'] + members_stats[residence_name]['number_of_cotisation_late_members'] + members_stats[residence_name]['number_of_no_cotisation_members']
|
||||
rooms_stats[residence_name] = dict()
|
||||
rooms_stats[residence_name]['number_of_rooms'] = Room.get_number_of_rooms(self.user, residence_dn)
|
||||
rooms_stats[residence_name]['empty_rooms'] = []
|
||||
for room in Room.get_rooms(self.user, residence_dn):
|
||||
if not room.has("x-memberIn"):
|
||||
rooms_stats[residence_name]['empty_rooms'].append(room)
|
||||
|
||||
residence = None
|
||||
if self.user is not None:
|
||||
residence = Residences.get_name_by_dn(self.user, self.user.residence_dn)
|
||||
def index(self, residence):
|
||||
residence_name = residence
|
||||
residence_dn = Residences.get_dn_by_name(self.user, residence_name)
|
||||
members = Member.get_all(self.user, residence_dn)
|
||||
emails = []
|
||||
current_year = CotisationComputes.current_year()
|
||||
for member in members:
|
||||
if len(Cotisation.cotisations_of_member(self.user, member.dn, current_year)) > 0:
|
||||
emails.append(member.mail.first())
|
||||
#end if
|
||||
#end for
|
||||
|
||||
return {
|
||||
"user" : self.user,
|
||||
"residence" : residence,
|
||||
"residences" : residences,
|
||||
"rooms_stats" : rooms_stats,
|
||||
"members_stats" : members_stats
|
||||
"residence" : residence_name,
|
||||
"emails" : emails
|
||||
}
|
||||
#end def
|
||||
#end class
|
||||
|
@ -38,5 +38,11 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<form action="/getemails/" method="post" class="inline_block">
|
||||
<input type="hidden" name="residence" value="${residence}"/>
|
||||
<input type="submit" value="Récupérer toutes les adresses mails" class="button"/>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -8,6 +8,9 @@
|
||||
<xi:include href="navbar.html" />
|
||||
<div class="section" >
|
||||
<span class="section_name show_section_name">Adresses mails des adhérents de ${residence}</span>
|
||||
<div py:for="email in emails">
|
||||
${email}<br />
|
||||
</div>
|
||||
<!--
|
||||
<div>
|
||||
<div class="room_number ok_color">${"%03d" % members_stats[residence]['number_of_cotisation_paid_members']}</div>
|
||||
|
Loading…
Reference in New Issue
Block a user