Example #1
0
def change_legal(name):
    ourdetails = LegalEntity()
    ourdetails.name = name
    ourdetails.address = "Place des cocotiers"
    ourdetails.postal_code = "97200"
    ourdetails.city = "FORT DE FRANCE"
    ourdetails.country = "MARTINIQUE"
    ourdetails.tel1 = "01-23-45-67-89"
    ourdetails.email = "*****@*****.**" % name
    ourdetails.save()
Example #2
0
 def create_account_atomic(self, username, legalentity):
     defaultgroup = Params.getobject("contacts-defaultgroup")
     user = LucteriosUser()
     user.username = username
     user.first_name = self.item.firstname
     user.last_name = self.item.lastname
     user.email = self.item.email
     user.save()
     if defaultgroup is not None:
         user.groups.add(defaultgroup)
     self.item.address = '---'
     self.item.postal_code = '---'
     self.item.city = '---'
     self.item.user = user
     self.item.save()
     if legalentity != '':
         entity = LegalEntity()
         entity.name = legalentity
         entity.address = '---'
         entity.postal_code = '---'
         entity.city = '---'
         entity.email = self.item.email
         entity.save()
         Responsability.objects.create(individual=self.item,
                                       legal_entity=entity)
Example #3
0
    def add_legalentity(self, legal_entity):
        self.new_tab(_("Legal entity"))
        self.item = legal_entity
        fields = LegalEntity.get_show_fields()
        self.fill_from_model(1, 1, True, fields[_('001@Identity')])
        self.get_components('name').colspan = 2
        self.get_components('structure_type').colspan = 2
        img_path = get_user_path(
            "contacts", "Image_%s.jpg" % legal_entity.abstractcontact_ptr_id)
        img = XferCompImage('logoimg')
        if exists(img_path):
            img.type = 'jpg'
            img.set_value(readimage_to_base64(img_path))
        else:
            img.set_value(
                get_icon_path("lucterios.contacts/images/NoImage.png"))
        img.set_location(0, 2, 1, 6)
        self.add_component(img)

        btn = XferCompButton('btn_edit')
        btn.set_is_mini(True)
        btn.set_location(4, 1, 1, 2)
        btn.set_action(self.request, CurrentLegalEntityModify.get_action(
            _('Edit'), "images/edit.png"), modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'legal_entity': legal_entity.id})
        self.add_component(btn)
Example #4
0
    def add_legalentity(self, legal_entity):
        self.new_tab(_("Legal entity"))
        self.item = legal_entity
        fields = LegalEntity.get_show_fields()
        self.fill_from_model(1, 1, True, fields[_('001@Identity')])
        self.get_components('name').colspan = 2
        self.get_components('structure_type').colspan = 2
        img_path = get_user_path(
            "contacts", "Image_%s.jpg" % legal_entity.abstractcontact_ptr_id)
        img = XferCompImage('logoimg')
        if exists(img_path):
            img.type = 'jpg'
            img.set_value(readimage_to_base64(img_path))
        else:
            img.set_value(
                get_icon_path("lucterios.contacts/images/NoImage.png"))
        img.set_location(0, 2, 1, 6)
        self.add_component(img)

        btn = XferCompButton('btn_edit')
        btn.set_is_mini(True)
        btn.set_location(4, 1, 1, 2)
        btn.set_action(self.request,
                       CurrentLegalEntityModify.get_action(
                           _('Edit'), "images/edit.png"),
                       modal=FORMTYPE_MODAL,
                       close=CLOSE_NO,
                       params={'legal_entity': legal_entity.id})
        self.add_component(btn)
Example #5
0
def conf_wizard_contacts(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("contacts_current", 5))
        wizard_ident.append(("contacts_params", 40))
        wizard_ident.append(("contacts_responsable", 41))
    elif (xfer is not None) and (wizard_ident == "contacts_current"):
        xfer.add_title(_("Lucterios contacts"), _("Our details"), _('configure our details'))
        xfer.model = LegalEntity
        xfer.item = LegalEntity.objects.get(id=1)
        xfer.fill_from_model(1, xfer.get_max_row() + 1, True, desc_fields=LegalEntity.get_show_fields()[_('001@Identity')])
        xfer.remove_component('structure_type')
        btn = XferCompButton("btnconf")
        btn.set_location(2, xfer.get_max_row() + 1)
        btn.set_is_mini(True)
        btn.set_action(xfer.request, CurrentStructureAddModify.get_action('', "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_params"):
        xfer.add_title(_("Lucterios contacts"), _("Contacts configuration"), _('configure your contacts'))
        param_lists = ['contacts-mailtoconfig', 'contacts-createaccount']
        Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
        btn = XferCompButton('editparam')
        btn.set_location(4, xfer.get_max_row())
        btn.set_is_mini(True)
        btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO,
                       params={'params': param_lists})
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_function")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Function._meta.verbose_name_plural, 'count': len(Function.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_structuretype")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': StructureType._meta.verbose_name_plural, 'count': len(StructureType.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_customfield")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': CustomField._meta.verbose_name_plural, 'count': len(CustomField.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnconf")
        btn.set_location(4, xfer.get_max_row() - 2, 1, 3)
        btn.set_action(xfer.request, Configuration.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)

        lbl = XferCompLabelForm("nb_legalentity")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LegalEntity._meta.verbose_name_plural, 'count': len(LegalEntity.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_individual")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Individual._meta.verbose_name_plural, 'count': len(Individual.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnimport")
        btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
        btn.set_action(xfer.request, ContactImport.get_action(_("Contact import"), "images/add.png"), close=CLOSE_NO, params={'step': 0})
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_responsable"):
        xfer.add_title(_("Lucterios contacts"), _('associates'), _('configure your association'))
        xfer.params['legal_entity'] = 1
        xfer.fill_grid(5, Responsability, "responsability", Responsability.objects.filter(legal_entity_id=1))
Example #6
0
 def add_legalentities(self, legal_entities):
     self.new_tab(_("Legal entities"))
     grid = XferCompGrid('legal_entity')
     grid.set_model(legal_entities, LegalEntity.get_default_fields())
     grid.add_action(self.request, CurrentLegalEntityShow.get_action(
         _("Edit"), "images/show.png"), modal=FORMTYPE_MODAL, close=CLOSE_NO, unique=SELECT_SINGLE)
     grid.set_location(1, 1, 2)
     grid.set_size(200, 500)
     self.add_component(grid)
Example #7
0
 def add_legalentities(self, legal_entities):
     self.new_tab(_("Legal entities"))
     grid = XferCompGrid('legal_entity')
     grid.set_model(legal_entities, LegalEntity.get_default_fields())
     grid.add_action(self.request,
                     CurrentLegalEntityShow.get_action(
                         _("Edit"), "images/show.png"),
                     modal=FORMTYPE_MODAL,
                     close=CLOSE_NO,
                     unique=SELECT_SINGLE)
     grid.set_location(1, 1, 2)
     grid.set_size(200, 500)
     self.add_component(grid)
Example #8
0
 def create_account_atomic(self, username, legalentity):
     user = LucteriosUser()
     user.username = username
     user.first_name = self.item.firstname
     user.last_name = self.item.lastname
     user.email = self.item.email
     user.save()
     self.item.address = '---'
     self.item.postal_code = '---'
     self.item.city = '---'
     self.item.user = user
     self.item.save()
     if legalentity != '':
         entity = LegalEntity()
         entity.name = legalentity
         entity.address = '---'
         entity.postal_code = '---'
         entity.city = '---'
         entity.email = self.item.email
         entity.save()
         Responsability.objects.create(individual=self.item,
                                       legal_entity=entity)
Example #9
0
 def create_account_atomic(self, username, legalentity):
     user = LucteriosUser()
     user.username = username
     user.first_name = self.item.firstname
     user.last_name = self.item.lastname
     user.email = self.item.email
     user.save()
     self.item.address = '---'
     self.item.postal_code = '---'
     self.item.city = '---'
     self.item.user = user
     self.item.save()
     if legalentity != '':
         entity = LegalEntity()
         entity.name = legalentity
         entity.address = '---'
         entity.postal_code = '---'
         entity.city = '---'
         entity.email = self.item.email
         entity.save()
         Responsability.objects.create(individual=self.item, legal_entity=entity)
Example #10
0
    def _test_bill_with_family(self):
        self.factory.xfer = SubscriptionAddModify()
        self.calljson('/diacamma.member/subscriptionAddModify',
                      {'SAVE': 'YES', 'adherent': 2, 'dateref': '2014-10-01', 'subscriptiontype': 1, 'season': 15, 'team': 2, 'activity': 1, 'value': '132'}, False)
        self.assert_observer('core.acknowledge', 'diacamma.member', 'subscriptionAddModify')

        Parameter.change_value('member-family-type', 3)
        Params.clear()
        myfamily = LegalEntity()
        myfamily.name = "LES DALTONS"
        myfamily.structure_type_id = 3
        myfamily.address = "Place des cocotiers"
        myfamily.postal_code = "97200"
        myfamily.city = "FORT DE FRANCE"
        myfamily.country = "MARTINIQUE"
        myfamily.tel1 = "01-23-45-67-89"
        myfamily.email = "*****@*****.**"
        myfamily.save()
        self.assertEqual(myfamily.id, 7)

        self.factory.xfer = AdherentFamilySelect()
        self.calljson('/diacamma.member/adherentFamilySelect', {'adherent': 2, 'legal_entity': 7}, False)
        self.assert_observer('core.acknowledge', 'diacamma.member', 'adherentFamilySelect')
        self.factory.xfer = AdherentFamilySelect()
        self.calljson('/diacamma.member/adherentFamilySelect', {'adherent': 4, 'legal_entity': 7}, False)
        self.assert_observer('core.acknowledge', 'diacamma.member', 'adherentFamilySelect')
        self.factory.xfer = AdherentFamilySelect()
        self.calljson('/diacamma.member/adherentFamilySelect', {'adherent': 5, 'legal_entity': 7}, False)
        self.assert_observer('core.acknowledge', 'diacamma.member', 'adherentFamilySelect')

        self.factory.xfer = EventAddModify()
        self.calljson('/diacamma.event/eventAddModify', {"SAVE": "YES", "comment": "la fiesta", "date": "2014-10-12", "date_end": "2014-10-13",
                                                         "activity": "1", "event_type": 1, 'default_article': 1, 'default_article_nomember': 2}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'eventAddModify')

        self.factory.xfer = OrganizerSave()
        self.calljson('/diacamma.event/organizerSave',
                      {"event": 1, 'pkname': 'contact', 'contact': '6'}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'organizerSave')

        self.factory.xfer = OrganizerResponsible()
        self.calljson('/diacamma.event/organizerResponsible', {"event": 1, 'organizer': '1'}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'organizerResponsible')

        self.factory.xfer = ParticipantSave()
        self.calljson('/diacamma.event/participantSave', {"event": 1, 'pkname': 'contact', 'contact': '2;4;5'}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'participantSave')

        self.factory.xfer = ParticipantModify()
        self.calljson('/diacamma.event/participantModify', {"event": 1, "participant": 2, "SAVE": "YES", 'comment': 'blabla', 'article': 0}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'participantModify')
        self.factory.xfer = ParticipantModify()
        self.calljson('/diacamma.event/participantModify', {"event": 1, "participant": 3, "SAVE": "YES", 'comment': 'bou!!!!', 'article': 5, 'reduce': 10.0}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'participantModify')

        self.factory.xfer = EventShow()
        self.calljson('/diacamma.event/eventShow', {"event": 1}, False)
        self.assert_observer('core.custom', 'diacamma.event', 'eventShow')
        self.assert_count_equal('participant', 3)
        self.assert_json_equal('', 'participant/@0/contact', "Dalton Avrel")
        self.assert_json_equal('', 'participant/@0/article_ref_price', 'ABC1 [12,34 €]')
        self.assert_json_equal('', 'participant/@0/comment', '')
        self.assert_json_equal('', 'participant/@1/contact', "Dalton Jack")
        self.assert_json_equal('', 'participant/@1/article_ref_price', None)
        self.assert_json_equal('', 'participant/@1/comment', 'blabla')
        self.assert_json_equal('', 'participant/@2/contact', "Dalton Joe")
        self.assert_json_equal('', 'participant/@2/article_ref_price', 'ABC5 [64,10 €] (-10,00 €)')
        self.assert_json_equal('', 'participant/@2/comment', 'bou!!!!')

        self.factory.xfer = EventTransition()
        self.calljson('/diacamma.event/eventTransition',
                      {"event": 1, 'CONFIRME': 'YES', 'TRANSITION': 'validate'}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'eventTransition')

        self.factory.xfer = BillList()
        self.calljson('/diacamma.invoice/billList', {}, False)
        self.assert_observer('core.custom', 'diacamma.invoice', 'billList')
        self.assert_count_equal('bill', 2)
        self.assert_json_equal('', 'bill/@0/bill_type', "facture")
        self.assert_json_equal('', 'bill/@0/status', 'en création')
        self.assert_json_equal('', 'bill/@0/third', "LES DALTONS")
        self.assert_json_equal('', 'bill/@0/total', 66.44)
        self.assert_json_equal('', 'bill/@0/comment', "{[b]}stage/sortie{[/b]}: 12 octobre 2014 -> 13 octobre 2014{[br/]}{[i]}la fiesta{[/i]}")
        self.assert_json_equal('', 'bill/@1/bill_type', "facture")
        self.assert_json_equal('', 'bill/@1/status', 'en création')
        self.assert_json_equal('', 'bill/@1/third', "Dalton Avrel")
        self.assert_json_equal('', 'bill/@1/total', 76.44)
        self.assert_json_equal('', 'bill/@1/comment', "{[b]}cotisation{[/b]}{[br/]}Cotisation de 'Dalton Avrel'")

        self.factory.xfer = BillShow()
        self.calljson('/diacamma.invoice/billShow', {'bill': 2}, False)
        self.assert_observer('core.custom', 'diacamma.invoice', 'billShow')
        self.assert_json_equal('LINK', 'third', "LES DALTONS")
        self.assert_count_equal('detail', 2)
        self.assert_json_equal('', 'detail/@0/article', 'ABC1')
        self.assert_json_equal('', 'detail/@0/designation', "Article 01{[br/]}Participant : Dalton Avrel")
        self.assert_json_equal('', 'detail/@0/price', 12.34)
        self.assert_json_equal('', 'detail/@0/quantity', '1.000')
        self.assert_json_equal('', 'detail/@0/total', 12.34)
        self.assert_json_equal('', 'detail/@1/article', 'ABC5')
        self.assert_json_equal('', 'detail/@1/designation', "Article 05{[br/]}Participant : Dalton Joe{[br/]}bou!!!!")
        self.assert_json_equal('', 'detail/@1/price', 64.10)
        self.assert_json_equal('', 'detail/@1/quantity', '1.00')
        self.assert_json_equal('', 'detail/@1/total', 54.10)
Example #11
0
def conf_wizard_contacts(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("contacts_current", 5))
        wizard_ident.append(("contacts_params", 40))
        wizard_ident.append(("contacts_responsable", 41))
    elif (xfer is not None) and (wizard_ident == "contacts_current"):
        xfer.add_title(_("Lucterios contacts"), _("Our details"),
                       _('configure our details'))
        xfer.model = LegalEntity
        xfer.item = LegalEntity.objects.get(id=1)
        xfer.fill_from_model(
            1,
            xfer.get_max_row() + 1,
            True,
            desc_fields=LegalEntity.get_show_fields()[_('001@Identity')])
        xfer.remove_component('structure_type')
        btn = XferCompButton("btnconf")
        btn.set_location(2, xfer.get_max_row() + 1)
        btn.set_is_mini(True)
        btn.set_action(xfer.request,
                       CurrentStructureAddModify.get_action(
                           '', "images/edit.png"),
                       close=CLOSE_NO)
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_params"):
        xfer.add_title(_("Lucterios contacts"), _("Contacts configuration"),
                       _('configure your contacts'))
        param_lists = [
            'contacts-mailtoconfig', 'contacts-createaccount',
            'contacts-defaultgroup', 'contacts-size-page'
        ]
        Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
        btn = XferCompButton('editparam')
        btn.set_location(4, xfer.get_max_row())
        btn.set_is_mini(True)
        btn.set_action(xfer.request,
                       ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'),
                       close=CLOSE_NO,
                       params={'params': param_lists})
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_function")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': Function._meta.verbose_name_plural,
                'count': len(Function.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_structuretype")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': StructureType._meta.verbose_name_plural,
                'count': len(StructureType.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_customfield")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': CustomField._meta.verbose_name_plural,
                'count': len(CustomField.objects.all())
            })
        xfer.add_component(lbl)
        btn = XferCompButton("btnconf")
        btn.set_location(4, xfer.get_max_row() - 2, 1, 3)
        btn.set_action(xfer.request,
                       Configuration.get_action(TITLE_MODIFY,
                                                "images/edit.png"),
                       close=CLOSE_NO)
        xfer.add_component(btn)

        lbl = XferCompLabelForm("nb_legalentity")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': LegalEntity._meta.verbose_name_plural,
                'count': len(LegalEntity.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_individual")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': Individual._meta.verbose_name_plural,
                'count': len(Individual.objects.all())
            })
        xfer.add_component(lbl)
        btn = XferCompButton("btnimport")
        btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
        btn.set_action(xfer.request,
                       ContactImport.get_action(_("Contact import"),
                                                "images/add.png"),
                       close=CLOSE_NO,
                       params={'step': 0})
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_responsable"):
        xfer.add_title(_("Lucterios contacts"), _('associates'),
                       _('configure your association'))
        xfer.params['legal_entity'] = 1
        xfer.fill_grid(5, Responsability, "responsability",
                       Responsability.objects.filter(legal_entity_id=1))