Script de contrôle des adhésions
This commit is contained in:
parent
4c8bc7f1df
commit
2380d30aba
|
@ -0,0 +1,8 @@
|
|||
build:
|
||||
:
|
||||
|
||||
install:
|
||||
:
|
||||
|
||||
run:
|
||||
python3 main.py
|
|
@ -0,0 +1 @@
|
|||
# GESTION -- outils de secrétariat
|
|
@ -0,0 +1,35 @@
|
|||
Bonjour NOM_MEMBRE,
|
||||
|
||||
J'ai le plaisir de vous confirmer que votre adhésion à l'association Libre en
|
||||
Communs a été enregistrée, sous le numéro de membre NUMERO_MEMBRE.
|
||||
|
||||
En adhérant à l'association vous adoptez ses statuts et acceptez son règlement
|
||||
intérieur. Vous pourrez retrouver ces textes, actualisés, sur la forge
|
||||
logicielle de l'association :
|
||||
|
||||
- https://git.a-lec.org/a-lec/vie-associative/statuts
|
||||
- https://git.a-lec.org/a-lec/vie-associative/reglement-interieur
|
||||
|
||||
Notez que les correspondances ultérieures avec l'association se feront à
|
||||
travers l'adresse de courriel COURRIEL_MEMBRE que vous avez choisie lors de
|
||||
votre adhésion, redirigée ou non selon vos demandes à l'inscription.
|
||||
La Commission Infrastructures vous informera de la mise en place de cette
|
||||
adresse et des autres services éventuels que vous auriez demandés. N'hésitez
|
||||
pas à contacter cette commission pour toute demande (cominfra@a-lec.org).
|
||||
|
||||
Le trésorier de notre association vous contactera très bientôt pour fixer avec
|
||||
vous les modalités de règlement de votre cotisation annuelle.
|
||||
|
||||
En attendant, au nom de toute l'association, je vous souhaite la bienvenue dans
|
||||
ce nouvel espace de liberté partagé !
|
||||
|
||||
Librement,
|
||||
--
|
||||
Jean Sirmai
|
||||
Secrétaire de Libre en Communs
|
||||
GPG: 4ab2153d1f66ac2e
|
||||
-
|
||||
Association Libre en Communs <https://www.a-lec.org>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
From: =?UTF-8?Q?Secr=c3=a9taire_de_Libre_en_Communs?= <secretaire@a-lec.org>
|
||||
To: <COURRIEL_INSCRIPTION>
|
||||
Bcc: <secretaire@a-lec.org>, <tresorier@a-lec.org>
|
||||
Subject: =?UTF-8?Q?=5bSecr=c3=a9tariat=5d_Confirmation de votre adh=c3=a9sion?=
|
||||
Content-Type: text/plain; charset="UTF-8"
|
||||
Content-Transfer-Encoding: quoted-printable
|
|
@ -0,0 +1,5 @@
|
|||
From: =?UTF-8?Q?Secr=c3=a9taire_de_Libre_en_Communs?= <secretaire@a-lec.org>
|
||||
To: <secretaire@a-lec.org>
|
||||
Subject: Suivi automatique des adhesions
|
||||
Content-Type: text/plain; charset="UTF-8"
|
||||
Content-Transfer-Encoding: quoted-printable
|
|
@ -0,0 +1,343 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
# Libre en Communs's adhesion control program
|
||||
# Copyright (C) 2022 Libre en Communs
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import os, requests, json, datetime, shutil, quopri, subprocess
|
||||
from requests.auth import HTTPBasicAuth
|
||||
from requests.auth import HTTPDigestAuth
|
||||
|
||||
|
||||
VERSION="0.0.1"
|
||||
GESTION_SECRET_FILE="/home/secretaire/.secret/gestion_api_password"
|
||||
GIT_SECRET_FILE="/home/secretaire/.secret/git_api_password"
|
||||
WORKDIR="/srv/validation_pre_adhesion.d"
|
||||
WELCOME_MAIL="mail_bienvenue.txt"
|
||||
WELCOME_MAIL_HEADERS="mail_bienvenue_header.txt"
|
||||
SUMMARY_MAIL="mail_resume.txt"
|
||||
SENDMAIL_LOCATION = "/usr/sbin/sendmail" # sendmail location
|
||||
BUF=[]
|
||||
|
||||
# gestion_read("SELECT * FROM services_users su \
|
||||
# INNER JOIN membres m ON m.id = su.id_user \
|
||||
# INNER JOIN services_fees sf ON sf.id = su.id_fee \
|
||||
# LEFT JOIN acc_transactions_users tu ON tu.id_service_user = su.id \
|
||||
# LEFT JOIN acc_transactions_lines l ON l.id_transaction = tu.id_transaction \
|
||||
# WHERE m.id = 3 AND l.id_account = 481;")
|
||||
|
||||
def gestion_get_secret():
|
||||
with open(GESTION_SECRET_FILE) as sfile:
|
||||
return sfile.readline().replace("\n", "")
|
||||
|
||||
def git_get_secret():
|
||||
with open(GIT_SECRET_FILE) as sfile:
|
||||
return sfile.readline().replace("\n", "")
|
||||
|
||||
def get_file_content(filename):
|
||||
with open(filename) as sfile:
|
||||
return sfile.readlines()
|
||||
|
||||
def get_file_content_all(filename):
|
||||
with open(filename) as sfile:
|
||||
return sfile.read()
|
||||
|
||||
def set_file_content(filename, lines):
|
||||
with open(filename, "x") as sfile:
|
||||
return sfile.writelines(lines)
|
||||
|
||||
def gestion_read(req):
|
||||
response = requests.post('https://gestion.a-lec.org/api/sql/',
|
||||
auth = HTTPBasicAuth('api666', gestion_get_secret()),
|
||||
data = req)
|
||||
return response.json()
|
||||
|
||||
def git_mail_ticket_create(req):
|
||||
response = requests.post('https://git.a-lec.org/api/v4/projects/46/issues',
|
||||
headers={'PRIVATE-TOKEN' : git_get_secret()},
|
||||
data = req)
|
||||
return response.json()
|
||||
|
||||
def git_xmpp_ticket_create(req):
|
||||
response = requests.post('https://git.a-lec.org/api/v4/projects/44/issues',
|
||||
headers={'PRIVATE-TOKEN' : git_get_secret()},
|
||||
data = req)
|
||||
return response.json()
|
||||
|
||||
def gestion_adduser(req):
|
||||
response = requests.put('https://gestion.a-lec.org/api/user/import',
|
||||
auth = HTTPBasicAuth('api666', gestion_get_secret()),
|
||||
data = req)
|
||||
return response.content
|
||||
|
||||
def setup_workdir():
|
||||
if not os.path.isdir(WORKDIR):
|
||||
os.mkdir(WORKDIR)
|
||||
if not "nouveau" in os.listdir(WORKDIR):
|
||||
os.mkdir(WORKDIR+"/nouveau")
|
||||
if not "attente" in os.listdir(WORKDIR):
|
||||
os.mkdir(WORKDIR+"/attente")
|
||||
if not "valide" in os.listdir(WORKDIR):
|
||||
os.mkdir(WORKDIR+"/valide")
|
||||
if not "refuse" in os.listdir(WORKDIR):
|
||||
os.mkdir(WORKDIR+"/refuse")
|
||||
|
||||
def sendmail(headers, data):
|
||||
msg = bytes(headers + "\n", 'utf-8') + quopri.encodestring(bytes(data, 'utf-8'))
|
||||
subprocess.run([SENDMAIL_LOCATION, "-t", "-oi"], input=msg)
|
||||
|
||||
def new_registrations_worker():
|
||||
if (os.listdir(WORKDIR+"/nouveau") == []):
|
||||
return
|
||||
global BUF
|
||||
BUF.append("*** Nouvelles adhésions ***")
|
||||
BUF.append("{} nouvelle(s) adhésion(s) reçue(s)".format(
|
||||
len(os.listdir(
|
||||
WORKDIR+"/nouveau"))))
|
||||
|
||||
# Parse each new registration
|
||||
for registration in os.listdir(WORKDIR+"/nouveau"):
|
||||
registration = WORKDIR+"/nouveau/"+registration
|
||||
if not os.path.isfile(registration):
|
||||
BUF.append("{} n'est pas un fichier".format(registration))
|
||||
continue
|
||||
numcode, content = get_file_content(registration)[0].split("|")
|
||||
reg_name, reg_firstname, reg_addr, reg_postalcode, reg_city, reg_email,\
|
||||
reg_attribmail, reg_redir, reg_tarif, reg_payment, reg_xmpp \
|
||||
= content.split(";")
|
||||
|
||||
# Write summary
|
||||
BUF.append("\n* {}\n".format(numcode))
|
||||
BUF.append("Nom: {} {}\nCode postal: {}\n".format(reg_name,
|
||||
reg_firstname, reg_postalcode))
|
||||
|
||||
# Check if exists
|
||||
request = "SELECT numero FROM membres \
|
||||
WHERE email = '{}' and nom = '{} {}'".format(
|
||||
reg_attribmail,
|
||||
reg_name,
|
||||
reg_firstname)
|
||||
try:
|
||||
if len(gestion_read(request)['results']) > 0:
|
||||
BUF.append("Utilisateur déjà existant !")
|
||||
continue
|
||||
except:
|
||||
BUF.append("Erreur inconnue : {}".format(gestion_read(request)))
|
||||
continue
|
||||
|
||||
# Create this new member
|
||||
request = ('"numero","date_adhesion","statut_juridique","siren_rna",' \
|
||||
+ '"nom","email","mail_redirs","adresse","code_postal","ville","pays",'\
|
||||
+ '"telephone","notes","Catégorie membre"' + "\n" \
|
||||
+ '"{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}",'
|
||||
+ '"{}"').format(
|
||||
"",
|
||||
datetime.datetime.now().strftime("%d/%m/%Y"),
|
||||
"Personne physique",
|
||||
"",
|
||||
"{} {}".format(reg_name, reg_firstname),
|
||||
reg_attribmail,
|
||||
reg_email,
|
||||
reg_addr,
|
||||
reg_postalcode,
|
||||
reg_city,
|
||||
"FR",
|
||||
"",
|
||||
"Adhesion "+numcode,
|
||||
"")
|
||||
answer = gestion_adduser(request)
|
||||
if len(answer) > 0:
|
||||
BUF.append("Erreur : {}".format(answer))
|
||||
|
||||
# Check if exists now
|
||||
request = "SELECT numero FROM membres \
|
||||
WHERE email = '{}' and nom = '{} {}'".format(
|
||||
reg_attribmail,
|
||||
reg_name,
|
||||
reg_firstname)
|
||||
try:
|
||||
if len(gestion_read(request)['results']) == 0:
|
||||
BUF.append("Inscription échouée pour une raison inconnue...")
|
||||
continue
|
||||
except:
|
||||
BUF.append("Erreur inconnue : {}".format(gestion_read(request)))
|
||||
continue
|
||||
|
||||
# Register new member to wait for secretary
|
||||
numero = gestion_read(request)['results'][-1]['numero']
|
||||
try:
|
||||
os.remove(WORKDIR+"/attente/"+numcode)
|
||||
except:
|
||||
pass
|
||||
set_file_content(
|
||||
WORKDIR+"/attente/"+numcode,
|
||||
["{};{};{};{}".format(numero, reg_email, reg_redir, reg_xmpp)])
|
||||
|
||||
# Cleanup
|
||||
os.remove(registration)
|
||||
|
||||
|
||||
def validate_registrations_worker():
|
||||
if (os.listdir(WORKDIR+"/attente") == []):
|
||||
return
|
||||
global BUF
|
||||
PREBUF = []
|
||||
PREBUF.append("\n*** Adhésions en validation ***")
|
||||
PREBUF.append("{} nouvelle(s) adhésion(s) reçue(s)".format(
|
||||
len(os.listdir(
|
||||
WORKDIR+"/attente"))))
|
||||
if len(BUF) > 0:
|
||||
BUF = BUF + PREBUF ; PREBUF = [] # flush
|
||||
|
||||
|
||||
# Parse each new registration
|
||||
for registration in os.listdir(WORKDIR+"/attente"):
|
||||
numcode = registration
|
||||
registration = WORKDIR+"/attente/"+registration
|
||||
if not os.path.isfile(registration):
|
||||
BUF = BUF + PREBUF ; PREBUF = [] # flush
|
||||
BUF.append("{} n'est pas un fichier".format(registration))
|
||||
continue
|
||||
|
||||
numero, email, is_redir, is_xmpp = \
|
||||
get_file_content(registration)[0].split(";")
|
||||
|
||||
# Write summary
|
||||
PREBUF.append("\n* {}\n".format(numcode))
|
||||
|
||||
# Gather information
|
||||
request = "SELECT * FROM membres \
|
||||
WHERE numero = '{}'".format(numero)
|
||||
|
||||
# Check status
|
||||
try:
|
||||
if len(gestion_read(request)['results']) == 0:
|
||||
BUF = BUF + PREBUF ; PREBUF = [] # flush
|
||||
BUF.append("Validation échouée : membre refusé.")
|
||||
|
||||
# Register new member to be refused
|
||||
try:
|
||||
os.remove(registration.replace("attente", "refuse"))
|
||||
except:
|
||||
pass
|
||||
os.rename(registration, registration.replace("attente", "refuse"))
|
||||
continue
|
||||
except:
|
||||
BUF.append("Erreur inconnue : {}".format(gestion_read(request)))
|
||||
continue
|
||||
|
||||
# Gather information
|
||||
member = gestion_read(request)['results'][-1]
|
||||
|
||||
PREBUF.append(("Numéro de membre: {}\nNom: {}\nCode postal: {}").format(
|
||||
numero,
|
||||
member['nom'],
|
||||
member['code_postal']))
|
||||
PREBUF.append(("Catégorie: {}").format(member['id_category']))
|
||||
|
||||
# Check category (validated or not !)
|
||||
if member['id_category'] == 2:
|
||||
continue
|
||||
elif member['id_category'] == 10:
|
||||
continue
|
||||
|
||||
BUF = BUF + PREBUF ; PREBUF = [] # flush
|
||||
BUF.append("=> MEMBRE VALIDE PAR SECRETARIAT <=")
|
||||
|
||||
# Launch git tickets
|
||||
request = { 'title' : "Création d'un compte courriel membre n°{}".format(numero),
|
||||
'labels' : "Nouveau membre",
|
||||
'confidential' : "yes",
|
||||
'description' : "Bonjour,\n Une demande de création de compte de" \
|
||||
+ "courriel ou une redirection a été émise.\n\n" \
|
||||
+ "Compte de courriel actuel : {} \n".format(
|
||||
email) \
|
||||
+ "Compte de courriel désiré : {} \n".format(
|
||||
member['email']) \
|
||||
+ "Redirection ('on' si oui, vide si non) : {} \n".format(
|
||||
is_redir)
|
||||
}
|
||||
if not "id" in str(git_mail_ticket_create(request)):
|
||||
BUF.append("Validation échouée : ticket git MAIL en erreur : {}".format(
|
||||
git_mail_ticket_create(request)
|
||||
))
|
||||
continue
|
||||
else:
|
||||
BUF.append("Ticket courriel ouvert.")
|
||||
|
||||
if is_xmpp == "on":
|
||||
request = { 'title' : "Création d'un compte XMPP membre n°{}".format(numero),
|
||||
'labels' : "Nouveau membre",
|
||||
'confidential' : "yes",
|
||||
'description' : "Bonjour,\n Une demande de création de compte" \
|
||||
+ "XMPP a été émise.\n\n" \
|
||||
+ "Compte de courriel actuel : {} \n".format(
|
||||
email) \
|
||||
+ "Compte XMPP désiré : {} \n".format(
|
||||
member['email'])
|
||||
}
|
||||
if not "id" in str(git_xmpp_ticket_create(request)):
|
||||
BUF.append("Validation échouée : ticket git MAIL en erreur : {}".format(
|
||||
git_xmpp_ticket_create(request)
|
||||
))
|
||||
continue
|
||||
else:
|
||||
BUF.append("Ticket XMPP ouvert.")
|
||||
|
||||
# Launch welcoming mail
|
||||
mailtextheaders = get_file_content_all(WELCOME_MAIL_HEADERS)
|
||||
mailtext = get_file_content_all(WELCOME_MAIL)
|
||||
|
||||
mailtextheaders = mailtextheaders.replace("COURRIEL_INSCRIPTION", email)
|
||||
mailtext = mailtext.replace("NUMERO_MEMBRE", numero)
|
||||
mailtext = mailtext.replace("COURRIEL_MEMBRE", member['email'])
|
||||
mailtext = mailtext.replace("COURRIEL_INSCRIPTION", email)
|
||||
mailtext = mailtext.replace("NOM_MEMBRE", member['nom'])
|
||||
|
||||
sendmail(mailtextheaders, mailtext)
|
||||
|
||||
# Register new member to be validated
|
||||
try:
|
||||
os.remove(registration.replace("attente", "valide"))
|
||||
except:
|
||||
pass
|
||||
os.rename(registration, registration.replace("attente", "valide"))
|
||||
|
||||
def main():
|
||||
setup_workdir()
|
||||
new_registrations_worker()
|
||||
validate_registrations_worker()
|
||||
|
||||
# End of work
|
||||
# Launch summary mail
|
||||
mailheaders = get_file_content_all(SUMMARY_MAIL) + "\n"
|
||||
mailtext = ""
|
||||
|
||||
is_sendable = False;
|
||||
for line in BUF:
|
||||
mailtext += line + "\n"
|
||||
is_sendable = True;
|
||||
print(line)
|
||||
|
||||
if is_sendable:
|
||||
try:
|
||||
os.remove("temp.txt")
|
||||
except:
|
||||
pass
|
||||
sendmail(mailheaders, mailtext)
|
||||
|
||||
## Bootstrap
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
# Check_adhesion
|
||||
# Copyright 2022 Adrien Bourmault
|
||||
# Licence AGPL v3
|
||||
|
||||
set -e
|
||||
|
||||
(cat temp.txt) | /usr/sbin/sendmail -i -- tresorier@a-lec.org
|
|
@ -0,0 +1,117 @@
|
|||
\documentclass{article}
|
||||
|
||||
\usepackage{graphicx}
|
||||
\usepackage{tabto}
|
||||
\usepackage{datetime}
|
||||
\ddmmyyyydate
|
||||
\usepackage[a4paper, total={7in, 12.5in}]{geometry}
|
||||
|
||||
\renewcommand{\familydefault}{\sfdefault}
|
||||
|
||||
|
||||
\title{
|
||||
|
||||
\begin{flushright}
|
||||
\vspace*{2ex}
|
||||
|
||||
\huge \bf Association Libre en Communs
|
||||
\end{flushright}
|
||||
|
||||
\vspace*{-6ex}
|
||||
|
||||
\noindent\makebox[\textwidth]{
|
||||
\includegraphics[width=\paperwidth]{header.png}
|
||||
}
|
||||
|
||||
\vspace*{-9ex}
|
||||
|
||||
\begin{flushright}
|
||||
\huge Reçu de cotisation annuelle
|
||||
\end{flushright}
|
||||
}
|
||||
|
||||
\date{}
|
||||
|
||||
% --
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\pagenumbering{gobble}
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\section*{Bénéficiaire des versements}
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\subparagraph{Dénomination} \tabto{5cm} LIBRE EN COMMUNS (RNA W941017425)
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Statut} \tabto{5cm} Association loi 1901 reconnue d'interêt général, à but non lucratif
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Adresse} \tabto{5cm} 13 RUE SULLY, 94210 SAINT-MAUR-DES-FOSSES
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\section*{Cotisant}
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\subparagraph{Nom ou dénomination} \tabto{5cm} NOM-COTISANT
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Statut} \tabto{5cm} STATUT-COTISANT
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Adresse} \tabto{5cm} ADRESSE-COTISANT
|
||||
|
||||
\section*{}
|
||||
|
||||
Le bénéficiaire rappelle que la cotisation n’est pas soumise à la TVA et qu’elle ne donne pas lieu à la délivrance d’une facture. Elle n’ouvre pas droit au bénéfice des dispositions des articles 200, 238 bis et 885-0 V bis A du code général des impôts. Ainsi, aucune réduction d'impôt ne pourra être obtenue de ce reçu. \newline \newline Le bénéficiaire reconnaît avoir reçu au titre de la cotisation annuelle de membre la somme suivante :
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\subparagraph{Somme (EUR)} \tabto{5cm} ***SOMME*** €
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Date du versement} \tabto{5cm} DATE-VERSEMENT
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Mode de versement} \tabto{5cm} MODE-VERSEMENT
|
||||
|
||||
\vspace*{-3ex}
|
||||
|
||||
\section*{}
|
||||
|
||||
Le bénéficiaire, par la présente, accuse réception de votre règlement et vous reconnaît à jour de cotisation à raison de votre adhésion à notre association pour l'année civile ANNEE-CIVILE.
|
||||
|
||||
\section*{}
|
||||
|
||||
\begin{flushright}
|
||||
Pour servir et faire valoir ce que de droit,
|
||||
|
||||
\vspace*{1ex}
|
||||
|
||||
Le \today\ à Saint-Maur des Fossés,
|
||||
|
||||
Le Trésorier de Libre en Communs
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\includegraphics[width=1.3in]{tresorier.png}
|
||||
|
||||
\end{flushright}
|
||||
|
||||
\section*{}
|
||||
|
||||
\center Délivré par l'association Libre en Communs -- https://www.a-lec.org -- contact@a-lec.org
|
||||
|
||||
\end{document}
|
|
@ -0,0 +1,234 @@
|
|||
#!/bin/bash
|
||||
# Check_cotisation
|
||||
# Copyright 2022 Adrien Bourmault
|
||||
# Licence AGPL v3
|
||||
|
||||
contains() {
|
||||
[[ $1 =~ (^|[[:space:]])$2($|[[:space:]]) ]]
|
||||
}
|
||||
|
||||
get_membre_nom()
|
||||
{
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d "SELECT nom FROM membres m WHERE m.id = $1;")
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo -e $requete | cut -d ":" -f 3 | tr -d "\"}]"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
||||
# CREER ENVIRONNEMENT DE TRAVAIL
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
VALIDATION_D=$(cat /etc/gestion-tresorerie/validation.conf)
|
||||
PRE_VALID_F="pre-valid"
|
||||
RELANCE_F="relance"
|
||||
VALID_F="valid"
|
||||
POST_VALID_F="post-valid"
|
||||
ENVOI=$((0))
|
||||
|
||||
SORTIE=$(mktemp /tmp/temporary-file.XXXXXXXX)
|
||||
|
||||
echo "From: root@gestion.a-lec.org (Cron Daemon)" >> "$SORTIE"
|
||||
echo "To: tresorier@a-lec.org" >> "$SORTIE"
|
||||
echo "Subject: [Tresorerie] Mis-a-jour cotisations " >> "$SORTIE"
|
||||
echo "MIME-Version: 1.0" >> "$SORTIE"
|
||||
echo "Content-Type: text/plain; charset=UTF-8" >> "$SORTIE"
|
||||
echo "Content-Transfer-Encoding: 8bit" >> "$SORTIE"
|
||||
echo " " >> "$SORTIE"
|
||||
|
||||
if [ ! -d "$VALIDATION_D" ]; then
|
||||
mkdir -p "$VALIDATION_D"
|
||||
fi
|
||||
if [ ! -f "$VALIDATION_D/$PRE_VALID_F" ]; then
|
||||
touch "$VALIDATION_D/$PRE_VALID_F"
|
||||
fi
|
||||
if [ ! -f "$VALIDATION_D/$VALID_F" ]; then
|
||||
touch "$VALIDATION_D/$VALID_F"
|
||||
fi
|
||||
if [ ! -f "$VALIDATION_D/$POST_VALID_F" ]; then
|
||||
touch "$VALIDATION_D/$POST_VALID_F"
|
||||
fi
|
||||
if [ ! -f "$VALIDATION_D/$RELANCE_F" ]; then
|
||||
touch "$VALIDATION_D/$RELANCE_F"
|
||||
fi
|
||||
|
||||
# LANCER VALIDATION
|
||||
# CONSTRUIRE L'IMAGE POST-VALIDATION (TROISIEME TOUR)
|
||||
IMPAYE_L=$(./get_impayes.sh) # cotisations pas à jour
|
||||
EXPIRE_L=$(./get_expires.sh) # cotisations expirées
|
||||
RELANCE_L=$(cat $VALIDATION_D/$RELANCE_F)
|
||||
VALID_L=$(cat $VALIDATION_D/$VALID_F) # DEUXIEME TOUR
|
||||
POST_VALID_L=$(cat $VALIDATION_D/$POST_VALID_F) # TROISIEME TOUR
|
||||
if [ ! -z "$VALID_L" ]
|
||||
then
|
||||
for adherent in $VALID_L
|
||||
do
|
||||
if ! contains "${IMPAYE_L}" "${adherent}"
|
||||
then
|
||||
if ! contains "${EXPIRE_L}" "${adherent}"
|
||||
then
|
||||
POST_VALID_L="$POST_VALID_L $adherent"
|
||||
NOM_ADHERENT=$(get_membre_nom $adherent)
|
||||
echo -e "VALIDATION FAITE DE $NOM_ADHERENT ($adherent)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
./valider_cotisation.sh "$adherent" >> "$SORTIE"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
POST_VALID_L=$(echo $POST_VALID_L | tr " " "\n" | sort -u | uniq | tr "\n" " ")
|
||||
VALID_L=" "
|
||||
echo "$POST_VALID_L" > "$VALIDATION_D/$POST_VALID_F"
|
||||
fi
|
||||
|
||||
# CONTROLER LES ADHERENTS VALIDES
|
||||
if [ ! -z "$POST_VALID_L" ]
|
||||
then
|
||||
NEW_POST_VALID_L=" "
|
||||
for adherent in $POST_VALID_L
|
||||
do
|
||||
if ! contains "${IMPAYE_L}" "${adherent}"
|
||||
then
|
||||
if ! contains "${EXPIRE_L}" "${adherent}"
|
||||
then
|
||||
NEW_POST_VALID_L="$NEW_POST_VALID_L $adherent"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
POST_VALID_L=$(echo $NEW_POST_VALID_L | tr " " "\n" | sort -u | uniq | tr "\n" " ")
|
||||
echo "$POST_VALID_L" > "$VALIDATION_D/$POST_VALID_F"
|
||||
fi
|
||||
|
||||
|
||||
# CONSTRUIRE L'IMAGE DE VALIDATION (DEUXIEME TOUR)
|
||||
PRE_VALID_L=$(cat $VALIDATION_D/$PRE_VALID_F) # PREMIER TOUR
|
||||
if [ ! -z "$PRE_VALID_L" ]
|
||||
then
|
||||
for adherent in $PRE_VALID_L
|
||||
do
|
||||
if [ ! -z "$POST_VALID_L" ]
|
||||
then
|
||||
if ! contains "${POST_VALID_L}" "${adherent}"
|
||||
then
|
||||
VALID_L="$VALID_L $adherent"
|
||||
echo -e "VALIDATION DE $(get_membre_nom $adherent) ($adherent)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
VALID_L=$(echo $VALID_L | tr " " "\n" | sort -u | uniq | tr "\n" " ")
|
||||
PRE_VALID_L=" "
|
||||
echo "$VALID_L" > "$VALIDATION_D/$VALID_F"
|
||||
fi
|
||||
|
||||
|
||||
# CONSTRUIRE L'IMAGE DE PRE-VALIDATION (PREMIER TOUR)
|
||||
A_JOUR_L=$(./get_payes.sh) # cotisations à jour
|
||||
if [ ! -z "$A_JOUR_L" ]
|
||||
then
|
||||
for adherent in $A_JOUR_L
|
||||
do
|
||||
if [ ! -z "$VALID_L" ]
|
||||
then
|
||||
if ! contains "${VALID_L}" "${adherent}"
|
||||
then
|
||||
if [ ! -z "$POST_VALID_L" ]
|
||||
then
|
||||
if ! contains "${POST_VALID_L}" "${adherent}"
|
||||
then
|
||||
PRE_VALID_L="$PRE_VALID_L $adherent"
|
||||
echo -e "PRE-VALIDATION DE $(get_membre_nom $adherent) ($adherent)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
PRE_VALID_L="$PRE_VALID_L $adherent"
|
||||
echo -e "PRE-VALIDATION DE $(get_membre_nom $adherent) ($adherent)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
fi
|
||||
done
|
||||
PRE_VALID_L=$(echo $PRE_VALID_L | tr " " "\n" | sort -u | uniq | tr "\n" " ")
|
||||
A_JOUR_L=" "
|
||||
echo "$PRE_VALID_L" > "$VALIDATION_D/$PRE_VALID_F"
|
||||
fi
|
||||
|
||||
# ENVOYER LES RELANCES POUR IMPAYES OU EXPIRES
|
||||
if [ ! -z "$IMPAYE_L" ]
|
||||
then
|
||||
for adherent in $IMPAYE_L
|
||||
do
|
||||
if [ ! -z "$RELANCE_L" ]
|
||||
then
|
||||
if ! contains "${RELANCE_L}" "${adherent}"
|
||||
then
|
||||
echo -e "LANCE OU RELANCE DE $(get_membre_nom $adherent) ($adherent)" >> "$SORTIE"
|
||||
ret=$(./envoi_instruction_cotisation.sh $adherent)
|
||||
if [ -z "$ret" ]
|
||||
then
|
||||
RELANCE_L="$RELANCE_L $adherent"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
else
|
||||
echo -e " COURRIEL NON FONCTIONNEL" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "LANCE OU RELANCE DE $(get_membre_nom $adherent) ($adherent)" >> "$SORTIE"
|
||||
ret=$(./envoi_instruction_cotisation.sh $adherent)
|
||||
if [ -z "$ret" ]
|
||||
then
|
||||
RELANCE_L="$RELANCE_L $adherent"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
else
|
||||
echo -e " COURRIEL NON FONCTIONNEL" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
RELANCE_L=$(echo $RELANCE_L | tr " " "\n" | sort -u | uniq | tr "\n" " ")
|
||||
echo "$RELANCE_L" > "$VALIDATION_D/$RELANCE_F"
|
||||
fi
|
||||
|
||||
if [ ! -z "$EXPIRE_L" ]
|
||||
then
|
||||
for adherent in $EXPIRE_L
|
||||
do
|
||||
if [ ! -z "$RELANCE_L" ]
|
||||
then
|
||||
if ! contains "${RELANCE_L}" "${adherent}"
|
||||
then
|
||||
echo -e "EXPIRATION DE $(get_membre_nom $adherent) ($adherent)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
fi
|
||||
else
|
||||
echo -e "EXPIRATION DE $(get_membre_nom $adherent) ($adherent)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
fi
|
||||
done
|
||||
echo "$RELANCE_L" > "$VALIDATION_D/$RELANCE_F"
|
||||
fi
|
||||
|
||||
echo " " >> "$SORTIE"
|
||||
echo "------------------------------------------------------------" >> "$SORTIE"
|
||||
echo -e "Récapitulatif:" >> "$SORTIE"
|
||||
echo -e "Adhérents impayés: $IMPAYE_L" >> "$SORTIE"
|
||||
echo -e "Adhérents expirés: $EXPIRE_L" >> "$SORTIE"
|
||||
echo -e "Adhérents relancés ou avertis: $RELANCE_L" >> "$SORTIE"
|
||||
echo -e "Adhérents validés: $POST_VALID_L" >> "$SORTIE"
|
||||
echo -e "Adhérents en validation: $VALID_L" >> "$SORTIE"
|
||||
echo -e "Adhérents en pré-validation: $PRE_VALID_L" >> "$SORTIE"
|
||||
|
||||
# ENVOI
|
||||
if [ ! -z $1 ] && [ $1 == "debug" ]
|
||||
then
|
||||
echo DEBUG
|
||||
cat "$SORTIE"
|
||||
else
|
||||
if [ $ENVOI -ge 1 ]
|
||||
then
|
||||
cat "$SORTIE" | /usr/sbin/sendmail -i -- tresorier@a-lec.org
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf "$SORTIE"
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
#!/bin/bash
|
||||
# Check_don
|
||||
# Copyright 2022 Adrien Bourmault
|
||||
# Licence AGPL v3
|
||||
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
TOKEN=$(cat ~/.secret/git_api_password)
|
||||
|
||||
contains() {
|
||||
[[ $1 =~ (^|[[:space:]])$2($|[[:space:]]) ]]
|
||||
}
|
||||
|
||||
# RECUPERATION DONNEES
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d "SELECT * FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services s ON s.id = su.id_service
|
||||
LEFT JOIN services_fees sf ON sf.id = su.id_fee
|
||||
INNER JOIN (SELECT id, MAX(date) FROM services_users GROUP BY id_user, id_service) AS su2 ON su2.id = su.id
|
||||
WHERE su.id_service = 1 AND m.id = $1;")
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
#requete=$(echo -e $requete | cut -d ":" -f 3 | tr -d "\"}]")
|
||||
requete=$(echo -e $requete | tr -d "{}\"[]" | cut -c 9-1000)
|
||||
IFS="," read -a results <<< $requete
|
||||
|
||||
# VERIFICATION EXISTENCE
|
||||
if [ ${#results[@]} -eq $((0)) ]
|
||||
then
|
||||
echo " *** MEMBRE INEXISTANT ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
statut=$(echo ${results[15]} | cut -d ":" -f 2)
|
||||
siren=$(echo ${results[16]}| cut -d ":" -f 2)
|
||||
nom=$(echo ${results[17]}| cut -d ":" -f 2)
|
||||
courriel=$(echo ${results[18]}| cut -d ":" -f 2)
|
||||
numero=$(echo ${results[13]}| cut -d ":" -f 2)
|
||||
montant=$(echo ${results[5]}| cut -d ":" -f 2)
|
||||
|
||||
if [ "$montant" == "null" ]
|
||||
then
|
||||
montant=2000
|
||||
fi
|
||||
|
||||
montant=${montant::-2},${montant: -2:2}
|
||||
date=$(echo ${results[6]} | cut -d ":" -f 2)
|
||||
ANNEE_CIVILE=$(( $(echo ${results[7]} | cut -d ":" -f 2 | cut -d "-" -f 1) - 1))
|
||||
|
||||
|
||||
# Vérifier que le courriel est opérationnel
|
||||
|
||||
requete=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" --request GET "https://git.a-lec.org/api/v4/projects/46/issues?not%5Blabels%5D=R%C3%A9solu&state=opened" | grep -e "Création de compte courriel membre n°${numero}")
|
||||
|
||||
echo $requete
|
||||
|
||||
if [ ! -z "$requete" ]
|
||||
then
|
||||
echo " COURRIEL NON FONCTIONNEL"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
FILE=$(mktemp /tmp/temporary.XXXXXXXX)
|
||||
|
||||
cat mail_instructions_cotisation.txt >> "$FILE"
|
||||
|
||||
sed -i "s/ANNEE_CIVILE/$ANNEE_CIVILE/g" "$FILE"
|
||||
sed -i "s/NUMERO_MEMBRE/$numero/" "$FILE"
|
||||
sed -i "s/COURRIEL_COTISANT/$courriel/" "$FILE"
|
||||
sed -i "s/NOM_COTISANT/$nom/" "$FILE"
|
||||
sed -i "s/MONTANT_COTISATION/$montant/" "$FILE"
|
||||
|
||||
# ENVOI
|
||||
( cat "$FILE" ) | /usr/sbin/sendmail -i -- tresorier@a-lec.org "$courriel"
|
||||
#cat "$FILE"
|
||||
|
||||
rm -f "$FILE"
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $1 : NOM-COTISANT
|
||||
# $2 : STATUT-COTISANT
|
||||
# $3 : ADRESSE-COTISANT
|
||||
# $4 : SOMME
|
||||
# $5 : DATE-VERSEMENT
|
||||
# $6 : MODE-VERSEMENT
|
||||
# $7 : ANNEE-CIVILE
|
||||
|
||||
set -e
|
||||
|
||||
#exec {BASH_XTRACEFD}> >(tail -n 1) # send set -x output to tail -n 1
|
||||
#PS4=':At line $LINENO; prior command exit status $?+'
|
||||
#set -x
|
||||
|
||||
if [ $# -ne 7 ]; then
|
||||
|
||||
echo "Nombre d'arguments incorrect"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILE=$(echo $1 | tr " " "_")_reçu_$(echo $5 | tr "/" ".").tex
|
||||
NOM_COTISANT=$(echo $1 | tr "/" ".")
|
||||
STATUT_COTISANT=$(echo $2 | tr "/" ".")
|
||||
ADRESSE_COTISANT=$(echo $3 | tr "/" ".")
|
||||
SOMME=$(echo $4 | tr "/" ".")
|
||||
DATE_VERSEMENT=$(date -d$5 +%d/%m/%Y)
|
||||
MODE_VERSEMENT=$(echo $6 | tr "/" ".")
|
||||
ANNEE_CIVILE=$(echo $7)
|
||||
|
||||
cat RECU_COTISATION.tex > "$FILE"
|
||||
|
||||
sed -i "s/ANNEE-CIVILE/$ANNEE_CIVILE/" "$FILE"
|
||||
sed -i "s/NOM-COTISANT/$NOM_COTISANT/" "$FILE"
|
||||
sed -i "s/STATUT-COTISANT/$STATUT_COTISANT/" "$FILE"
|
||||
sed -i "s/ADRESSE-COTISANT/$ADRESSE_COTISANT/" "$FILE"
|
||||
sed -i "s/SOMME/$SOMME/" "$FILE"
|
||||
sed -i "s|DATE-VERSEMENT|$DATE_VERSEMENT|" "$FILE"
|
||||
sed -i "s/MODE-VERSEMENT/$MODE_VERSEMENT/" "$FILE"
|
||||
|
||||
pdflatex "$FILE"
|
||||
|
||||
rm -f *.aux *.log
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT * FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services_fees sf ON sf.id = su.id_fee
|
||||
LEFT JOIN acc_transactions_users tu ON tu.id_service_user = su.id
|
||||
LEFT JOIN acc_transactions_lines l ON l.id_transaction = tu.id_transaction
|
||||
WHERE m.id = 3 AND l.id_account = 481;')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete
|
||||
|
||||
exit 0
|
||||
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT * FROM
|
||||
acc_transactions_lines;')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete_expire=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT id_user FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services s ON s.id = su.id_service
|
||||
LEFT JOIN services_fees sf ON sf.id = su.id_fee
|
||||
INNER JOIN (SELECT id, MAX(date) FROM services_users GROUP BY id_user, id_service) AS su2 ON su2.id = su.id
|
||||
WHERE su.id_service = 1 AND su.expiry_date < date() AND NOT (m.id_category = 10 OR m.id_category = 3 OR m.id_category = 2 OR m.id_category = 8);')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete_expire | tr "," "\n" | sed 's/[^[:digit:]]\+//g' | tr "\n" " "
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete_impaye=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT id_user FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services s ON s.id = su.id_service
|
||||
LEFT JOIN services_fees sf ON sf.id = su.id_fee
|
||||
INNER JOIN (SELECT id, MAX(date) FROM services_users GROUP BY id_user, id_service) AS su2 ON su2.id = su.id
|
||||
WHERE su.id_service = 1 AND su.paid = 0 AND NOT (m.id_category = 10 OR m.id_category = 3 OR m.id_category = 2 OR m.id_category = 8);')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete_impaye | tr "," "\n" | sed 's/[^[:digit:]]\+//g' | tr "\n" " "
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT id_user FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services s ON s.id = su.id_service
|
||||
LEFT JOIN services_fees sf ON sf.id = su.id_fee
|
||||
INNER JOIN (SELECT id, MAX(date) FROM services_users GROUP BY id_user, id_service) AS su2 ON su2.id = su.id
|
||||
WHERE su.id_service = 1 AND su.paid = 1 AND su.expiry_date > date() AND NOT (m.id_category = 10 OR m.id_category = 3 OR m.id_category = 2 OR m.id_category = 8);')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete | tr "," "\n" | sed 's/[^[:digit:]]\+//g' | tr "\n" " "
|
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
|
@ -0,0 +1,32 @@
|
|||
Content-Language: fr
|
||||
From: =?UTF-8?Q?Tr=c3=a9sorier_de_Libre_en_Communs?= <tresorier@a-lec.org>
|
||||
To: <COURRIEL-COTISANT>
|
||||
Subject: =?UTF-8?Q?=5bTr=c3=a9sorerie=5d_Re=c3=a7u_pour_votre_cotisation_de_?=
|
||||
=?UTF-8?Q?membre?=
|
||||
Mime-Version: 1.0
|
||||
Content-Type: multipart/mixed; boundary="------------3yxkFgv0AINs5nd0i6BJrWaV"
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------3yxkFgv0AINs5nd0i6BJrWaV
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bonsoir,
|
||||
|
||||
Veuillez trouver ci-joint votre reçu pour la cotisation annuelle pour l'année civile ANNEE-CIVILE.
|
||||
|
||||
Librement,
|
||||
|
||||
--
|
||||
Adrien Bourmault
|
||||
Trésorier de Libre en Communs
|
||||
GPG: 0980e827cb47fbb9
|
||||
-
|
||||
Association Libre en Communs <https://www.a-lec.org>
|
||||
--------------3yxkFgv0AINs5nd0i6BJrWaV
|
||||
Content-Type: application/pdf; name="Recu_cotisation_ANNEE-CIVILE.pdf"
|
||||
Content-Disposition: attachment; filename="Recu_cotisation_ANNEE-CIVILE.pdf"
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
Content-Language: fr
|
||||
From: =?UTF-8?Q?Tr=c3=a9sorier_de_Libre_en_Communs?= <tresorier@a-lec.org>
|
||||
To: <COURRIEL_COTISANT>
|
||||
Subject: =?UTF-8?Q?=5bTr=c3=a9sorerie=5d_-_modalit=c3=a9s_de_r=c3=a8glement_de_vo?=
|
||||
=?UTF-8?Q?tre_cotisation_ANNEE_CIVILE?=
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bonjour NOM_COTISANT,
|
||||
|
||||
Je reviens vers vous pour vous informer des modalités de règlement de votre
|
||||
cotisation pour l'année civile ANNEE_CIVILE. Votre numéro de membre est le
|
||||
NUMERO_MEMBRE et le montant de votre cotisation est MONTANT_COTISATION €.
|
||||
|
||||
Les moyens de paiement acceptés sont: espèces, chèques et virement bancaire.
|
||||
Vous avez normalement déjà formulé une préférence. Si toutefois vous souhaitez
|
||||
changer de mode de paiement, merci de nous en informer en réponse à ce courriel.
|
||||
|
||||
|
||||
Pour le paiement par chèque à l'ordre de Libre en Communs, ainsi que le
|
||||
paiement en espèces, merci d'expédier votre courrier à l'adresse suivante:
|
||||
|
||||
ASSOCIATION LIBRE EN COMMUNS
|
||||
13 RUE SULLY
|
||||
94210 SAINT MAUR DES FOSSÉS
|
||||
|
||||
|
||||
Pour le paiement par virement bancaire, merci d'émettre votre virement à
|
||||
destination de l'IBAN ci-dessous.
|
||||
MERCI D'INDIQUER VOTRE NUMERO DE MEMBRE EN COMMENTAIRE OU REFERENCE DE VOTRE VIREMENT.
|
||||
|
||||
IBAN: FR7610278061690002212870186
|
||||
BIC: CMCIFR2A
|
||||
Domiciliation: CCM DU PLATEAU BRIARD
|
||||
|
||||
|
||||
Vous remerciant encore de votre engagement,
|
||||
Librement,
|
||||
--
|
||||
Adrien Bourmault
|
||||
Trésorier de Libre en Communs
|
||||
GPG: 0980e827cb47fbb9
|
||||
-
|
||||
Association Libre en Communs <https://www.a-lec.org>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
#!/bin/bash
|
||||
# Validation_cotisation
|
||||
# Copyright 2022 Adrien Bourmault
|
||||
# Licence AGPL v3
|
||||
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
|
||||
##############################################################################
|
||||
LISTE_PAYES=$(./get_payes.sh)
|
||||
|
||||
# RECUPERATION DONNEES
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d "SELECT * FROM services_users su INNER JOIN membres m ON m.id = su.id_user INNER JOIN services_fees sf ON sf.id = su.id_fee LEFT JOIN acc_transactions_users tu ON tu.id_service_user = su.id LEFT JOIN acc_transactions_lines l ON l.id_transaction = tu.id_transaction WHERE m.numero = $1 AND l.id_account = 481;")
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
#requete=$(echo -e $requete | cut -d ":" -f 3 | tr -d "\"}]")
|
||||
requete=$(echo -e $requete | tr -d "{}\"[]" | cut -c 9-1000)
|
||||
IFS="," read -a results <<< $requete
|
||||
|
||||
# VERIFICATION EXISTENCE
|
||||
if [ ${#results[@]} -eq $((0)) ]
|
||||
then
|
||||
echo "*** MEMBRE INEXISTANT ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
id=$(echo ${results[1]} | cut -d ":" -f 2)
|
||||
statut=$(echo ${results[15]} | cut -d ":" -f 2)
|
||||
siren=$(echo ${results[16]}| cut -d ":" -f 2)
|
||||
nom=$(echo ${results[17]}| cut -d ":" -f 2)
|
||||
courriel=$(echo ${results[18]}| cut -d ":" -f 2)
|
||||
adresse=$(echo "$(echo ${results[20]}| cut -d ":" -f 2), $(echo ${results[21]}| cut -d ":" -f 2) $(echo ${results[22]}| cut -d ":" -f 2) $(echo ${results[23]}| cut -d ":" -f 2)")
|
||||
notes=$(echo ${results[25]}| cut -d ":" -f 2)
|
||||
transaction=$(echo ${results[34]}| cut -d ":" -f 2)
|
||||
montant=$(echo ${results[36]}| cut -d ":" -f 2)
|
||||
montant=${montant::-2},${montant: -2:2}
|
||||
reference=$(echo ${results[38]}| cut -d ":" -f 2)
|
||||
date=$(echo ${results[6]} | cut -d ":" -f 2)
|
||||
ANNEE_CIVILE=$(( $(echo ${results[7]} | cut -d ":" -f 2 | cut -d "-" -f 1) - 1))
|
||||
|
||||
# VERIFICATION PAIEMENT
|
||||
for adherent in $LISTE_PAYES
|
||||
do
|
||||
if [ "$adherent" -eq "$id" ]
|
||||
then
|
||||
echo "AVERTISSEMENT: cotisation déjà validée"
|
||||
fi
|
||||
done
|
||||
|
||||
# CONFIRMATION
|
||||
echo -ne "Valider membre $nom numéro $1 (cotisation $montant € réference $reference) ? [y/n] "
|
||||
read ans
|
||||
if [[ $ans == y* ]]; then
|
||||
echo "Validation..."
|
||||
else
|
||||
echo "Annulation."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# GENERATION
|
||||
|
||||
if [ "$siren" = "null" ]
|
||||
then
|
||||
./generer_cotisation.sh "$nom" "$statut" "$adresse" "$montant" "$date" "$reference" "$ANNEE_CIVILE"
|
||||
else
|
||||
./generer_cotisation.sh "$nom (SIREN $siren)" "$statut" "$adresse" "$montant" "$date" "$reference" "$ANNEE_CIVILE"
|
||||
fi
|
||||
|
||||
FILE=$(echo "$nom" | tr " " "_")_reçu_$(echo "$date" | tr "/" ".").pdf
|
||||
|
||||
# ENVOI
|
||||
(cat mail.txt|sed "s/ANNEE-CIVILE/$ANNEE_CIVILE/g"|sed "s/COURRIEL-COTISANT/$courriel/g"; base64 "$FILE"; echo "--------------3yxkFgv0AINs5nd0i6BJrWaV--")|/usr/sbin/sendmail -i -- "$courriel" tresorier@a-lec.org
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
From: root@gestion.a-lec.org (Cron Daemon)
|
||||
To: tresorier@a-lec.org
|
||||
Subject: Gestion -- script cotisation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
# Validation_cotisation
|
||||
# Copyright 2022 Adrien Bourmault
|
||||
# Licence AGPL v3
|
||||
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# RECUPERATION DONNEES
|
||||
results=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d "SELECT *, l.reference true_reference FROM services_users su INNER JOIN membres m ON m.id = su.id_user INNER JOIN services_fees sf ON sf.id = su.id_fee LEFT JOIN acc_transactions_users tu ON tu.id_service_user = su.id LEFT JOIN acc_transactions_lines l ON l.id_transaction = tu.id_transaction INNER JOIN acc_transactions tr ON tr.id = l.id_transaction WHERE m.id = $1 AND l.id_account = 481;")
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
# VERIFICATION EXISTENCE
|
||||
if [ -z "$results" ]
|
||||
then
|
||||
echo " *** MEMBRE INEXISTANT ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
statut=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['statut_juridique'])")
|
||||
siren=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['siren_rna'])")
|
||||
nom=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['nom'])")
|
||||
courriel=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['email'])")
|
||||
rue=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['adresse'])")
|
||||
codepostal=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['code_postal'])")
|
||||
ville=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['ville'])")
|
||||
pays=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['pays'])")
|
||||
adresse="$rue, $codepostal $ville, $pays"
|
||||
notes=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['notes'])")
|
||||
montant=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['amount'])")
|
||||
montant=${montant::-2},${montant: -2:2}
|
||||
reference=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['true_reference'])")
|
||||
date=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['date'])")
|
||||
ANNEE_CIVILE=$(echo $results | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['results'][-1]['date'])" | cut -d "-" -f 1)
|
||||
|
||||
# GENERATION
|
||||
|
||||
if [ "$siren" = "None" ]
|
||||
then
|
||||
./generer_cotisation.sh "$nom" "$statut" "$adresse" "$montant" "$date" "$reference" "$ANNEE_CIVILE" > /dev/null
|
||||
else
|
||||
./generer_cotisation.sh "$nom (SIREN $siren)" "$statut" "$adresse" "$montant" "$date" "$reference" "$ANNEE_CIVILE" > /dev/null
|
||||
fi
|
||||
|
||||
if [ "$reference" = "None" ]
|
||||
then
|
||||
echo " PAIEMENT INVALIDE !"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
FILE=$(echo "$nom" | tr " " "_")_reçu_$(echo "$date" | tr "/" ".").pdf
|
||||
|
||||
# ENVOI
|
||||
(cat mail_cotisation.txt|sed "s/ANNEE-CIVILE/$ANNEE_CIVILE/g"|sed "s/COURRIEL-COTISANT/$courriel/g"; base64 "$FILE"; echo "--------------3yxkFgv0AINs5nd0i6BJrWaV--")|/usr/sbin/sendmail -i -- "$courriel" tresorier@a-lec.org > /dev/null
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
\documentclass{article}
|
||||
|
||||
\usepackage{graphicx}
|
||||
\usepackage{tabto}
|
||||
\usepackage{datetime}
|
||||
\ddmmyyyydate
|
||||
\usepackage[a4paper, total={7in, 12.5in}]{geometry}
|
||||
|
||||
\renewcommand{\familydefault}{\sfdefault}
|
||||
|
||||
|
||||
\title{
|
||||
|
||||
\begin{flushright}
|
||||
\vspace*{2ex}
|
||||
|
||||
\huge \bf Association Libre en Communs
|
||||
\end{flushright}
|
||||
|
||||
\vspace*{-6ex}
|
||||
|
||||
\noindent\makebox[\textwidth]{
|
||||
\includegraphics[width=\paperwidth]{header.png}
|
||||
}
|
||||
|
||||
\vspace*{-9ex}
|
||||
|
||||
\begin{flushright}
|
||||
\huge Reçu fiscal au titre de dons
|
||||
\end{flushright}
|
||||
}
|
||||
|
||||
\date{}
|
||||
|
||||
% --
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\pagenumbering{gobble}
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\section*{Bénéficiaire des versements}
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\subparagraph{Dénomination} \tabto{5cm} LIBRE EN COMMUNS (RNA W941017425)
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Statut} \tabto{5cm} Association loi 1901 reconnue d'interêt général, à but non lucratif
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Adresse} \tabto{5cm} 13 RUE SULLY, 94210 SAINT-MAUR-DES-FOSSES
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\section*{Donateur}
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\subparagraph{Nom ou dénomination} \tabto{5cm} NOM-DONATEUR
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Statut} \tabto{5cm} STATUT-DONATEUR
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Adresse} \tabto{5cm} ADRESSE-DONATEUR
|
||||
|
||||
|
||||
\vspace*{7ex}
|
||||
|
||||
\section*{}
|
||||
|
||||
Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction d’impôt prévue aux articles 200 et 238 du Code Général des Impôts. \newline \newline Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction d’impôt :
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\subparagraph{Somme (EUR)} \tabto{5cm} ***SOMME*** €
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Date du versement} \tabto{5cm} DATE-VERSEMENT
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Forme} \tabto{5cm} FORME-DON
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Nature} \tabto{5cm} NATURE-DON
|
||||
|
||||
\vspace*{-2ex}
|
||||
|
||||
\subparagraph{Mode de versement} \tabto{5cm} MODE-VERSEMENT
|
||||
|
||||
\section*{}
|
||||
|
||||
\begin{flushright}
|
||||
Pour servir et faire valoir ce que de droit,
|
||||
|
||||
\vspace*{1ex}
|
||||
|
||||
Le \today\ à Saint-Maur des Fossés,
|
||||
|
||||
Le Trésorier de Libre en Communs
|
||||
|
||||
\vspace*{2ex}
|
||||
|
||||
\includegraphics[width=1.3in]{tresorier.png}
|
||||
|
||||
\end{flushright}
|
||||
|
||||
\section*{}
|
||||
|
||||
\center Délivré par l'association Libre en Communs -- https://www.a-lec.org -- contact@a-lec.org
|
||||
|
||||
\end{document}
|
|
@ -0,0 +1,173 @@
|
|||
#!/bin/bash
|
||||
# Check_don
|
||||
# Copyright 2022 Adrien Bourmault
|
||||
# Licence AGPL v3
|
||||
|
||||
set -e
|
||||
|
||||
contains()
|
||||
{
|
||||
[[ $1 =~ (^|[[:space:]])$2($|[[:space:]]) ]]
|
||||
}
|
||||
|
||||
get_nom()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 1
|
||||
}
|
||||
|
||||
get_prenom()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 2
|
||||
}
|
||||
|
||||
get_adresse()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 3
|
||||
}
|
||||
|
||||
get_code_postal()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 4
|
||||
}
|
||||
|
||||
get_ville()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 5
|
||||
}
|
||||
|
||||
get_courriel()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 6
|
||||
}
|
||||
|
||||
get_somme()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 7
|
||||
}
|
||||
|
||||
get_mode()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 8
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
||||
# CREER ENVIRONNEMENT DE TRAVAIL
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
VALIDATION_D=$(cat /etc/gestion-tresorerie/validation_don.conf)
|
||||
PRE_VALID_F="pre-valid"
|
||||
VALID_F="valid"
|
||||
POST_VALID_F="post-valid"
|
||||
ENVOI=$((0))
|
||||
|
||||
SORTIE=$(mktemp /tmp/temporary-file.XXXXXXXX)
|
||||
|
||||
echo "From: root@gestion.a-lec.org (Cron Daemon)" >> "$SORTIE"
|
||||
echo "To: tresorier@a-lec.org" >> "$SORTIE"
|
||||
echo "Subject: [Tresorerie] Nouveau don" >> "$SORTIE"
|
||||
echo "MIME-Version: 1.0" >> "$SORTIE"
|
||||
echo "Content-Type: text/plain; charset=UTF-8" >> "$SORTIE"
|
||||
echo "Content-Transfer-Encoding: 8bit" >> "$SORTIE"
|
||||
echo " " >> "$SORTIE"
|
||||
|
||||
if [ ! -d "$VALIDATION_D" ]; then
|
||||
mkdir -p "$VALIDATION_D"
|
||||
fi
|
||||
if [ ! -f "$VALIDATION_D/$PRE_VALID_F" ]; then
|
||||
echo " " > "$VALIDATION_D/$PRE_VALID_F"
|
||||
fi
|
||||
if [ ! -f "$VALIDATION_D/$VALID_F" ]; then
|
||||
echo " " > "$VALIDATION_D/$VALID_F"
|
||||
fi
|
||||
if [ ! -f "$VALIDATION_D/$POST_VALID_F" ]; then
|
||||
echo " " > "$VALIDATION_D/$POST_VALID_F"
|
||||
fi
|
||||
|
||||
POST_VALID_L=$(cat $VALIDATION_D/$POST_VALID_F) # TROISIEME TOUR
|
||||
VALID_L=$(cat $VALIDATION_D/$VALID_F) # DEUXIEME TOUR
|
||||
PRE_VALID_L=$(cat $VALIDATION_D/$PRE_VALID_F) # PREMIER TOUR
|
||||
DONS_EN_ATTENTE=$(find $VALIDATION_D/*pre_don* -exec cat -v {} \; -exec echo " " \; | cut -d "|" -f 1)
|
||||
|
||||
# LANCER VALIDATION
|
||||
# CONSTRUIRE L'IMAGE POST-VALIDATION (TROISIEME TOUR)
|
||||
if [ ! -z "$VALID_L" ]
|
||||
then
|
||||
for don in $VALID_L
|
||||
do
|
||||
POST_VALID_L="$POST_VALID_L $don"
|
||||
echo -e "VALIDATION FAITE DE $(get_nom $don) ($don)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
./valider_don.sh "$don" "$(get_nom $don) $(get_prenom $don)" "Personne physique" "$(get_adresse $don) $(get_code_postal $don) $(get_ville $don)" "$(get_somme $don)" "$(get_courriel $don)" >> "$SORTIE"
|
||||
done
|
||||
POST_VALID_L=$(echo $POST_VALID_L | tr " " "\n" | sort -u | uniq | tr "\n" " ")
|
||||
VALID_L=" "
|
||||
echo "$POST_VALID_L" > "$VALIDATION_D/$POST_VALID_F"
|
||||
fi
|
||||
|
||||
|
||||
# CONSTRUIRE L'IMAGE DE VALIDATION (DEUXIEME TOUR)
|
||||
if [ ! -z "$PRE_VALID_L" ]
|
||||
then
|
||||
for don in $PRE_VALID_L
|
||||
do
|
||||
if [ ! -z "$POST_VALID_L" ] && ! contains "${POST_VALID_L}" "${don}"
|
||||
then
|
||||
# RECUPERATION DONNEES
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d "SELECT * FROM acc_transactions tr INNER JOIN acc_transactions_lines l ON tr.id = l.id_transaction WHERE tr.notes = $don and id_account = 469")
|
||||
requete=$(echo -e $requete | tr -d "{}\"[] " | cut -c 10-1000)
|
||||
|
||||
if [ ! -z "$requete" ]
|
||||
then
|
||||
VALID_L="$VALID_L $don"
|
||||
echo -e "VALIDATION DE $(get_nom $don), ($don)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
VALID_L=$(echo $VALID_L | tr " " "\n" | sort -u | uniq | tr "\n" " ")
|
||||
echo "$VALID_L" > "$VALIDATION_D/$VALID_F"
|
||||
fi
|
||||
|
||||
# CONSTRUIRE LIMAGE DE PRE-VALIDATION (PREMIER TOUR)
|
||||
if [ ! -z "$DONS_EN_ATTENTE" ]
|
||||
then
|
||||
for don in $DONS_EN_ATTENTE
|
||||
do
|
||||
if [ ! -z "$PRE_VALID_L" ] && ! contains "${PRE_VALID_L}" "${don}" && [ ! -z "$VALID_L" ] && ! contains "${VALID_L}" "${don}" && [ ! -z "$POST_VALID_L" ] && ! contains "${POST_VALID_L}" "${don}"
|
||||
then
|
||||
PRE_VALID_L="$PRE_VALID_L $don"
|
||||
echo -e "PRE-VALIDATION DE $(get_nom $don), $(get_somme $don) € par $(get_mode $don) ($don)" >> "$SORTIE"
|
||||
ENVOI=$((ENVOI + 1))
|
||||
|
||||
# RECUPERATION DONNEES
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d "SELECT * FROM acc_transactions tr INNER JOIN acc_transactions_lines l ON tr.id = l.id_transaction WHERE tr.notes = $don and id_account = 469")
|
||||
|
||||
requete=$(echo -e $requete | tr -d "{}\"[] " | cut -c 9-1000)
|
||||
|
||||
if [ -z "$requete" ]
|
||||
then
|
||||
bash -c "./envoi_instructions_don.sh $don"
|
||||
echo -e " COURRIEL INSTRUCTION TRANSMIS" >> "$SORTIE"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
PRE_VALID_L=$(echo $PRE_VALID_L | tr " " "\n" | sort -u | uniq | tr "\n" " ")
|
||||
DONS_EN_ATTENTE=" "
|
||||
echo "$PRE_VALID_L" > "$VALIDATION_D/$PRE_VALID_F"
|
||||
fi
|
||||
|
||||
echo " " >> "$SORTIE"
|
||||
echo "------------------------------------------------------------" >> "$SORTIE"
|
||||
echo -e "Récapitulatif:" >> "$SORTIE"
|
||||
echo -e "Dons réglés: $POST_VALID_L" >> "$SORTIE"
|
||||
echo -e "Dons validés: $VALID_L" >> "$SORTIE"
|
||||
echo -e "Dons en validation (attente paiement): $PRE_VALID_L" >> "$SORTIE"
|
||||
echo -e "Dons en attente: $DONS_EN_ATTENTE" >> "$SORTIE"
|
||||
|
||||
# ENVOI
|
||||
if [ $ENVOI -ge 1 ]
|
||||
then
|
||||
(cat "$SORTIE") | /usr/sbin/sendmail -i -- tresorier@a-lec.org
|
||||
fi
|
||||
|
||||
rm -rf "$SORTIE"
|
|
@ -0,0 +1,71 @@
|
|||
#!/bin/bash
|
||||
# Check_don
|
||||
# Copyright 2022 Adrien Bourmault
|
||||
# Licence AGPL v3
|
||||
|
||||
contains() {
|
||||
[[ $1 =~ (^|[[:space:]])$2($|[[:space:]]) ]]
|
||||
}
|
||||
|
||||
get_nom()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 1
|
||||
}
|
||||
|
||||
get_prenom()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 2
|
||||
}
|
||||
|
||||
get_adresse()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 3
|
||||
}
|
||||
|
||||
get_code_postal()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 4
|
||||
}
|
||||
|
||||
get_ville()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 5
|
||||
}
|
||||
|
||||
get_courriel()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 6
|
||||
}
|
||||
|
||||
get_somme()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 7
|
||||
}
|
||||
|
||||
get_mode()
|
||||
{
|
||||
find /srv/validation_don.d/*pre_don* -exec cat -v {} \; -exec echo " " \; | grep "$1" | cut -d "|" -f 2 | cut -d ";" -f 8
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
||||
FILE=$(mktemp /tmp/temporary.XXXXXXXX)
|
||||
|
||||
courriel="$(get_courriel $1)"
|
||||
nom="$(get_prenom $1) $(get_nom $1)"
|
||||
somme="$(get_somme $1)"
|
||||
mode="$(get_mode $1)"
|
||||
|
||||
cat mail_instructions_don.txt >> "$FILE"
|
||||
|
||||
sed -i "s/COURRIEL_DONNEUR/$courriel/" "$FILE"
|
||||
sed -i "s/NOM_DONNEUR/$nom/" "$FILE"
|
||||
sed -i "s/NUMERO_DON/$1/" "$FILE"
|
||||
sed -i "s/MONTANT_DON/$somme/" "$FILE"
|
||||
sed -i "s/MODE_DON/$mode/" "$FILE"
|
||||
|
||||
# ENVOI
|
||||
( cat "$FILE" ) | /usr/sbin/sendmail -i -- "$courriel" tresorier@a-lec.org
|
||||
#cat "$FILE"
|
||||
|
||||
rm -f "$FILE"
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $1 : NOM-DONATEUR
|
||||
# $2 : STATUT-DONATEUR
|
||||
# $3 : ADRESSE-DONATEUR
|
||||
# $4 : SOMME
|
||||
# $5 : DATE-VERSEMENT
|
||||
# $6 : FORME-DON
|
||||
# $7 : NATURE-DON
|
||||
# $8 : MODE-VERSEMENT
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# -ne 8 ]; then
|
||||
|
||||
echo "Nombre d'arguments incorrect"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILE=$(echo "$1" | tr " " "_")_reçu_don_$(echo "$5" | tr "/" ".").pdf
|
||||
NOM_DONATEUR=$1
|
||||
STATUT_DONATEUR=$2
|
||||
ADRESSE_DONATEUR=$3
|
||||
SOMME=$4
|
||||
DATE_VERSEMENT=$(date -d$5 +%d/%m/%Y)
|
||||
FORME_DON=$6
|
||||
NATURE_DON=$7
|
||||
MODE_VERSEMENT=$8
|
||||
|
||||
cat RECU_FISCAL.tex > "$FILE"
|
||||
|
||||
sed -i "s/NOM-DONATEUR/$NOM_DONATEUR/" "$FILE"
|
||||
sed -i "s/STATUT-DONATEUR/$STATUT_DONATEUR/" "$FILE"
|
||||
sed -i "s/ADRESSE-DONATEUR/$ADRESSE_DONATEUR/" "$FILE"
|
||||
sed -i "s/SOMME/$SOMME/" "$FILE"
|
||||
sed -i "s|DATE-VERSEMENT|$DATE_VERSEMENT|" "$FILE"
|
||||
sed -i "s/FORME-DON/$FORME_DON/" "$FILE"
|
||||
sed -i "s/NATURE-DON/$NATURE_DON/" "$FILE"
|
||||
sed -i "s/MODE-VERSEMENT/$MODE_VERSEMENT/" "$FILE"
|
||||
|
||||
pdflatex "$FILE"
|
||||
|
||||
rm -f *.aux *.log
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT * FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services_fees sf ON sf.id = su.id_fee
|
||||
LEFT JOIN acc_transactions_users tu ON tu.id_service_user = su.id
|
||||
LEFT JOIN acc_transactions_lines l ON l.id_transaction = tu.id_transaction
|
||||
WHERE m.id = 3 AND l.id_account = 481;')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete
|
||||
|
||||
exit 0
|
||||
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT * FROM
|
||||
acc_transactions_lines;')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete_expire=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT id_user FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services s ON s.id = su.id_service
|
||||
LEFT JOIN services_fees sf ON sf.id = su.id_fee
|
||||
INNER JOIN (SELECT id, MAX(date) FROM services_users GROUP BY id_user, id_service) AS su2 ON su2.id = su.id
|
||||
WHERE su.id_service = 1 AND su.expiry_date < date() AND NOT (m.id_category = 10 OR m.id_category = 3 OR m.id_category = 2 OR m.id_category = 8);')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete_expire | tr "," "\n" | sed 's/[^[:digit:]]\+//g' | tr "\n" " "
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete_impaye=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT id_user FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services s ON s.id = su.id_service
|
||||
LEFT JOIN services_fees sf ON sf.id = su.id_fee
|
||||
INNER JOIN (SELECT id, MAX(date) FROM services_users GROUP BY id_user, id_service) AS su2 ON su2.id = su.id
|
||||
WHERE su.id_service = 1 AND su.paid = 0 AND NOT (m.id_category = 10 OR m.id_category = 3 OR m.id_category = 2 OR m.id_category = 8);')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete_impaye | tr "," "\n" | sed 's/[^[:digit:]]\+//g' | tr "\n" " "
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d 'SELECT id_user FROM
|
||||
services_users su
|
||||
INNER JOIN membres m ON m.id = su.id_user
|
||||
INNER JOIN services s ON s.id = su.id_service
|
||||
LEFT JOIN services_fees sf ON sf.id = su.id_fee
|
||||
INNER JOIN (SELECT id, MAX(date) FROM services_users GROUP BY id_user, id_service) AS su2 ON su2.id = su.id
|
||||
WHERE su.id_service = 1 AND su.paid = 1 AND su.expiry_date > date() AND NOT (m.id_category = 10 OR m.id_category = 3 OR m.id_category = 2 OR m.id_category = 8);')
|
||||
# Note: su.id_service = 1 parceque la cotisation correspond au service 1
|
||||
|
||||
echo $requete | tr "," "\n" | sed 's/[^[:digit:]]\+//g' | tr "\n" " "
|
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
|
@ -0,0 +1,32 @@
|
|||
Content-Language: fr
|
||||
From: =?UTF-8?Q?Tr=c3=a9sorier_de_Libre_en_Communs?= <tresorier@a-lec.org>
|
||||
To: <COURRIEL-DON>
|
||||
Subject: =?UTF-8?Q?=5bTr=c3=a9sorerie=5d_Re=c3=a7u_pour_votre_don_pour_Libre_en_Communs?=
|
||||
Mime-Version: 1.0
|
||||
Content-Type: multipart/mixed; boundary="------------3yxkFgv0AINs5nd0i6BJrWaV"
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------3yxkFgv0AINs5nd0i6BJrWaV
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bonjour,
|
||||
|
||||
Veuillez trouver ci-joint votre reçu au titre de votre don à l'association
|
||||
Libre en Communs du DATE-DON.
|
||||
|
||||
Librement,
|
||||
|
||||
--
|
||||
Adrien Bourmault
|
||||
Trésorier de Libre en Communs
|
||||
GPG: 0980e827cb47fbb9
|
||||
-
|
||||
Association Libre en Communs <https://www.a-lec.org>
|
||||
--------------3yxkFgv0AINs5nd0i6BJrWaV
|
||||
Content-Type: application/pdf; name="Recu_don_DATE-DON.pdf"
|
||||
Content-Disposition: attachment; filename="Recu_don_DATE-DON.pdf"
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
Content-Language: fr
|
||||
From: =?UTF-8?Q?Tr=c3=a9sorier_de_Libre_en_Communs?= <tresorier@a-lec.org>
|
||||
To: <COURRIEL_DONNEUR>
|
||||
Subject: =?UTF-8?Q?Libre_en_Communs_-_modalit=c3=a9s_de_r=c3=a8glement_de_vo?=
|
||||
=?UTF-8?Q?tre_don?=
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bonjour NOM_DONNEUR et merci de votre générosité !
|
||||
|
||||
Suite à votre soumission de notre formulaire sur https://don.a-lec.org,
|
||||
je reviens vers vous pour vous informer des modalités de règlement de
|
||||
votre don numéro NUMERO_DON d'un montant de MONTANT_DON €.
|
||||
|
||||
Les moyens de paiement acceptés sont: espèces, chèques et virement bancaire.
|
||||
Vous avez indiqué régler par MODE_DON. Si toutefois vous souhaitez changer de
|
||||
mode de paiement, merci de nous en informer en réponse à ce courriel.
|
||||
|
||||
|
||||
Pour le paiement par chèque à l'ordre de Libre en Communs, ainsi que le paiement
|
||||
en espèces, merci d'expédier votre courrier à l'adresse suivante:
|
||||
|
||||
ASSOCIATION LIBRE EN COMMUNS
|
||||
13 RUE SULLY
|
||||
94210 SAINT MAUR DES FOSSÉS
|
||||
|
||||
|
||||
Pour le paiement par virement bancaire, merci d'émettre votre virement à
|
||||
destination de l'IBAN ci-dessous. MERCI D'INDIQUER VOTRE NUMERO DE DON EN
|
||||
COMMENTAIRE OU REFERENCE DE VOTRE VIREMENT.
|
||||
|
||||
IBAN: FR7610278061690002212870186
|
||||
BIC: CMCIFR2A
|
||||
Domiciliation: CCM DU PLATEAU BRIARD
|
||||
|
||||
|
||||
Vous remerciant encore de votre engagement,
|
||||
Librement,
|
||||
|
||||
--
|
||||
Adrien Bourmault
|
||||
Trésorier de Libre en Communs
|
||||
GPG: 0980e827cb47fbb9
|
||||
-
|
||||
Association Libre en Communs <https://www.a-lec.org>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
From: root@gestion.a-lec.org (Cron Daemon)
|
||||
To: tresorier@a-lec.org
|
||||
Subject: Gestion -- script cotisation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
|
@ -0,0 +1,76 @@
|
|||
#!/bin/bash
|
||||
# Validation_don
|
||||
# Copyright 2022 Adrien Bourmault
|
||||
# Licence AGPL v3
|
||||
|
||||
set -e
|
||||
|
||||
#$1 = numero de don
|
||||
nom=$2
|
||||
statut=$3
|
||||
adresse=$4
|
||||
montant_declare=$5
|
||||
courriel=$6
|
||||
|
||||
PASSWORD=$(cat ~/.secret/gestion_api_password)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# RECUPERATION DONNEES
|
||||
requete=$(curl https://api666:$PASSWORD@gestion.a-lec.org/api/sql/ -s -d "SELECT * FROM acc_transactions tr INNER JOIN acc_transactions_lines l ON tr.id = l.id_transaction WHERE tr.notes = $1 and id_account = 469")
|
||||
|
||||
requete=$(echo -e $requete | tr -d "{}\"[] " | cut -c 10-1000)
|
||||
|
||||
if [ -z "$requete" ]
|
||||
then
|
||||
echo " DON NON REGLE !"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
IFS="," read -a results <<< $requete
|
||||
|
||||
notes=$(echo ${results[4]} | cut -d ":" -f 2)
|
||||
reference=$(echo ${results[5]} | cut -d ":" -f 2)
|
||||
date=$(echo ${results[6]} | cut -d ":" -f 2)
|
||||
montant=$(echo ${results[15]} | cut -d ":" -f 2)
|
||||
montant=${montant::-2},${montant: -2:2}
|
||||
|
||||
# GENERATION
|
||||
|
||||
if [ "$reference" = "null" ]
|
||||
then
|
||||
echo " PAIEMENT INVALIDE !"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
forme="Déclaration de don manuel"
|
||||
nature="Numéraire"
|
||||
siren="null"
|
||||
|
||||
echo "Nom ou dénomination: $nom"
|
||||
echo "SIREN: $siren"
|
||||
echo "Statut: $statut"
|
||||
echo "Adresse: $adresse"
|
||||
echo "Somme: $montant €" #OK
|
||||
echo "Date de versement: $date" #OK
|
||||
echo "Forme: $forme" #OK
|
||||
echo "Nature: $nature" #OK
|
||||
echo "Mode de versement: $reference" #OK
|
||||
echo "Numéro du don lié: $notes" #OK
|
||||
|
||||
if [ "$siren" = "null" ]
|
||||
then
|
||||
./generer_don.sh "$nom" "$statut" "$adresse" "$montant" "$date" "$forme" "$nature" "$reference" > /dev/null
|
||||
else
|
||||
./generer_don.sh "$nom (SIREN $siren)" "$statut" "$adresse" "$montant" "$date" "$forme" "$nature" "$reference" > /dev/null
|
||||
fi
|
||||
|
||||
FILE=$(echo "$nom" | tr " " "_")_reçu_don_$(echo "$date" | tr "/" ".").pdf
|
||||
DATE_VERSEMENT=$(date -d"$date" +%d/%m/%Y)
|
||||
|
||||
# ENVOI
|
||||
(cat mail_don.txt | sed "s|DATE-DON|$(echo "$date" | tr "/" "-")|g" | sed "s/COURRIEL-DON/$courriel/g" ; base64 "$FILE"; echo "--------------3yxkFgv0AINs5nd0i6BJrWaV--") | /usr/sbin/sendmail -i -- "$courriel" tresorier@a-lec.org > /dev/null
|
||||
|
||||
mv $FILE /srv/validation_don.d
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue