def Ajouter(self, event): if self.IDcompte_payeur != None and UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "familles_reglements", "creer") == False: return from Dlg import DLG_Saisie_reglement dlg = DLG_Saisie_reglement.Dialog(self, IDcompte_payeur=self.IDcompte_payeur, IDreglement=None) if dlg.ShowModal() == wx.ID_OK: IDreglement = dlg.GetIDreglement() self.MAJ(IDreglement) dlg.Destroy()
def Modifier(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("facturation_prelevements", "modifier") == False : return if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucun lot à modifier dans la liste"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return track = self.Selection()[0] from Dlg import DLG_Saisie_prelevement_lot dlg = DLG_Saisie_prelevement_lot.Dialog(self, IDlot=track.IDlot, typePrelevement=track.typePrelevement) if dlg.ShowModal() == wx.ID_OK: self.MAJ(track.IDlot) dlg.Destroy()
def OuvrirFicheFamille(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("familles_fiche", "consulter") == False : return if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucune fiche famille à ouvrir !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return IDfamille = self.Selection()[0].IDfamille from Dlg import DLG_Famille dlg = DLG_Famille.Dialog(self, IDfamille) if dlg.ShowModal() == wx.ID_OK: self.MAJ(IDfamille) dlg.Destroy()
def Ajouter(self, event): """ Ajouter une ville """ if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_villes", "creer") == False : return # Demande le nom et le code postal dlg = DLG_Saisie(self) if dlg.ShowModal() == wx.ID_OK: nom = dlg.GetNom() cp = dlg.GetCp() DB = GestionDB.DB() IDcorrection = DB.ReqInsert("corrections_villes", [("mode", "ajout"), ("nom", nom), ("cp", cp)]) DB.Close() self.MAJ(100000+IDcorrection) dlg.Destroy()
def Modifier(self, event): if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucun modèle à modifier dans la liste !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_modeles_droits", "modifier") == False : return IDmodele = self.Selection()[0].IDmodele from Dlg import DLG_Saisie_modele_droits dlg = DLG_Saisie_modele_droits.Dialog(self, IDmodele=IDmodele) if dlg.ShowModal() == wx.ID_OK: self.MAJ(IDmodele) dlg.Destroy()
def Ajouter(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "facturation_helios", "creer") == False: return reponse = self.Get_classe() if not reponse: return False format, classe = reponse dlg = classe(self, format=format) if dlg.ShowModal() == wx.ID_OK: IDlot = dlg.GetIDlot() self.MAJ(IDlot) dlg.Destroy()
def Exporter(self, event): """ Exporter le modèle sélectionné """ if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_modeles_docs", "consulter") == False : return if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucun modèle dans la liste !"), _(u"Erreur"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return track = self.Selection()[0] IDmodele = track.IDmodele IDfond = track.IDfond # Vérifie s'il y a un fond if IDfond != None : dlg = wx.MessageDialog(None, _(u"Ce modèle dispose d'un fond. Notez que celui-ci ne sera pas intégré lors de l'exportation. \n\nVoulez-vous quand même continuer ?"), _(u"Remarque"), wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) if dlg.ShowModal() == wx.ID_NO : return False dlg.Destroy() else: dlg.Destroy() # Demande le chemin pour la sauvegarde du fichier standardPath = wx.StandardPaths.Get() dlg = wx.FileDialog(self, message=_(u"Enregistrer le modèle sous..."), defaultDir = standardPath.GetDocumentsDir(), defaultFile="modele.ndc", wildcard=u"Modèle Noedoc (*.ndc)|*.ndc", style=wx.FD_SAVE) if dlg.ShowModal() == wx.ID_OK: path = dlg.GetPath() else : path = None dlg.Destroy() if path == None : return # Le fichier de destination existe déjà : if os.path.isfile(path) == True : dlg = wx.MessageDialog(None, _(u"Un fichier portant ce nom existe déjà. \n\nVoulez-vous le remplacer ?"), "Attention !", wx.YES_NO | wx.NO_DEFAULT | wx.ICON_EXCLAMATION) if dlg.ShowModal() == wx.ID_NO : return False dlg.Destroy() else: dlg.Destroy() # Exportation UTILS_Export_documents.Exporter(IDmodele, path) # Confirmation dlg = wx.MessageDialog(self, _(u"Le modèle a été exporté avec succès !"), _(u"Exportation"), wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy()
def MenuPhoto(self, event): """Ouverture du menu contextuel de la photo """ if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "individus_photo", "modifier") == False: return # Création du menu contextuel menuPop = UTILS_Adaptations.Menu() # Item Ajouter item = wx.MenuItem(menuPop, 10, _(u"Importer une photo")) bmp = wx.Bitmap( Chemins.GetStaticPath("Images/16x16/Importer_photo.png"), wx.BITMAP_TYPE_PNG) item.SetBitmap(bmp) menuPop.AppendItem(item) self.Bind(wx.EVT_MENU, self.Menu_Ajouter, id=10) # Item Capturer à partir d'une caméra item = wx.MenuItem(menuPop, 20, _(u"Capturer une photo à partir d'une webcam")) bmp = wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Webcam.png"), wx.BITMAP_TYPE_PNG) item.SetBitmap(bmp) menuPop.AppendItem(item) self.Bind(wx.EVT_MENU, self.Menu_Capturer, id=20) menuPop.AppendSeparator() # Item Supprimer item = wx.MenuItem(menuPop, 30, _(u"Supprimer")) bmp = wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_PNG) item.SetBitmap(bmp) menuPop.AppendItem(item) self.Bind(wx.EVT_MENU, self.Menu_Supprimer, id=30) if self.IDphoto == None and self.modeBase64 == False: item.Enable(False) ## menuPop.AppendSeparator() ## ## # Item Imprimer ## item = wx.MenuItem(menuPop, 40, _(u"Imprimer la photo")) ## bmp = wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Imprimante.png"), wx.BITMAP_TYPE_PNG) ## item.SetBitmap(bmp) ## menuPop.AppendItem(item) ## self.Bind(wx.EVT_MENU, self.Menu_Imprimer, id=40) ## if self.IDphoto == None : item.Enable(False) self.PopupMenu(menuPop) menuPop.Destroy()
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, name="DLG_Enregistrement", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX) self.parent = parent self.derniereValidation = (None, None) # Bandeau titre = _(u"Enregistrement") intro = _(u"Vous pouvez saisir ici votre code d'enregistrement personnel afin d'activer votre abonnement Classic ou Premium. Effectuez ce paramétrage sur chacun de vos postes.") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Cle.png") # Saisie code self.staticbox_code_staticbox = wx.StaticBox(self, -1, _(u"Code d'enregistrement")) self.label_identifiant = wx.StaticText(self, -1, _(u"Identifiant :")) self.ctrl_identifiant = wx.TextCtrl(self, -1, "") self.label_code = wx.StaticText(self, -1, _(u"Code :")) self.ctrl_code = masked.TextCtrl(self, -1, "", mask="AAAA-AAAA-AAAA-AAAA-AAAA", formatcodes="F!") self.ctrl_code.SetMinSize((190, -1)) self.bouton_validite = wx.Button(self, -1, _(u"Vérifier la validité")) self.ctrl_image = wx.StaticBitmap(self, -1, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/absenti.png"), wx.BITMAP_TYPE_ANY)) self.label_validite = wx.StaticText(self, -1, _(u"Veuillez saisir un code.")) # HTML self.ctrl_html = MyHtml(self, texte=TEXTE, hauteur=30) # Boutons self.bouton_aide = CTRL_Bouton_image.CTRL(self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_fermer = CTRL_Bouton_image.CTRL(self, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonValidite, self.bouton_validite) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonFermer, self.bouton_fermer) self.Bind(wx.EVT_CLOSE, self.OnClose) # Init contrôles identifiant = UTILS_Config.GetParametre("enregistrement_identifiant", defaut=None) code = UTILS_Config.GetParametre("enregistrement_code", defaut=None) if identifiant != None and code != None : self.ctrl_identifiant.SetValue(identifiant) self.ctrl_code.SetValue(code) self.VerifieEtat(identifiant, code) # Vérifie droits utilisateurs if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_enregistrement", "modifier", afficheMessage=False) == False : self.ctrl_identifiant.Enable(False) self.ctrl_code.Enable(False) self.bouton_validite.Enable(False)
def Ajouter(self, event): if self.IDfamille != None and UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "familles_pieces", "creer") == False: return if self.IDindividu != None and UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "individus_pieces", "creer") == False: return # Vérifie que l'individu est rattaché comme REPRESENTANT ou ENFANT à une famille if self.dictFamillesRattachees != None: valide = False for IDfamilleTmp, dictFamille in self.dictFamillesRattachees.iteritems( ): if dictFamille["IDcategorie"] in (1, 2): valide = True if valide == False: dlg = wx.MessageDialog( self, _(u"Pour saisir une pièce, un individu doit obligatoirement être\nrattaché comme représentant ou enfant à une fiche famille !" ), _(u"Saisie de pièce impossible"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return # Ouverture de la fenêtre de saisie from Dlg import DLG_Saisie_piece dlg = DLG_Saisie_piece.Dialog( self, IDpiece=None, IDfamille=self.IDfamille, IDindividu=self.IDindividu, dictFamillesRattachees=self.dictFamillesRattachees) if dlg.ShowModal() == wx.ID_OK: IDpiece = dlg.GetIDpiece() self.MAJ(IDpiece) self.MAJctrlPiecesObligatoires() dlg.Destroy()
def Supprimer(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "parametrage_emetteurs", "supprimer") == False: return if len(self.Selection()) == 0: dlg = wx.MessageDialog( self, _(u"Vous n'avez sélectionné aucun émetteur à supprimer dans la liste !" ), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return IDemetteur = self.Selection()[0].IDemetteur # Vérifie que l'émetteur n'a pas déjà été attribué à un règlement DB = GestionDB.DB() req = """SELECT COUNT(IDreglement) FROM reglements WHERE IDemetteur=%d ;""" % IDemetteur DB.ExecuterReq(req) nbreReglements = int(DB.ResultatReq()[0][0]) DB.Close() if nbreReglements > 0: message = _( u"Attention, cet émetteur a déjà été attribué à %d règlement(s). Si vous le supprimez, il sera également dissocié des règlements associés !\n\nSouhaitez-vous tout de même le supprimer ?" ) % nbreReglements dlg = wx.MessageDialog( self, message, _(u"Suppression"), wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_EXCLAMATION) reponse = dlg.ShowModal() dlg.Destroy() if reponse != wx.ID_YES: return False # Suppression dlg = wx.MessageDialog( self, _(u"Confirmez-vous vraiment la suppression de cet émetteur ?"), _(u"Suppression"), wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION) if dlg.ShowModal() == wx.ID_YES: DB = GestionDB.DB() DB.ReqDEL("emetteurs", "IDemetteur", IDemetteur) DB.ReqMAJ("reglements", [ ("IDemetteur", None), ], "IDemetteur", IDemetteur) DB.Close() self.MAJ() dlg.Destroy()
def Ajouter(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "parametrage_modeles_tickets", "creer") == False: return from Dlg import DLG_Saisie_modele_ticket dlg = DLG_Saisie_modele_ticket.Dialog(self, categorie=self.categorie, IDmodele=None) if len(self.donnees) == 0: dlg.defaut = 1 if dlg.ShowModal() == wx.ID_OK: IDmodele = dlg.GetIDmodele() self.MAJ(IDmodele) dlg.Destroy()
def OnBoutonModifier(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("familles_messages", "modifier") == False : return item = self.ctrl_infos.GetSelection() if not item or self.ctrl_infos.GetPyData(item) == None or self.ctrl_infos.GetPyData(item)["type"] != "message": dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucun message à modifier dans la liste !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return IDmessage = self.ctrl_infos.GetPyData(item)["IDmessage"] import DLG_Saisie_message dlg = DLG_Saisie_message.Dialog(self, IDmessage=IDmessage, mode="famille") if dlg.ShowModal() == wx.ID_OK: self.MAJ() dlg.Destroy()
def Supprimer(self, event): if self.IDfamille != None and UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "familles_mandats", "supprimer") == False: return if len(self.Selection()) == 0: dlg = wx.MessageDialog( self, _(u"Vous n'avez sélectionné aucun mandat à supprimer dans la liste" ), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return track = self.Selection()[0] # Avertissement si appartient à un prélèvement if track.nbrePrelevements > 0: dlg = wx.MessageDialog( self, _(u"Suppression impossible ! \n\nCe mandat est déjà rattaché à %d prélèvements." ) % track.nbrePrelevements, _(u"Suppression impossible"), wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() return # Demande de confirmation de suppression dlg = wx.MessageDialog( self, _(u"Confirmez-vous la suppression de ce mandat ?"), _(u"Suppression"), wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION) if dlg.ShowModal() == wx.ID_YES: DB = GestionDB.DB() DB.ReqDEL("mandats", "IDmandat", track.IDmandat) ## # Mémorise l'action dans l'historique ## montant = u"%.2f ¤" % self.Selection()[0].montant ## texteMode = self.Selection()[0].nom_mode ## textePayeur = self.Selection()[0].nom_payeur ## UTILS_Historique.InsertActions([{ ## "IDfamille" : IDfamille, ## "IDcategorie" : 8, ## "action" : _(u"Suppression du règlement ID%d : %s en %s payé par %s") % (IDreglement, montant, texteMode, textePayeur), ## },]) DB.Close() # MAJ de l'affichage self.MAJ() dlg.Destroy()
def Ajouter(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "facturation_prelevements", "creer") == False: return typePrelevement = self.DemanderTypePrelevement() if typePrelevement == False: return from Dlg import DLG_Saisie_prelevement_lot dlg = DLG_Saisie_prelevement_lot.Dialog( self, typePrelevement=typePrelevement) if dlg.ShowModal() == wx.ID_OK: IDlot = dlg.GetIDlot() self.MAJ(IDlot) dlg.Destroy()
def On_outils_recalculer(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "consommations_conso", "modifier") == False: return dlg = wx.MessageDialog( self, _(u"Confirmez-vous le recalcul des prestations de toutes les consommations affichées ?" ), _(u"Recalcul des prestations"), wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_QUESTION) reponse = dlg.ShowModal() dlg.Destroy() if reponse != wx.ID_YES: return self.panel_grille.grille.RecalculerToutesPrestations()
def Selectionner_medecin(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "individus_medecin", "modifier") == False: return import DLG_Medecins dlg = DLG_Medecins.Dialog(self, mode="selection") etat = dlg.ShowModal() if etat == wx.ID_OK: IDmedecin = dlg.GetIDmedecin() self.ctrl_medecin.SetIDmedecin(IDmedecin=IDmedecin) if etat == wx.ID_CANCEL: self.ctrl_medecin.SetIDmedecin() dlg.Destroy() self.SetEtatBoutonDetacherMedecin()
def Ajouter(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "parametrage_analytiques", "creer") == False: return if len(self.donnees) == 0: defaut = 1 else: defaut = 0 dlg = DLG_Saisie_analytique.Dialog(self, IDanalytique=None, defaut=defaut) if dlg.ShowModal() == wx.ID_OK: self.MAJ(dlg.GetIDanalytique()) dlg.Destroy()
def Modifier(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("reglements_depots", "modifier") == False : return if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucun dépôt à modifier dans la liste !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return IDdepot = self.Selection()[0].IDdepot from Dlg import DLG_Saisie_depot dlg = DLG_Saisie_depot.Dialog(self, IDdepot=IDdepot) if dlg.ShowModal() == wx.ID_OK: self.MAJ(IDdepot) self.GetGrandParent().MAJreglements() dlg.Destroy()
def Supprimer(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_restaurateurs", "supprimer") == False : return if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucun restaurateur dans la liste"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return IDrestaurateur = self.Selection()[0].IDrestaurateur # Vérifie que ce restaurateur n'a pas déjà été attribué à une unité de consommation DB = GestionDB.DB() req = """SELECT COUNT(IDunite) FROM unites WHERE IDrestaurateur=%d ;""" % IDrestaurateur DB.ExecuterReq(req) nbreUnites = int(DB.ResultatReq()[0][0]) DB.Close() if nbreUnites > 0 : dlg = wx.MessageDialog(self, _(u"Ce restaurateur a déjà été attribué à %d unité(s) de consommation.\n\nVous ne pouvez donc pas le supprimer !") % nbreUnites, _(u"Suppression impossible"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return # Vérifie que des menus n'ont pas déjà été associés DB = GestionDB.DB() req = """SELECT COUNT(IDmenu) FROM menus WHERE IDrestaurateur=%d ;""" % IDrestaurateur DB.ExecuterReq(req) nbreMenus = int(DB.ResultatReq()[0][0]) DB.Close() if nbreMenus > 0 : dlg = wx.MessageDialog(self, _(u"Attention, %s menus sont associés à ce restaurateur. Si vous supprimez ce restaurateur, les menus seront également supprimés. \n\nSouhaitez-vous tout de même supprimer le restaurateur ?") % nbreMenus, _(u"Avertissement"), wx.YES_NO|wx.NO_DEFAULT|wx.CANCEL|wx.ICON_EXCLAMATION) reponse = dlg.ShowModal() dlg.Destroy() if reponse != wx.ID_YES : return False # Confirmation de suppression dlg = wx.MessageDialog(self, _(u"Souhaitez-vous vraiment supprimer ce restaurateur ?"), _(u"Suppression"), wx.YES_NO|wx.NO_DEFAULT|wx.CANCEL|wx.ICON_INFORMATION) if dlg.ShowModal() == wx.ID_YES : DB = GestionDB.DB() DB.ReqDEL("restaurateurs", "IDrestaurateur", IDrestaurateur) DB.ReqDEL("menus", "IDrestaurateur", IDrestaurateur) DB.Close() self.MAJ() dlg.Destroy()
def Supprimer(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("familles_quotients", "supprimer") == False : return if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucun quotient familial/revenu à supprimer dans la liste !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return dlg = wx.MessageDialog(self, _(u"Souhaitez-vous vraiment supprimer ce quotient familial/revenu ?"), _(u"Suppression"), wx.YES_NO|wx.NO_DEFAULT|wx.CANCEL|wx.ICON_INFORMATION) if dlg.ShowModal() == wx.ID_YES : IDquotient = self.Selection()[0].IDquotient DB = GestionDB.DB() DB.ReqDEL("quotients", "IDquotient", IDquotient) DB.Close() self.MAJ() dlg.Destroy()
def SetDefaut(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_modeles_emails", "modifier") == False : return if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucun modèle dans la liste !"), _(u"Erreur"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return IDmodele = self.Selection()[0].IDmodele DB = GestionDB.DB() for track in self.donnees : if track.defaut == 1 : DB.ReqMAJ("modeles_emails", [("defaut", 0),], "IDmodele", track.IDmodele) DB.ReqMAJ("modeles_emails", [("defaut", 1),], "IDmodele", IDmodele) DB.Close() self.MAJ()
def Ajouter(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_caisses", "creer") == False : return dlg = Saisie(self) if dlg.ShowModal() == wx.ID_OK: nom = dlg.GetNom() IDregime = dlg.GetRegime() DB = GestionDB.DB() listeDonnees = [ ("nom", nom ), ("IDregime", IDregime), ] IDcaisse = DB.ReqInsert("caisses", listeDonnees) DB.Close() self.MAJ(IDcaisse) dlg.Destroy()
def Supprimer(self, event): if self.IDfamille== None and UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_modeles_aides", "supprimer") == False : return if self.IDfamille != None and UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("familles_aides", "supprimer") == False : return if len(self.Selection()) == 0 : dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucune aide à supprimer dans la liste"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return IDaide = self.Selection()[0].IDaide # Vérifie que cette aide n'a pas déjà été utilisée pour une prestation DB = GestionDB.DB() req = """SELECT IDdeduction, IDaide FROM deductions WHERE IDaide=%d ;""" % IDaide DB.ExecuterReq(req) listeDeductions = DB.ResultatReq() DB.Close() if len(listeDeductions) > 0 : dlg = wx.MessageDialog(self, _(u"Cette aide a déjà été attribuée à %s déductions. Il est donc impossible de la supprimer !") % len(listeDeductions), _(u"Suppression impossible"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return dlg = wx.MessageDialog(self, _(u"Souhaitez-vous vraiment supprimer cette aide ?"), _(u"Suppression"), wx.YES_NO|wx.NO_DEFAULT|wx.CANCEL|wx.ICON_INFORMATION) if dlg.ShowModal() == wx.ID_YES : DB = GestionDB.DB() DB.ReqDEL("aides", "IDaide", IDaide) DB.ReqDEL("aides_beneficiaires", "IDaide", IDaide) DB.ReqDEL("aides_montants", "IDaide", IDaide) DB.ReqDEL("aides_combinaisons", "IDaide", IDaide) DB.ReqDEL("aides_combi_unites", "IDaide", IDaide) DB.Close() self.MAJ() dlg.Destroy()
def OnBoutonConsommations(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "consommations_conso", "consulter") == False: return self.Sauvegarde() import DLG_Grille dlg = DLG_Grille.Dialog(self, IDfamille=self.IDfamille, selectionTous=True) if dlg.ShowModal() == wx.ID_OK: self.MAJpageActive() try: dlg.Destroy() except: pass
def OuvrirFicheFamille(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "familles_fiche", "consulter") == False: return dictItem = self.GetMainWindow().GetItemPyData(self.GetSelection()) if dictItem == None: dlg = wx.MessageDialog( self, _(u"Vous n'avez sélectionné aucun individu dans la liste !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return IDindividu = dictItem["code"] print IDindividu # Fonction pas terminée ici
def Supprimer(self, event=None): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "parametrage_classes", "supprimer") == False: return item = self.GetSelection() dictItem = self.GetMainWindow().GetItemPyData(item) type = dictItem["type"] IDclasse = dictItem["ID"] if type != "classe": dlg = wx.MessageDialog( self, _(u"Vous n'avez sélectionné aucune classe à supprimer !"), _(u"Erreur"), wx.OK | wx.ICON_QUESTION) dlg.ShowModal() dlg.Destroy() return # Vérifie que cette classe n'a pas été attribuée à un individu DB = GestionDB.DB() req = """SELECT COUNT(IDclasse) FROM scolarite WHERE IDclasse=%d ;""" % IDclasse DB.ExecuterReq(req) nbre = int(DB.ResultatReq()[0][0]) DB.Close() if nbre > 0: dlg = wx.MessageDialog( self, _(u"Cette classe a déjà été attribuée %d fois.\n\nVous ne pouvez donc pas la supprimer !" ) % nbre, _(u"Suppression impossible"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return # Confirmation de suppression dlg = wx.MessageDialog( self, _(u"Souhaitez-vous vraiment supprimer cette classe ?"), _(u"Suppression"), wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_EXCLAMATION) if dlg.ShowModal() == wx.ID_YES: DB = GestionDB.DB() DB.ReqDEL("classes", "IDclasse", IDclasse) DB.Close() self.MAJ(IDecole=self.IDecole) dlg.Destroy()
def Modifier(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "parametrage_ecoles", "modifier") == False: return if len(self.Selection()) == 0: dlg = wx.MessageDialog( self, _(u"Vous n'avez sélectionné aucune école à modifier dans la liste" ), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() dlg.Destroy() return from Dlg import DLG_Saisie_ecole IDecole = self.Selection()[0].IDecole dlg = DLG_Saisie_ecole.Dialog(self) dlg.SetTitle(_(u"Modification d'une école")) dlg.SetNom(self.Selection()[0].nom) dlg.SetRue(self.Selection()[0].rue) dlg.SetCp(self.Selection()[0].cp) dlg.SetVille(self.Selection()[0].ville) dlg.SetTel(self.Selection()[0].tel) dlg.SetFax(self.Selection()[0].fax) dlg.SetMail(self.Selection()[0].mail) dlg.SetSecteurs(self.Selection()[0].secteurs) if dlg.ShowModal() == wx.ID_OK: nom = dlg.GetNom() rue = dlg.GetRue() cp = dlg.GetCp() ville = dlg.GetVille() tel = dlg.GetTel() fax = dlg.GetFax() mail = dlg.GetMail() secteurs = dlg.GetSecteurs() DB = GestionDB.DB() listeDonnees = [ ("nom", nom), ("rue", rue), ("cp", cp), ("ville", ville), ("tel", tel), ("fax", fax), ("mail", mail), ("secteurs", secteurs), ] DB.ReqMAJ("ecoles", listeDonnees, "IDecole", IDecole) DB.Close() self.MAJ(IDecole) dlg.Destroy()
def Ajouter(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel( "parametrage_types_cotisations", "creer") == False: return if len(self.donnees) == 0: premiereCotisation = True else: premiereCotisation = False dlg = DLG_Saisie_type_cotisation.Dialog( self, IDtype_cotisation=None, premiereCotisation=premiereCotisation) if dlg.ShowModal() == wx.ID_OK: IDtype_cotisation = dlg.GetIDtype_cotisation() self.MAJ(IDtype_cotisation) dlg.Destroy()
def Ajouter(self, event): if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("familles_fiche", "creer") == False : return from Dlg import DLG_Famille dlg = DLG_Famille.Dialog(self, IDfamille=None) if dlg.ShowModal() == wx.ID_OK: pass # MAJ du listView ## self.MAJ() # MAJ du remplissage try : if self.GetGrandParent().GetName() == "general" : self.GetGrandParent().MAJ() ## self.GetGrandParent().ctrl_remplissage.MAJ() else: self.MAJ() except : pass