Summary
A new issue has been introduced between 4.1.5 and 4.1.8, and is also present on https://demo.orocrm.com/
When Applying a segment, query is not processed correctly.
[Semantical Error] line 0, col 1993 near 'filter__gpnpmultiEnum2': Error: 'filter__gpnpmultiEnum2' is already defined. in /var/www/orocrm/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:65
~My guess is the issue was introduced in b1516a322e2a1de326ebeea5874bbcdc6048337c~
UPDATE : Did some investigation and issue is caused by 7e6c6e3
/cc @AlexandrDmitriev
EDIT : Reformat for clarity
Steps to reproduce
1)
Edit any contact and set Contact Method Phone
2)
Create a segment Test SUB
3)
Create a segment Test WITH RESULTS BUT WRONG
OUTPUT :
4) Create a segment Test NO RESULTS
OUTPUT :
5) Create a segment Test WITHOUT SEGMENT
OUTPUT
[Semantical Error] line 0, col 1993 near 'filter__gpnpmultiEnum2': Error: 'filter__gpnpmultiEnum2' is already defined. in /var/www/orocrm/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:65
Actual Result
Test NO RESULTS
Getting grid data failed.
exception: "Doctrine\ORM\Query\QueryException:
QUERY :
SELECT
t1.id
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact t1
WHERE
t1.id IN(
SELECT
ts1443173037.id
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact ts1443173037
WHERE
ts1443173037 IN(
SELECT
filter__gpnpmultiEnum2
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact filter__gpnpmultiEnum2
INNER JOIN filter__gpnpmultiEnum2.myField filter__gpnpmultiEnum3_rel
WHERE
filter__gpnpmultiEnum3_rel IN(:_gpnpmultiEnum1)
) AND ts1443173037.id IN(
SELECT
ts1845229959.id
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact ts1845229959
WHERE
ts1845229959 NOT IN(
SELECT
filter__gpnpmultiEnum2
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact filter__gpnpmultiEnum2
INNER JOIN filter__gpnpmultiEnum2.myField filter__gpnpmultiEnum3_rel
WHERE
filter__gpnpmultiEnum3_rel IN(:_gpnpmultiEnum1)
)
)
)
in /var/www/orocrm/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:43
`Test WITH RESULTS BUT WRONG
A Contact is found BUT SHOULD NOT since NO contacts have Contact Method set at BOTHPhone and Email at the same time
Test WITHOUT SEGMENT
Ok, Good. No result shown as expected, and no error. All 3 segments should be identical
Expected Result
Order of OP when using AND operands should not mather, or produce error.
Summary
A new issue has been introduced between 4.1.5 and 4.1.8, and is also present on https://demo.orocrm.com/
When Applying a segment, query is not processed correctly.
~My guess is the issue was introduced in b1516a322e2a1de326ebeea5874bbcdc6048337c~
UPDATE : Did some investigation and issue is caused by 7e6c6e3
/cc @AlexandrDmitriev
EDIT : Reformat for clarity
Steps to reproduce
1) Edit any contact and set
Contact Method Phone
2) Create a segment
Test SUB
3) Create a segment
Test WITH RESULTS BUT WRONG
OUTPUT :
4) Create a segment
Test NO RESULTS
OUTPUT :
5) Create a segment
Test WITHOUT SEGMENT
OUTPUT
Actual Result
Test NO RESULTS
`Test WITH RESULTS BUT WRONG
A Contact is found BUT SHOULD NOT since NO contacts have Contact Method set at BOTH
Phone
andEmail
at the same timeTest WITHOUT SEGMENT
Ok, Good. No result shown as expected, and no error. All 3 segments should be identical
Expected Result
Order of OP when using AND operands should not mather, or produce error.
a AND b
should provide the same result asb AND a
Details about your environment