Fix param validation errors and add TNS config section
- terceros/transaccion: return clear error when required params (doc_num, num_factura) are missing instead of passing empty dict to Firebird causing Column unknown error - transaccion: remove prefijo from 'por factura' query; parse num_factura as int when digit - automation: add /preview endpoint to show patient/reception counts before sending; update UI with preview step and disabled run button until preview loads - config: add TNS credentials section (tns_empresa, tns_usuario, tns_password, api_sucursal) with test-connection button - config: add POST /config/test-tns endpoint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3755a51562
commit
b4a7271d8d
+10
-2
@@ -79,8 +79,12 @@ async def preview_query(
|
||||
if not ok:
|
||||
return JSONResponse({"success": False, "message": f"Error Firebird: {msg}"})
|
||||
|
||||
if ":doc_num" in q["query_text"] and not doc_num:
|
||||
fb.disconnect()
|
||||
return JSONResponse({"success": False, "message": "Ingresa el número de documento para buscar el paciente"})
|
||||
|
||||
params = {}
|
||||
if ":doc_num" in q["query_text"] and doc_num:
|
||||
if ":doc_num" in q["query_text"]:
|
||||
params["doc_num"] = doc_num
|
||||
if ":fecha_ini" in q["query_text"]:
|
||||
params["fecha_ini"] = "1900-01-01"
|
||||
@@ -124,9 +128,13 @@ async def send_terceros(
|
||||
if not ok:
|
||||
return JSONResponse({"success": False, "message": f"Error Firebird: {msg}"})
|
||||
|
||||
if ":doc_num" in q["query_text"] and not doc_num:
|
||||
fb.disconnect()
|
||||
return JSONResponse({"success": False, "message": "Ingresa el número de documento"})
|
||||
|
||||
params = {}
|
||||
if ":doc_num" in q["query_text"]:
|
||||
params["doc_num"] = doc_num or configs.get("doc_num_default", "")
|
||||
params["doc_num"] = doc_num
|
||||
|
||||
success, error, rows = fb.execute_query(q["query_text"], params if params else None)
|
||||
fb.disconnect()
|
||||
|
||||
Reference in New Issue
Block a user