Skip to content
Snippets Groups Projects
Commit bf0493ac authored by jaapjansma's avatar jaapjansma
Browse files

Merge branch 'fixestorecurpaymentprocessorcondition' into 'master'

Add help to rule conditions and update ContributionRecur has payment processor condition

See merge request extensions/civirules!46
parents 758c111c 60ba3e8e
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ class CRM_CivirulesConditions_ContributionRecur_PaymentProcessor extends CRM_Civ
case 'Membership':
$whereClauses[] = "cm.id = %1";
$sql = "SELECT ccr.payment_processor_id FROM civicrm_membership cm
$sql = "SELECT cm.id FROM civicrm_membership cm
LEFT JOIN civicrm_contribution_recur ccr ON ccr.id = cm.contribution_recur_id WHERE ";
break;
}
......@@ -51,7 +51,9 @@ LEFT JOIN civicrm_contribution_recur ccr ON ccr.id = cm.contribution_recur_id WH
$whereClauses[] = 'payment_processor_id IN ('.implode($this->conditionParams['payment_processor_id'], ','). ')';
break;
case 'not in':
$whereClauses[] = 'payment_processor_id NOT IN ('.implode($this->conditionParams['payment_processor_id'], ','). ')';
$whereClauses[] = '(payment_processor_id NOT IN ('
. implode($this->conditionParams['payment_processor_id'], ',')
. ') OR payment_processor_id IS NULL)';
break;
}
}
......
......@@ -6,6 +6,8 @@
* @license AGPL-3.0
*/
use CRM_Civirules_ExtensionUtil as E;
class CRM_CivirulesConditions_Form_ContributionRecur_PaymentProcessor extends CRM_CivirulesConditions_Form_Form {
/**
......@@ -68,4 +70,12 @@ class CRM_CivirulesConditions_Form_ContributionRecur_PaymentProcessor extends CR
$this->ruleCondition->save();
parent::postProcess();
}
protected function getHelpText() {
$help = E::ts('This condition works with Membership (checks the linked recur) and Recurring Contribution triggers.');
$help .= '<ul><li>' . E::ts('IS ONE OF will match a Membership/Recurring Contribution that has a payment processor in the list.');
$help .= '</li><li>' . E::ts('IS NOT ONE OF will match a Membership that does not have a linked recurring contribution OR a Membership/Recurring Contribution that: Has a recurring contribution with no payment processor; Has a recurring contribution that has a payment processor not in the list.');
$help .= '</ul>';
return $help;
}
}
......@@ -71,6 +71,8 @@ class CRM_CivirulesConditions_Form_Form extends CRM_Core_Form
parent::preProcess();
$this->setFormTitle();
$this->assign('ruleConditionHelp', $this->getHelpText());
$this->assign('ruleName', $this->condition->name);
//set user context
$session = CRM_Core_Session::singleton();
......@@ -115,4 +117,11 @@ class CRM_CivirulesConditions_Form_Form extends CRM_Core_Form
CRM_Utils_System::setTitle($title);
}
}
\ No newline at end of file
/**
* @return string
*/
protected function getHelpText() {
return '';
}
}
<h3>{$ruleConditionHeader}</h3>
<div class="crm-block crm-form-block crm-civirule-rule_condition-block-membership_has_recurring">
<div class="crm-block crm-form-block crm-civirule-rule_condition-block-{$ruleName}">
<div class="help">{$ruleConditionHelp}</div>
<h4>{$form.payment_processor_id.label}</h4>
<div class="crm-section">
<div class="label">{$form.payment_processor_id_operator.html}</div>
......
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