Commit 990e879b authored by Adrien Simon's avatar Adrien Simon
Browse files

fixed ajouterVehicule

parent 3df81c40
......@@ -591,6 +591,23 @@ def reservationOccasionnel(conn, date, typeFournisseurPlace, typeVehicule, nomPa
def ajouterVehicule(conn):
proprio = int(input("Entrez l'adresse mail du propriétaire: "))
cur = conn.cursor()
sql = f"SELECT id FROM occasionnel WHERE compte = '{proprio}'"
cur.execute(sql)
raw = cur.fetchone()
if raw:
proprio_id = raw[0]
else:
sql = f"SELECT id FROM abonne WHERE compte = '{proprio}'"
cur.execute(sql)
raw = cur.fetchone()
if raw:
proprio_id = raw[0]
else:
print("Ce propriétaire n'existe pas")
return
immat = input("Entrez l'immatriculation du vehicule: ")
modele = input("Entrez le modele du vehicule: ")
marque = input("Entrez la marque du vehicule: ")
......@@ -607,9 +624,8 @@ def ajouterVehicule(conn):
type = "2 roues"
elif type == 3:
type = "camion"
proprio = int(input("Entrez l'id du propriétaire: "))
cur = conn.cursor()
sql = f"INSERT INTO vehicule ('{immat}','{modele}','{marque}','{type}','{proprio}')"
sql = f"INSERT INTO vehicule ('{immat}','{modele}','{marque}','{type}','{proprio_id}')"
cur.execute(sql)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment