contao / core-bundle

[READ-ONLY] Contao Core Bundle
GNU Lesser General Public License v3.0
123 stars 58 forks source link

Backend DCA filter dropdown/select options overwritten - can't have 2 options with the same label #1727

Closed rhymeadam closed 1 year ago

rhymeadam commented 1 year ago

Hi all, I'm running into an issue where a DCA filter of mine is based on a field with a foreign key to tl_member. I noticed that if 2 or more of the members have the exact same first and last name, the code overwrites the first occurences with the last option. I adjusted this line of code to include the $kk variable and it seems to work as intended.

$options_sorter[$option_label . '_' . $field . '_' . $kk] = ' <option value="' . StringUtil::specialchars($value) . '"' . ((isset($session['filter'][$filter][$field]) && $value == $session['filter'][$filter][$field]) ? ' selected="selected"' : '') . '>' . StringUtil::specialchars($option_label) . '</option>';

https://github.com/contao/core-bundle/blob/e548fe395542a3265a7468a1d2f472cbc00eaf58/contao/drivers/DC_Table.php#L6265

github-actions[bot] commented 1 year ago

Thank you for your contribution.

Unfortunately, you have created your issue in the wrong repository, as this is a read-only split repository. Please go to https://github.com/contao/contao and create your issue there.