Exemple #1
0
 def before_save(self, xfer):
     xfer.is_new = (self.item.id is None)
     if xfer.getparam('autocreate', 0) == 1:
         self.item.send_email_param = (xfer.request.META.get(
             'HTTP_REFERER',
             xfer.request.build_absolute_uri()), xfer.language)
         self.item.season = Season.current_season()
         if self.item.adherent_id is None:
             current_contact = Individual.objects.get(
                 user=xfer.request.user)
             current_contact = current_contact.get_final_child()
             self.item.adherent = Adherent(id=current_contact.pk)
             self.item.adherent.save(new_num=True)
             self.item.adherent.__dict__.update(current_contact.__dict__)
             self.item.adherent.save()
             self.item.adherent_id = self.item.adherent.id
     if self.item.subscriptiontype.duration == 0:  # periodic
         season = self.item.season
         self.item.begin_date = season.begin_date
         self.item.end_date = season.end_date
     elif self.item.subscriptiontype.duration == 1:  # periodic
         periodid = xfer.getparam('period', 0)
         period = Period.objects.get(id=periodid)
         self.item.begin_date = period.begin_date
         self.item.end_date = period.end_date
     elif self.item.subscriptiontype.duration == 2:  # monthly
         month_num = xfer.getparam('month', '')
         self.item.begin_date = convert_date(month_num + '-01')
         self.item.end_date = same_day_months_after(self.item.begin_date,
                                                    1) - timedelta(days=1)
     elif self.item.subscriptiontype.duration == 3:  # calendar
         self.item.begin_date = convert_date(xfer.getparam(
             'begin_date', ''))
         self.item.end_date = same_day_months_after(self.item.begin_date,
                                                    12) - timedelta(days=1)
Exemple #2
0
def fill_params(xfer, param_lists=None, smallbtn=False):
    if param_lists is None:
        param_lists = [
            "member-team-enable", "member-team-text", "member-activite-enable",
            "member-activite-text", "member-age-enable",
            "member-licence-enabled", "member-filter-genre", "member-numero",
            "member-birth", "member-fields", "member-subscription-message"
        ]
    if len(param_lists) >= 3:
        nb_col = 2
    else:
        nb_col = 1
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=nb_col)

    comp_fields = xfer.get_components("member-fields")
    if comp_fields is not None:
        comp_fields.value = "{[br/]}".join([
            six.text_type(fields_title[1])
            for fields_title in Adherent.get_default_fields_title()
        ])

    btn = XferCompButton('editparam')
    btn.set_is_mini(smallbtn)
    btn.set_location(3, xfer.get_max_row() + 1)
    btn.set_action(xfer.request,
                   CategoryParamEdit.get_action(TITLE_MODIFY,
                                                'images/edit.png'),
                   close=CLOSE_NO,
                   params={
                       'params': param_lists,
                       'nb_col': nb_col
                   })
    xfer.add_component(btn)
Exemple #3
0
 def fillresponse(self, params=(), nb_col=1):
     ParamEdit.fillresponse(self, params=params, nb_col=nb_col)
     comp_fields = self.get_components("member-fields")
     if comp_fields is not None:
         self.remove_component("member-fields")
         new_comp_fields = XferCompCheckList("member-fields")
         new_comp_fields.description = comp_fields.description
         new_comp_fields.simple = 2
         new_comp_fields.set_location(comp_fields.col, comp_fields.row,
                                      comp_fields.colspan,
                                      comp_fields.rowspan)
         new_comp_fields.set_select(Adherent.get_allowed_fields_title())
         new_comp_fields.set_value([
             field[1] if isinstance(field, tuple) else field
             for field in Adherent.get_default_fields()
         ])
         self.add_component(new_comp_fields)
Exemple #4
0
 def fillresponse_header(self):
     self.params['is_renew'] = True
     AdherentAbstractList.fillresponse_header(self)
     self.fieldnames = Adherent.get_renew_fields()
Exemple #5
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Lucterios.  If not, see <http://www.gnu.org/licenses/>.
'''

from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _

from diacamma.member.models import Adherent

name = _("adherents listing")
kind = 0
modelname = Adherent.get_long_name()
value = """210
297
22//%s//#num
25//%s//#lastname
40//%s//#firstname
50//%s//#address
15//%s//#postal_code
30//%s//#city
20//%s//#tel1 #tel2
35//%s//#email
30//%s//#comment
""" % (_('numeros'), _('lastname'), _('firstname'), _('address'),
       _('postal code'), _('city'), _('phone'), _('email'), _('comment'))
Exemple #6
0
@author: Laurent GAY
@organization: sd-libre.fr
@contact: [email protected]
@copyright: 2016 sd-libre.fr
@license: This file is part of Lucterios.

Lucterios is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Lucterios is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Lucterios.  If not, see <http://www.gnu.org/licenses/>.
'''

from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _

from diacamma.member.models import Adherent

name = _("card")
kind = 1
modelname = Adherent.get_long_name()
value = "#num #firstname #lastname{[newline]}#birthday #birthplace{[newline]}#subscription_set.license_set.team #subscription_set.license_set.activity #subscription_set.license_set.value"
Exemple #7
0
def create_adherent(firstname, lastname, birthday):
    new_adh = Adherent()
    new_adh.firstname = firstname
    new_adh.lastname = lastname
    new_adh.address = "rue de la liberté"
    new_adh.postal_code = "97250"
    new_adh.city = "LE PRECHEUR"
    new_adh.country = "MARTINIQUE"
    new_adh.tel2 = "02-78-45-12-95"
    new_adh.email = "*****@*****.**" % (firstname, lastname)
    new_adh.birthday = birthday
    new_adh.save()
    return new_adh
Exemple #8
0
def create_adherent(firstname, lastname, birthday):
    new_adh = Adherent()
    new_adh.firstname = firstname
    new_adh.lastname = lastname
    new_adh.address = "rue de la liberté"
    new_adh.postal_code = "97250"
    new_adh.city = "LE PRECHEUR"
    new_adh.country = "MARTINIQUE"
    new_adh.tel2 = "02-78-45-12-95"
    new_adh.email = "*****@*****.**" % (firstname, lastname)
    new_adh.birthday = birthday
    new_adh.save()
    return new_adh