fix database changes

This commit is contained in:
Tresorier de Libre en Communs 2024-09-16 16:35:41 +02:00
parent bf39e8a8b9
commit d651ad1dbb
1 changed files with 27 additions and 7 deletions

View File

@ -145,7 +145,7 @@ def sendmail_with_attachment(headers, data, attachment_path, filename):
def gestion_get_expired(): def gestion_get_expired():
request_expired = "SELECT id_user FROM services_users su " +\ request_expired = "SELECT id_user FROM services_users su " +\
"INNER JOIN membres m ON m.id = su.id_user " +\ "INNER JOIN users m ON m.id = su.id_user " +\
"INNER JOIN services s ON s.id = su.id_service " +\ "INNER JOIN services s ON s.id = su.id_service " +\
"LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\ "LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\
"INNER JOIN (SELECT id, MAX(date) " +\ "INNER JOIN (SELECT id, MAX(date) " +\
@ -165,7 +165,7 @@ def gestion_get_expired():
def gestion_get_unpaid(): def gestion_get_unpaid():
request_unpaid = "SELECT id_user FROM services_users su " +\ request_unpaid = "SELECT id_user FROM services_users su " +\
"INNER JOIN membres m ON m.id = su.id_user " +\ "INNER JOIN users m ON m.id = su.id_user " +\
"INNER JOIN services s ON s.id = su.id_service " +\ "INNER JOIN services s ON s.id = su.id_service " +\
"LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\ "LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\
"INNER JOIN (SELECT id, MAX(date) " +\ "INNER JOIN (SELECT id, MAX(date) " +\
@ -187,7 +187,7 @@ def gestion_get_unpaid():
def gestion_get_amount(member): def gestion_get_amount(member):
request_unpaid = "SELECT amount FROM services_users su " +\ request_unpaid = "SELECT amount FROM services_users su " +\
"INNER JOIN membres m ON m.id = su.id_user " +\ "INNER JOIN users m ON m.id = su.id_user " +\
"INNER JOIN services s ON s.id = su.id_service " +\ "INNER JOIN services s ON s.id = su.id_service " +\
"LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\ "LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\
"INNER JOIN (SELECT id, MAX(date) " +\ "INNER JOIN (SELECT id, MAX(date) " +\
@ -201,7 +201,7 @@ def gestion_get_amount(member):
def gestion_get_date(member): def gestion_get_date(member):
request_unpaid = "SELECT date FROM services_users su " +\ request_unpaid = "SELECT date FROM services_users su " +\
"INNER JOIN membres m ON m.id = su.id_user " +\ "INNER JOIN users m ON m.id = su.id_user " +\
"INNER JOIN services s ON s.id = su.id_service " +\ "INNER JOIN services s ON s.id = su.id_service " +\
"LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\ "LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\
"INNER JOIN (SELECT id, MAX(date) " +\ "INNER JOIN (SELECT id, MAX(date) " +\
@ -214,7 +214,7 @@ def gestion_get_date(member):
return gestion_read(request_unpaid)["results"][-1]["date"] return gestion_read(request_unpaid)["results"][-1]["date"]
def get_member_infos(member): def get_member_infos(member):
request = "SELECT * FROM membres " +\ request = "SELECT * FROM users " +\
"WHERE id = '{}';".format(member) "WHERE id = '{}';".format(member)
try: try:
name = gestion_read(request)['results'][-1]['nom'] name = gestion_read(request)['results'][-1]['nom']
@ -246,7 +246,27 @@ def check_email_created(member):
} }
answer2 = git_mail_ticket_read(request) answer2 = git_mail_ticket_read(request)
if len(answer1) + len(answer2) >= 1:
request = {
'state' : "closed",
'q' : "Inscription {}".format(numero)
}
answer3 = git_mail_ticket_read(request)
request = {
'state' : "closed",
'q' : "Adhésion {}".format(numero)
}
answer4 = git_mail_ticket_read(request)
request = {
'state' : "closed",
'q' : "Adhésion n° {}".format(numero)
}
answer4 = git_mail_ticket_read(request)
if len(answer1) + len(answer2) + len(answer3) + len(answer4) >= 1:
return True return True
return False return False
@ -383,7 +403,7 @@ def validate(member):
# Get infos # Get infos
request = "SELECT *, l.reference true_reference " +\ request = "SELECT *, l.reference true_reference " +\
"FROM services_users su " +\ "FROM services_users su " +\
"INNER JOIN membres m ON m.id = su.id_user " +\ "INNER JOIN users m ON m.id = su.id_user " +\
"INNER JOIN services_fees sf ON sf.id = su.id_fee " +\ "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_users tu ON tu.id_service_user = su.id " +\
"LEFT JOIN acc_transactions_lines l ON l.id_transaction = tu.id_transaction " +\ "LEFT JOIN acc_transactions_lines l ON l.id_transaction = tu.id_transaction " +\