fix(main): validate specialty exists, fix double-escaped title filter
This commit is contained in:
@@ -78,7 +78,7 @@ class CustomerSpecialtyQueryBuilder extends AbstractDoctrineQueryBuilder
|
|||||||
switch ($filterName) {
|
switch ($filterName) {
|
||||||
case 'title':
|
case 'title':
|
||||||
$queryBuilder->andWhere('csl.title LIKE :title')
|
$queryBuilder->andWhere('csl.title LIKE :title')
|
||||||
->setParameter('title', '%' . pSQL($filterValue) . '%');
|
->setParameter('title', '%' . $filterValue . '%');
|
||||||
break;
|
break;
|
||||||
case 'active':
|
case 'active':
|
||||||
$queryBuilder->andWhere('cs.active = :active')
|
$queryBuilder->andWhere('cs.active = :active')
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ trait DisplayHooks
|
|||||||
$idCustomer = (int) $customer->id;
|
$idCustomer = (int) $customer->id;
|
||||||
$specialization = (int) Tools::getValue('specialization');
|
$specialization = (int) Tools::getValue('specialization');
|
||||||
|
|
||||||
if ($idCustomer <= 0 || $specialization <= 0) {
|
if ($idCustomer <= 0 || $specialization <= 0 || !$this->customerSpecialtyExists($specialization)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +108,14 @@ trait DisplayHooks
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function customerSpecialtyExists(int $idCustomerSpecialty): bool
|
||||||
|
{
|
||||||
|
return (bool) Db::getInstance()->getValue(
|
||||||
|
'SELECT `id_ws_customerspecialty` FROM `' . _DB_PREFIX_ . 'ws_customerspecialty`
|
||||||
|
WHERE `id_ws_customerspecialty` = ' . $idCustomerSpecialty . ' AND `active` = 1'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private function loadOrderCustomerSpecialization(int $idOrder): ?string
|
private function loadOrderCustomerSpecialization(int $idOrder): ?string
|
||||||
{
|
{
|
||||||
$idCustomer = (int) Db::getInstance()->getValue(
|
$idCustomer = (int) Db::getInstance()->getValue(
|
||||||
|
|||||||
Reference in New Issue
Block a user