Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
civirules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
ayduns
civirules
Commits
45b0fce4
Commit
45b0fce4
authored
9 years ago
by
jaapjansma
Browse files
Options
Downloads
Patches
Plain Diff
added edit screen for editting delay
parent
40860f6c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Civirules/Form/Rule.php
+4
-0
4 additions, 0 deletions
CRM/Civirules/Form/Rule.php
CRM/Civirules/Form/RuleAction.php
+52
-3
52 additions, 3 deletions
CRM/Civirules/Form/RuleAction.php
templates/CRM/Civirules/Form/RuleAction.tpl
+13
-5
13 additions, 5 deletions
templates/CRM/Civirules/Form/RuleAction.tpl
with
69 additions
and
8 deletions
CRM/Civirules/Form/Rule.php
+
4
−
0
View file @
45b0fce4
...
...
@@ -362,6 +362,10 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
protected
function
setRuleActionActions
(
$ruleActionId
,
CRM_Civirules_Action
$action
)
{
$actionActions
=
array
();
$delaySettingsUrl
=
CRM_Utils_System
::
url
(
'civicrm/civirule/form/rule_action'
,
'reset=1&action=update&rid='
.
$this
->
ruleId
.
'&id='
.
$ruleActionId
);
$actionActions
[]
=
'<a class="action-item" title="Edit delay settings" href="'
.
$delaySettingsUrl
.
'">'
.
ts
(
'Edit delay'
)
.
'</a>'
;
$editUrl
=
$action
->
getExtraDataInputUrl
(
$ruleActionId
);
if
(
!
empty
(
$editUrl
))
{
$actionActions
[]
=
'<a class="action-item" title="Edit" href="'
.
$editUrl
.
'">'
.
ts
(
'Edit'
)
.
'</a>'
;
...
...
This diff is collapsed.
Click to expand it.
CRM/Civirules/Form/RuleAction.php
+
52
−
3
View file @
45b0fce4
...
...
@@ -13,6 +13,12 @@ class CRM_Civirules_Form_RuleAction extends CRM_Core_Form {
protected
$ruleId
=
NULL
;
protected
$ruleActionId
;
protected
$ruleAction
;
protected
$action
;
/**
* Function to buildQuickForm (extends parent function)
*
...
...
@@ -31,6 +37,24 @@ class CRM_Civirules_Form_RuleAction extends CRM_Core_Form {
*/
function
preProcess
()
{
$this
->
ruleId
=
CRM_Utils_Request
::
retrieve
(
'rid'
,
'Integer'
);
$this
->
ruleActionId
=
CRM_Utils_Request
::
retrieve
(
'id'
,
'Integer'
);
if
(
$this
->
ruleActionId
)
{
$this
->
ruleAction
=
new
CRM_Civirules_BAO_RuleAction
();
$this
->
ruleAction
->
id
=
$this
->
ruleActionId
;
if
(
!
$this
->
ruleAction
->
find
(
true
))
{
throw
new
Exception
(
'Civirules could not find ruleAction'
);
}
$this
->
action
=
new
CRM_Civirules_BAO_Action
();
$this
->
action
->
id
=
$this
->
ruleAction
->
action_id
;
if
(
!
$this
->
action
->
find
(
true
))
{
throw
new
Exception
(
'Civirules could not find action'
);
}
$this
->
assign
(
'action_label'
,
$this
->
action
->
label
);
}
$redirectUrl
=
CRM_Utils_System
::
url
(
'civicrm/civirule/form/rule'
,
'action=update&id='
.
$this
->
ruleId
,
TRUE
);
$session
=
CRM_Core_Session
::
singleton
();
$session
->
pushUserContext
(
$redirectUrl
);
...
...
@@ -53,6 +77,9 @@ class CRM_Civirules_Form_RuleAction extends CRM_Core_Form {
'action_id'
=>
$this
->
_submitValues
[
'rule_action_select'
],
'delay'
=>
'null'
,
);
if
(
$this
->
ruleActionId
)
{
$saveParams
[
'id'
]
=
$this
->
ruleActionId
;
}
if
(
!
empty
(
$this
->
_submitValues
[
'delay_select'
]))
{
$delayClass
=
CRM_Civirules_Delay_Factory
::
getDelayClassByName
(
$this
->
_submitValues
[
'delay_select'
]);
...
...
@@ -68,7 +95,7 @@ class CRM_Civirules_Form_RuleAction extends CRM_Core_Form {
$action
=
CRM_Civirules_BAO_Action
::
getActionObjectById
(
$ruleAction
[
'action_id'
],
true
);
$redirectUrl
=
$action
->
getExtraDataInputUrl
(
$ruleAction
[
'id'
]);
if
(
empty
(
$redirectUrl
))
{
if
(
empty
(
$redirectUrl
)
||
$this
->
ruleActionId
)
{
$redirectUrl
=
CRM_Utils_System
::
url
(
'civicrm/civirule/form/rule'
,
'action=update&id='
.
$this
->
_submitValues
[
'rule_id'
],
TRUE
);
}
...
...
@@ -82,9 +109,16 @@ class CRM_Civirules_Form_RuleAction extends CRM_Core_Form {
*/
protected
function
createFormElements
()
{
$this
->
add
(
'hidden'
,
'rule_id'
);
if
(
$this
->
ruleActionId
)
{
$this
->
add
(
'hidden'
,
'id'
);
}
$actionList
=
array
(
' - select - '
)
+
CRM_Civirules_Utils
::
buildActionList
();
asort
(
$actionList
);
$this
->
add
(
'select'
,
'rule_action_select'
,
ts
(
'Select Action'
),
$actionList
);
$attributes
=
array
();
if
(
!
empty
(
$this
->
ruleActionId
))
{
$this
->
add
(
'select'
,
'rule_action_select'
,
ts
(
'Select Action'
),
$actionList
,
$attributes
);
}
$delayList
=
array
(
' - No Delay - '
)
+
CRM_Civirules_Delay_Factory
::
getOptionList
();
$this
->
add
(
'select'
,
'delay_select'
,
ts
(
'Delay action to'
),
$delayList
);
...
...
@@ -105,6 +139,16 @@ class CRM_Civirules_Form_RuleAction extends CRM_Core_Form {
$delay_class
->
setDefaultValues
(
$defaults
);
}
if
(
!
empty
(
$this
->
ruleActionId
))
{
$defaults
[
'rule_action_select'
]
=
$this
->
ruleActionId
;
$defaults
[
'id'
]
=
$this
->
ruleActionId
;
$delayClass
=
unserialize
(
$this
->
ruleAction
->
delay
);
if
(
$delayClass
)
{
$defaults
[
'delay_select'
]
=
get_class
(
$delayClass
);
}
}
return
$defaults
;
}
...
...
@@ -125,7 +169,12 @@ class CRM_Civirules_Form_RuleAction extends CRM_Core_Form {
* @access public
*/
public
function
addRules
()
{
$this
->
addFormRule
(
array
(
'CRM_Civirules_Form_RuleAction'
,
'validateRuleAction'
));
if
(
empty
(
$this
->
ruleActionId
))
{
$this
->
addFormRule
(
array
(
'CRM_Civirules_Form_RuleAction'
,
'validateRuleAction'
));
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
templates/CRM/Civirules/Form/RuleAction.tpl
+
13
−
5
View file @
45b0fce4
{* block for rule condition data *}
<h3>
{
$ruleActionHeader
}
</h3>
<div
class=
"crm-block crm-form-block crm-civirule-rule_action-block"
>
<div
class=
"crm-section"
>
<div
class=
"label"
>
{
$form.rule_action_select.label
}
</div>
<div
class=
"content"
>
{
$form.rule_action_select.html
}
</div>
<div
class=
"clear"
></div>
</div>
{
if
(!
empty
(
$action_label
))
}
<div
class=
"crm-section"
>
<div
class=
"label"
></div>
<div
class=
"content"
>
{
$action_label
}
</div>
<div
class=
"clear"
></div>
</div>
{
else
}
<div
class=
"crm-section"
>
<div
class=
"label"
>
{
$form.rule_action_select.label
}
</div>
<div
class=
"content"
>
{
$form.rule_action_select.html
}
</div>
<div
class=
"clear"
></div>
</div>
{/
if
}
</div>
<h3>
{
ts
}
Delay action
{/
ts
}
</h3>
<div
class=
"crm-block crm-form-block crm-civirule-rule_action_delay-block"
>
...
...
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