Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
c1b3f0cc
Unverified
Commit
c1b3f0cc
authored
3 months ago
by
Seamus Lee
Committed by
GitHub
3 months ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #31736 from eileenmcnaughton/repeat
#5580
Fix ActionSchedule save on repeat events
parents
00556d30
4fff214f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/Form/RecurringEntity.php
+9
-5
9 additions, 5 deletions
CRM/Core/Form/RecurringEntity.php
Civi/Api4/Service/Spec/Provider/ActionScheduleSpecProvider.php
+6
-4
6 additions, 4 deletions
...Api4/Service/Spec/Provider/ActionScheduleSpecProvider.php
with
15 additions
and
9 deletions
CRM/Core/Form/RecurringEntity.php
+
9
−
5
View file @
c1b3f0cc
...
...
@@ -15,6 +15,7 @@
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
use
Civi\Api4\ActionSchedule
;
/**
* This class generates form components for processing Entity.
...
...
@@ -126,7 +127,7 @@ class CRM_Core_Form_RecurringEntity {
if
(
self
::
$_scheduleReminderID
)
{
$defaults
[
'repetition_frequency_unit'
]
=
self
::
$_scheduleReminderDetails
->
repetition_frequency_unit
;
$defaults
[
'repetition_frequency_interval'
]
=
self
::
$_scheduleReminderDetails
->
repetition_frequency_interval
;
$defaults
[
'start_action_condition'
]
=
array_flip
(
explode
(
","
,
self
::
$_scheduleReminderDetails
->
start_action_condition
));
$defaults
[
'start_action_condition'
]
=
array_flip
(
explode
(
","
,
(
string
)
self
::
$_scheduleReminderDetails
->
start_action_condition
));
foreach
(
$defaults
[
'start_action_condition'
]
as
$key
=>
$val
)
{
$val
=
1
;
$defaults
[
'start_action_condition'
][
$key
]
=
$val
;
...
...
@@ -357,11 +358,14 @@ class CRM_Core_Form_RecurringEntity {
unset
(
$params
[
'id'
]);
}
$dbParams
[
'name'
]
=
'repeat_'
.
$params
[
'used_for'
]
.
'_'
.
$params
[
'entity_id'
];
$actionScheduleObj
=
CRM_Core_BAO_ActionSchedule
::
writeRecord
(
$dbParams
);
$actionSchedule
=
ActionSchedule
::
save
(
FALSE
)
->
addRecord
(
$dbParams
)
->
setMatch
([
'name'
])
->
execute
()
->
first
();
//exclude dates
$excludeDateList
=
[];
if
(
!
empty
(
$params
[
'exclude_date_list'
])
&&
!
empty
(
$params
[
'parent_entity_id'
])
&&
$actionSchedule
Obj
->
entity_value
)
{
if
(
!
empty
(
$params
[
'exclude_date_list'
])
&&
!
empty
(
$params
[
'parent_entity_id'
])
&&
$actionSchedule
[
'
entity_value
'
]
)
{
//Since we get comma separated values lets get them in array
$excludeDates
=
explode
(
","
,
$params
[
'exclude_date_list'
]);
...
...
@@ -375,7 +379,7 @@ class CRM_Core_Form_RecurringEntity {
CRM_Core_BAO_OptionGroup
::
deleteRecord
([
'id'
=>
$optionGroupIdExists
]);
}
$optionGroupParams
=
[
'name'
=>
$type
.
'_repeat_exclude_dates_'
.
$actionSchedule
Obj
->
entity_value
,
'name'
=>
$type
.
'_repeat_exclude_dates_'
.
CRM_Core_DAO
::
serializeField
(
$actionSchedule
[
'
entity_value
'
],
CRM_Core_DAO
::
SERIALIZE_SEPARATOR_TRIMMED
)
,
'title'
=>
$type
.
' recursion'
,
'is_reserved'
=>
0
,
'is_active'
=>
1
,
...
...
@@ -428,7 +432,7 @@ class CRM_Core_Form_RecurringEntity {
$recursion
=
new
CRM_Core_BAO_RecurringEntity
();
$recursion
->
dateColumns
=
$params
[
'dateColumns'
];
$recursion
->
scheduleId
=
$actionSchedule
Obj
->
id
;
$recursion
->
scheduleId
=
$actionSchedule
[
'id'
]
;
if
(
!
empty
(
$excludeDateList
))
{
$recursion
->
excludeDates
=
$excludeDateList
;
...
...
This diff is collapsed.
Click to expand it.
Civi/Api4/Service/Spec/Provider/ActionScheduleSpecProvider.php
+
6
−
4
View file @
c1b3f0cc
...
...
@@ -25,13 +25,15 @@ class ActionScheduleSpecProvider extends \Civi\Core\Service\AutoService implemen
*/
public
function
modifySpec
(
RequestSpec
$spec
)
{
if
(
$spec
->
getAction
()
===
'create'
)
{
$spec
->
getFieldByName
(
'title'
)
->
setRequired
(
TRUE
);
$spec
->
getFieldByName
(
'title'
)
->
setRequired
If
(
'empty($values.name)'
);
$spec
->
getFieldByName
(
'name'
)
->
setRequired
(
FALSE
);
$spec
->
getFieldByName
(
'mapping_id'
)
->
setRequired
(
TRUE
);
// Repeat events do not require mapping_id or start_action_unit (or seemingly start_action_condition)- although
// we don't have that level of nuance available so we make them optional for all events.
$spec
->
getFieldByName
(
'mapping_id'
)
->
setRequiredIf
(
'empty($values.used_for) || $values.used_for !== "civicrm_event"'
);
$spec
->
getFieldByName
(
'start_action_unit'
)
->
setRequiredIf
(
'empty($values.absolute_date) && (empty($values.used_for) || $values.used_for !== "civicrm_event")'
);
$spec
->
getFieldByName
(
'start_action_condition'
)
->
setRequiredIf
(
'empty($values.absolute_date) && (empty($values.used_for) || $values.used_for !== "civicrm_event")'
);
$spec
->
getFieldByName
(
'entity_value'
)
->
setRequired
(
TRUE
);
$spec
->
getFieldByName
(
'start_action_offset'
)
->
setRequiredIf
(
'empty($values.absolute_date)'
);
$spec
->
getFieldByName
(
'start_action_unit'
)
->
setRequiredIf
(
'empty($values.absolute_date)'
);
$spec
->
getFieldByName
(
'start_action_condition'
)
->
setRequiredIf
(
'empty($values.absolute_date)'
);
$spec
->
getFieldByName
(
'start_action_date'
)
->
setRequiredIf
(
'empty($values.absolute_date)'
);
$spec
->
getFieldByName
(
'absolute_date'
)
->
setRequiredIf
(
'empty($values.start_action_date)'
);
$spec
->
getFieldByName
(
'group_id'
)
->
setRequiredIf
(
'!empty($values.limit_to) && !empty($values.recipient) && $values.recipient === "group"'
);
...
...
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