Bug #16392
closedPage-TSconfig ###PAGE_TSCONFIG_STR### not evaluated correctly in Backend
100%
Description
A plugin on Web>Page, that is normally stored in tt_content, is configurable by a flexform. That flexform has a paragraph, using a select-type to get data from a foreign table.
The flexform-configuration on that is a bit special:
<config>
<type>select</type>
<foreign_table>tx_ohhotels_hotel</foreign_table>
<foreign_table_where>
AND pages.pid = ###PAGE_TSCONFIG_ID###
AND ('###PAGE_TSCONFIG_STR###' = '-' OR tx_ohhotels_hotel.exthotel REGEXP '(^|,)###PAGE_TSCONFIG_STR###(,|$)')
ORDER BY tx_ohhotels_hotel.title
</foreign_table_where>
<size>15</size>
<minitems>0</minitems>
<maxitems>500</maxitems>
</config>
And on Page-TSconfig we have:
TCEFORM.tt_content.pi_flexform.PAGE_TSCONFIG_ID = 474
TCEFORM.tt_content.pi_flexform.PAGE_TSCONFIG_STR = 1
If you have a look to the image attached, you can see, that the "Items" on the right side are shown correctly. But if chose some of the available items, save and reload the page, this selected items should be visible under "Selected:" - but here they are not!
To get more in detail, here are the performed SQL-queries (depending on the flexform-structure above):
1) This is a WRONG query, trying to get the selected-fields:
SELECT tx_ohhotels_hotel.uid,tx_ohhotels_hotel.title,tx_ohhotels_hotel.hidden
FROM tx_ohhotels_hotel,pages
WHERE pages.uid=tx_ohhotels_hotel.pid
AND pages.deleted=0 AND tx_ohhotels_hotel.deleted=0 AND 1=1
AND pages.pid = 0
AND ('' = '-' OR tx_ohhotels_hotel.exthotel REGEXP '(^|,)(,|$)')
ORDER BY tx_ohhotels_hotel.title
If you compare this query to the flexform-configuration, you can see, that the ###PAGE_TSCONFIG_STR### and ###PAGE_TSCONFIG_ID### are not correctly replaced by the configured values in Page-TSconfig.
2) And this is the correct query, used to get the items on the right side:
SELECT tx_ohhotels_hotel.uid,tx_ohhotels_hotel.title,tx_ohhotels_hotel.hidden
FROM tx_ohhotels_hotel,pages
WHERE pages.uid=tx_ohhotels_hotel.pid
AND pages.deleted=0 AND tx_ohhotels_hotel.deleted=0 AND 1=1
AND pages.pid = 474
AND ('1' = '-' OR tx_ohhotels_hotel.exthotel REGEXP '(^|,)1(,|$)')
ORDER BY tx_ohhotels_hotel.title
I think the queries for rendering the "Items:" and the "Selected:" part (as shown in the image) are composed differently. For "Selected:" the marker substituion is missing.
(issue imported from #M3906)
Files