Skip to content
Snippets Groups Projects
Commit 0babfc53 authored by jaapjansma's avatar jaapjansma
Browse files
parents 89596af3 03e796c1
No related branches found
No related tags found
No related merge requests found
......@@ -129,4 +129,17 @@ class CRM_Civirules_BAO_RuleCondition extends CRM_Civirules_DAO_RuleCondition {
}
}
/**
* Function to count the number of conditions for a rule
*
* @param int $ruleId
* @return int
* @access public
* @static
*/
public static function countConditionsForRule($ruleId) {
$ruleCondition = new CRM_Civirules_BAO_RuleCondition();
$ruleCondition->rule_id = $ruleId;
return $ruleCondition->count();
}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ class CRM_Civirules_Form_RuleCondition extends CRM_Core_Form {
*/
function preProcess() {
$this->ruleId = CRM_Utils_Request::retrieve('rid', 'Integer');
$this->assign('countRuleConditions', CRM_Civirules_BAO_RuleCondition::countConditionsForRule($this->ruleId));
if ($this->_action == CRM_Core_Action::DELETE) {
$ruleConditionId = CRM_Utils_Request::retrieve('id', 'Integer');
CRM_Civirules_BAO_RuleCondition::deleteWithId($ruleConditionId);
......
......@@ -8,7 +8,7 @@
<thead>
<tr>
<th>{ts}Link operator{/ts}</th>
<th>{ts}Conidtion{/ts}</th>
<th>{ts}Condition{/ts}</th>
<th>{ts}Description{/ts}</th>
<th>&nbsp;</th>
</tr>
......@@ -17,9 +17,15 @@
{assign var="row_class" value="odd-row"}
{foreach from=$ruleConditions key=ruleConditionIid item=ruleCondition}
<tr class={$row_class}>
<td>{$ruleCondition.condition_link}</td>
{if $countRuleConditions > 0}
<td>{$ruleCondition.condition_link}</td>
{/if}
<td>{$ruleCondition.name}</td>
<td>{if !empty($ruleCondition.formattedConditionParams)}{$ruleCondition.formattedConditionParams}{/if}</td>
<td>
{if !empty($ruleCondition.formattedConditionParams)}
{$ruleCondition.formattedConditionParams}
{/if}
</td>
<td>
<span>
{foreach from=$ruleCondition.actions item=action_link}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment