From 0766849cb98912f795f4f15f83a7fcaae3dde0b9 Mon Sep 17 00:00:00 2001 From: Jaroslaw Klopotek - INTERDUO Date: Sun, 18 Jun 2023 20:48:02 +0200 Subject: [PATCH] bugfix: using &phone in URL generated SQL error on postgres 15 --- contrib/tele.centrum.v2/index.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/contrib/tele.centrum.v2/index.php b/contrib/tele.centrum.v2/index.php index 85880acedb..97e98935fb 100644 --- a/contrib/tele.centrum.v2/index.php +++ b/contrib/tele.centrum.v2/index.php @@ -54,13 +54,16 @@ // get all customers with valid phone number if (!empty($phone)) { $result = $DB->GetAll( - 'SELECT c.id, cc.contact AS phone, address, city, deleted, - ' . $DB->Concat('UPPER(lastname)', "' '", 'c.name') . ' AS username + 'SELECT c.id, address, city, deleted, + ' . $DB->Concat('UPPER(lastname)', "' '", 'c.name') . ' AS username, + REPLACE(REPLACE(cc.contact, \'-\', \'\'), \' \', \'\') AS phone FROM customerview c - LEFT JOIN customercontacts cc ON cc.customerid = c.id - WHERE REPLACE(REPLACE(cc.contact, \'-\', \'\'), \' \', \'\') ?LIKE? ? + LEFT JOIN customercontacts cc ON cc.customerid = c.id + WHERE + REPLACE(REPLACE(cc.contact, \'-\', \'\'), \' \', \'\') ?LIKE? \'?\' AND c.deleted = 0 - ORDER BY deleted, username, cc.contact, address', + AND cc.type IN (' . CONTACT_MOBILE .', ' . CONTACT_LANDLINE . ') + ORDER BY username, cc.contact, address, deleted', array($phone) ); // prepare result to put in js