diff --git a/contao/dca/tl_calendar.php b/contao/dca/tl_calendar.php index ef5b124..a2fea4e 100644 --- a/contao/dca/tl_calendar.php +++ b/contao/dca/tl_calendar.php @@ -18,8 +18,8 @@ PaletteManipulator::create() ->addLegend('booking_options_legend', 'title_legend', PaletteManipulator::POSITION_AFTER) ->addLegend('event_unsubscribe_legend', 'booking_options_legend', PaletteManipulator::POSITION_AFTER) - ->addField(['eventUnsubscribePage', 'calculateTotalFrom', 'eventUnsubscribeNotification', 'eventUnsubscribeNotificationSender'], 'event_unsubscribe_legend', PaletteManipulator::POSITION_APPEND) - ->addField(['allowDuplicateEmail', 'bookingState', 'addEscortsToTotal', 'waitingListLimit', 'eventBookingNotification', 'eventBookingNotificationSender'], 'booking_options_legend', PaletteManipulator::POSITION_APPEND) + ->addField(['eventUnsubscribePage', 'eventUnsubscribeNotification', 'eventUnsubscribeNotificationSender'], 'event_unsubscribe_legend', PaletteManipulator::POSITION_APPEND) + ->addField(['allowDuplicateEmail', 'bookingState', 'calculateTotalFrom', 'addEscortsToTotal', 'waitingListLimit', 'eventBookingNotification', 'eventBookingNotificationSender'], 'booking_options_legend', PaletteManipulator::POSITION_APPEND) ->applyToPalette('default', 'tl_calendar'); $GLOBALS['TL_DCA']['tl_calendar']['fields']['eventUnsubscribePage'] = [ @@ -36,88 +36,88 @@ 'inputType' => 'select', 'options' => [BookingState::STATE_NOT_CONFIRMED, BookingState::STATE_CONFIRMED, BookingState::STATE_UNDEFINED], 'reference' => &$GLOBALS['TL_LANG']['MSC'], - 'eval' => ['mandatory' => true, 'multiple' => true, 'chosen' => true], + 'eval' => ['mandatory' => true, 'multiple' => true, 'chosen' => true, 'tl_class' => 'clr w50'], 'sql' => "varchar(255) NOT NULL default '".serialize([BookingState::STATE_CONFIRMED])."'", ]; +// This field is used to override the twin input field in tl_calendar_events +$GLOBALS['TL_DCA']['tl_calendar']['fields']['addEscortsToTotal'] = [ + 'exclude' => true, + 'filter' => true, + 'inputType' => 'checkbox', + 'eval' => ['isBoolean' => true, 'tl_class' => 'w50 m12 override_event'], + 'sql' => "char(1) NOT NULL default ''", +]; + // This field is used to override the twin input field in tl_calendar_events $GLOBALS['TL_DCA']['tl_calendar']['fields']['allowDuplicateEmail'] = [ - 'eval' => ['isBoolean' => true, 'tl_class' => 'clr m12 override_event'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', + 'eval' => ['isBoolean' => true, 'tl_class' => 'clr m12 override_event'], 'sql' => "char(1) NOT NULL default ''", ]; // This field is used to override the twin input field in tl_calendar_events $GLOBALS['TL_DCA']['tl_calendar']['fields']['bookingState'] = [ - 'eval' => ['tl_class' => 'w50 override_event', 'mandatory' => true], 'filter' => true, 'inputType' => 'select', 'options' => BookingState::ALL, 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'search' => true, 'sorting' => true, + 'eval' => ['tl_class' => 'clr w50 override_event', 'mandatory' => true], 'sql' => "varchar(64) NOT NULL default '".BookingState::STATE_CONFIRMED."'", ]; -// This field is used to override the twin input field in tl_calendar_events -$GLOBALS['TL_DCA']['tl_calendar']['fields']['addEscortsToTotal'] = [ - 'eval' => ['isBoolean' => true, 'tl_class' => 'clr m12 override_event'], - 'exclude' => true, - 'filter' => true, - 'inputType' => 'checkbox', - 'sql' => "char(1) NOT NULL default ''", -]; - // This field is used to override the twin input field in tl_calendar_events $GLOBALS['TL_DCA']['tl_calendar']['fields']['waitingListLimit'] = [ - 'eval' => ['rgxp' => 'digit', 'tl_class' => 'clr w50 override_event'], 'exclude' => true, 'inputType' => 'text', + 'eval' => ['rgxp' => 'digit', 'tl_class' => 'clr w50 override_event'], 'sql' => "smallint(3) unsigned NOT NULL default '0'", ]; // This field is used to override the twin input field in tl_calendar_events $GLOBALS['TL_DCA']['tl_calendar']['fields']['eventBookingNotification'] = [ - 'eval' => ['mandatory' => false, 'includeBlankOption' => true, 'chosen' => true, 'multiple' => true, 'tl_class' => 'clr w50 override_event'], 'exclude' => true, 'foreignKey' => 'tl_nc_notification.title', 'inputType' => 'select', 'relation' => ['type' => 'hasOne', 'load' => 'lazy'], 'search' => true, + 'eval' => ['mandatory' => false, 'includeBlankOption' => true, 'chosen' => true, 'multiple' => true, 'tl_class' => 'clr w50 override_event'], 'sql' => 'blob NULL', ]; // This field is used to override the twin input field in tl_calendar_events $GLOBALS['TL_DCA']['tl_calendar']['fields']['eventBookingNotificationSender'] = [ - 'eval' => ['mandatory' => false, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50 override_event'], 'exclude' => true, 'foreignKey' => 'tl_user.name', 'inputType' => 'select', 'relation' => ['type' => 'hasOne', 'load' => 'lazy'], 'search' => true, + 'eval' => ['mandatory' => false, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50 override_event'], 'sql' => "int(10) unsigned NOT NULL default '0'", ]; // This field is used to override the twin input field in tl_calendar_events $GLOBALS['TL_DCA']['tl_calendar']['fields']['eventUnsubscribeNotification'] = [ - 'eval' => ['mandatory' => false, 'includeBlankOption' => true, 'chosen' => true, 'multiple' => true, 'tl_class' => 'clr w50 override_event'], 'exclude' => true, 'foreignKey' => 'tl_nc_notification.title', 'inputType' => 'select', 'relation' => ['type' => 'hasOne', 'load' => 'lazy'], 'search' => true, + 'eval' => ['mandatory' => false, 'includeBlankOption' => true, 'chosen' => true, 'multiple' => true, 'tl_class' => 'clr w50 override_event'], 'sql' => 'blob NULL', ]; // This field is used to override the twin input field in tl_calendar_events $GLOBALS['TL_DCA']['tl_calendar']['fields']['eventUnsubscribeNotificationSender'] = [ - 'eval' => ['mandatory' => false, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50 override_event'], 'exclude' => true, 'foreignKey' => 'tl_user.name', 'inputType' => 'select', 'relation' => ['type' => 'hasOne', 'load' => 'lazy'], 'search' => true, + 'eval' => ['mandatory' => false, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50 override_event'], 'sql' => "int(10) unsigned NOT NULL default '0'", ]; diff --git a/contao/dca/tl_calendar_events.php b/contao/dca/tl_calendar_events.php index b20f913..b5ea3eb 100644 --- a/contao/dca/tl_calendar_events.php +++ b/contao/dca/tl_calendar_events.php @@ -36,7 +36,7 @@ $GLOBALS['TL_DCA']['tl_calendar_events']['palettes']['__selector__'][] = 'activateUnsubscribeNotification'; // Subpalettes -$GLOBALS['TL_DCA']['tl_calendar_events']['subpalettes']['enableBookingForm'] = 'overrideByParent,minMembers,maxMembers,maxEscortsPerMember,addEscortsToTotal,bookingStartDate,bookingEndDate,allowDuplicateEmail,bookingState,,activateWaitingList,activateBookingNotification,activateDeregistration'; +$GLOBALS['TL_DCA']['tl_calendar_events']['subpalettes']['enableBookingForm'] = 'inheritFromCal,minMembers,maxMembers,maxEscortsPerMember,addEscortsToTotal,bookingStartDate,bookingEndDate,allowDuplicateEmail,bookingState,activateWaitingList,activateBookingNotification,activateDeregistration'; $GLOBALS['TL_DCA']['tl_calendar_events']['subpalettes']['activateWaitingList'] = 'waitingListLimit'; $GLOBALS['TL_DCA']['tl_calendar_events']['subpalettes']['activateBookingNotification'] = 'eventBookingNotification,eventBookingNotificationSender'; $GLOBALS['TL_DCA']['tl_calendar_events']['subpalettes']['activateDeregistration'] = 'unsubscribeLimit,unsubscribeLimitTstamp,activateUnsubscribeNotification'; @@ -87,7 +87,7 @@ 'sql' => "char(1) NOT NULL default ''", ]; -$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['overrideByParent'] = [ +$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['inheritFromCal'] = [ 'eval' => ['submitOnChange' => true, 'isBoolean' => true, 'tl_class' => 'clr m12'], 'exclude' => true, 'filter' => true, @@ -96,7 +96,7 @@ ]; $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['allowDuplicateEmail'] = [ - 'eval' => ['allowOverrideByParent' => true, 'isBoolean' => true, 'tl_class' => 'clr m12'], + 'eval' => ['inheritFromCal' => true, 'isBoolean' => true, 'tl_class' => 'clr m12'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', @@ -104,7 +104,7 @@ ]; $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['bookingState'] = [ - 'eval' => ['allowOverrideByParent' => true, 'tl_class' => 'w50', 'mandatory' => true], + 'eval' => ['inheritFromCal' => true, 'tl_class' => 'w50', 'mandatory' => true], 'filter' => true, 'inputType' => 'select', 'options' => BookingState::ALL, @@ -158,7 +158,7 @@ ]; $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['addEscortsToTotal'] = [ - 'eval' => ['allowOverrideByParent' => true, 'isBoolean' => true, 'tl_class' => 'clr m12'], + 'eval' => ['inheritFromCal' => true, 'isBoolean' => true, 'tl_class' => 'clr m12'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', @@ -173,7 +173,7 @@ ]; $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['waitingListLimit'] = [ - 'eval' => ['allowOverrideByParent' => true, 'rgxp' => 'digit', 'tl_class' => 'clr w50'], + 'eval' => ['inheritFromCal' => true, 'rgxp' => 'digit', 'tl_class' => 'clr w50'], 'exclude' => true, 'inputType' => 'text', 'sql' => "smallint(3) unsigned NOT NULL default '0'", @@ -188,7 +188,7 @@ ]; $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['eventBookingNotification'] = [ - 'eval' => ['allowOverrideByParent' => true, 'mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'multiple' => true, 'tl_class' => 'clr w50'], + 'eval' => ['inheritFromCal' => true, 'mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'multiple' => true, 'tl_class' => 'clr w50'], 'exclude' => true, 'foreignKey' => 'tl_nc_notification.title', 'inputType' => 'select', @@ -198,7 +198,7 @@ ]; $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['eventBookingNotificationSender'] = [ - 'eval' => ['allowOverrideByParent' => true, 'mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'], + 'eval' => ['inheritFromCal' => true, 'mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'], 'exclude' => true, 'foreignKey' => 'tl_user.name', 'inputType' => 'select', @@ -243,7 +243,7 @@ ]; $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['eventUnsubscribeNotification'] = [ - 'eval' => ['allowOverrideByParent' => true, 'mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'multiple' => true, 'tl_class' => 'clr w50'], + 'eval' => ['inheritFromCal' => true, 'mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'multiple' => true, 'tl_class' => 'clr w50'], 'exclude' => true, 'foreignKey' => 'tl_nc_notification.title', 'inputType' => 'select', @@ -253,7 +253,7 @@ ]; $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['eventUnsubscribeNotificationSender'] = [ - 'eval' => ['allowOverrideByParent' => true, 'mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'], + 'eval' => ['inheritFromCal' => true, 'mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'], 'exclude' => true, 'foreignKey' => 'tl_user.name', 'inputType' => 'select', diff --git a/contao/languages/de/tl_calendar_events.xlf b/contao/languages/de/tl_calendar_events.xlf index 5d26cb7..a4c1a2e 100644 --- a/contao/languages/de/tl_calendar_events.xlf +++ b/contao/languages/de/tl_calendar_events.xlf @@ -10,11 +10,11 @@ Booking settings Buchungseinstellungen - + Inherit booking settings from calendar Buchungseinstellungen von Kalender erben - + Inherit booking settings from parent calendar. Buchungseinstellungen vom übergeordneten Kalender erben. diff --git a/contao/languages/en/tl_calendar_events.php b/contao/languages/en/tl_calendar_events.php index 8d92bb3..2b5336f 100644 --- a/contao/languages/en/tl_calendar_events.php +++ b/contao/languages/en/tl_calendar_events.php @@ -19,7 +19,7 @@ $GLOBALS['TL_LANG']['tl_calendar_events']['booking_options_legend'] = 'Booking settings'; // Fields -$GLOBALS['TL_LANG']['tl_calendar_events']['overrideByParent'] = ['Inherit booking settings from calendar', 'Inherit booking settings from parent calendar.']; +$GLOBALS['TL_LANG']['tl_calendar_events']['inheritFromCal'] = ['Inherit booking settings from calendar', 'Inherit booking settings from parent calendar.']; $GLOBALS['TL_LANG']['tl_calendar_events']['street'] = ['Street', 'Please add the street.']; $GLOBALS['TL_LANG']['tl_calendar_events']['postal'] = ['PLZ', 'Please add the postal code.']; $GLOBALS['TL_LANG']['tl_calendar_events']['city'] = ['Ort', 'Please add the city.']; diff --git a/contao/languages/en/tl_calendar_events.xlf b/contao/languages/en/tl_calendar_events.xlf index 08f223c..83b5e38 100644 --- a/contao/languages/en/tl_calendar_events.xlf +++ b/contao/languages/en/tl_calendar_events.xlf @@ -8,10 +8,10 @@ Booking settings - + Inherit booking settings from calendar - + Inherit booking settings from parent calendar. diff --git a/src/DataContainer/CalendarEvents.php b/src/DataContainer/CalendarEvents.php index d754ff6..17462c8 100644 --- a/src/DataContainer/CalendarEvents.php +++ b/src/DataContainer/CalendarEvents.php @@ -67,16 +67,16 @@ public function adjustSubPalettes(DataContainer $dc): void { $arrRemove = []; - $overrideByParent = (bool) $this->connection->fetchOne('SELECT overrideByParent FROM tl_calendar_events WHERE id = ?', [$dc->id]); + $inheritFromCal = (bool) $this->connection->fetchOne('SELECT inheritFromCal FROM tl_calendar_events WHERE id = ?', [$dc->id]); - if ($overrideByParent) { + if ($inheritFromCal) { $this->controller->loadDataContainer('tl_calendar_events'); $arrFields = array_keys($GLOBALS['TL_DCA']['tl_calendar_events']['fields']); foreach ($arrFields as $fieldName) { - $allowOverriding = $GLOBALS['TL_DCA']['tl_calendar_events']['fields'][$fieldName]['eval']['allowOverrideByParent'] ?? false; + $inheritFromCal = $GLOBALS['TL_DCA']['tl_calendar_events']['fields'][$fieldName]['eval']['inheritFromCal'] ?? false; - if (true === $allowOverriding) { + if (true === $inheritFromCal) { $arrRemove[] = $fieldName; } } diff --git a/src/EventBooking/Config/EventConfig.php b/src/EventBooking/Config/EventConfig.php index 0d57e4e..912cbc7 100644 --- a/src/EventBooking/Config/EventConfig.php +++ b/src/EventBooking/Config/EventConfig.php @@ -82,9 +82,9 @@ public function get(string $propertyName): mixed $arrEventFields = $GLOBALS['TL_DCA']['tl_calendar_events']['fields'] ?? []; $arrCalFields = $GLOBALS['TL_DCA']['tl_calendar']['fields'] ?? []; - $allowOverriding = $arrEventFields[$propertyName]['eval']['allowOverrideByParent'] ?? false; + $inheritFromCal = $arrEventFields[$propertyName]['eval']['inheritFromCal'] ?? false; - if (true === $allowOverriding && !empty($arrCalFields[$propertyName])) { + if (true === $inheritFromCal && !empty($arrCalFields[$propertyName])) { $calendar = CalendarModel::findByPk($this->get('pid')); if (null !== $calendar) {