From b2a42659b9391e74f2305db003d80d11ffabd220 Mon Sep 17 00:00:00 2001 From: Enrique Barcelli Date: Sun, 5 Dec 2021 12:31:55 +0800 Subject: [PATCH] Fix cabecera and other 1 dimension json being generated as arrays of 1 json. Standardize all to jsonb instead of json. FACTURADOR APP can now process the output of the query without manual editions to the json file. --- .../kikobar/intfactsunat/query-facturador.sql | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/org/openbravo/kikobar/intfactsunat/query-facturador.sql b/src/org/openbravo/kikobar/intfactsunat/query-facturador.sql index cb9ac01..c23ead7 100644 --- a/src/org/openbravo/kikobar/intfactsunat/query-facturador.sql +++ b/src/org/openbravo/kikobar/intfactsunat/query-facturador.sql @@ -62,7 +62,7 @@ ad_client.name ='BLB' select jsonb_build_object( - 'cabecera', json_agg(DISTINCT + 'cabecera', jsonb_agg(DISTINCT jsonb_build_object( 'ivoiceid',c_invoice_id, 'tipOperacion','0101', @@ -83,11 +83,11 @@ select 'ublVersionId','2.1', 'customizationId','2.0' ) - ) + )->0 ) || jsonb_build_object( - 'adicionalCabecera', json_agg(DISTINCT + 'adicionalCabecera', jsonb_agg(DISTINCT jsonb_build_object( 'invoiceid',c_invoice_id, 'codPaisCliente','PE', @@ -97,11 +97,11 @@ select 'codUbigeoEntrega','150140', 'desDireccionEntrega','AV. ANGAMOS 1111, SURCO, LIMA' ) - ) + )->0 ) || jsonb_build_object( - 'detalle', json_agg(DISTINCT + 'detalle', jsonb_agg(DISTINCT jsonb_build_object( 'invoiceline',c_invoiceline_id, 'codUnidadMedida','BX', @@ -150,7 +150,7 @@ select ) || jsonb_build_object( - 'adicionalDetalle','[]'::json + 'adicionalDetalle','[]'::jsonb ) || jsonb_build_object( @@ -175,11 +175,11 @@ select ) || jsonb_build_object( - 'relacionados','[]'::json + 'relacionados','[]'::jsonb ) || jsonb_build_object( - 'variablesGlobales','[]'::json + 'variablesGlobales','[]'::jsonb ) || jsonb_build_object( @@ -189,7 +189,7 @@ select 'mtoNetoPendientePago',grandtotal::varchar, 'tipMonedaMtoNetoPendientePago',iso_code ) - ) + )->0 ) || jsonb_build_object( @@ -210,7 +210,7 @@ select 'porRetencion','0.00', 'impRetencion','0.00' ) - ) + )->0 ) --*/