Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
recurring_events-3244975
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
recurring_events-3244975
Commits
73a4c932
Commit
73a4c932
authored
4 years ago
by
Owen Bush
Committed by
Owen Bush
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3145454
by owenbush, the_glitch: Inline Entity Form stops Registrations from saving
parent
15d65cfb
No related branches found
Branches containing commit
Tags
2.0.0-beta3
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/recurring_events_registration/src/Form/RegistrantForm.php
+9
-25
9 additions, 25 deletions
...recurring_events_registration/src/Form/RegistrantForm.php
with
9 additions
and
25 deletions
modules/recurring_events_registration/src/Form/RegistrantForm.php
+
9
−
25
View file @
73a4c932
...
...
@@ -134,23 +134,13 @@ class RegistrantForm extends ContentEntityForm {
/* @var $entity \Drupal\recurring_events_registration\Entity\Registrant */
$entity
=
$this
->
entity
;
if
(
!
$entity
->
isNew
())
{
$event_instance
=
$entity
->
getEventInstance
();
$editing
=
TRUE
;
}
else
{
$event_instance
=
$this
->
routeMatch
->
getParameter
(
'eventinstance'
);
$editing
=
FALSE
;
}
$event_instance
=
$this
->
routeMatch
->
getParameter
(
'eventinstance'
);
$editing
=
!
$entity
->
isNew
();
if
(
empty
(
$event_instance
))
{
throw
new
NotFoundHttpException
();
}
$event_series
=
$event_instance
->
getEventSeries
();
$form_state
->
setTemporaryValue
(
'series'
,
$event_series
);
$form_state
->
setTemporaryValue
(
'event'
,
$event_instance
);
// Use the registration creation service to grab relevant data.
$this
->
creationService
->
setEventInstance
(
$event_instance
);
$availability
=
$this
->
creationService
->
retrieveAvailability
();
...
...
@@ -337,12 +327,8 @@ class RegistrantForm extends ContentEntityForm {
// Only perform the checks if the entity is new.
if
(
$entity
->
isNew
())
{
$event_series
=
$form_state
->
getTemporaryValue
(
'series'
);
// We need to grab a fresh copy of the series to check for updates.
$event_series
=
$this
->
entityTypeManager
->
getStorage
(
'eventseries'
)
->
load
(
$event_series
->
id
());
// Grab the event instance so we can check if registration is open.
$event_instance
=
$form_state
->
getTemporaryValue
(
'event'
);
$event_instance
=
$this
->
routeMatch
->
getParameter
(
'eventinstance'
);
$event_series
=
$event_instance
->
getEventSeries
();
// Use the registration creation service to grab relevant data.
$this
->
creationService
->
setEventInstance
(
$event_instance
);
...
...
@@ -357,16 +343,16 @@ class RegistrantForm extends ContentEntityForm {
// Registration has closed.
if
(
!
$registration_open
)
{
$form_state
->
setError
(
$form
,
''
);
$form_state
->
setError
(
$form
,
$this
->
t
(
'Unfortunately, registration has closed.'
)
);
}
// Capacity is full, there is a waitlist, but user was not being added to
// the waitlist.
elseif
(
!
$add_to_waitlist
&&
$availability
==
0
&&
$waitlist
)
{
$form_state
->
setError
(
$form
,
''
);
$form_state
->
setError
(
$form
,
$this
->
t
(
'Unfortunately, this event is now full and you must join the waitlist.'
)
);
}
// There are no spaces left, and there is no waitlist.
elseif
(
$availability
==
0
&&
!
$waitlist
)
{
$form_state
->
setError
(
$form
,
''
);
$form_state
->
setError
(
$form
,
$this
->
t
(
'Unfortunately, this event is now full.'
)
);
}
}
else
{
...
...
@@ -381,10 +367,8 @@ class RegistrantForm extends ContentEntityForm {
* {@inheritdoc}
*/
public
function
save
(
array
$form
,
FormStateInterface
$form_state
)
{
$event_series
=
$form_state
->
getTemporaryValue
(
'series'
);
// We need to grab a fresh copy of the series to check for updates.
$event_series
=
$this
->
entityTypeManager
->
getStorage
(
'eventseries'
)
->
load
(
$event_series
->
id
());
$event_instance
=
$form_state
->
getTemporaryValue
(
'event'
);
$event_instance
=
$this
->
routeMatch
->
getParameter
(
'eventinstance'
);
$event_series
=
$event_instance
->
getEventSeries
();
// Use the registration creation service to grab relevant data.
$this
->
creationService
->
setEventInstance
(
$event_instance
);
...
...
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