Skip to content

Commit

Permalink
Merge pull request #55 from qzminski/master
Browse files Browse the repository at this point in the history
Fix the problem with an empty dropdown menu when adding a new MCW row for repeat exceptions field
  • Loading branch information
kmielke authored Dec 21, 2021
2 parents 0cc0be4 + 6633473 commit 21e1d75
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Resources/contao/dca/tl_calendar_events.php
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@ public function setmaxperson($dc)
public function listMultiExceptions($var1)
{
$columnFields = null;
$activeRecord = $var1->activeRecord;

// arrays for the select fields
$arrSource1 = array();
Expand All @@ -1180,8 +1181,17 @@ public function listMultiExceptions($var1)
$arrSource4 = array();

if (\Input::get('id')) {
if ($var1->activeRecord->repeatDates) {
$arrDates = deserialize($var1->activeRecord->repeatDates);
// Probably an AJAX request where activeRecord is not available
if ($activeRecord === null) {
$activeRecord = \Database::getInstance()
->prepare("SELECT * FROM {$var1->strTable} WHERE id=?")
->limit(1)
->execute(\Input::get('id'))
;
}

if ($activeRecord->repeatDates) {
$arrDates = deserialize($activeRecord->repeatDates);
if (is_array($arrDates)) {
if ($var1->id == "repeatExceptions") {
// fill array for option date
Expand Down Expand Up @@ -1281,7 +1291,7 @@ public function listMultiExceptions($var1)
} // exceptions by interval
elseif ($var1->id == "repeatExceptionsInt") {
$firstField = array(
'label' => $GLOBALS['TL_LANG']['tl_calendar_events']['exceptionInt'] . $GLOBALS['TL_LANG']['DAYS'][$var1->activeRecord->weekday],
'label' => $GLOBALS['TL_LANG']['tl_calendar_events']['exceptionInt'] . $GLOBALS['TL_LANG']['DAYS'][$activeRecord->weekday],
'exclude' => true,
'inputType' => 'select',
'options' => array('first', 'second', 'third', 'fourth', 'fifth', 'last'),
Expand Down

0 comments on commit 21e1d75

Please sign in to comment.