예제 #1
0
def A8574():
    """ Mise à niveau de la base de données """
    import FonctionsPerso
    versionApplication = FonctionsPerso.GetVersionLogiciel()
    dlg = wx.TextEntryDialog(None, _(u"Saisissez le numéro de version à partir duquel vous souhaitez \neffectuer la mise à niveau ('x.x.x.x'):"), _(u"Mise à niveau de la base de données"), versionApplication)
    reponse = dlg.ShowModal() 
    version = dlg.GetValue()
    dlg.Destroy()
    if reponse != wx.ID_OK:
        return
    
    valide = True
    try :
        version = tuple([int(x) for x in version.split(".")])
    except :
        valide = False
    if len(version) != 4 :
        valide = False
    
    if valide == False :
        dlg = wx.MessageDialog(None, _(u"Impossible d'effectuer la procédure !\n\nLe numéro de version que vous avez saisi semble erroné. Vérifiez qu'il est formaté de la façon suivante : 'x.x.x.x'"), _(u"Erreur"), wx.OK | wx.ICON_ERROR)
        dlg.ShowModal()
        dlg.Destroy()
        return False
    
    print "Procedure manuelle de mise a niveau de la base de donnee depuis la version : ", version
    DB = GestionDB.DB()        
    resultat = DB.ConversionDB(version)
    DB.Close()
    print resultat
예제 #2
0
def setRepositoryBranch():
    global repositoryBranch
    noethysVersion = FonctionsPerso.GetVersionLogiciel()
    if getFromGithub("versions.json", noethysVersion) is None:
        repositoryBranch = "master"
    else:
        repositoryBranch = noethysVersion
예제 #3
0
def GetXML(dictDonnees={}):
    """ Génération du fichier PES Recette ORMC """
    doc = Document()

    # Génération du document XML
    racine = doc.createElement("n:PES_Aller")
    racine.setAttribute(
        "xsi:schemaLocation",
        "http://www.minefi.gouv.fr/cp/helios/pes_v2/recette/r0/aller")
    racine.setAttribute("xmlns:xsi",
                        "http://www.w3.org/2001/XMLSchema-instance")
    racine.setAttribute("xmlns:xenc", "http://www.w3.org/2001/04/xmlenc#")
    racine.setAttribute("xmlns:xad", "http://uri.etsi.org/01903/v1.1.1#")
    racine.setAttribute(
        "xmlns:reca",
        "http://www.minefi.gouv.fr/cp/helios/pes_v2/recette/r0/aller")
    racine.setAttribute(
        "xmlns:n", "http://www.minefi.gouv.fr/cp/helios/pes_v2/Rev0/aller")
    racine.setAttribute("xmlns:cm",
                        "http://www.minefi.gouv.fr/cp/helios/pes_v2/commun")
    racine.setAttribute(
        "xmlns:acta",
        "http://www.minefi.gouv.fr/cp/helios/pes_v2/etatactif/r0/aller")
    doc.appendChild(racine)

    # Enveloppe
    Enveloppe = doc.createElement("Enveloppe")
    racine.appendChild(Enveloppe)

    Parametres = doc.createElement("Parametres")
    Enveloppe.appendChild(Parametres)

    Version = doc.createElement("Version")
    Version.setAttribute("V", "2")
    Parametres.appendChild(Version)

    TypFic = doc.createElement("TypFic")
    TypFic.setAttribute("V", "PESORMC")
    Parametres.appendChild(TypFic)

    NomFic = doc.createElement("NomFic")
    NomFic.setAttribute("V", dictDonnees["nom_fichier"][:100])
    Parametres.appendChild(NomFic)

    Emetteur = doc.createElement("Emetteur")
    Enveloppe.appendChild(Emetteur)

    Sigle = doc.createElement("Sigle")
    Sigle.setAttribute("V", "Ivan LUCAS")
    Emetteur.appendChild(Sigle)

    versionLogiciel = FonctionsPerso.GetVersionLogiciel()
    Adresse = doc.createElement("Adresse")
    Adresse.setAttribute("V", _(u"Noethys %s") % versionLogiciel)
    Emetteur.appendChild(Adresse)

    # EnTetePES
    EnTetePES = doc.createElement("EnTetePES")
    racine.appendChild(EnTetePES)

    DteStr = doc.createElement("DteStr")
    DteStr.setAttribute("V", dictDonnees["date_emission"])
    EnTetePES.appendChild(DteStr)

    IdPost = doc.createElement("IdPost")
    IdPost.setAttribute("V", dictDonnees["id_poste"][:7])
    EnTetePES.appendChild(IdPost)

    IdColl = doc.createElement("IdColl")
    IdColl.setAttribute("V", dictDonnees["id_collectivite"][:14])
    EnTetePES.appendChild(IdColl)

    CodCol = doc.createElement("CodCol")
    CodCol.setAttribute("V", dictDonnees["code_collectivite"][:3])
    EnTetePES.appendChild(CodCol)

    CodBud = doc.createElement("CodBud")
    CodBud.setAttribute("V", dictDonnees["code_budget"][:10])
    EnTetePES.appendChild(CodBud)

    # PES_RecetteAller
    PES_RecetteAller = doc.createElement("PES_RecetteAller")
    racine.appendChild(PES_RecetteAller)

    # EnTeteRecette
    EnTeteRecette = doc.createElement("EnTeteRecette")
    PES_RecetteAller.appendChild(EnTeteRecette)

    IdVer = doc.createElement("IdVer")
    IdVer.setAttribute("V", "2")
    EnTeteRecette.appendChild(IdVer)

    InfoDematerialisee = doc.createElement("InfoDematerialisee")
    InfoDematerialisee.setAttribute("V", "0")
    EnTeteRecette.appendChild(InfoDematerialisee)

    # Bordereau
    Bordereau = doc.createElement("Bordereau")
    PES_RecetteAller.appendChild(Bordereau)

    # Bloc Bordereau
    BlocBordereau = doc.createElement("BlocBordereau")
    Bordereau.appendChild(BlocBordereau)

    Exer = doc.createElement("Exer")
    Exer.setAttribute("V", dictDonnees["exercice"][:4])
    BlocBordereau.appendChild(Exer)

    IdBord = doc.createElement("IdBord")
    IdBord.setAttribute("V", dictDonnees["id_bordereau"][:7])
    BlocBordereau.appendChild(IdBord)

    DteBordEm = doc.createElement("DteBordEm")
    DteBordEm.setAttribute("V", dictDonnees["date_emission"])
    BlocBordereau.appendChild(DteBordEm)

    TypBord = doc.createElement("TypBord")
    TypBord.setAttribute("V", "06")
    BlocBordereau.appendChild(TypBord)

    NbrPce = doc.createElement("NbrPce")
    NbrPce.setAttribute("V", str(len(dictDonnees["pieces"])))
    BlocBordereau.appendChild(NbrPce)

    MtBordHt = doc.createElement("MtBordHt")
    MtBordHt.setAttribute("V", dictDonnees["montant_total"])
    BlocBordereau.appendChild(MtBordHt)

    DteAsp = doc.createElement("DteAsp")
    DteAsp.setAttribute("V", dictDonnees["date_envoi"])
    BlocBordereau.appendChild(DteAsp)

    Objet = doc.createElement("Objet")
    Objet.setAttribute("V", dictDonnees["objet_dette"][:160])
    BlocBordereau.appendChild(Objet)

    # ----------------------- PIECES --------------------------------------------------------------------------------------------------------------------------

    for dictPiece in dictDonnees["pieces"]:

        # Pièce
        Piece = doc.createElement("Piece")
        Bordereau.appendChild(Piece)

        BlocPiece = doc.createElement("BlocPiece")
        Piece.appendChild(BlocPiece)

        IdPce = doc.createElement("IdPce")
        IdPce.setAttribute("V", dictPiece["id_piece"][:8])
        BlocPiece.appendChild(IdPce)

        TypPce = doc.createElement("TypPce")
        TypPce.setAttribute("V", "15")
        BlocPiece.appendChild(TypPce)

        NatPce = doc.createElement("NatPce")
        NatPce.setAttribute("V", "01")
        BlocPiece.appendChild(NatPce)

        if dictDonnees["pieces_jointes"] != False:
            Edition = doc.createElement("Edition")
            Edition.setAttribute("V", "03")
            BlocPiece.appendChild(Edition)

        ObjPce = doc.createElement("ObjPce")
        ObjPce.setAttribute("V", dictPiece["objet_piece"][:160])
        BlocPiece.appendChild(ObjPce)

        NumDette = doc.createElement("NumDette")
        NumDette.setAttribute("V", dictPiece["num_dette"][:15])
        BlocPiece.appendChild(NumDette)

        Per = doc.createElement("Per")
        Per.setAttribute("V", dictDonnees["mois"][:1])
        BlocPiece.appendChild(Per)

        Cle1 = doc.createElement("Cle1")
        cle1 = GetCle_modulo11(
            (dictDonnees["code_collectivite"], dictDonnees["id_bordereau"],
             dictDonnees["exercice"][-2:], dictDonnees["mois"],
             u"{:0>13}".format(dictPiece["num_dette"])))
        Cle1.setAttribute("V", str(cle1))
        BlocPiece.appendChild(Cle1)

        Cle2 = doc.createElement("Cle2")
        cle2 = GetCle_modulo23(
            (dictDonnees["exercice"][-2:], dictDonnees["mois"], "00",
             u"{:0>13}".format(dictPiece["num_dette"])))
        Cle2.setAttribute("V", cle2)
        BlocPiece.appendChild(Cle2)

        if dictDonnees["pieces_jointes"] != False:

            PJRef = doc.createElement("PJRef")
            BlocPiece.appendChild(PJRef)

            Support = doc.createElement("Support")
            Support.setAttribute("V", "01")
            PJRef.appendChild(Support)

            IdUnique = doc.createElement("IdUnique")
            IdUnique.setAttribute(
                "V", dictDonnees["pieces_jointes"][dictPiece["IDfacture"]]
                ["IdUnique"])
            PJRef.appendChild(IdUnique)

            NomPJ = doc.createElement("NomPJ")
            NomPJ.setAttribute(
                "V",
                dictDonnees["pieces_jointes"][dictPiece["IDfacture"]]["NomPJ"])
            PJRef.appendChild(NomPJ)

        NumeroFacture = doc.createElement("NumeroFacture")
        NumeroFacture.setAttribute("V", dictPiece["num_dette"][:20])
        BlocPiece.appendChild(NumeroFacture)

        # NumeroMarche = doc.createElement("NumeroMarche")
        # NumeroMarche.setAttribute("V", "")
        # BlocPiece.appendChild(NumeroMarche)

        # NumeroEngagement = doc.createElement("NumeroEngagement")
        # NumeroEngagement.setAttribute("V", "")
        # BlocPiece.appendChild(NumeroEngagement)

        # CodeService = doc.createElement("CodeService")
        # CodeService.setAttribute("V", "")
        # BlocPiece.appendChild(CodeService)

        # NomService = doc.createElement("NomService")
        # NomService.setAttribute("V", "")
        # BlocPiece.appendChild(NomService)

        # Ligne de pièce
        LigneDePiece = doc.createElement("LigneDePiece")
        Piece.appendChild(LigneDePiece)

        BlocLignePiece = doc.createElement("BlocLignePiece")
        LigneDePiece.appendChild(BlocLignePiece)

        InfoLignePiece = doc.createElement("InfoLignePiece")
        BlocLignePiece.appendChild(InfoLignePiece)

        IdLigne = doc.createElement("IdLigne")
        IdLigne.setAttribute("V", "1")
        InfoLignePiece.appendChild(IdLigne)

        ObjLignePce = doc.createElement("ObjLignePce")
        ObjLignePce.setAttribute("V", dictPiece["objet_piece"][:160])
        InfoLignePiece.appendChild(ObjLignePce)

        CodProdLoc = doc.createElement("CodProdLoc")
        CodProdLoc.setAttribute("V", dictDonnees["code_prodloc"][:4])
        InfoLignePiece.appendChild(CodProdLoc)

        Nature = doc.createElement("Nature")
        Nature.setAttribute("V", "588")
        InfoLignePiece.appendChild(Nature)

        Majo = doc.createElement("Majo")
        Majo.setAttribute("V", "0")
        InfoLignePiece.appendChild(Majo)

        TvaIntraCom = doc.createElement("TvaIntraCom")
        TvaIntraCom.setAttribute("V", "0")
        InfoLignePiece.appendChild(TvaIntraCom)

        MtHT = doc.createElement("MtHT")
        MtHT.setAttribute("V", dictPiece["montant"])
        InfoLignePiece.appendChild(MtHT)

        # Info prélèvement SEPA
        if dictPiece["prelevement"] == 1:

            InfoPrelevementSEPA = doc.createElement("InfoPrelevementSEPA")
            BlocLignePiece.appendChild(InfoPrelevementSEPA)

            NatPrel = doc.createElement("NatPrel")
            NatPrel.setAttribute("V", "01")
            InfoPrelevementSEPA.appendChild(NatPrel)

            PerPrel = doc.createElement("PerPrel")
            PerPrel.setAttribute("V", "07")
            InfoPrelevementSEPA.appendChild(PerPrel)

            DtePrel = doc.createElement("DtePrel")
            DtePrel.setAttribute("V", dictDonnees["date_prelevement"])
            InfoPrelevementSEPA.appendChild(DtePrel)

            MtPrel = doc.createElement("MtPrel")
            MtPrel.setAttribute("V", dictPiece["montant"])
            InfoPrelevementSEPA.appendChild(MtPrel)

            if dictPiece["sequence"] == "FRST":
                sequence = "02"
            elif dictPiece["sequence"] == "RCUR":
                sequence = "03"
            elif dictPiece["sequence"] == "FNAL":
                sequence = "04"
            else:
                sequence = "01"
            SequencePres = doc.createElement("SequencePres")
            SequencePres.setAttribute("V", sequence)
            InfoPrelevementSEPA.appendChild(SequencePres)

            DateSignMandat = doc.createElement("DateSignMandat")
            DateSignMandat.setAttribute("V",
                                        dictPiece["prelevement_date_mandat"])
            InfoPrelevementSEPA.appendChild(DateSignMandat)

            RefUniMdt = doc.createElement("RefUniMdt")
            RefUniMdt.setAttribute("V", dictPiece["prelevement_rum"])
            InfoPrelevementSEPA.appendChild(RefUniMdt)

            LibPrel = doc.createElement("LibPrel")
            LibPrel.setAttribute("V", dictPiece["prelevement_libelle"][:140])
            InfoPrelevementSEPA.appendChild(LibPrel)

        # Tiers
        Tiers = doc.createElement("Tiers")
        LigneDePiece.appendChild(Tiers)

        InfoTiers = doc.createElement("InfoTiers")
        Tiers.appendChild(InfoTiers)

        if dictPiece["idtiers_helios"] != "":
            IdTiers = doc.createElement("IdTiers")
            IdTiers.setAttribute("V", dictPiece["idtiers_helios"])
            InfoTiers.appendChild(IdTiers)

        if dictPiece["natidtiers_helios"] != "":
            NatIdTiers = doc.createElement("NatIdTiers")
            NatIdTiers.setAttribute("V", str(dictPiece["natidtiers_helios"]))
            InfoTiers.appendChild(NatIdTiers)

        if dictPiece["reftiers_helios"] != "":
            RefTiers = doc.createElement("RefTiers")
            RefTiers.setAttribute("V", dictPiece["reftiers_helios"])
            InfoTiers.appendChild(RefTiers)

        CatTiers = doc.createElement("CatTiers")
        CatTiers.setAttribute("V", dictPiece["cattiers_helios"])
        InfoTiers.appendChild(CatTiers)

        NatJur = doc.createElement("NatJur")
        NatJur.setAttribute("V", dictPiece["natjur_helios"])
        InfoTiers.appendChild(NatJur)

        TypTiers = doc.createElement("TypTiers")
        TypTiers.setAttribute("V", "01")
        InfoTiers.appendChild(TypTiers)

        civilite = dictPiece["titulaire_civilite"]
        if civilite == "M.": civilite = "Mr"
        if civilite == "Melle": civilite = "Mme"
        if civilite not in (None, ""):
            Civilite = doc.createElement("Civilite")
            Civilite.setAttribute("V", civilite[:10])
            InfoTiers.appendChild(Civilite)

        Nom = doc.createElement("Nom")
        Nom.setAttribute("V", dictPiece["titulaire_nom"][:38])
        InfoTiers.appendChild(Nom)

        prenom = dictPiece["titulaire_prenom"]
        if prenom not in (None, ""):
            Prenom = doc.createElement("Prenom")
            Prenom.setAttribute("V", prenom[:38])
            InfoTiers.appendChild(Prenom)

        # Adresse
        Adresse = doc.createElement("Adresse")
        Tiers.appendChild(Adresse)

        TypAdr = doc.createElement("TypAdr")
        TypAdr.setAttribute("V", "1")
        Adresse.appendChild(TypAdr)

        Adr2 = doc.createElement("Adr2")
        Adr2.setAttribute("V", dictPiece["titulaire_rue"][:38])
        Adresse.appendChild(Adr2)

        CP = doc.createElement("CP")
        CP.setAttribute("V", dictPiece["titulaire_cp"][:5])
        Adresse.appendChild(CP)

        Ville = doc.createElement("Ville")
        Ville.setAttribute("V", dictPiece["titulaire_ville"][:38])
        Adresse.appendChild(Ville)

        CodRes = doc.createElement("CodRes")
        CodRes.setAttribute("V", "0")
        Adresse.appendChild(CodRes)

        # Compte bancaire
        if dictPiece["prelevement"] == 1:

            CpteBancaire = doc.createElement("CpteBancaire")
            Tiers.appendChild(CpteBancaire)

            BIC = doc.createElement("BIC")
            BIC.setAttribute("V", dictPiece["prelevement_bic"])
            CpteBancaire.appendChild(BIC)

            IBAN = doc.createElement("IBAN")
            IBAN.setAttribute("V", dictPiece["prelevement_iban"])
            CpteBancaire.appendChild(IBAN)

            TitCpte = doc.createElement("TitCpte")
            TitCpte.setAttribute("V", dictPiece["prelevement_titulaire"][:32])
            CpteBancaire.appendChild(TitCpte)

    # ----------------------- PIECES JOINTES -------------------------------------------------------------------------------------------------------------------

    if dictDonnees["pieces_jointes"] != False and len(
            dictDonnees["pieces_jointes"]) > 0:

        # PES_PJ
        PES_PJ = doc.createElement("PES_PJ")
        racine.appendChild(PES_PJ)

        # EnTetePES_PJ
        EnTetePES_PJ = doc.createElement("EnTetePES_PJ")
        PES_PJ.appendChild(EnTetePES_PJ)

        IdVer = doc.createElement("IdVer")
        IdVer.setAttribute("V", "1")
        EnTetePES_PJ.appendChild(IdVer)

        for IDfacture, dictPieceJointe in dictDonnees["pieces_jointes"].items(
        ):

            PJ = doc.createElement("PJ")
            PES_PJ.appendChild(PJ)

            Contenu = doc.createElement("Contenu")
            PJ.appendChild(Contenu)

            Fichier = doc.createElement("Fichier")
            Fichier.setAttribute("MIMEType", "application/pdf")
            Contenu.appendChild(Fichier)

            binaire = doc.createTextNode(dictPieceJointe["contenu"])
            Fichier.appendChild(binaire)

            IdUnique = doc.createElement("IdUnique")
            IdUnique.setAttribute("V", dictPieceJointe["IdUnique"])
            PJ.appendChild(IdUnique)

            NomPJ = doc.createElement("NomPJ")
            NomPJ.setAttribute("V", dictPieceJointe["NomPJ"])
            PJ.appendChild(NomPJ)

            TypePJ = doc.createElement("TypePJ")
            TypePJ.setAttribute("V", "007")
            PJ.appendChild(TypePJ)

            Description = doc.createElement("Description")
            Description.setAttribute(
                "V", "FACTURE %s" % dictPieceJointe["numero_facture"])
            PJ.appendChild(Description)

    return doc
예제 #4
0
#------------------------------------------------------------------------
# Application :    Noethys, gestion multi-activités
# Site internet :  www.noethys.com
# Auteur:           Ivan LUCAS
# Copyright:       (c) 2010-11 Ivan LUCAS
# Licence:         Licence GNU GPL
#------------------------------------------------------------------------

import Chemins
from Utils.UTILS_Traduction import _
import wx
from Ctrl import CTRL_Bouton_image
import wx.html as html
import FonctionsPerso

VERSION_LOGICIEL = FonctionsPerso.GetVersionLogiciel()

TEXTE_ACCUEIL = u"""
<CENTER><IMG SRC="Static/Images/80x80/Logo.png">
<BR>
<FONT SIZE=2>
<B>Bienvenue dans Noethys</B><BR>
<B>Version %s</B>
<BR><BR>
Noethys est un logiciel gratuit de gestion multi-activités pour les accueils de 
loisirs, crèches, cantines, garderies périscolaires, secteurs jeunes, activités
sportives et culturelles, etc...
<BR><BR>
Merci de bien vouloir signaler tous les bugs rencontrés ou exposer vos suggestions
sur le forum dédié :
<BR>