Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
webform_booking
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
webform_booking
Commits
5e59574e
Commit
5e59574e
authored
11 months ago
by
Ricardo Marcelino
Browse files
Options
Downloads
Patches
Plain Diff
#3427811
- Days in advance
parent
502897a6
Branches
main
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Controller/WebformBookingController.php
+8
-0
8 additions, 0 deletions
src/Controller/WebformBookingController.php
src/Plugin/WebformElement/WebformBooking.php
+8
-1
8 additions, 1 deletion
src/Plugin/WebformElement/WebformBooking.php
with
16 additions
and
1 deletion
src/Controller/WebformBookingController.php
+
8
−
0
View file @
5e59574e
...
...
@@ -52,6 +52,14 @@ class WebformBookingController extends ControllerBase {
$actualEndDate
=
$endDate
<
$endOfMonth
?
$endDate
:
$endOfMonth
;
$actualEndDate
->
modify
(
'+1 day'
);
// Adjusting end date based on 'days_advance' if set.
if
(
isset
(
$config
[
'#days_advance'
])
&&
is_numeric
(
$config
[
'#days_advance'
]))
{
$advanceDate
=
(
new
\DateTime
())
->
modify
(
'+'
.
$config
[
'#days_advance'
]
.
' days'
);
if
(
$actualStartDate
<
$advanceDate
)
{
$actualStartDate
=
$advanceDate
;
}
}
// Interval of 1 day.
$interval
=
new
\DateInterval
(
'P1D'
);
$dateRange
=
new
\DatePeriod
(
$actualStartDate
,
$interval
,
$actualEndDate
);
...
...
This diff is collapsed.
Click to expand it.
src/Plugin/WebformElement/WebformBooking.php
+
8
−
1
View file @
5e59574e
...
...
@@ -33,6 +33,7 @@ class WebformBooking extends WebformElementBase {
'start_date'
=>
''
,
'end_date'
=>
''
,
'exclusion_dates'
=>
''
,
'days_advance'
=>
'0'
,
'excluded_weekdays'
=>
[],
'time_interval'
=>
''
,
'slot_duration'
=>
''
,
...
...
@@ -77,7 +78,13 @@ class WebformBooking extends WebformElementBase {
'#title'
=>
$this
->
t
(
'End Date'
),
'#default_value'
=>
$this
->
getDefaultProperty
(
'end_date'
),
];
// Days in advance.
$form
[
'appointment_settings'
][
'days_advance'
]
=
[
'#type'
=>
'number'
,
'#title'
=>
$this
->
t
(
'Days in Advance'
),
'#default_value'
=>
$this
->
getDefaultProperty
(
'days_advance'
),
'#description'
=>
$this
->
t
(
'Number of days in advance a booking can be made'
),
];
// Exclusion Dates.
$form
[
'appointment_settings'
][
'exclusion_dates'
]
=
[
'#type'
=>
'textarea'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment