Skip to content

Commit

Permalink
Mailing pilotes brevétés actifs
Browse files Browse the repository at this point in the history
  • Loading branch information
cvermot committed Mar 25, 2024
1 parent ea9a019 commit 421bc73
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion database/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS parametres (nom TEXT PRIMARY KEY NOT NULL UNIQUE, inf
INSERT INTO parametres (nom, info1, info2, info3) VALUES ('versionBdd', '1.0', NULL, NULL);

-- Table: pilote
CREATE TABLE IF NOT EXISTS pilote (piloteId TEXT PRIMARY KEY UNIQUE NOT NULL, nom TEXT NOT NULL, prenom TEXT NOT NULL, aeroclub TEXT NOT NULL, estAyantDroit INTEGER NOT NULL, mail TEXT, telephone TEXT, remarque TEXT, activitePrincipale TEXT REFERENCES activite (nom) NOT NULL, estActif NUMERIC NOT NULL DEFAULT (1), estPiloteBrevete NUMERIC NOT NULL DEFAULT (1));
CREATE TABLE IF NOT EXISTS pilote (piloteId TEXT PRIMARY KEY UNIQUE NOT NULL, nom TEXT NOT NULL, prenom TEXT NOT NULL, aeroclub TEXT NOT NULL, estAyantDroit INTEGER NOT NULL, mail TEXT, telephone TEXT, remarque TEXT, activitePrincipale TEXT REFERENCES activite (nom) NOT NULL, estActif NUMERIC NOT NULL DEFAULT (1), estBrevete NUMERIC NOT NULL DEFAULT (1));

-- Table: recettes
CREATE TABLE IF NOT EXISTS recettes (recetteId INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL, typeDeRecette TEXT NOT NULL REFERENCES typeDeRecetteDepense (typeDeRecetteDepenseId), Intitule TEXT NOT NULL, montant REAL NOT NULL, identifiantFormulaireSoumissionCe INTEGER REFERENCES demandeRemboursementSoumises (demandeId));
Expand Down
9 changes: 9 additions & 0 deletions src/AeroDms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,13 @@ AeroDms::AeroDms(QWidget* parent) :QMainWindow(parent)
mailing->addAction(mailingPilotesAyantCotiseCetteAnnee);
mailingPilotesActifsAyantCotiseCetteAnnee = new QAction(QIcon("./ressources/email-multiple.svg"), tr("Envoyer un mail aux pilotes ayant cotisé cette année (pilotes actifs seulement)"), this);
mailing->addAction(mailingPilotesActifsAyantCotiseCetteAnnee);
mailingPilotesActifsBrevetes = new QAction(QIcon("./ressources/email-multiple.svg"), tr("Envoyer un mail aux pilotes actifs brevetés"), this);
mailing->addAction(mailingPilotesActifsBrevetes);
mailingPilotesDerniereDemandeSubvention = new QAction(QIcon("./ressources/email-multiple.svg"), tr("Envoyer un mail aux pilotes concernés par la dernière demande de subvention"), this);
mailing->addAction(mailingPilotesDerniereDemandeSubvention);
connect(mailingPilotesAyantCotiseCetteAnnee, SIGNAL(triggered()), this, SLOT(envoyerMail()));
connect(mailingPilotesActifsAyantCotiseCetteAnnee, SIGNAL(triggered()), this, SLOT(envoyerMail()));
connect(mailingPilotesActifsBrevetes, SIGNAL(triggered()), this, SLOT(envoyerMail()));
connect(mailingPilotesDerniereDemandeSubvention, SIGNAL(triggered()), this, SLOT(envoyerMail()));

menuOutils->addSeparator();
Expand Down Expand Up @@ -2103,6 +2106,12 @@ void AeroDms::envoyerMail()
+ db->recupererMailPilotes(listeDeroulanteAnnee->currentData().toInt(), true)
+ "?subject=[Section aéronautique]&body=", QUrl::TolerantMode));
}
else if (sender() == mailingPilotesActifsBrevetes)
{
QDesktopServices::openUrl(QUrl("mailto:"
+ db->recupererMailPilotes(listeDeroulanteAnnee->currentData().toInt(), true, true)
+ "?subject=[Section aéronautique]&body=", QUrl::TolerantMode));
}
else if (sender() == mailingPilotesDerniereDemandeSubvention)
{
QDesktopServices::openUrl(QUrl("mailto:"
Expand Down
1 change: 1 addition & 0 deletions src/AeroDms.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class AeroDms : public QMainWindow
//Menu outils
QAction* mailingPilotesAyantCotiseCetteAnnee;
QAction* mailingPilotesActifsAyantCotiseCetteAnnee;
QAction* mailingPilotesActifsBrevetes;
QAction* mailingPilotesDerniereDemandeSubvention;
QAction* scanAutoOpenFlyer;
QAction* scanAutoAca;
Expand Down
14 changes: 13 additions & 1 deletion src/ManageDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,13 +1377,23 @@ QStringList ManageDb::recupererListeActivites()
}

QString ManageDb::recupererMailPilotes( const int p_annee,
const bool p_pilotesActifsSeulement)
const bool p_pilotesActifsSeulement,
const bool p_pilotesBrevetes)
{
QSqlQuery query;
query.prepare("SELECT piloteId, mail, annee FROM cotisation INNER JOIN pilote ON cotisation.pilote = pilote.piloteId WHERE annee = :annee");
if (p_pilotesActifsSeulement)
{
query.prepare("SELECT piloteId, mail, annee FROM cotisation INNER JOIN pilote ON cotisation.pilote = pilote.piloteId WHERE annee = :annee AND estActif = 1");
if (p_pilotesBrevetes)
{
query.prepare("SELECT piloteId, mail FROM pilote WHERE estActif = 1 AND estBrevete = 1");
qDebug() << "ici";
}
}
else if (p_pilotesBrevetes)
{
query.prepare("SELECT piloteId, mail FROM pilote WHERE estBrevete = 1");
}
query.bindValue(":annee", p_annee);
query.exec();
Expand All @@ -1402,6 +1412,8 @@ QString ManageDb::recupererMailPilotes( const int p_annee,
listeMail.chop(1);
}

qDebug() << listeMail << query.size();

return listeMail;
}

Expand Down
3 changes: 2 additions & 1 deletion src/ManageDb.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ class ManageDb : public QWidget {

AeroDmsTypes::ListeStatsHeuresDeVol recupererHeuresMensuelles(const int p_annee = -1);
QString recupererMailPilotes( const int p_annee,
const bool p_pilotesActifsSeulement);
const bool p_pilotesActifsSeulement,
const bool p_pilotesBrevetes = false);
QString recupererMailDerniereDemandeDeSubvention();

public slots:
Expand Down

0 comments on commit 421bc73

Please sign in to comment.