Commit 4c7156a4 authored by Vincent Le gallic's avatar Vincent Le gallic

bugfix crédit carte bancaire

parent 6587da5f
......@@ -172,7 +172,7 @@ def get_photo(request, idbde=None):
@csrf_exempt
def do_credit_retrait(request, action):
types = {"especes": "Espèces", "cheque": "Chèque", "virement": "Virement bancaire"}
types = {"especes": "Espèces", "cheque": "Chèque", "virement": "Virement bancaire", "cb" : "Carte bancaire"}
actions_write = {"credit": "crédit", "retrait": "retrait"}
actions_socket = {"credit": "crediter", "retrait": "retirer"}
# On appelle la fonction standard
......@@ -183,8 +183,10 @@ def do_credit_retrait(request, action):
form = forms.CreditRetraitForm(request.POST, label_suffix=" :")
if form.is_valid():
data = form.cleaned_data
if data["type"] != "especes" and "" in [data["nom"], data["prenom"], data["banque"]]:
if (data["type"] in ["cheque", "virement"] and "" in [data["nom"], data["prenom"], data["banque"]]):
return HttpResponse("""Pour un %s par %s, les champs Nom, Prénom et Banque doivent être spécifiés.""" % (actions_write[action], types[data["type"]]))
if (data["type"] in ["cb"] and "" in [data["nom"], data["prenom"]]):
return HttpResponse("""Pour un %s par %s, les champs Nom et Prénom doivent être spécifiés.""" % (actions_write[action], types[data["type"]]))
to_send = [data["idbde"], data["montant"], data["type"],
{"nom": data["nom"], "prenom": data["prenom"], "banque": data["banque"], "commentaire" : data["commentaire"]}]
paquet = [actions_socket[action], to_send]
......
Markdown is supported
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