Skip to content

Commit

Permalink
bugfix: using &phone in URL generated SQL error on postgres 15
Browse files Browse the repository at this point in the history
  • Loading branch information
interduo committed Jun 18, 2023
1 parent cb83f45 commit 0766849
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions contrib/tele.centrum.v2/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0766849

Please sign in to comment.