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
+12
-10
@@ -53,12 +53,13 @@ async def preview_transaccion(
|
||||
if not ok:
|
||||
return JSONResponse({"success": False, "message": f"Error Firebird: {msg}"})
|
||||
|
||||
if ":num_factura" in q["query_text"] and not factura:
|
||||
fb.disconnect()
|
||||
return JSONResponse({"success": False, "message": "Ingresa el número de factura"})
|
||||
|
||||
params = {"fecha_ini": fecha_inicio, "fecha_fin": fecha_fin}
|
||||
if ":num_factura" in q["query_text"] and factura:
|
||||
params["num_factura"] = factura
|
||||
prefijo = configs.get("api_prefijo", "")
|
||||
if prefijo:
|
||||
params["prefijo"] = prefijo
|
||||
if ":num_factura" in q["query_text"]:
|
||||
params["num_factura"] = int(factura) if factura.isdigit() else factura
|
||||
|
||||
success, error, rows = fb.execute_query(q["query_text"], params)
|
||||
fb.disconnect()
|
||||
@@ -101,12 +102,13 @@ async def send_transaccion(
|
||||
if not ok:
|
||||
return JSONResponse({"success": False, "message": f"Error Firebird: {msg}"})
|
||||
|
||||
if ":num_factura" in q["query_text"] and not factura:
|
||||
fb.disconnect()
|
||||
return JSONResponse({"success": False, "message": "Ingresa el número de factura"})
|
||||
|
||||
params = {"fecha_ini": fecha_inicio, "fecha_fin": fecha_fin}
|
||||
if ":num_factura" in q["query_text"] and factura:
|
||||
params["num_factura"] = factura
|
||||
prefijo = configs.get("api_prefijo", "")
|
||||
if prefijo:
|
||||
params["prefijo"] = prefijo
|
||||
if ":num_factura" in q["query_text"]:
|
||||
params["num_factura"] = int(factura) if factura.isdigit() else factura
|
||||
|
||||
success, error, rows = fb.execute_query(q["query_text"], params)
|
||||
fb.disconnect()
|
||||
|
||||
Reference in New Issue
Block a user