Améliore check min/max dans anciens formulaires

This commit is contained in:
Emmanuel Viennet 2022-01-31 22:53:11 +01:00
parent 0d97d5bfc6
commit 81366e6569

View File

@ -276,14 +276,24 @@ class TF(object):
) )
ok = 0 ok = 0
if typ[:3] == "int" or typ == "float" or typ == "real": if typ[:3] == "int" or typ == "float" or typ == "real":
if "min_value" in descr and val < descr["min_value"]: if (
val != ""
and val != None
and "min_value" in descr
and val < descr["min_value"]
):
msg.append( msg.append(
"La valeur (%d) du champ '%s' est trop petite (min=%s)" "La valeur (%d) du champ '%s' est trop petite (min=%s)"
% (val, field, descr["min_value"]) % (val, field, descr["min_value"])
) )
ok = 0 ok = 0
if "max_value" in descr and val > descr["max_value"]: if (
val != ""
and val != None
and "max_value" in descr
and val > descr["max_value"]
):
msg.append( msg.append(
"La valeur (%s) du champ '%s' est trop grande (max=%s)" "La valeur (%s) du champ '%s' est trop grande (max=%s)"
% (val, field, descr["max_value"]) % (val, field, descr["max_value"])