Ejemplo n.º 1
0
def event_checkparam():
    Parameter.check_and_create(name="event-degree-enable",
                               typeparam=3,
                               title=_("event-degree-enable"),
                               args="{}",
                               value='True')
    Parameter.check_and_create(name="event-subdegree-enable",
                               typeparam=3,
                               title=_("event-subdegree-enable"),
                               args="{}",
                               value='True')
    Parameter.check_and_create(name="event-degree-text",
                               typeparam=0,
                               title=_("event-degree-text"),
                               args="{'Multi':False}",
                               value=_('Degree'))
    Parameter.check_and_create(name="event-subdegree-text",
                               typeparam=0,
                               title=_("event-subdegree-text"),
                               args="{'Multi':False}",
                               value=_('Sub-degree'))
    Parameter.check_and_create(name="event-comment-text",
                               typeparam=0,
                               title=_("event-comment-text"),
                               args="{'Multi':True}",
                               value='')
Ejemplo n.º 2
0
 def _params(self):
     cur_p = self.old_db.open()
     cur_p.execute(
         "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_facture' and paramName in ('ModeTVA','DefaultCompteVente','compteTVAVente','CompteRemise','CompteFraisBank','CompteCaisse')")
     for param_name, param_value in cur_p.fetchall():
         pname = ''
         if param_name == 'ModeTVA':
             pname = 'invoice-vat-mode'
             if param_value == '':
                 param_value = '0'
         elif param_name == 'DefaultCompteVente':
             pname = 'invoice-default-sell-account'
             param_value = convert_code(param_value)
         elif param_name == 'compteTVAVente':
             pname = 'invoice-vatsell-account'
             param_value = convert_code(param_value)
         elif param_name == 'CompteRemise':
             pname = 'invoice-reduce-account'
             param_value = convert_code(param_value)
         elif param_name == 'CompteFraisBank':
             pname = 'payoff-bankcharges-account'
             param_value = convert_code(param_value)
         elif param_name == 'CompteCaisse':
             pname = 'payoff-cash-account'
             param_value = convert_code(param_value)
         if pname != '':
             self.print_debug(
                 "=> parameter of invoice %s - %s", (pname, param_value))
             Parameter.change_value(pname, param_value)
     Params.clear()
Ejemplo n.º 3
0
 def _params(self):
     cur_p = self.old_db.open()
     cur_p.execute(
         "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_membres' and paramName in ('EquipeEnable', 'EquipeText', 'ActiviteEnable', 'ActiviteText', 'AgeEnable', 'LicenceEnabled', 'FiltreGenre', 'Numero', 'Naissance', 'compteTiersDefault', 'connexion')")
     for param_name, param_value in cur_p.fetchall():
         pname = ''
         if param_name == "EquipeEnable":
             pname = "member-team-enable"
         if param_name == "EquipeText":
             pname = "member-team-text"
         if param_name == "ActiviteEnable":
             pname = "member-activite-enable"
         if param_name == "ActiviteText":
             pname = "member-activite-text"
         if param_name == "AgeEnable":
             pname = "member-age-enable"
         if param_name == "LicenceEnabled":
             pname = "member-licence-enabled"
         if param_name == "FiltreGenre":
             pname = "member-filter-genre"
         if param_name == "Numero":
             pname = "member-numero"
         if param_name == "Naissance":
             pname = "member-birth"
         if param_name == "compteTiersDefault":
             pname = "invoice-account-third"
             param_value = convert_code(param_value)
         if param_name == "connexion":
             pname = "member-connection"
         if pname != '':
             self.print_debug(
                 "=> parameter of invoice %s - %s", (pname, param_value))
             Parameter.change_value(pname, param_value)
     Params.clear()
Ejemplo n.º 4
0
def paramchange_condominium(params):
    if 'accounting-sizecode' in params:
        for set_item in Set.objects.all():
            if set_item.revenue_account != correct_accounting_code(set_item.revenue_account):
                set_item.revenue_account = correct_accounting_code(set_item.revenue_account)
                set_item.save()
        for exp_item in ExpenseDetail.objects.filter(expense__status=0):
            if exp_item.expense_account != correct_accounting_code(exp_item.expense_account):
                exp_item.expense_account = correct_accounting_code(exp_item.expense_account)
                exp_item.save()
    accounts = ('condominium-default-owner-account', 'condominium-current-revenue-account',
                'condominium-default-owner-account1', 'condominium-default-owner-account2',
                'condominium-default-owner-account3', 'condominium-default-owner-account4',
                'condominium-default-owner-account5',
                'condominium-exceptional-revenue-account', 'condominium-fundforworks-revenue-account',
                'condominium-exceptional-reserve-account', 'condominium-advance-reserve-account',
                'condominium-fundforworks-reserve-account')
    for account_item in accounts:
        has_changed = False
        if (account_item in params) or ('accounting-sizecode' in params):
            Parameter.change_value(account_item, correct_accounting_code(Params.getvalue(account_item)))
            system_condo = current_system_condo()
            system_condo.owner_account_changed(account_item)
            has_changed = True
        if has_changed:
            Params.clear()
    if 'accounting-system' in params:
        clear_system_condo()
        system_condo = current_system_condo()
        system_condo.initialize_system()
Ejemplo n.º 5
0
 def fillresponse(self, params=()):
     for pname in params:
         pvalue = self.getparam(pname)
         if pvalue is not None:
             Parameter.change_value(pname, pvalue)
     Params.clear()
     signal_and_lock.Signal.call_signal("param_change", params)
Ejemplo n.º 6
0
 def _params(self):
     from lucterios.CORE.models import Parameter
     cur_p = self.old_db.open()
     cur_p.execute(
         "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'org_lucterios_contacts' and paramName in ('MailSmtpServer','MailSmtpPort','MailSmtpSecurity','MailSmtpUser','MailSmtpPass','MailConnectionMsg')"
     )
     for param_name, param_value in cur_p.fetchall():
         pname = ''
         if param_name == 'MailSmtpServer':
             pname = 'mailing-smtpserver'
         if param_name == 'MailSmtpPort':
             pname = 'mailing-smtpport'
             if param_value == '':
                 param_value = '25'
         if param_name == 'MailSmtpSecurity':
             pname = 'mailing-smtpsecurity'
         if param_name == 'MailSmtpUser':
             pname = 'mailing-smtpuser'
         if param_name == 'MailSmtpPass':
             pname = 'mailing-smtppass'
         if param_name == 'MailConnectionMsg':
             pname = 'mailing-msg-connection'
         if pname != '':
             self.print_debug("=> parameter of mailing %s - %s",
                              (pname, param_value))
             Parameter.change_value(pname, param_value)
Ejemplo n.º 7
0
    def test_payment_billpartial_with_tax(self):
        Parameter.change_value('invoice-vat-mode', '2')
        Params.clear()
        details = [
            {'article': 2, 'designation': 'Article 02', 'price': '100.00', 'quantity': 1}]
        self._create_bill(details, 1, '2015-04-02', 4, True)
        self.factory.xfer = PayoffAddModify()
        self.call(
            '/diacamma.payoff/payoffAddModify', {'SAVE': 'YES', 'supporting': 6, 'amount': '60.0', 'payer': "Ma'a Dalton", 'date': '2015-04-01', 'mode': 0, 'reference': 'abc', 'bank_account': 0}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.payoff', 'payoffAddModify')

        self.factory.xfer = BillShow()
        self.call('/diacamma.invoice/billShow', {'bill': 6}, False)
        self.assert_observer(
            'core.custom', 'diacamma.invoice', 'billShow')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="title"]', "{[br/]}{[center]}{[u]}{[b]}facture{[/b]}{[/u]}{[/center]}")
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="status"]', "validé")
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="total_rest_topay"]', "40.00€")
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="vta_sum"]', "4.76€")
        self.assert_count_equal('ACTIONS/ACTION', 5)
        self.assert_action_equal('ACTIONS/ACTION[1]', (six.text_type(
            'Règlement'), 'diacamma.payoff/images/payments.png', 'diacamma.payoff', 'payableShow', 0, 1, 1))

        self.factory.xfer = PayableShow()
        self.call('/diacamma.payoff/supportingPaymentMethod', {'bill': 6, 'item_name': 'bill'}, False)
        self.assert_observer('core.custom', 'diacamma.payoff', 'supportingPaymentMethod')
        self.assert_xml_equal('COMPONENTS/LABELFORM[@name="num_txt"]', 'A-2')
        self.check_payment(6, 'facture A-2 - 2 avril 2015', '38.1', '1.9')
Ejemplo n.º 8
0
    def test_params(self):
        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('COMPONENTS/*', 37)
        self.assert_count_equal('COMPONENTS/TAB', 4)
        self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
        self.assert_xml_equal('COMPONENTS/TAB[2]', 'Age')
        self.assert_xml_equal('COMPONENTS/TAB[3]', 'Équipe')
        self.assert_xml_equal('COMPONENTS/TAB[4]', 'Activité')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="member-team-text"]', 'Équipe')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="member-activite-text"]', 'Activité')

        Parameter.change_value("member-team-text", 'Cours')
        Parameter.change_value("member-activite-text", 'Sport')
        Params.clear()

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('COMPONENTS/*', 37)
        self.assert_count_equal('COMPONENTS/TAB', 4)
        self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
        self.assert_xml_equal('COMPONENTS/TAB[2]', 'Age')
        self.assert_xml_equal('COMPONENTS/TAB[3]', 'Cours')
        self.assert_xml_equal('COMPONENTS/TAB[4]', 'Sport')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="member-team-text"]', 'Cours')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="member-activite-text"]', 'Sport')
Ejemplo n.º 9
0
 def fillresponse(self, account_system=''):
     if account_system != '':
         if self.confirme(_('Do you confirm to select "%s" like accounting system?{[br/]}{[br/]}{[i]}{[u]}Warning{[/u]}: This choose is definitive.{[/i]}') %
                          accounting_system_name(account_system)):
             Parameter.change_value('accounting-system', account_system)
             Params.clear()
             clear_system_account()
Ejemplo n.º 10
0
def conf_wizard_core(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("core_home", 0))
        wizard_ident.append(("core_users", 100))
    elif (xfer is not None) and (wizard_ident == "core_home"):
        initial_wizard = Params.getvalue("CORE-Wizard")
        param_wizard = xfer.getparam("CORE-Wizard", initial_wizard)
        if initial_wizard != param_wizard:
            Parameter.change_value("CORE-Wizard", param_wizard)
            Params.clear()
        lbl = XferCompLabelForm('title')
        lbl.set_centered()
        lbl.set_value_as_info(six.text_type(settings.APPLIS_NAME))
        lbl.set_location(0, 3, 6)
        xfer.add_component(lbl)
        lbl = XferCompImage('img')
        lbl.type = 'jpg'
        lbl.set_value(settings.APPLIS_LOGO)
        lbl.set_location(2, 4, 2)
        xfer.add_component(lbl)
        lbl = XferCompLabelForm('home')
        lbl.set_value(_('This wizard will help you to configure this software.'))
        lbl.set_location(0, 5, 6)
        xfer.add_component(lbl)
        Params.fill(xfer, ['CORE-Wizard'], 1, 6, False)
        check = xfer.get_components("CORE-Wizard")
        check.set_action(xfer.request, xfer.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        lbl = XferCompLabelForm('lbl_wizard')
        lbl.set_value_as_name(check.description)
        lbl.set_location(2, 6)
        xfer.add_component(lbl)
        check.description = ""
    elif (xfer is not None) and (wizard_ident == "core_users"):
        xfer.add_title(six.text_type(settings.APPLIS_NAME), _("Groups and users"))
        param_lists = ['CORE-connectmode', 'CORE-Wizard']
        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_user")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LucteriosUser._meta.verbose_name_plural, 'count': len(LucteriosUser.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnusers")
        btn.set_location(4, xfer.get_max_row())
        btn.set_action(xfer.request, UsersList.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_group")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LucteriosGroup._meta.verbose_name_plural, 'count': len(LucteriosGroup.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btngroups")
        btn.set_location(4, xfer.get_max_row())
        btn.set_action(xfer.request, GroupsList.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
Ejemplo n.º 11
0
 def fillresponse(self):
     if self.getparam("CONVERT") is None:
         dlg = self.create_custom()
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0)
         dlg.add_component(img)
         lbl = XferCompLabelForm('title')
         lbl.set_value_as_title(self.caption)
         lbl.set_location(1, 0)
         dlg.add_component(lbl)
         year_list = [
             "{[i]} - %s{[/i]}" % year
             for year in FiscalYear.objects.filter(
                 status__in=(FiscalYear.STATUS_BUILDING,
                             FiscalYear.STATUS_RUNNING))
         ]
         lab = XferCompLabelForm('info')
         lab.set_value(
             _("This conversion tool will change your account to respect French law about condominium.{[br/]}For the no-closed fiscal years:{[newline]}%s{[newline]}It will do:{[newline]} - To change accounting code for each owners.{[newline]} - To de-validate all your entity.{[br/]} - To delete all entity link to call of funds or expenses.{[br/]} - To de-archive call of funds or expenses.{[br/]} - To generate correct account for call of funds or expenses.{[br/]}{[center]}{[u]}{[b]}Warning: This action is  definitive.{[/b]}{[/u]}{[center]}"
               ) % '{[br/]}'.join(year_list))
         lab.set_location(0, 1, 4)
         dlg.add_component(lab)
         dlg.new_tab(_("Third accounts"))
         self.fill_third_convert(dlg)
         dlg.new_tab(_("Parameters"))
         fill_params(dlg, True, True)
         dlg.add_action(self.return_action(TITLE_OK, 'images/ok.png'),
                        modal=FORMTYPE_MODAL,
                        close=CLOSE_YES,
                        params={'CONVERT': 'YES'})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         Parameter.change_value('condominium-old-accounting', False)
         Params.clear()
         try:
             thirds_convert = self.get_thirds_convert()
             for set_cost in SetCost.objects.filter(
                     year__status=2, cost_accounting__status=0):
                 set_cost.cost_accounting.is_protected = True
                 set_cost.cost_accounting.save()
                 if (set_cost.year.status == FiscalYear.STATUS_FINISHED
                     ) and (set_cost.cost_accounting.status
                            == CostAccounting.STATUS_OPENED):
                     set_cost.cost_accounting.close()
             for owner in Owner.objects.all():
                 owner.check_account()
             for year in FiscalYear.objects.filter(
                     status__in=(FiscalYear.STATUS_BUILDING,
                                 FiscalYear.STATUS_RUNNING)):
                 convert_accounting(year, thirds_convert)
         except BaseException:
             Params.clear()
             raise
         self.message(_("Data converted"))
Ejemplo n.º 12
0
def invoice_checkparam():
    Parameter.check_and_create(name='invoice-default-sell-account', typeparam=0,
                               title=_("invoice-default-sell-account"), args="{'Multi':False}", value='706')
    Parameter.check_and_create(name='invoice-reduce-account', typeparam=0, title=_("invoice-reduce-account"),
                               args="{'Multi':False}", value='709')
    Parameter.check_and_create(name='invoice-vatsell-account', typeparam=0, title=_("invoice-vatsell-account"),
                               args="{'Multi':False}", value='4455')
    Parameter.check_and_create(name='invoice-vat-mode', typeparam=4, title=_("invoice-vat-mode"),
                               args="{'Enum':3}", value='0', param_titles=(_("invoice-vat-mode.0"), _("invoice-vat-mode.1"), _("invoice-vat-mode.2")))
    Parameter.check_and_create(name="invoice-account-third", typeparam=0, title=_("invoice-account-third"),
                               args="{'Multi':False}", value='411')
Ejemplo n.º 13
0
    def test_no_subdegree(self):
        Parameter.change_value("event-subdegree-enable", 0)
        Params.clear()

        self.factory.xfer = DegreeAddModify()
        self.calljson('/diacamma.event/degreeAddModify',
                      {"SAVE": "YES", 'adherent': 2, "degree": "3", "date": "2014-10-12"}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'degreeAddModify')

        self.factory.xfer = AdherentShow()
        self.calljson('/diacamma.member/adherentShow', {'adherent': 2}, False)
        self.assert_grid_equal('degrees', {'degree': 'Grade', 'date': 'date'}, 1)  # nb=2
        self.assert_json_equal('', 'degrees/@0/degree', "[activity1] level #1.3")
        self.assert_json_equal('', 'degrees/@0/date', "2014-10-12")
Ejemplo n.º 14
0
def contacts_checkparam():
    Parameter.check_and_create(name='contacts-mailtoconfig',
                               typeparam=4,
                               title=_("contacts-mailtoconfig"),
                               args="{'Enum':3}",
                               value='0',
                               param_titles=(_("contacts-mailtoconfig.0"),
                                             _("contacts-mailtoconfig.1"),
                                             _("contacts-mailtoconfig.2")))
    Parameter.check_and_create(name='contacts-createaccount',
                               typeparam=4,
                               title=_("contacts-createaccount"),
                               args="{'Enum':3}",
                               value='0',
                               param_titles=(_("contacts-createaccount.0"),
                                             _("contacts-createaccount.1"),
                                             _("contacts-createaccount.2")))
    Parameter.check_and_create(
        name="contacts-defaultgroup",
        typeparam=0,
        title=_("contacts-defaultgroup"),
        args="{'Multi':False}",
        value='',
        meta='("CORE","LucteriosGroup","django.db.models.Q()", "id", False)')
    Parameter.check_and_create(
        name="contacts-size-page",
        typeparam=1,
        title=_("contacts-size-page"),
        args="{}",
        value='25',
        meta=
        '("","", "[(25,\'25\'),(50,\'50\'),(100,\'100\'),(250,\'250\'),(500,\'500\'),]", "", True)'
    )
Ejemplo n.º 15
0
def run_simple_action(timetxt):
    """Run simple action"""
    if timetxt is None:
        Parameter.change_value('dummy-value', '')
        Params.clear()
    else:
        value = Params.getvalue('dummy-value')
        size = len(value.split('{[br/]}'))
        if size >= 5:
            LucteriosScheduler.remove(run_simple_action)
            LucteriosScheduler.add_date(run_simple_action, datetime=datetime.now() + timedelta(seconds=20), timetxt=None)
        else:
            value += timetxt + "{[br/]}"
            Parameter.change_value('dummy-value', value)
            Params.clear()
Ejemplo n.º 16
0
def paramchange_payoff(params):
    if 'accounting-sizecode' in params:
        for bank in BankAccount.objects.all():
            if bank.account_code != correct_accounting_code(bank.account_code):
                bank.account_code = correct_accounting_code(bank.account_code)
                bank.save()
    if ('payoff-cash-account' in params) or ('accounting-sizecode' in params):
        Parameter.change_value(
            'payoff-cash-account', correct_accounting_code(Params.getvalue('payoff-cash-account')))
    if ('payoff-bankcharges-account' in params) or ('accounting-sizecode' in params):
        pvalue = Params.getvalue('payoff-bankcharges-account')
        if pvalue != '':
            Parameter.change_value(
                'payoff-bankcharges-account', correct_accounting_code(pvalue))
    Params.clear()
Ejemplo n.º 17
0
 def _params(self):
     cur_p = self.old_db.open()
     cur_p.execute(
         "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_copropriete' and paramName in ('frequenceAppel','defautCompteCopro')")
     for param_name, param_value in cur_p.fetchall():
         pname = ''
         if param_name == 'defautCompteCopro':
             pname = 'condominium-default-owner-account'
             param_value = convert_code(param_value)
         if pname != '':
             self.print_debug(
                 "=> parameter of invoice %s - %s", (pname, param_value))
             Parameter.change_value(pname, param_value)
     Parameter.change_value('condominium-old-accounting', True)
     Params.clear()
Ejemplo n.º 18
0
def run_simple_action(timetxt):
    """Run simple action"""
    if timetxt is None:
        Parameter.change_value('dummy-value', '')
        Params.clear()
    else:
        value = Params.getvalue('dummy-value')
        size = len(value.split('{[br/]}'))
        if size >= 5:
            LucteriosScheduler.remove(run_simple_action)
            LucteriosScheduler.add_date(run_simple_action, datetime=datetime.now() + timedelta(seconds=20), timetxt=None)
        else:
            value += timetxt + "{[br/]}"
            Parameter.change_value('dummy-value', value)
            Params.clear()
Ejemplo n.º 19
0
 def _params(self):
     from lucterios.CORE.models import Parameter
     cur_p = self.old_db.open()
     cur_p.execute(
         "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'org_lucterios_contacts' and paramName in ('MailToConfig')")
     for param_name, param_value in cur_p.fetchall():
         pname = ''
         if param_name == 'MailToConfig':
             pname = 'contacts-mailtoconfig'
             if param_value == '':
                 param_value = '0'
         if pname != '':
             self.print_debug(
                 "=> parameter of contacts %s - %s", (pname, param_value))
             Parameter.change_value(pname, param_value)
Ejemplo n.º 20
0
def set_parameters(values):
    param_lists = [
        "team", "activite", "age", "licence", "genre", 'numero', 'birth']
    for param_item in param_lists:
        if param_item == "genre":
            param_name = "member-filter-genre"
        elif param_item == "numero":
            param_name = "member-numero"
        elif param_item == "birth":
            param_name = "member-birth"
        else:
            param_name = "member-%s-enable" % param_item
            if param_item == "licence":
                param_name += 'd'
        Parameter.change_value(param_name, param_item in values)
    Params.clear()
Ejemplo n.º 21
0
def paramchange_invoice(params):
    invoice_params = ['invoice-default-sell-account', 'invoice-vatsell-account',
                      'invoice-reduce-account', 'invoice-account-third']
    if 'accounting-sizecode' in params:
        for param_item in invoice_params:
            Parameter.change_value(
                param_item, correct_accounting_code(Params.getvalue(param_item)))
        Params.clear()
        for art in Article.objects.all():
            if art.sell_account != correct_accounting_code(art.sell_account):
                art.sell_account = correct_accounting_code(art.sell_account)
                art.save()
    for invoice_param in invoice_params:
        if invoice_param in params:
            Parameter.change_value(
                invoice_param, correct_accounting_code(Params.getvalue(invoice_param)))
Ejemplo n.º 22
0
def set_parameters(values):
    param_lists = [
        "team", "activite", "age", "licence", "genre", 'numero', 'birth'
    ]
    for param_item in param_lists:
        if param_item == "genre":
            param_name = "member-filter-genre"
        elif param_item == "numero":
            param_name = "member-numero"
        elif param_item == "birth":
            param_name = "member-birth"
        else:
            param_name = "member-%s-enable" % param_item
            if param_item == "licence":
                param_name += 'd'
        Parameter.change_value(param_name, param_item in values)
    Params.clear()
Ejemplo n.º 23
0
def contacts_checkparam():
    Parameter.check_and_create(name='contacts-mailtoconfig',
                               typeparam=4,
                               title=_("contacts-mailtoconfig"),
                               args="{'Enum':3}",
                               value='0',
                               param_titles=(_("contacts-mailtoconfig.0"),
                                             _("contacts-mailtoconfig.1"),
                                             _("contacts-mailtoconfig.2")))
    Parameter.check_and_create(name='contacts-createaccount',
                               typeparam=4,
                               title=_("contacts-createaccount"),
                               args="{'Enum':3}",
                               value='0',
                               param_titles=(_("contacts-createaccount.0"),
                                             _("contacts-createaccount.1"),
                                             _("contacts-createaccount.2")))
Ejemplo n.º 24
0
 def _params(self):
     cur_p = self.old_db.open()
     cur_p.execute(
         "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_FormationSport'")
     for param_name, param_value in cur_p.fetchall():
         pname = ''
         if param_name == "GradeText":
             pname = "event-degree-text"
         if param_name == "SousGradeEnable":
             pname = "event-subdegree-enable"
         if param_name == "SousGradeText":
             pname = "event-subdegree-text"
         if param_name == "defaultCommentaire":
             pname = "event-comment-text"
         if pname != '':
             self.print_debug(
                 "=> parameter of event %s - %s", (pname, param_value))
             Parameter.change_value(pname, param_value)
     Params.clear()
Ejemplo n.º 25
0
    def test_params(self):
        self.factory.xfer = EventConf()
        self.calljson('/diacamma.event/eventConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.event', 'eventConf')
        self.assert_count_equal('', 2 + 2 + 2 + 7)
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('TAB', '__tab_2', 'Diplôme')
        self.assert_json_equal('TAB', '__tab_3', 'Sous-diplôme')
        self.assertFalse('__tab_4' in self.json_data.keys(), self.json_data.keys())
        self.assert_json_equal('LABELFORM', 'event-degree-text', 'Diplôme')
        self.assert_json_equal('LABELFORM', 'event-subdegree-text', 'Sous-diplôme')

        Parameter.change_value("event-degree-text", 'Grade')
        Parameter.change_value("event-subdegree-text", 'Barette')
        Params.clear()

        self.factory.xfer = EventConf()
        self.calljson('/diacamma.event/eventConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.event', 'eventConf')
        self.assert_count_equal('', 2 + 2 + 2 + 7)
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('TAB', '__tab_2', 'Grade')
        self.assert_json_equal('TAB', '__tab_3', 'Barette')
        self.assertFalse('__tab_4' in self.json_data.keys(), self.json_data.keys())
        self.assert_json_equal('LABELFORM', 'event-degree-text', 'Grade')
        self.assert_json_equal('LABELFORM', 'event-subdegree-text', 'Barette')
        self.assert_json_equal('LABELFORM', 'event-subdegree-enable', 'Oui')
        self.assert_json_equal('LABELFORM', 'event-degree-enable', 'Oui')

        Parameter.change_value("event-subdegree-enable", 0)
        Params.clear()

        self.factory.xfer = EventConf()
        self.calljson('/diacamma.event/eventConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.event', 'eventConf')
        self.assert_count_equal('', 2 + 2 + 7)
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('TAB', '__tab_2', 'Grade')
        self.assertFalse('__tab_3' in self.json_data.keys(), self.json_data.keys())
        self.assert_json_equal('LABELFORM', 'event-subdegree-enable', 'Non')
        self.assert_json_equal('LABELFORM', 'event-degree-enable', 'Oui')

        Parameter.change_value("event-degree-enable", 0)
        Params.clear()

        self.factory.xfer = EventConf()
        self.calljson('/diacamma.event/eventConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.event', 'eventConf')
        self.assert_count_equal('', 2 + 7)
        self.assertFalse('__tab_2' in self.json_data.keys(), self.json_data.keys())
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('LABELFORM', 'event-subdegree-enable', 'Non')
        self.assert_json_equal('LABELFORM', 'event-degree-enable', 'Non')
Ejemplo n.º 26
0
def event_checkparam():
    Parameter.check_and_create(name="event-subdegree-enable", typeparam=3, title=_("event-subdegree-enable"),
                               args="{}", value='True')

    Parameter.check_and_create(name="event-degree-text", typeparam=0, title=_("event-degree-text"),
                               args="{'Multi':False}", value=_('Degree'))

    Parameter.check_and_create(name="event-subdegree-text", typeparam=0, title=_("event-subdegree-text"),
                               args="{'Multi':False}", value=_('Sub-degree'))

    Parameter.check_and_create(name="event-comment-text", typeparam=0,
                               title=_("event-comment-text"), args="{'Multi':True}", value='')
Ejemplo n.º 27
0
 def fillresponse(self):
     if self.getparam("CONVERT") is None:
         dlg = self.create_custom()
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0)
         dlg.add_component(img)
         lbl = XferCompLabelForm('title')
         lbl.set_value_as_title(self.caption)
         lbl.set_location(1, 0)
         dlg.add_component(lbl)
         year_list = ["{[i]} - %s{[/i]}" % year for year in FiscalYear.objects.filter(status__lt=2)]
         lab = XferCompLabelForm('info')
         lab.set_value(
             _("This conversion tool will change your account to respect French law about condominium.{[br/]}For the no-closed fiscal years:{[newline]}%s{[newline]}It will do:{[newline]} - To change accounting code for each owners.{[newline]} - To de-validate all your entity.{[br/]} - To delete all entity link to call of funds or expenses.{[br/]} - To de-archive call of funds or expenses.{[br/]} - To generate correct account for call of funds or expenses.{[br/]}{[center]}{[u]}{[b]}Warning: This action is  definitive.{[/b]}{[/u]}{[center]}") % '{[br/]}'.join(year_list))
         lab.set_location(0, 1, 4)
         dlg.add_component(lab)
         dlg.new_tab(_("Third accounts"))
         self.fill_third_convert(dlg)
         dlg.new_tab(_("Parameters"))
         fill_params(dlg, True, True)
         dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), modal=FORMTYPE_MODAL, close=CLOSE_YES, params={'CONVERT': 'YES'})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         Parameter.change_value('condominium-old-accounting', False)
         Params.clear()
         try:
             thirds_convert = self.get_thirds_convert()
             for set_cost in SetCost.objects.filter(year__status=2, cost_accounting__status=0):
                 set_cost.cost_accounting.is_protected = True
                 set_cost.cost_accounting.save()
                 if (set_cost.year.status == 2) and (set_cost.cost_accounting.status == 0):
                     set_cost.cost_accounting.close()
             for owner in Owner.objects.all():
                 for num_account in range(1, 5):
                     AccountThird.objects.create(third=owner.third,
                                                 code=correct_accounting_code(Params.getvalue("condominium-default-owner-account%d" % num_account)))
             for year in FiscalYear.objects.filter(status__lt=2):
                 convert_accounting(year, thirds_convert)
         except:
             Params.clear()
             raise
         self.message(_("Data converted"))
Ejemplo n.º 28
0
    def test_no_subdegree(self):
        Parameter.change_value("event-subdegree-enable", 0)
        Params.clear()

        self.factory.xfer = DegreeAddModify()
        self.call('/diacamma.event/degreeAddModify',
                  {"SAVE": "YES", 'adherent': 2, "degree": "3", "date": "2014-10-12"}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.event', 'degreeAddModify')

        self.factory.xfer = AdherentShow()
        self.call('/diacamma.member/adherentAddModify', {'adherent': 2}, False)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="degrees"]/RECORD', 1)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="degrees"]/HEADER', 2)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="degrees"]/RECORD[1]/VALUE[@name="degree"]', "[activity1] level #1.3")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="degrees"]/RECORD[1]/VALUE[@name="date"]', "12 octobre 2014")
Ejemplo n.º 29
0
def payoff_checkparam():
    Parameter.check_and_create(name='payoff-bankcharges-account', typeparam=0,
                               title=_("payoff-bankcharges-account"), args="{'Multi':False}", value='')
    Parameter.check_and_create(name='payoff-cash-account', typeparam=0, title=_("payoff-cash-account"), args="{'Multi':False}", value='531')
    Parameter.check_and_create(name='payoff-email-message', typeparam=0, title=_("payoff-email-message"),
                               args="{'Multi':True}", value=_('%(name)s\n\nJoint in this email %(doc)s.\n\nRegards'))
    check_payoff_accounting()
Ejemplo n.º 30
0
def default_params():
    Parameter.change_value(
        'member-team-text', 'group')
    Parameter.change_value(
        'member-activite-text', 'passion')
    Params.clear()
    default = Activity.objects.get(id=1)
    default.name = "activity1"
    default.description = "activity N°1"
    default.save()
    Activity.objects.create(name="activity2", description="activity N°2")
    Team.objects.create(name="team1", description="team N°1")
    Team.objects.create(name="team2", description="team N°2")
    Team.objects.create(name="team3", description="team N°3")
    Age.objects.create(name="Poussins", minimum=9, maximum=10)
    Age.objects.create(name="Benjamins", minimum=11, maximum=12)
    Age.objects.create(name="Minimes", minimum=13, maximum=14)
    Age.objects.create(name="Cadets", minimum=15, maximum=16)
    Age.objects.create(name="Juniors", minimum=17, maximum=18)
    Age.objects.create(name="Espoirs", minimum=19, maximum=21)
    Age.objects.create(name="Seniors", minimum=22, maximum=38)
    Age.objects.create(name="Vétérans", minimum=39, maximum=108)
    Document.objects.create(season=Season.current_season(), name="Doc 1")
    Document.objects.create(season=Season.current_season(), name="Doc 2")
Ejemplo n.º 31
0
def default_event_params():
    for activity in Activity.objects.all():
        for level in range(1, 10):
            DegreeType.objects.create(
                name="level #%d.%d" % (activity.id, level), level=level, activity=activity)
    for level in range(1, 6):
        SubDegreeType.objects.create(
            name="sublevel #%d" % level, level=level)
    Parameter.change_value("event-degree-text", 'Grade')
    Parameter.change_value("event-subdegree-text", 'Barette')
    Parameter.change_value("event-comment-text", 'Epreuve 1:{[br/]}Epreuve 2:{[br/]}')
    Params.clear()
Ejemplo n.º 32
0
    def test_params(self):
        self.factory.xfer = EventConf()
        self.call('/diacamma.event/EventConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.event', 'EventConf')
        self.assert_count_equal('COMPONENTS/*', 2 + 3 + 3 + 10)
        self.assert_count_equal('COMPONENTS/TAB', 3)
        self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
        self.assert_xml_equal('COMPONENTS/TAB[2]', 'Diplôme')
        self.assert_xml_equal('COMPONENTS/TAB[3]', 'Sous-diplôme')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="event-degree-text"]', 'Diplôme')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="event-subdegree-text"]', 'Sous-diplôme')

        Parameter.change_value("event-degree-text", 'Grade')
        Parameter.change_value("event-subdegree-text", 'Barette')
        Params.clear()

        self.factory.xfer = EventConf()
        self.call('/diacamma.event/EventConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.event', 'EventConf')
        self.assert_count_equal('COMPONENTS/*', 2 + 3 + 3 + 10)
        self.assert_count_equal('COMPONENTS/TAB', 3)
        self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
        self.assert_xml_equal('COMPONENTS/TAB[2]', 'Grade')
        self.assert_xml_equal('COMPONENTS/TAB[3]', 'Barette')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="event-degree-text"]', 'Grade')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="event-subdegree-text"]', 'Barette')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="event-subdegree-enable"]', 'Oui')

        Parameter.change_value("event-subdegree-enable", 0)
        Params.clear()

        self.factory.xfer = EventConf()
        self.call('/diacamma.event/EventConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.event', 'EventConf')
        self.assert_count_equal('COMPONENTS/*', 2 + 3 + 10)
        self.assert_count_equal('COMPONENTS/TAB', 2)
        self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
        self.assert_xml_equal('COMPONENTS/TAB[2]', 'Grade')
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="event-subdegree-enable"]', 'Non')
Ejemplo n.º 33
0
def default_event_params():
    for activity in Activity.objects.all():
        for level in range(1, 10):
            DegreeType.objects.create(name="level #%d.%d" %
                                      (activity.id, level),
                                      level=level,
                                      activity=activity)
    for level in range(1, 6):
        SubDegreeType.objects.create(id=level,
                                     name="sublevel #%d" % level,
                                     level=level)
    Parameter.change_value("event-degree-text", 'Grade')
    Parameter.change_value("event-subdegree-text", 'Barette')
    Parameter.change_value("event-comment-text",
                           'Epreuve 1:{[br/]}Epreuve 2:{[br/]}')
    Params.clear()
Ejemplo n.º 34
0
 def _params(self):
     from lucterios.CORE.models import Parameter
     Parameter.change_value(
         'accounting-system', 'diacamma.accounting.system.french.FrenchSystemAcounting')
     Parameter.change_value("accounting-sizecode", 6)
     cur_p = self.old_db.open()
     cur_p.execute(
         "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_compta' and paramName in ('Devise','DeviseOff','PrecDevise')")
     for param_name, param_value in cur_p.fetchall():
         pname = ''
         if param_name == 'Devise':
             pname = 'accounting-devise'
             param_value = decode_html(param_value)
         elif param_name == 'DeviseOff':
             pname = 'accounting-devise-iso'
         elif param_name == 'PrecDevise':
             pname = 'accounting-devise-prec'
         if pname != '':
             self.print_debug(
                 "=> parameter of account %s - %s", (pname, param_value))
             Parameter.change_value(pname, param_value)
     Params.clear()
Ejemplo n.º 35
0
def default_params():
    Parameter.change_value('member-team-text', 'group')
    Parameter.change_value('member-activite-text', 'passion')
    Parameter.change_value('member-tax-receipt', '708')
    Params.clear()
    default = Activity.objects.get(id=1)
    default.name = "activity1"
    default.description = "activity N°1"
    default.save()
    Activity.objects.create(name="activity2", description="activity N°2")
    Team.objects.create(name="team1", description="team N°1{[br/]}The bests")
    Team.objects.create(name="team2",
                        description="team N°2{[br/]}The chalengers")
    Team.objects.create(name="team3", description="team N°3{[br/]}The newbies")
    Age.objects.create(name="Poussins", minimum=9, maximum=10)
    Age.objects.create(name="Benjamins", minimum=11, maximum=12)
    Age.objects.create(name="Minimes", minimum=13, maximum=14)
    Age.objects.create(name="Cadets", minimum=15, maximum=16)
    Age.objects.create(name="Juniors", minimum=17, maximum=18)
    Age.objects.create(name="Espoirs", minimum=19, maximum=21)
    Age.objects.create(name="Seniors", minimum=22, maximum=38)
    Age.objects.create(name="Vétérans", minimum=39, maximum=108)
    Document.objects.create(season=Season.current_season(), name="Doc 1")
    Document.objects.create(season=Season.current_season(), name="Doc 2")
Ejemplo n.º 36
0
def old_accounting():
    Parameter.change_value('condominium-old-accounting', True)
    Params.clear()
Ejemplo n.º 37
0
def mailing_checkparam():
    Parameter.check_and_create(name='mailing-smtpserver',
                               typeparam=0,
                               title=_("mailing-smtpserver"),
                               args="{'Multi': False}",
                               value='')
    Parameter.check_and_create(name='mailing-smtpport',
                               typeparam=1,
                               title=_("mailing-smtpport"),
                               args="{'Min': 0, 'Max': 99999}",
                               value='25')

    Parameter.check_and_create(name='mailing-smtpsecurity',
                               typeparam=4,
                               title=_("mailing-smtpsecurity"),
                               args="{'Enum':3}",
                               value='0',
                               param_titles=(_("mailing-smtpsecurity.0"),
                                             _("mailing-smtpsecurity.1"),
                                             _("mailing-smtpsecurity.2")))

    Parameter.check_and_create(name='mailing-smtpuser',
                               typeparam=0,
                               title=_("mailing-smtpuser"),
                               args="{'Multi': False}",
                               value='')

    Parameter.check_and_create(name='mailing-smtppass',
                               typeparam=5,
                               title=_("mailing-smtppass"),
                               args="{'Multi': False}",
                               value='')
    Parameter.check_and_create(
        name='mailing-msg-connection',
        typeparam=0,
        title=_("mailing-msg-connection"),
        args="{'Multi': True, 'HyperText': True}",
        value=
        _('''Connection confirmation to your application:{[br/]} - User:%(username)s{[br/]} - Password:%(password)s{[br/]}'''
          ))
    Parameter.check_and_create(name='mailing-delay-batch',
                               typeparam=2,
                               title=_("mailing-delay-batch"),
                               args="{'Min': 0.1, 'Max': 120, 'Prec': 1}",
                               value='15')
    Parameter.check_and_create(name='mailing-nb-by-batch',
                               typeparam=1,
                               title=_("mailing-nb-by-batch"),
                               args="{'Min': 1, 'Max': 100}",
                               value='10')

    Parameter.check_and_create(name='mailing-dkim-private-path',
                               typeparam=0,
                               title=_("mailing-dkim-private-path"),
                               args="{'Multi': False}",
                               value='')
    Parameter.check_and_create(name='mailing-dkim-selector',
                               typeparam=0,
                               title=_("mailing-dkim-selector"),
                               args="{'Multi': False}",
                               value='default')
Ejemplo n.º 38
0
 def fillresponse(self):
     Parameter.change_value('dummy-value', '')
     Params.clear()
     LucteriosScheduler.add_task(run_simple_action, minutes=1.0 / 6, timetxt=datetime.now().ctime())
Ejemplo n.º 39
0
def documents_checkparam():
    Parameter.check_and_create(name="documents-signature", typeparam=0, title=_("documents-signature"),
                               args="{'Multi':False}", value='',
                               meta='("documents","DocumentContainer","django.db.models.Q(name__regex=\'.*\\.jpg|.*\\.png\')", "id", False)')
Ejemplo n.º 40
0
    def test_params(self):
        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 2 + 3 + 2)
        self.assertFalse('__tab_5' in self.json_data.keys(),
                         self.json_data.keys())
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('TAB', '__tab_2', 'Âge')
        self.assert_json_equal('TAB', '__tab_3', 'Équipe')
        self.assert_json_equal('TAB', '__tab_4', 'Activité')
        self.assert_json_equal('LABELFORM', 'member-team-text', 'Équipe')
        self.assert_json_equal('LABELFORM', 'member-activite-text', 'Activité')
        self.assert_json_equal(
            'LABELFORM', 'member-fields',
            "N°{[br/]}prénom{[br/]}nom{[br/]}tel1{[br/]}tel2{[br/]}courriel{[br/]}participation"
        )
        self.assert_json_equal('', '#editparam/action/action',
                               'categoryParamEdit')

        self.factory.xfer = CategoryParamEdit()
        self.calljson(
            '/diacamma.member/categoryParamEdit', {
                'params':
                ";".join([
                    "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-family-type", "member-connection",
                    "member-subscription-mode", "member-size-page",
                    "member-fields", "member-subscription-message"
                ])
            }, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'categoryParamEdit')
        self.assert_json_equal('SELECT', 'member-size-page', '25')
        self.assert_select_equal('member-size-page', 5)
        self.assert_json_equal('CHECKLIST', 'member-fields', [
            'num', 'firstname', 'lastname', 'tel1', 'tel2', 'email', 'license'
        ])
        self.assert_select_equal('member-fields', 17, checked=True)

        Parameter.change_value("member-team-text", 'Cours')
        Parameter.change_value("member-activite-text", 'Sport')
        Parameter.change_value("member-fields",
                               "firstname;lastname;email;documents")
        Params.clear()

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 2 + 3 + 2)
        self.assertFalse('__tab_5' in self.json_data.keys(),
                         self.json_data.keys())
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('TAB', '__tab_2', 'Âge')
        self.assert_json_equal('TAB', '__tab_3', 'Cours')
        self.assert_json_equal('TAB', '__tab_4', 'Sport')
        self.assert_json_equal('LABELFORM', 'member-team-text', 'Cours')
        self.assert_json_equal('LABELFORM', 'member-activite-text', 'Sport')
        self.assert_json_equal(
            'LABELFORM', 'member-fields',
            "prénom{[br/]}nom{[br/]}courriel{[br/]}documents demandés")
Ejemplo n.º 41
0
    def test_no_subdegree(self):
        Parameter.change_value("event-subdegree-enable", 0)
        Params.clear()

        self.factory.xfer = EventAddModify()
        self.calljson('/diacamma.event/eventAddModify',
                      {"SAVE": "YES", "date": "2014-10-12", "activity": "1", "event_type": 0, "comment": "new examination", 'default_article': 0}, 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, 'adherent': '2;4;5'}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'participantSave')

        self.factory.xfer = EventTransition()
        self.calljson('/diacamma.event/eventTransition', {"event": 1, 'TRANSITION': 'validate'}, False)
        self.assert_observer('core.custom', 'diacamma.event', 'eventTransition')
        self.assert_count_equal('', 5 + 4 * 3)
        self.assert_json_equal('LABELFORM', 'name_1', "Dalton Avrel")
        self.assert_select_equal('degree_1', 9)  # nb=9
        self.assert_json_equal('MEMO', 'comment_1', "Epreuve 1:{[br/]}Epreuve 2:{[br/]}")
        self.assert_json_equal('LABELFORM', 'name_2', "Dalton Jack")
        self.assert_select_equal('degree_2', 10)  # nb=10
        self.assert_json_equal('MEMO', 'comment_2', "Epreuve 1:{[br/]}Epreuve 2:{[br/]}")
        self.assert_json_equal('LABELFORM', 'name_3', "Dalton Joe")
        self.assert_select_equal('degree_3', 10)  # nb=10
        self.assert_json_equal('MEMO', 'comment_3', "Epreuve 1:{[br/]}Epreuve 2:{[br/]}")

        self.factory.xfer = EventTransition()
        self.calljson('/diacamma.event/eventTransition',
                      {"event": 1, 'CONFIRME': 'YES', 'comment_1': 'trop nul!', 'degree_2': 5, 'comment_2': 'ça va...',
                       'degree_3': 3, 'comment_3': 'bien :)', 'TRANSITION': 'validate'}, False)
        self.assert_observer('core.acknowledge', 'diacamma.event', 'eventTransition')

        self.factory.xfer = EventShow()
        self.calljson('/diacamma.event/eventShow', {"event": 1}, False)
        self.assert_observer('core.custom', 'diacamma.event', 'eventShow')
        self.assert_count_equal('', 9)
        self.assert_count_equal('#organizer/actions', 0)
        self.assert_count_equal('#participant/actions', 1)
        self.assert_grid_equal('participant', {'contact': "contact", "is_subscripter": "adhérent ?", 'degree_result_simple': "Grade résultant", 'comment': "commentaire", 'article_ref_price': "article"}, 3)
        self.assert_json_equal('', 'participant/@0/contact', "Dalton Avrel")
        self.assert_json_equal('', 'participant/@0/is_subscripter', False)
        self.assert_json_equal('', 'participant/@0/degree_result_simple', None)
        self.assert_json_equal('', 'participant/@0/comment', 'trop nul!')
        self.assert_json_equal('', 'participant/@0/article_ref_price', None)
        self.assert_json_equal('', 'participant/@1/contact', "Dalton Jack")
        self.assert_json_equal('', 'participant/@1/is_subscripter', False)
        self.assert_json_equal('', 'participant/@1/degree_result_simple', "level #1.5")
        self.assert_json_equal('', 'participant/@1/comment', 'ça va...')
        self.assert_json_equal('', 'participant/@1/article_ref_price', None)
        self.assert_json_equal('', 'participant/@2/contact', "Dalton Joe")
        self.assert_json_equal('', 'participant/@2/is_subscripter', False)
        self.assert_json_equal('', 'participant/@2/degree_result_simple', "level #1.3")
        self.assert_json_equal('', 'participant/@2/comment', 'bien :)')
        self.assert_json_equal('', 'participant/@2/article_ref_price', None)
Ejemplo n.º 42
0
def mailing_checkparam():
    Parameter.check_and_create(name='mailing-smtpserver', typeparam=0, title=_("mailing-smtpserver"), args="{'Multi': False}", value='')
    Parameter.check_and_create(name='mailing-smtpport', typeparam=1, title=_("mailing-smtpport"), args="{'Min': 0, 'Max': 99999}", value='25')

    Parameter.check_and_create(name='mailing-smtpsecurity', typeparam=4, title=_("mailing-smtpsecurity"), args="{'Enum':3}", value='0',
                               param_titles=(_("mailing-smtpsecurity.0"), _("mailing-smtpsecurity.1"), _("mailing-smtpsecurity.2")))

    Parameter.check_and_create(name='mailing-smtpuser', typeparam=0, title=_("mailing-smtpuser"), args="{'Multi': False}", value='')

    Parameter.check_and_create(name='mailing-smtppass', typeparam=5, title=_("mailing-smtppass"), args="{'Multi': False}", value='')
    Parameter.check_and_create(name='mailing-msg-connection', typeparam=0, title=_("mailing-msg-connection"), args="{'Multi': True}",
                               value=_('''Connection confirmation to your application:
User:%(username)s
Password:%(password)s
'''))
Ejemplo n.º 43
0
def old_accounting():
    Parameter.change_value('condominium-old-accounting', True)
    Params.clear()
Ejemplo n.º 44
0
    def test_team(self):
        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 2 + 3 + 2)
        self.assert_grid_equal('team', {
            'name': "nom",
            'description': "description"
        }, 0)

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf',
                      {'show_only_enabled_team': False}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 2 + 3 + 2)
        self.assert_grid_equal('team', {
            'name': "nom",
            'description': "description",
            'unactive': "désactivé"
        }, 0)

        self.factory.xfer = TeamAddModify()
        self.calljson('/diacamma.member/teamAddModify', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'teamAddModify')
        self.assert_count_equal('', 4)

        self.factory.xfer = TeamAddModify()
        self.calljson('/diacamma.member/teamAddModify', {
            "SAVE": "YES",
            "name": "xyz",
            "description": "abc",
            'unactive': 0
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'teamAddModify')

        self.factory.xfer = TeamAddModify()
        self.calljson('/diacamma.member/teamAddModify', {
            "SAVE": "YES",
            "name": "uvw",
            "description": "def",
            'unactive': 1
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'teamAddModify')

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf',
                      {'show_only_enabled_team': False}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('team', 2)
        self.assert_json_equal('', 'team/@0/name', "uvw")
        self.assert_json_equal('', 'team/@0/unactive', True)
        self.assert_json_equal('', 'team/@1/name', "xyz")
        self.assert_json_equal('', 'team/@1/unactive', False)

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf',
                      {'show_only_enabled_team': True}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('team', 1)
        self.assert_json_equal('', 'team/@0/name', "xyz")

        self.factory.xfer = TeamDel()
        self.calljson('/diacamma.member/teamDel', {
            "CONFIRME": "YES",
            "team": 1
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member', 'teamDel')

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('team', 0)

        Parameter.change_value("member-team-enable", '0')
        Params.clear()

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 2 + 0 + 2)
        self.assert_json_equal('LABELFORM', 'member-team-enable', 'Non')
        self.assertFalse('__tab_4' in self.json_data.keys(),
                         self.json_data.keys())
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('TAB', '__tab_2', 'Âge')
        self.assert_json_equal('TAB', '__tab_3', 'Activité')
Ejemplo n.º 45
0
    def test_age(self):
        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('COMPONENTS/*', 37)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="age"]/HEADER', 3)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/HEADER[@name="name"]', "nom")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/HEADER[@name="date_min"]', "date min.")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/HEADER[@name="date_max"]', "date max.")
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD', 0)

        self.factory.xfer = AgeAddModify()
        self.call('/diacamma.member/ageAddModify', {}, False)
        self.assert_observer(
            'core.exception', 'diacamma.member', 'ageAddModify')

        default_season()

        self.factory.xfer = AgeAddModify()
        self.call('/diacamma.member/ageAddModify', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'ageAddModify')
        self.assert_count_equal('COMPONENTS/*', 7)

        self.factory.xfer = AgeAddModify()
        self.call('/diacamma.member/ageAddModify',
                  {"SAVE": "YES", "name": "xyz", "date_min": "1981", "date_max": "1980"}, False)
        self.assert_observer(
            'core.exception', 'diacamma.member', 'ageAddModify')

        self.factory.xfer = AgeAddModify()
        self.call('/diacamma.member/ageAddModify',
                  {"SAVE": "YES", "name": "xyz", "date_min": "1980", "date_max": "1981"}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'ageAddModify')
        self.factory.xfer = AgeAddModify()
        self.call('/diacamma.member/ageAddModify',
                  {"SAVE": "YES", "name": "uvw", "date_min": "1979", "date_max": "1980"}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'ageAddModify')

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD', 2)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[1]/VALUE[@name="name"]', "uvw")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[1]/VALUE[@name="date_min"]', "1979")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[1]/VALUE[@name="date_max"]', "1980")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[2]/VALUE[@name="name"]', "xyz")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[2]/VALUE[@name="date_min"]', "1980")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[2]/VALUE[@name="date_max"]', "1981")

        self.factory.xfer = SeasonActive()
        self.call('/diacamma.member/seasonActive', {'season': 12}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'seasonActive')

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD', 2)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[1]/VALUE[@name="name"]', "uvw")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[1]/VALUE[@name="date_min"]', "1981")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[1]/VALUE[@name="date_max"]', "1982")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[2]/VALUE[@name="name"]', "xyz")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[2]/VALUE[@name="date_min"]', "1982")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD[2]/VALUE[@name="date_max"]', "1983")
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="member-age-enable"]', 'Oui')

        self.factory.xfer = AgeDel()
        self.call('/diacamma.member/ageDel',
                  {"CONFIRME": "YES", "age": 1}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'ageDel')

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="age"]/RECORD', 1)

        Parameter.change_value("member-age-enable", '0')
        Params.clear()

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('COMPONENTS/*', 34)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="member-age-enable"]', 'Non')
        self.assert_count_equal('COMPONENTS/TAB', 3)
        self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
        self.assert_xml_equal('COMPONENTS/TAB[2]', 'Équipe')
        self.assert_xml_equal('COMPONENTS/TAB[3]', 'Activité')
Ejemplo n.º 46
0
def dummy_checkparam():
    Parameter.check_and_create(name="dummy-value", typeparam=0, title=_("dummy-value"), args="{}", value='')
Ejemplo n.º 47
0
 def fillresponse(self):
     Parameter.change_value('dummy-value', '')
     Params.clear()
     LucteriosScheduler.add_task(run_simple_action,
                                 minutes=1.0 / 6,
                                 timetxt=datetime.now().ctime())
Ejemplo n.º 48
0
def member_checkparam():
    Parameter.check_and_create(name="member-age-enable", typeparam=3, title=_("member-age-enable"), args="{}", value='True')
    Parameter.check_and_create(name="member-team-enable", typeparam=3, title=_("member-team-enable"), args="{}", value='True')
    Parameter.check_and_create(name="member-team-text", typeparam=0, title=_("member-team-text"), args="{'Multi':False}", value=_('Team'))
    Parameter.check_and_create(name="member-activite-enable", typeparam=3, title=_("member-activite-enable"), args="{}", value="True")
    Parameter.check_and_create(name="member-activite-text", typeparam=0, title=_("member-activite-text"), args="{'Multi':False}", value=_('Activity'))
    Parameter.check_and_create(name="member-connection", typeparam=3, title=_("member-connection"), args="{}", value='False')
    Parameter.check_and_create(name="member-birth", typeparam=3, title=_("member-birth"), args="{}", value='True')
    Parameter.check_and_create(name="member-filter-genre", typeparam=3, title=_("member-filter-genre"), args="{}", value='True')
    Parameter.check_and_create(name="member-numero", typeparam=3, title=_("member-numero"), args="{}", value='True')
    Parameter.check_and_create(name="member-licence-enabled", typeparam=3, title=_("member-licence-enabled"), args="{}", value='True')
    Parameter.check_and_create(name="member-subscription-message", typeparam=0, title=_("member-subscription-message"),
                               args="{'Multi':True}", value=_('Welcome,\n\nYou have a new subscription.Joint, the quotation relative.\n\nRegards,'))
    Parameter.check_and_create(name="member-subscription-mode", typeparam=4, title=_("member-subscription-mode"), args="{'Enum':3}", value='0',
                               param_titles=(_("member-subscription-mode.0"), _("member-subscription-mode.1"), _("member-subscription-mode.2")))
Ejemplo n.º 49
0
 def initialize_system(self):
     Parameter.change_value('condominium-default-owner-account', correct_accounting_code('450'))
     Parameter.change_value('condominium-default-owner-account1', correct_accounting_code('4501'))
     Parameter.change_value('condominium-default-owner-account2', correct_accounting_code('4502'))
     Parameter.change_value('condominium-default-owner-account3', correct_accounting_code('4503'))
     Parameter.change_value('condominium-default-owner-account4', correct_accounting_code('4504'))
     Parameter.change_value('condominium-default-owner-account5', correct_accounting_code('4505'))
     Parameter.change_value('condominium-current-revenue-account', correct_accounting_code('701'))
     Parameter.change_value('condominium-exceptional-revenue-account', correct_accounting_code('702'))
     Parameter.change_value('condominium-fundforworks-revenue-account', correct_accounting_code('705'))
     Parameter.change_value('condominium-exceptional-reserve-account', correct_accounting_code('120'))
     Parameter.change_value('condominium-advance-reserve-account', correct_accounting_code('103'))
     Parameter.change_value('condominium-fundforworks-reserve-account', correct_accounting_code('105'))
     Parameter.change_value('condominium-mode-current-callfunds', 0)
     Params.clear()
Ejemplo n.º 50
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)
Ejemplo n.º 51
0
    def test_team(self):
        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('COMPONENTS/*', 37)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="team"]/HEADER', 3)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="team"]/HEADER[@name="name"]', "nom")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="team"]/HEADER[@name="description"]', "description")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="team"]/HEADER[@name="unactive"]', "désactivé")
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="team"]/RECORD', 0)

        self.factory.xfer = TeamAddModify()
        self.call('/diacamma.member/teamAddModify', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'teamAddModify')
        self.assert_count_equal('COMPONENTS/*', 7)

        self.factory.xfer = TeamAddModify()
        self.call('/diacamma.member/teamAddModify',
                  {"SAVE": "YES", "name": "xyz", "description": "abc"}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'teamAddModify')

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="team"]/RECORD', 1)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="team"]/RECORD[1]/VALUE[@name="name"]', "xyz")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="team"]/RECORD[1]/VALUE[@name="unactive"]', "0")

        self.factory.xfer = TeamDel()
        self.call('/diacamma.member/teamDel',
                  {"CONFIRME": "YES", "team": 1}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'teamDel')

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="team"]/RECORD', 0)

        Parameter.change_value("member-team-enable", '0')
        Params.clear()

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('COMPONENTS/*', 34)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="member-team-enable"]', 'Non')
        self.assert_count_equal('COMPONENTS/TAB', 3)
        self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
        self.assert_xml_equal('COMPONENTS/TAB[2]', 'Age')
        self.assert_xml_equal('COMPONENTS/TAB[3]', 'Activité')
Ejemplo n.º 52
0
 def initialize_system(self):
     Parameter.change_value('accounting-sizecode', 6)
     Parameter.change_value('condominium-default-owner-account',
                            correct_accounting_code(''))
     Parameter.change_value('condominium-default-owner-account1',
                            correct_accounting_code('410100'))
     Parameter.change_value('condominium-default-owner-account2',
                            correct_accounting_code('410000'))
     Parameter.change_value('condominium-default-owner-account3',
                            correct_accounting_code('410100'))
     Parameter.change_value('condominium-default-owner-account4',
                            correct_accounting_code(''))
     Parameter.change_value('condominium-default-owner-account5',
                            correct_accounting_code('410000'))
     Parameter.change_value('condominium-current-revenue-account',
                            correct_accounting_code('701100'))
     Parameter.change_value('condominium-exceptional-revenue-account',
                            correct_accounting_code('700100'))
     Parameter.change_value('condominium-advance-revenue-account',
                            correct_accounting_code('701200'))
     Parameter.change_value('condominium-fundforworks-revenue-account',
                            correct_accounting_code('700000'))
     Parameter.change_value('condominium-exceptional-reserve-account',
                            correct_accounting_code('160000'))
     Parameter.change_value('condominium-advance-reserve-account',
                            correct_accounting_code('100000'))
     Parameter.change_value('condominium-fundforworks-reserve-account',
                            correct_accounting_code('100000'))
     Parameter.change_value('condominium-mode-current-callfunds', 1)
     Params.clear()
     CustomField.objects.get_or_create(modelname='accounting.Third',
                                       name='IBAN',
                                       kind=0,
                                       args="{'multi': False}")
     CustomField.objects.get_or_create(modelname='accounting.Third',
                                       name='SWIFT',
                                       kind=0,
                                       args="{'multi': False}")
Ejemplo n.º 53
0
def set_accounting_system():
    Parameter.change_value(
        'accounting-system', 'diacamma.accounting.system.french.FrenchSystemAcounting')
    Params.clear()
    clear_system_account()
Ejemplo n.º 54
0
    def test_activity(self):
        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 2 + 3 + 2)
        self.assert_grid_equal('activity', {
            'name': "nom",
            'description': "description"
        }, 1)

        self.factory.xfer = ActivityAddModify()
        self.calljson('/diacamma.member/activityAddModify', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'activityAddModify')
        self.assert_count_equal('', 3)

        self.factory.xfer = ActivityAddModify()
        self.calljson('/diacamma.member/activityAddModify', {
            "SAVE": "YES",
            "name": "xyz",
            "description": "abc"
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'activityAddModify')

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('activity', 2)
        self.assert_json_equal('', 'activity/@1/name', "xyz")

        self.factory.xfer = ActivityDel()
        self.calljson('/diacamma.member/activityDel', {
            "CONFIRME": "YES",
            "activity": 2
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'activityDel')

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('activity', 1)

        self.factory.xfer = ActivityDel()
        self.calljson('/diacamma.member/activityDel', {
            "CONFIRME": "YES",
            "activity": 1
        }, False)
        self.assert_observer('core.exception', 'diacamma.member',
                             'activityDel')

        Parameter.change_value("member-activite-enable", '0')
        Params.clear()

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 2 + 3 + 0)
        self.assert_json_equal('LABELFORM', 'member-activite-enable', 'Non')
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('TAB', '__tab_2', 'Âge')
        self.assert_json_equal('TAB', '__tab_3', 'Équipe')
        self.assertFalse('__tab_4' in self.json_data.keys(),
                         self.json_data.keys())
Ejemplo n.º 55
0
 def fillresponse(self, AuditLogSetting=[]):
     Parameter.change_value('CORE-AuditLog', "\n".join(AuditLogSetting))
     Params.clear()
     set_auditlog_states()
Ejemplo n.º 56
0
    def test_age(self):
        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 2 + 3 + 2)
        self.assert_grid_equal('age', {
            'name': "nom",
            'date_min': "date min.",
            'date_max': "date max."
        }, 0)

        self.factory.xfer = AgeAddModify()
        self.calljson('/diacamma.member/ageAddModify', {}, False)
        self.assert_observer('core.exception', 'diacamma.member',
                             'ageAddModify')

        default_season()

        self.factory.xfer = AgeAddModify()
        self.calljson('/diacamma.member/ageAddModify', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'ageAddModify')
        self.assert_count_equal('', 4)

        self.factory.xfer = AgeAddModify()
        self.calljson('/diacamma.member/ageAddModify', {
            "SAVE": "YES",
            "name": "xyz",
            "date_min": "1981",
            "date_max": "1980"
        }, False)
        self.assert_observer('core.exception', 'diacamma.member',
                             'ageAddModify')

        self.factory.xfer = AgeAddModify()
        self.calljson('/diacamma.member/ageAddModify', {
            "SAVE": "YES",
            "name": "xyz",
            "date_min": "1980",
            "date_max": "1981"
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'ageAddModify')
        self.factory.xfer = AgeAddModify()
        self.calljson('/diacamma.member/ageAddModify', {
            "SAVE": "YES",
            "name": "uvw",
            "date_min": "1979",
            "date_max": "1980"
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'ageAddModify')

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('age', 2)
        self.assert_json_equal('', 'age/@0/name', "uvw")
        self.assert_json_equal('', 'age/@0/date_min', "1979")
        self.assert_json_equal('', 'age/@0/date_max', "1980")
        self.assert_json_equal('', 'age/@1/name', "xyz")
        self.assert_json_equal('', 'age/@1/date_min', "1980")
        self.assert_json_equal('', 'age/@1/date_max', "1981")

        self.factory.xfer = SeasonActive()
        self.calljson('/diacamma.member/seasonActive', {'season': 12}, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'seasonActive')

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('age', 2)
        self.assert_json_equal('', 'age/@0/name', "uvw")
        self.assert_json_equal('', 'age/@0/date_min', "1981")
        self.assert_json_equal('', 'age/@0/date_max', "1982")
        self.assert_json_equal('', 'age/@1/name', "xyz")
        self.assert_json_equal('', 'age/@1/date_min', "1982")
        self.assert_json_equal('', 'age/@1/date_max', "1983")
        self.assert_json_equal('LABELFORM', 'member-age-enable', 'Oui')

        self.factory.xfer = AgeDel()
        self.calljson('/diacamma.member/ageDel', {
            "CONFIRME": "YES",
            "age": 1
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member', 'ageDel')

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('age', 1)

        Parameter.change_value("member-age-enable", '0')
        Params.clear()

        self.factory.xfer = CategoryConf()
        self.calljson('/diacamma.member/categoryConf', {}, False)
        self.assert_observer('core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('', 2 + 13 + 0 + 3 + 2)
        self.assert_json_equal('LABELFORM', 'member-age-enable', 'Non')
        self.assertFalse('__tab_4' in self.json_data.keys(),
                         self.json_data.keys())
        self.assert_json_equal('TAB', '__tab_1', 'Paramètres')
        self.assert_json_equal('TAB', '__tab_2', 'Équipe')
        self.assert_json_equal('TAB', '__tab_3', 'Activité')
Ejemplo n.º 57
0
def contacts_checkparam():
    Parameter.check_and_create(name='contacts-mailtoconfig', typeparam=4, title=_("contacts-mailtoconfig"), args="{'Enum':3}", value='0',
                               param_titles=(_("contacts-mailtoconfig.0"), _("contacts-mailtoconfig.1"), _("contacts-mailtoconfig.2")))
    Parameter.check_and_create(name='contacts-createaccount', typeparam=4, title=_("contacts-createaccount"), args="{'Enum':3}", value='0',
                               param_titles=(_("contacts-createaccount.0"), _("contacts-createaccount.1"), _("contacts-createaccount.2")))
Ejemplo n.º 58
0
    def test_no_subdegree(self):
        Parameter.change_value("event-subdegree-enable", 0)
        Params.clear()

        self.factory.xfer = EventAddModify()
        self.call('/diacamma.event/eventAddModify',
                  {"SAVE": "YES", "date": "2014-10-12", "activity": "1", "event_type": 0, "comment": "new examination", 'default_article': 0}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.event', 'eventAddModify')

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

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

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

        self.factory.xfer = EventTransition()
        self.call('/diacamma.event/eventShow', {"event": 1, 'TRANSITION': 'validate'}, False)
        self.assert_observer(
            'core.custom', 'diacamma.event', 'eventShow')
        self.assert_count_equal('COMPONENTS/*', 7 + 4 * 3)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="name_1"]', "{[b]}Dalton Avrel{[/b]}")
        self.assert_count_equal('COMPONENTS/SELECT[@name="degree_1"]/CASE', 9)
        self.assert_xml_equal(
            'COMPONENTS/MEMO[@name="comment_1"]', "Epreuve 1:{[br/]}Epreuve 2:{[br/]}")
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="name_2"]', "{[b]}Dalton Jack{[/b]}")
        self.assert_count_equal('COMPONENTS/SELECT[@name="degree_2"]/CASE', 10)
        self.assert_xml_equal(
            'COMPONENTS/MEMO[@name="comment_2"]', "Epreuve 1:{[br/]}Epreuve 2:{[br/]}")
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="name_3"]', "{[b]}Dalton Joe{[/b]}")
        self.assert_count_equal('COMPONENTS/SELECT[@name="degree_3"]/CASE', 10)
        self.assert_xml_equal(
            'COMPONENTS/MEMO[@name="comment_3"]', "Epreuve 1:{[br/]}Epreuve 2:{[br/]}")

        self.factory.xfer = EventTransition()
        self.call('/diacamma.event/eventShow',
                  {"event": 1, 'CONFIRME': 'YES', 'comment_1': 'trop nul!', 'degree_2': 5, 'comment_2': 'ça va...',
                   'degree_3': 3, 'comment_3': 'bien :)', 'TRANSITION': 'validate'}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.event', 'eventShow')

        self.factory.xfer = EventShow()
        self.call('/diacamma.event/eventShow', {"event": 1}, False)
        self.assert_observer(
            'core.custom', 'diacamma.event', 'eventShow')
        self.assert_count_equal('COMPONENTS/*', 15)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="organizer"]/ACTIONS/ACTION', 0)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="participant"]/ACTIONS/ACTION', 1)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="participant"]/HEADER', 5)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/HEADER[@name="contact"]', "contact")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/HEADER[@name="degree_result_simple"]', "Grade résultant")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/HEADER[@name="comment"]', "commentaire")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/HEADER[@name="article.ref_price"]', "article")
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD', 3)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[1]/VALUE[@name="contact"]', "Dalton Avrel")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[1]/VALUE[@name="is_subscripter"]', "0")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[1]/VALUE[@name="degree_result_simple"]', '---')
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[1]/VALUE[@name="comment"]', 'trop nul!')
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[1]/VALUE[@name="article.ref_price"]', '---')
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[2]/VALUE[@name="contact"]', "Dalton Jack")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[2]/VALUE[@name="is_subscripter"]', "0")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[2]/VALUE[@name="degree_result_simple"]', "level #1.5")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[2]/VALUE[@name="comment"]', 'ça va...')
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[2]/VALUE[@name="article.ref_price"]', '---')
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[3]/VALUE[@name="contact"]', "Dalton Joe")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[3]/VALUE[@name="is_subscripter"]', "0")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[3]/VALUE[@name="degree_result_simple"]', "level #1.3")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[3]/VALUE[@name="comment"]', 'bien :)')
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="participant"]/RECORD[3]/VALUE[@name="article.ref_price"]', '---')
Ejemplo n.º 59
0
    def test_activity(self):
        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('COMPONENTS/*', 37)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="activity"]/HEADER', 2)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="activity"]/HEADER[@name="name"]', "nom")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="activity"]/HEADER[@name="description"]', "description")
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="activity"]/RECORD', 1)

        self.factory.xfer = ActivityAddModify()
        self.call('/diacamma.member/activityAddModify', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'activityAddModify')
        self.assert_count_equal('COMPONENTS/*', 5)

        self.factory.xfer = ActivityAddModify()
        self.call('/diacamma.member/activityAddModify',
                  {"SAVE": "YES", "name": "xyz", "description": "abc"}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'activityAddModify')

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="activity"]/RECORD', 2)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="activity"]/RECORD[2]/VALUE[@name="name"]', "xyz")

        self.factory.xfer = ActivityDel()
        self.call('/diacamma.member/activityAddModify',
                  {"CONFIRME": "YES", "activity": 2}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'activityAddModify')

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="activity"]/RECORD', 1)

        self.factory.xfer = ActivityDel()
        self.call('/diacamma.member/activityDel',
                  {"CONFIRME": "YES", "activity": 1}, False)
        self.assert_observer(
            'core.exception', 'diacamma.member', 'activityDel')

        Parameter.change_value("member-activite-enable", '0')
        Params.clear()

        self.factory.xfer = CategoryConf()
        self.call('/diacamma.member/categoryConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'categoryConf')
        self.assert_count_equal('COMPONENTS/*', 34)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="member-activite-enable"]', 'Non')
        self.assert_count_equal('COMPONENTS/TAB', 3)
        self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
        self.assert_xml_equal('COMPONENTS/TAB[2]', 'Age')
        self.assert_xml_equal('COMPONENTS/TAB[3]', 'Équipe')