From c81ca94d2e5c8d7e1a5cb94e2d2da1c0f23dcdce Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 11 Dec 2023 14:44:33 +0100 Subject: [PATCH] refs #6220 add filter address --- modules/client/back/methods/client/filter.js | 56 +++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/modules/client/back/methods/client/filter.js b/modules/client/back/methods/client/filter.js index 47d5f6d2f..782d355ca 100644 --- a/modules/client/back/methods/client/filter.js +++ b/modules/client/back/methods/client/filter.js @@ -129,25 +129,43 @@ module.exports = Self => { const stmts = []; const stmt = new ParameterizedSQL( `SELECT - DISTINCT c.id, - c.name, - c.fi, - c.socialName, - c.phone, - c.mobile, - c.city, - c.postcode, - c.email, - c.isActive, - c.isFreezed, - p.id AS provinceFk, - p.name AS province, - u.id AS salesPersonFk, - u.name AS salesPerson - FROM client c - LEFT JOIN account.user u ON u.id = c.salesPersonFk - LEFT JOIN province p ON p.id = c.provinceFk - JOIN vn.address a ON a.clientFk = c.id + DISTINCT c.id, + c.name, + c.fi, + c.socialName, + c.phone, + c.mobile, + c.city, + c.postcode, + c.email, + c.isActive, + c.isFreezed, + p.id AS provinceFk, + p.name AS province, + u.id AS salesPersonFk, + u.name AS salesPerson, + a.street, + a.city AS addressCity, + a.provinceFk AS addressProvinceFk, + a.postalCode AS addressPostalCode, + a.phone AS addressPhone, + a.mobile AS addressMobile, + a.nickname, + a.isDefaultAddress, + a.agencyModeFk AS addressAgencyModeFk, + a.isActive AS addressIsActive, + a.longitude AS addressLongitude, + a.latitude AS addressLatitude, + a.isEqualizated, + a.customsAgentFk AS addressCustomsAgentFk, + a.incotermsFk AS addressIncotermsFk, + a.isLogifloraAllowed, + a.editorFk AS addressEditorFk + FROM client c + LEFT JOIN account.user u ON u.id = c.salesPersonFk + LEFT JOIN province p ON p.id = c.provinceFk + JOIN vn.address a ON a.clientFk = c.id; + ` );