Skip to content

Commit

Permalink
Complete rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
markocupic committed Jun 2, 2024
1 parent 9ae85b0 commit 437f242
Show file tree
Hide file tree
Showing 170 changed files with 8,708 additions and 3,737 deletions.
232 changes: 106 additions & 126 deletions README.md

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# API changes

## Version 5.* to 6.0

### Notification Center Tokens

The following Notification Center Tokens have been renamed:

| old | new |
|------------------------------|------------------------------|
| `member_unsubscribeHref` | `cancelRegistrationUrl` |
| `event_city` | `event_location` |
| `event_enableDeregistration` | `event_enableUnsubscription` |

### Event Booking Module

The booking module has been completely revised and now works with checkout steps.
The partial templates of each step can be customized,
but must be registered in 'config/config.yaml`. More about this in the README.md.

### Database changes

The registration table has been renamed from `tl_calendar_events_member` to `tl_cebb_registration`
In addition, two tables have been added: `tl_cebb_order` and `tl_cebb_cart`

### `tl_cebb_registration.escorts`

Accompanying persons are no longer counted to the total number of participants.

### New field `tl_cebb_registration.quantity`

A new `quantity` field has been added to `tl_cebb_registration` so that multiple tickets can be purchased during registration.
If the `quantity` field is not displayed in the booking form, the field value is automatically set to 1 during the booking process.
**Important! The value of `quantity` is added to the total number of participants.**

| table | column name old | column name new |
|------------------------|-------------------------------------|-----------------------------|
| `tl_calendar_events` | `enableNotificationCenter` | `enableBookingNotification` |
| `tl_calendar_events` | `addBookingForm` | `enableBookingForm` |
| `tl_calendar_events` | `enableDeregistration` | `enableUnsubscription` |
| `tl_calendar_events` | `eventBookingNotificationCenterIds` | `eventBookingNotification` |
| `tl_calendar_events` | `enableMultiBookingWithSameAddress` | `allowDuplicateEmail` |
| `tl_cebb_registration` | `addedOn` | `dateAdded` |
| `tl_cebb_registration` | `regToken` | `uuid` |



15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
{
"name": "markocupic/calendar-event-booking-bundle",
"type": "contao-bundle",
"description": "Contao 4 Calendar Event Booking Bundle",
"description": "Calendar Event Booking extension for Contao CMS",
"license": "MIT",
"authors": [
{
"name": "Marko Cupic",
"homepage": "https://github.com/markocupic"
"homepage": "https://github.com/markocupic/calendar-event-booking-bundle"
}
],
"require": {
"php": "^8.1",
"contao/core-bundle": "^4.13",
"contao/calendar-bundle": "^4.13",
"php": "^8.2",
"contao/core-bundle": "^5.3",
"contao/calendar-bundle": "^5.3",
"markocupic/export_table": "^5.0",
"ramsey/uuid": "^3.0 || ^4.0",
"codefog/contao-haste": "^5.0",
"terminal42/notification_center": "^1.5"
"terminal42/notification_center": "^2.0"
},
"require-dev": {
"contao/easy-coding-standard": "^6.0"
},
"autoload": {
"psr-4": {
Expand Down
13 changes: 13 additions & 0 deletions config/checkout/checkout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
markocupic_calendar_event_booking:
checkout_manager_factory: default
checkout:
default:
steps:
subscription:
step: 'Markocupic\CalendarEventBookingBundle\Checkout\Step\SubscriptionStep'
template: '@Contao_MarkocupicCalendarEventBookingBundle/checkout_step_subscription.html.twig'
priority: 100
finalisation:
step: 'Markocupic\CalendarEventBookingBundle\Checkout\Step\FinalisationStep'
template: '@Contao_MarkocupicCalendarEventBookingBundle/checkout_step_finalisation.html.twig'
priority: 90
2 changes: 2 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: checkout/checkout.yaml }
19 changes: 14 additions & 5 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@ services:
public: false
bind:
$projectDir: '%kernel.project_dir%'
$checkout: '%markocupic_calendar_event_booking.checkout%'

Markocupic\CalendarEventBookingBundle\:
resource: ../src/
exclude: [
'../src/{Event,Model,DependencyInjection}',
'../src/EventBooking/Config/EventConfig.php'
'../src/{Event,Storage,Model,DependencyInjection}',
'../src/Checkout/Exception/CheckoutException.php',
'../src/Checkout/Exception/CheckoutException.php',
'../src/Checkout/Step/CheckoutManager.php',
'../src/Checkout/Step/DefaultCheckoutManagerFactory.php',
'../src/Checkout/CheckoutManagerFactoryCollection.php',
'../src/EventBooking/Config/EventConfig.php',
'../src/Registry/ExistingServiceException.php',
'../src/Registry/NonExistingServiceException.php',
'../src/Registry/PrioritizedServiceRegistry.php',
'../src/Registry/ServiceRegistry.php',
]

Markocupic\CalendarEventBookingBundle\DataContainer\DcaUtil:
public: true

Markocupic\CalendarEventBookingBundle\Checkout\CheckoutManagerFactoryCollection:
arguments: [ !tagged_iterator { tag: 'markocupic_calendar_event_booking.checkout_manager_factory', index_by: 'key' } ]
48 changes: 13 additions & 35 deletions contao/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,29 @@
/*
* This file is part of Calendar Event Booking Bundle.
*
* (c) Marko Cupic 2023 <[email protected]>
* (c) Marko Cupic 2024 <[email protected]>
* @license MIT
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/markocupic/calendar-event-booking-bundle
*/

use Markocupic\CalendarEventBookingBundle\Model\CalendarEventsMemberModel;
use Markocupic\CalendarEventBookingBundle\Model\CebbCartModel;
use Markocupic\CalendarEventBookingBundle\Model\CebbOrderModel;
use Markocupic\CalendarEventBookingBundle\Model\CebbPaymentModel;
use Markocupic\CalendarEventBookingBundle\Model\CebbRegistrationModel;

/*
* Backend modules
*/
$GLOBALS['BE_MOD']['content']['calendar']['tables'][] = 'tl_calendar_events_member';

$GLOBALS['BE_MOD']['content']['calendar']['tables'][] = 'tl_cebb_registration';
$GLOBALS['BE_MOD']['content']['calendar']['tables'][] = 'tl_cebb_order';
$GLOBALS['BE_MOD']['content']['calendar']['tables'][] = 'tl_cebb_cart';
$GLOBALS['BE_MOD']['content']['calendar']['tables'][] = 'tl_cebb_payment';
/*
* Contao models
*/
$GLOBALS['TL_MODELS']['tl_calendar_events_member'] = CalendarEventsMemberModel::class;

/*
* Notification center
*/
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['calendar-event-booking-bundle'] = [
'booking-notification' => [
'email_sender_name' => ['sender_name'],
'email_sender_address' => ['sender_email', 'admin_email'],
'recipients' => ['sender_email', 'member_email', 'admin_email'],
'email_recipient_cc' => ['sender_email', 'member_email', 'admin_email'],
'email_recipient_bcc' => ['sender_email', 'member_email', 'admin_email'],
'email_replyTo' => ['sender_email', 'member_email', 'admin_email'],
'email_subject' => ['event_*', 'event_title', 'event_unsubscribeLimitTstamp', 'member_*', 'member_dateOfBirth', 'member_salutation', 'member_unsubscribeHref', 'sender_*', 'sender_name', 'sender_email', 'admin_email'],
'email_text' => ['event_*', 'event_title', 'event_unsubscribeLimitTstamp', 'member_*', 'member_dateOfBirth', 'member_salutation', 'member_unsubscribeHref', 'sender_*', 'sender_name', 'sender_email', 'admin_email'],
'email_html' => ['event_*', 'event_title', 'event_unsubscribeLimitTstamp', 'member_*', 'member_dateOfBirth', 'member_salutation', 'member_unsubscribeHref', 'sender_*', 'sender_name', 'sender_email', 'admin_email'],
'attachment_tokens' => [],
],
'event-unsubscribe-notification' => [
'email_sender_name' => ['sender_name'],
'email_sender_address' => ['sender_email', 'admin_email'],
'recipients' => ['sender_email', 'member_email', 'admin_email'],
'email_recipient_cc' => ['sender_email', 'member_email', 'admin_email'],
'email_recipient_bcc' => ['sender_email', 'member_email', 'admin_email'],
'email_replyTo' => ['sender_email', 'member_email', 'admin_email'],
'email_subject' => ['event_*', 'event_title', 'event_unsubscribeLimitTstamp', 'member_*', 'member_dateOfBirth', 'member_salutation', 'member_unsubscribeHref', 'sender_*', 'sender_name', 'sender_email', 'admin_email'],
'email_text' => ['event_*', 'event_title', 'event_unsubscribeLimitTstamp', 'member_*', 'member_dateOfBirth', 'member_salutation', 'member_unsubscribeHref', 'sender_*', 'sender_name', 'sender_email', 'admin_email'],
'email_html' => ['event_*', 'event_title', 'event_unsubscribeLimitTstamp', 'member_*', 'member_dateOfBirth', 'member_salutation', 'member_unsubscribeHref', 'sender_*', 'sender_name', 'sender_email', 'admin_email'],
'attachment_tokens' => [],
],
];
$GLOBALS['TL_MODELS']['tl_cebb_cart'] = CebbCartModel::class;
$GLOBALS['TL_MODELS']['tl_cebb_order'] = CebbOrderModel::class;
$GLOBALS['TL_MODELS']['tl_cebb_payment'] = CebbPaymentModel::class;
$GLOBALS['TL_MODELS']['tl_cebb_registration'] = CebbRegistrationModel::class;
92 changes: 4 additions & 88 deletions contao/dca/tl_calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/*
* This file is part of Calendar Event Booking Bundle.
*
* (c) Marko Cupic 2023 <[email protected]>
* (c) Marko Cupic 2024 <[email protected]>
* @license MIT
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
Expand All @@ -16,10 +16,8 @@
use Markocupic\CalendarEventBookingBundle\EventBooking\Booking\BookingState;

PaletteManipulator::create()
->addLegend('booking_options_legend', 'title_legend', PaletteManipulator::POSITION_AFTER)
->addLegend('event_unsubscribe_legend', 'booking_options_legend', PaletteManipulator::POSITION_AFTER)
->addField(['eventUnsubscribePage', 'eventUnsubscribeNotification', 'eventUnsubscribeNotificationSender'], 'event_unsubscribe_legend', PaletteManipulator::POSITION_APPEND)
->addField(['allowDuplicateEmail', 'bookingState', 'calculateTotalFrom', 'addEscortsToTotal', 'waitingListLimit', 'eventBookingNotification', 'eventBookingNotificationSender'], 'booking_options_legend', PaletteManipulator::POSITION_APPEND)
->addField(['eventUnsubscribePage'], 'event_unsubscribe_legend', PaletteManipulator::POSITION_APPEND)
->addField(['calculateTotalFrom'], 'booking_options_legend', PaletteManipulator::POSITION_APPEND)
->applyToPalette('default', 'tl_calendar');

$GLOBALS['TL_DCA']['tl_calendar']['fields']['eventUnsubscribePage'] = [
Expand All @@ -34,90 +32,8 @@
$GLOBALS['TL_DCA']['tl_calendar']['fields']['calculateTotalFrom'] = [
'exclude' => true,
'inputType' => 'select',
'options' => [BookingState::STATE_NOT_CONFIRMED, BookingState::STATE_CONFIRMED, BookingState::STATE_UNDEFINED],
'options' => [BookingState::STATE_WAITING_FOR_PAYMENT, BookingState::STATE_NOT_CONFIRMED, BookingState::STATE_CONFIRMED, BookingState::STATE_UNDEFINED],
'reference' => &$GLOBALS['TL_LANG']['MSC'],
'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'] = [
'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'] = [
'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']['waitingListLimit'] = [
'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'] = [
'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'] = [
'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'] = [
'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'] = [
'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'",
];
Loading

0 comments on commit 437f242

Please sign in to comment.