def _saveSetup(self):
        """ Salviamo i dati modificati in interfaccia """
        g = SetConf().select(key="cliente_struttura_codice", section="Clienti")
        g[0].value = str(self.clienti_struttura_codice_entry.get_text())
        g[0].tipo = "str"
        Environment.session.add(g[0])

        c = SetConf().select(key="cliente_codice_upper", section="Clienti")
        c[0].value = str(self.clienti_codice_upper_check.get_active())
        c[0].tipo = "bool"
        Environment.session.add(c[0])

        c = SetConf().select(key="cliente_insegna", section="Clienti")
        if c:
            c = c[0]
        else:
            c = SetConf()
        c.key = "cliente_insegna"
        c.section = "Clienti"
        c.value = str(self.clienti_insegna_check.get_active())
        c.tipo = "bool"
        c.description = "visualizzare il campo per insegna"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        c = SetConf().select(key="cliente_nome", section="Clienti")
        if c:
            c = c[0]
        else:
            c = SetConf()
        c.key = "cliente_nome"
        c.section = "Clienti"
        c.value = str(self.clienti_nomi_check.get_active())
        c.tipo = "bool"
        c.description = "visualizzare il campo per nome"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        c = SetConf().select(key="cliente_cognome", section="Clienti")
        if c:
            c = c[0]
        else:
            c = SetConf()
        c.key = "cliente_cognome"
        c.section = "Clienti"
        c.value = str(self.clienti_cognomi_check.get_active())
        c.tipo = "bool"
        c.description = "visualizzare il campo per cognome"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)
    def inizializzaValoriPrimaNotaSaldo(self):
        #messageInfo(msg="Nessun riporto settato, imposto uno standard al primo gennaio")
        tpn = TestataPrimaNota().select(aDataInizio=stringToDate('01/01/' + Environment.workingYear), batchSize=None)
        tot = calcolaTotaliPrimeNote(tpn, tpn)

        bb = SetConf().select(key="valore_saldo_parziale_cassa_primanota", section="PrimaNota")
        if not bb:
            kbb = SetConf()
            kbb.key = "valore_saldo_parziale_cassa_primanota"
            kbb.value = 0.0 #str(tot["saldo_cassa"])
            kbb.section = "PrimaNota"
            kbb.tipo_section = "Generico"
            kbb.description = "Valore saldo parziale cassa prima nota"
            kbb.active = True
            kbb.tipo = "float"
            kbb.date = datetime.datetime.now()
            Environment.session.add(kbb)

        bb = SetConf().select(key="data_saldo_parziale_cassa_primanota", section="PrimaNota")
        if not bb:
            kbb = SetConf()
            kbb.key = "data_saldo_parziale_cassa_primanota"
            kbb.value = '01/01/' + Environment.workingYear
            kbb.section = "PrimaNota"
            kbb.tipo_section = "Generico"
            kbb.description = "Valore saldo parziale cassa prima nota"
            kbb.active = True
            kbb.tipo = "date"
            kbb.date = datetime.datetime.now()
            Environment.session.add(kbb)

        bb = SetConf().select(key="valore_saldo_parziale_banca_primanota", section="PrimaNota")
        if not bb:
            kbb = SetConf()
            kbb.key = "valore_saldo_parziale_banca_primanota"
            kbb.value = 0.0 #str(tot["saldo_banca"])
            kbb.section = "PrimaNota"
            kbb.tipo_section = "Generico"
            kbb.description = "Valore saldo parziale banca prima nota"
            kbb.active = True
            kbb.tipo = "float"
            kbb.date = datetime.datetime.now()
            Environment.session.add(kbb)

        bb = SetConf().select(key="data_saldo_parziale_banca_primanota", section="PrimaNota")
        if not bb:
            kbb = SetConf()
            kbb.key = "data_saldo_parziale_banca_primanota"
            kbb.value = '01/01/' + Environment.workingYear
            kbb.section = "PrimaNota"
            kbb.tipo_section = "Generico"
            kbb.description = "Data saldo parziale banca prima nota"
            kbb.active = True
            kbb.tipo = "date"
            kbb.date = datetime.datetime.now()
            Environment.session.add(kbb)
        Environment.session.commit()
    def _saveSetup(self):
        """ Salviamo i dati modificati in interfaccia """
        d = SetConf().select(key="sistemarigafrontaline", section="Label")
        if d:
            d = d[0]
        else:
            d = SetConf()
        d.key = "sistemarigafrontaline"
        d.section = "Label"
        d.tipo = "int"
        if self.sistemarigafrontaline_entry.get_text() =="":
            valore = "1"
        else:
            valore = self.sistemarigafrontaline_entry.get_text()
        d.value =  valore
        d.description = "parametro di allineamento riga in label"
        d.tipo_section = "Generico"
        d.active = True
        d.visible = True
        d.date = datetime.datetime.now()
        Environment.session.add(d)

        d = SetConf().select(key="sistemacolonnafrontaline", section="Label")
        if d:
            d = d[0]
        else:
            d = SetConf()
        d.key = "sistemacolonnafrontaline"
        d.section = "Label"
        d.tipo = "int"
        if self.sistemarigafrontaline_entry.get_text() == "":
            valore = "1"
        else:
            valore = self.sistemarigafrontaline_entry.get_text()
        d.value =  valore
        d.description = "parametro di allineamento colonna in label"
        d.tipo_section = "Generico"
        d.active = True
        d.visible = True
        d.date = datetime.datetime.now()
        Environment.session.add(d)
    def _saveSetup(self):
        """ Salviamo i dati modificati in interfaccia """
        changed = (self.vecchia_data_cassa != self.data_cassa_DateWidget.get_text()) or \
                  (self.vecchio_valore_cassa != self.valore_cassa_SignedMoneyEntryField.get_text()) or \
                  (self.vecchia_data_banca != self.data_banca_DateWidget.get_text()) or \
                  (self.vecchio_valore_banca != self.valore_banca_SignedMoneyEntryField.get_text())
        if changed and YesNoDialog(msg="Sei sicuro di voler modificare le date e i valori di Prima Nota?"):
            # CASSA
            c = SetConf().select(key="data_saldo_parziale_cassa_primanota", section="PrimaNota")
            if c:
                c = c[0]
            else:
                c = SetConf()
            c.key = "data_saldo_parziale_cassa_primanota"
            c.section = "PrimaNota"
            c.value = str(self.data_cassa_DateWidget.get_text())
            c.tipo = "date"
            c.description = "Data saldo parziale di cassa per prima nota"
            c.tipo_section = "Generico"
            c.active = True
            c.visible = True
            c.date = datetime.datetime.now()
            Environment.session.add(c)

            c = SetConf().select(key="valore_saldo_parziale_cassa_primanota", section="PrimaNota")
            if c:
                c = c[0]
            else:
                c = SetConf()
            c.key = "valore_saldo_parziale_cassa_primanota"
            c.section = "PrimaNota"
            c.value = str(self.valore_cassa_SignedMoneyEntryField.get_text())
            c.tipo = "float"
            c.description = "Valore saldo parziale di cassa per prima nota"
            c.tipo_section = "Generico"
            c.active = True
            c.visible = True
            c.date = datetime.datetime.now()
            Environment.session.add(c)

            # BANCA
            c = SetConf().select(key="data_saldo_parziale_banca_primanota", section="PrimaNota")
            if c:
                c = c[0]
            else:
                c = SetConf()
            c.key = "data_saldo_parziale_banca_primanota"
            c.section = "PrimaNota"
            c.value = str(self.data_banca_DateWidget.get_text())
            c.tipo = "date"
            c.description = "Data saldo parziale di banca per prima nota"
            c.tipo_section = "Generico"
            c.active = True
            c.visible = True
            c.date = datetime.datetime.now()
            Environment.session.add(c)

            c = SetConf().select(key="valore_saldo_parziale_banca_primanota", section="PrimaNota")
            if c:
                c = c[0]
            else:
                c = SetConf()
            c.key = "valore_saldo_parziale_banca_primanota"
            c.section = "PrimaNota"
            c.value = str(self.valore_banca_SignedMoneyEntryField.get_text())
            c.tipo = "float"
            c.description = "Valore saldo parziale di banca per prima nota"
            c.tipo_section = "Generico"
            c.active = True
            c.visible = True
            c.date = datetime.datetime.now()
            Environment.session.add(c)

            # Salvo i vecchi valori
            self.vecchia_data_cassa = str(self.data_cassa_DateWidget.get_text()).strip()
            self.vecchio_valore_cassa = str(self.valore_cassa_SignedMoneyEntryField.get_text()).strip()
            self.vecchia_data_banca = str(self.data_banca_DateWidget.get_text()).strip()
            self.vecchio_valore_banca = str(self.valore_banca_SignedMoneyEntryField.get_text()).strip()

        c = SetConf().select(key="aggiungi_partita_iva", section="PrimaNota")
        if c:
            c = c[0]
        else:
            c = SetConf()
        c.key = "aggiungi_partita_iva"
        c.section = "PrimaNota"
        c.value = str(self.aggiungi_partita_iva_check.get_active())
        c.tipo = "bool"
        c.description = "Aggiungere la partita IVA di un cliente/fornitore e/o il codice fiscale di un cliente in descrizione operazione"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        c = SetConf().select(key="inserisci_senza_data_pagamento", section="PrimaNota")
        if c:
            c = c[0]
        else:
            c = SetConf()
        c.key = "inserisci_senza_data_pagamento"
        c.section = "PrimaNota"
        c.value = str(self.inserisci_senza_data_pagamento_check.get_active())
        c.tipo = "bool"
        c.description = "Inserire la prima nota senza data di scadenza"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        c = SetConf().select(key="saldi_periodo", section="PrimaNota")
        if c:
            c = c[0]
        else:
            c = SetConf()
        c.key = "saldi_periodo"
        c.section = "PrimaNota"
        c.value = str(self.inserisci_totali_generali_in_report_check.get_active())
        c.tipo = "bool"
        c.description = "Inserire i saldi per periodo nel report"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)
Example #5
0
    def _saveSetup(self):
        """ Salviamo i dati modificati in interfaccia """
        d = SetConf().select(key="multilinealimite", section="Multilinea")
        d[0].value = str(self.multilinea_entry.get_text())
        d[0].tipo = "int"
        Environment.session.add(d[0])

        d = SetConf().select(key="causale_vendita", section="Documenti")
        if d:
            d = d[0]
        else:
            d = SetConf()
        d.key = "causale_vendita"
        d.section = "Documenti"
        d.tipo = "str"
        d.value = str(self.causale_vendita_entry.get_text())
        d.description = "causale vendita preferenziale da preimpostare"
        d.tipo_section = "Generico"
        d.active = True
        d.visible = True
        d.date = datetime.datetime.now()
        Environment.session.add(d)

        d = SetConf().select(key="incaricato_predef", section="Documenti")
        if d:
            d = d[0]
        else:
            d = SetConf()
        d.key = "incaricato_predef"
        d.section = "Documenti"
        d.tipo = "str"
        d.value = findStrFromCombobox(self.incaricato_predef_combobox, 0)
        d.description = "incaricato trasporto preferenziale da preimpostare"
        d.tipo_section = "Generico"
        d.active = True
        d.visible = True
        d.date = datetime.datetime.now()
        Environment.session.add(d)

        c = SetConf().select(key="primo_dest_merce", section="Documenti")
        if c:
            c=c[0]
        else:
            c = SetConf()
        c.key = "primo_dest_merce"
        c.section = "Documenti"
        c.tipo = "bool"
        c.value = str(self.primo_dest_merce_check.get_active())
        c.description = "Seleziona primo destinatario merce in lista"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        d = SetConf().select(key="tipo_documento_predefinito", section="Documenti")
        if d:
            d = d[0]
        else:
            d = SetConf()
        d.key = "tipo_documento_predefinito"
        d.section = "Documenti"
        d.tipo = "str"
        d.value = findIdFromCombobox(self.tipo_documento_predefinito_combo)
        d.description = "eventuale tipo documento preferenziale da preimpostare"
        d.tipo_section = "Generico"
        d.active = True
        d.visible = True
        d.date = datetime.datetime.now()
        Environment.session.add(d)

        d = SetConf().select(key="tipo_movimento_predefinito", section="Documenti")
        if d:
            d = d[0]
        else:
            d = SetConf()
        d.key = "tipo_movimento_predefinito"
        d.section = "Documenti"
        d.tipo = "str"
        d.value = findIdFromCombobox(self.tipo_movimento_predefinito_combo)
        d.description = "eventuale tipo movimento preferenziale da preimpostare"
        d.tipo_section = "Generico"
        d.active = True
        d.visible = True
        d.date = datetime.datetime.now()
        Environment.session.add(d)

        d = SetConf().select(key="cliente_predefinito", section="Documenti")
        if d:
            d = d[0]
        else:
            d = SetConf()
        d.key = "cliente_predefinito"
        d.section = "Documenti"
        d.tipo = "int"
        d.value = findIdFromCombobox(self.cliente_predefinito_combo)
        d.description = "eventuale cliente preferenziale da preimpostare"
        d.tipo_section = "Generico"
        d.active = True
        d.visible = True
        d.date = datetime.datetime.now()
        Environment.session.add(d)

        c = SetConf().select(key="lotto_temp", section="Documenti")
        if c:
            c=c[0]
        else:
            c = SetConf()
        c.key = "lotto_temp"
        c.section = "Documenti"
        c.tipo = "bool"
        c.value = str(self.lotto_temp_check.get_active())
        c.description = "gestione lotti temporanei"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        c = SetConf().select(key="add_quantita", section="Documenti")
        if c:
            c=c[0]
        else:
            c = SetConf()
        c.key = "add_quantita"
        c.section = "Documenti"
        c.tipo = "bool"
        c.value = str(self.add_quantita_check.get_active())
        c.description = "Aggiugni quantita"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        c = SetConf().select(key="lista_componenti_articolokit", section="Documenti")
        if c:
            c=c[0]
        else:
            c = SetConf()
        c.key = "lista_componenti_articolokit"
        c.section = "Documenti"
        c.tipo = "bool"
        c.value = str(self.lista_componenti_articolokit_check.get_active())
        c.description = "visualizza in stampa la lista dei componenti articolo kit"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        c = SetConf().select(key="no_ricerca_incrementale", section="Documenti")
        if c:
            c=c[0]
        else:
            c = SetConf()
        c.key = "no_ricerca_incrementale"
        c.section = "Documenti"
        c.tipo = "bool"
        c.value = str(self.lotto_temp_check.get_active())
        c.description = "elimina la ricerca incrementale su codici a barre"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)


        d = SetConf().select(key="fornitore_predefinito", section="Documenti")
        if d:
            d = d[0]
        else:
            d = SetConf()
        d.key = "fornitore_predefinito"
        d.section = "Documenti"
        d.tipo = "int"
        d.value = findIdFromCombobox(self.fornitore_predefinito_combo)
        d.description = "eventuale fornitore preferenziale da preimpostare"
        d.tipo_section = "Generico"
        d.active = True
        d.visible = True
        d.date = datetime.datetime.now()
        Environment.session.add(d)

        d = SetConf().select(key="ricerca_per", section="Documenti")
        if self.codice_radio.get_active():
            d[0].value = "codice"
        elif self.codice_a_barre_radio.get_active():
            d[0].value = "codice_a_barre"
        elif self.descrizione_radio.get_active():
            d[0].value = "descrizione"
        elif self.codice_articolo_fornitore_radio.get_active():
            d[0].value = "codice_articolo_fornitore"
        d[0].tipo = "str"
        Environment.session.add(d[0])

        c = SetConf().select(key="costi_ddt_riga", section="Documenti")
        if c:
            c=c[0]
        else:
            c = SetConf()
        c.key = "costi_ddt_riga"
        c.section = "Documenti"
        c.tipo = "bool"
        c.value = str(self.costi_ddt_riga_check.get_active())
        c.description = "visualizza i costi in DDT riga"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)

        c = SetConf().select(key="costi_ddt_totale", section="Documenti")
        if c:
            c=c[0]
        else:
            c = SetConf()
        c.key = "costi_ddt_totale"
        c.section = "Documenti"
        c.tipo = "bool"
        c.value = str(self.costi_ddt_totale_check.get_active())
        c.description = "visualizza i costi in DDT totale"
        c.tipo_section = "Generico"
        c.active = True
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)


        c = SetConf().select(key="save_new_doc", section="Documenti")
        if c:
            c=c[0]
        else:
            c = SetConf()
        c.key = "save_new_doc"
        c.section = "Documenti"
        c.tipo = "bool"
        c.value = str(self.save_new_doc_check.get_active())
        c.description = "opzione per attivare l'inserimento del nuovo documento dopo il salvataggio"
        c.tipo_section = "Generico"
        c.active = False
        c.visible = True
        c.date = datetime.datetime.now()
        Environment.session.add(c)
    def on_salva_button_clicked(self, button_salva):

        a = SetConf().select(key="feed", section="Feed")
        a[0].value= str(self.feed_check.get_active())
        a[0].tipo = "bool"
        Environment.session.add(a[0])

        b = SetConf().select(key="zeri_in_totali", section="Stampa")
        b[0].value = str(self.zeri_in_totali_check.get_active())
        b[0].tipo = "bool"
        Environment.session.add(b[0])

        cc = SetConf().select(key="turbo", section="General")
        if not cc:
            cc = SetConf()
            cc.key = "turbo"
            cc.section = "General"
            cc.tipo_section = "Generico"
            cc.description = "turbo per connessioni remote"
            cc.active = True
            cc.tipo = "bool"
            cc.date = datetime.datetime.now()
        else:
            cc = cc[0]
        cc.value = str(self.turbo_check.get_active())
        Environment.session.add(cc)

        c = SetConf().select(key="zeri_in_riga", section="Stampa")
        c[0].value = str(self.zeri_in_riga_check.get_active())
        c[0].tipo = "bool"
        Environment.session.add(c[0])

        d = SetConf().select(key="altezza_logo", section="Documenti")
        d[0].value = str(self.altezza_logo_entry.get_text())
        d[0].tipo = "float"
        Environment.session.add(d[0])
        if Environment.tipo_eng =="postgresql":
            if not hasattr(Environment.conf, "Documenti"):
                Environment.conf.add_section("Documenti")
                Environment.conf.save()
            if  hasattr(Environment.conf, "Documenti") and not hasattr(Environment.conf.Documenti, "cartella_predefinita"):
                setattr(Environment.conf.Documenti,"cartella_predefinita",Environment.documentsDir)
                Environment.conf.save()
            Environment.conf.Documenti.cartella_predefinita = str(self.path_label.get_text()+os.sep)
            Environment.conf.save()
        else:
            d = SetConf().select(key="cartella_predefinita", section="General")
            d[0].value = str(self.path_label.get_text()+os.sep)
            d[0].tipo = "str"
            Environment.session.add(d[0])

        e = SetConf().select(key="larghezza_logo", section="Documenti")
        e[0].value = str(self.larghezza_logo_entry.get_text())
        e[0].tipo = "float"
        Environment.session.add(e[0])

        f = SetConf().select(key="combo_column", section="Numbers")
        f[0].value = str(self.combo_column_entry.get_text())
        f[0].tipo = "int"
        Environment.session.add(f[0])

        g = SetConf().select(key="decimals", section="Numbers")
        g[0].value = str(self.decimals_entry.get_text()) or "2"
        g[0].tipo = "int"
        Environment.session.add(g[0])

        g = SetConf().select(key="separatore_numerazione", section="Documenti")
        g[0].value = str(self.separatore_entry.get_text()) or ""
        g[0].tipo = "str"
        Environment.session.add(g[0])

        f = SetConf().select(key="batch_size", section="Numbers")
        f[0].value = str(self.batch_size_entry.get_text()) or "3"
        f[0].tipo = "int"
        Environment.session.add(f[0])

        c = SetConf().select(key="vettore_codice_upper", section="Vettori")
        c[0].value = str(self.vettore_codice_upper_check.get_active())
        c[0].tipo = "bool"
        Environment.session.add(c[0])

        c = SetConf().select(key="gestione_totali_mercatino", section="General")
        c[0].value = str(self.mercatino_check.get_active())
        c[0].tipo = "bool"
        Environment.session.add(c[0])

        c = SetConf().select(key="gestione_lotti", section="General")
        c[0].value = str(self.gestione_lotti_check.get_active())
        c[0].tipo = "bool"
        Environment.session.add(c[0])


        g = SetConf().select(key="vettore_struttura_codice", section="Vettori")
        g[0].value = str(self.vettore_struttura_codice_entry.get_text())
        g[0].tipo = "str"
        Environment.session.add(g[0])

        g = SetConf().select(key="valuta_curr", section="Valuta")
        if self.euro_radio.get_active():
            g[0].value = "€"
        elif self.dollaro_radio.get_active():
            g[0].value = "$"
        elif self.sterlina_radio.get_active():
            g[0].value = "£"
        elif self.francosvizzero_radio.get_active():
            g[0].value = "CHF"
        g[0].tipo = "str"
        Environment.session.add(g[0])

        # può bastare un bool su true su vert se è false allora sarà landscape
        # REPORT
        c = SetConf().select(key="report_ori", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "report_ori"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " orientamento stampa report"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        if self.report_vert_radio.get_active():
            c.value = "verticale"
        else:
            c.value = "orizzontale"
        Environment.session.add(c)

        c = SetConf().select(key="report_margine_alto", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "report_margine_alto"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " margine report alto"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        c.value = str(self.report_margine_alto_entry.get_text())
        Environment.session.add(c)

        c = SetConf().select(key="report_margine_basso", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "report_margine_basso"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " margine report basso"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        c.value = str(self.report_margine_basso_entry.get_text())
        Environment.session.add(c)

        c = SetConf().select(key="report_margine_destro", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "report_margine_destro"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " margine report destro"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        c.value = str(self.report_margine_destro_entry.get_text())
        Environment.session.add(c)

        c = SetConf().select(key="report_margine_sinistro", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "report_margine_sinistro"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " margine report sinistro"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        c.value = str(self.report_margine_sinistro_entry.get_text())
        Environment.session.add(c)
        # SINGOLO
        c = SetConf().select(key="singolo_ori", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "singolo_ori"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " orientamento stampa singolo"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        if self.singolo_vert_radio.get_active():
            c.value = "verticale"
        else:
            c.value = "orizzontale"
        Environment.session.add(c)

        c = SetConf().select(key="singolo_margine_alto", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "singolo_margine_alto"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " margine singolo alto"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        c.value = str(self.singolo_margine_alto_entry.get_text())
        Environment.session.add(c)

        c = SetConf().select(key="singolo_margine_basso", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "singolo_margine_basso"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " margine singolo basso"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        c.value = str(self.singolo_margine_basso_entry.get_text())
        Environment.session.add(c)

        c = SetConf().select(key="singolo_margine_destro", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "singolo_margine_destro"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " margine singolo destro"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        c.value = str(self.singolo_margine_destro_entry.get_text())
        Environment.session.add(c)

        c = SetConf().select(key="singolo_margine_sinistro", section="Stampa")
        if not c:
            c = SetConf()
            c.key = "singolo_margine_sinistro"
            c.section = "Stampa"
            c.tipo_section = "Generico"
            c.description = " margine singolo sinistro"
            c.active = True
            c.tipo = "str"
            c.date = datetime.datetime.now()
        else:
            c = c[0]
        c.value = str(self.singolo_margine_sinistro_entry.get_text())
        Environment.session.add(c)

        self.documenti_setup_page._saveSetup()
        self.articoli_setup_page._saveSetup()
        self.clienti_setup_page._saveSetup()
        self.fornitori_setup_page._saveSetup()
        self.primanota_setup_page._saveSetup()
        self.label_setup_page._saveSetup()
        if posso("VD"):
            self.vendita_dettaglio_setup_page._saveSetup()

        Environment.session.commit()
        confList = SetConf().select(batchSize=None)
        for d in confList:
            Environment.confDict[(d.key,d.section)] = d
        self.destroy()
Example #7
0
    def on_inserimento_codice_activate(self,widget):
        from promogest.dao.Setconf import SetConf
        dialog = gtk.MessageDialog(self.getTopLevel(),
                                   GTK_DIALOG_MODAL
                                   | GTK_DIALOG_DESTROY_WITH_PARENT,
                                   GTK_DIALOG_MESSAGE_INFO, GTK_BUTTON_OK)
        dialog.set_markup(_("""<b>                CODICE ATTIVAZIONE PACCHETTO               </b>"""))
        hbox = gtk.HBox()
        entry___ = gtk.Entry()

        label = gtk.Label()
        label.set_markup(_("<b>   Inserisci codice   </b>"))
        hbox.pack_start(label, True, True, 0)
        hbox.pack_start(entry___, True, True, 0)
        dialog.get_content_area().pack_start(hbox, True, True, 0)
        dialog.show_all()
        dialog.run()
        codice = entry___.get_text()
#        hascode = str(hashlib.sha224(codice+orda(codice)).hexdigest())
        if "cl" and "|" in codice :
            d = codice.split("|")
            if d[1] == "azienda":
                if Environment.tipodb == "sqlite":
                    from promogest.dao.Azienda import Azienda
                    oldnomeazienda = d[2]
                    newnameazienda = d[3]
                    aa = Azienda().select(schemaa = oldnomeazienda)
                    if aa:
                        aa[0].schemaa = newnameazienda.strip()
                        aa[0].persist()
                        messageInfo(msg=_("NOME AZIENDA MODIFICATO"))
                        dialog.destroy()
                        return
                    else:
                        messageInfo(msg=_("VECCHIO NOME AZIENDA NON TROVATO"))
                        dialog.destroy()
                        return
                    return
                else:
                    messageInfo(msg=_("POSSIBILE SOLO CON LA VERSIONE ONE"))
                    dialog.destroy()
                    return
            elif d[1] == "modulo":
                tipo_section = d[2]  # Modulo
                section = d[3]  # Inventario
                description = str(d[4]) or ""  # Gestione inventario
                tipo = d[5] or None  # Niente o BOOLEAN o colore
                active = bool(d[6]) or True  # bool
                visible = bool(d[7]) or True  # bool
                key = d[8]  # mod_enable
                value = d[9]  # yes or no
                if section not in Environment.modules_folders:
                    messageInfo(msg=_("ERRORE ATTIVAZIONE MODULO"))
                    return
                dao = SetConf().select(key=key, section=section)
                if dao:
                    d = dao[0]
                else:
                    d = SetConf()
                d.key = key
                d.value =value
                d.section = section
                d.description = description
                d.tipo_section = tipo_section
                d.tipo = tipo
                d.active = active
                d.visible = visible
                d.date = datetime.now()
                d.persist()
                messageInfo(msg=_("MODULO O OPZIONE MODIFICATO attivato o disattivato"))
                dialog.destroy()
                return
            elif d[1] == "registro":
                operazione = d[2].strip()+".registro"
                registro_da_assegnare = d[3]
                from promogest.dao.Setting import Setting
                a = Setting().getRecord(id=operazione)
                if a:
                    b = Setting().select(value=registro_da_assegnare)
                    if b:
                        a.value = registro_da_assegnare
                        a.persist()
                        messageInfo(msg=_("REGISTRO NUMERAZIONE MODIFICATO\n\nRIAVVIARE"))
                        dialog.destroy()
                        return True
                    else:
                        messageInfo(msg=_("REGISTRO DA ASSEGNARE NON TROVATO O CORRETTO\n\n RIPROVARE"))
                        return False
                else:
                    messageInfo(msg=_("OPERAZIONE NON CORRETTA E NON TROVATA\n\nRIPROVARE"))
                    return False
        else:
            sets = SetConf().select(key="install_code",section="Master")
            if sets:
                sets[0].delete()
            if codice:
                k = SetConf()
                k.key = "install_code"
                k.value =str(hashlib.sha224(codice+orda(codice)).hexdigest())
                k.section = "Master"
                k.description = "codice identificativo della propria installazione"
                k.tipo_section = "General"
                k.tipo = "ONE"
                k.active = True
                k.date = datetime.now()
                k.persist()
                messageInfo(msg=_("ATTIVAZIONE EFFETTUATA, RIAVVIARE IL PROMOGEST"))
        dialog.destroy()