diff --git a/CRM/Contact/Form/Search/Custom/ContribSYBNT.php b/CRM/Contact/Form/Search/Custom/ContribSYBNT.php index 00a471369da2..de292bb76ab8 100644 --- a/CRM/Contact/Form/Search/Custom/ContribSYBNT.php +++ b/CRM/Contact/Form/Search/Custom/ContribSYBNT.php @@ -169,6 +169,7 @@ public function all( $from WHERE contrib_1.contact_id = contact_a.id AND contrib_1.is_test = 0 +AND contrib_1.is_template = 0 $where GROUP BY contact_a.id $having @@ -237,6 +238,7 @@ public function where($includeContactIDs = FALSE) { if (!empty($this->start_date_2) || !empty($this->end_date_2)) { $clauses[] = "contrib_2.is_test = 0"; + $clauses[] = "contrib_2.is_template = 0"; if (!empty($this->start_date_2)) { $clauses[] = CRM_Core_DAO::composeQuery('contrib_2.receive_date >= %1', [1 => [$this->start_date_2, 'String']]); @@ -293,7 +295,7 @@ public function where($includeContactIDs = FALSE) { REPLACE INTO {$this->_xgTableName} SELECT DISTINCT contact_id AS contact_id FROM civicrm_contribution c -WHERE c.is_test = 0 +WHERE c.is_test = 0 AND c.is_template = 0 $excludeClause GROUP BY c.contact_id $havingClause @@ -308,7 +310,7 @@ public function where($includeContactIDs = FALSE) { REPLACE INTO {$this->_xgTableName} SELECT DISTINCT contact_id AS contact_id FROM civicrm_contribution c -WHERE c.is_test = 0 +WHERE c.is_test = 0 AND c.is_template = 0 AND c.receive_date < {$this->start_date_1} "; CRM_Core_DAO::executeQuery($query); diff --git a/CRM/Contact/Form/Search/Custom/ContributionAggregate.php b/CRM/Contact/Form/Search/Custom/ContributionAggregate.php index 2d95568eebc7..0b0698c5a961 100644 --- a/CRM/Contact/Form/Search/Custom/ContributionAggregate.php +++ b/CRM/Contact/Form/Search/Custom/ContributionAggregate.php @@ -198,6 +198,7 @@ public function where($includeContactIDs = FALSE) { $clauses = [ "contrib.contact_id = contact_a.id", "contrib.is_test = 0", + "contrib.is_template = 0", "contrib.contribution_status_id = " . intval($contributionCompletedStatusId), ]; diff --git a/CRM/Contact/Form/Search/Custom/EventAggregate.php b/CRM/Contact/Form/Search/Custom/EventAggregate.php index 3dd307089c02..29e76dbeaab4 100644 --- a/CRM/Contact/Form/Search/Custom/EventAggregate.php +++ b/CRM/Contact/Form/Search/Custom/EventAggregate.php @@ -214,6 +214,7 @@ public function where($includeContactIDs = FALSE) { $clauses[] = "civicrm_participant.status_id in ( 1 )"; $clauses[] = "civicrm_contribution.is_test = 0"; + $clauses[] = "civicrm_contribution.is_template = 0"; $onLine = CRM_Utils_Array::value('paid_online', $this->_formValues ); diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 5255b6d36ebf..e5aabe2a970f 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -961,6 +961,7 @@ public static function buildSearchForm(&$form) { $form->addYesNo('contribution_recurring', ts('Contribution is Recurring?'), TRUE); $form->addYesNo('contribution_test', ts('Contribution is a Test?'), TRUE); + $form->addYesNo('is_template', ts('Contribution is Template?'), TRUE); // Add field for transaction ID search $form->addElement('text', 'contribution_trxn_id', ts("Transaction ID")); $form->addElement('text', 'contribution_check_number', ts('Check Number')); @@ -1029,6 +1030,7 @@ public static function buildSearchForm(&$form) { $form->assign('validCiviContribute', TRUE); $form->setDefaults(['contribution_test' => 0]); + $form->setDefaults(['is_template' => 0]); CRM_Contribute_BAO_ContributionRecur::recurringContribution($form); } diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index c8b5a8ca185b..fed38afc1e90 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -53,6 +53,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'contribution_cancel_date', 'product_name', 'is_test', + 'is_template', 'contribution_recur_id', 'receipt_date', 'membership_id', diff --git a/templates/CRM/Contact/Form/Search/Advanced.hlp b/templates/CRM/Contact/Form/Search/Advanced.hlp index 3747d071c366..d8ffbaf895c7 100644 --- a/templates/CRM/Contact/Form/Search/Advanced.hlp +++ b/templates/CRM/Contact/Form/Search/Advanced.hlp @@ -96,6 +96,15 @@
{ts}Once you have finished your testing, it is a good idea to clean up by finding your test records and deleting them.{/ts}
{/htxt} + +{htxt id="is-template-title"} +{ts}Template Records{/ts} +{/htxt} +{htxt id="is-template"} +{ts}Template contributions are used with recurring contribution to generate follow up contributions.{/ts}
+{ts}You can change the template contribution and the changes will occur as soon as new contribution is generated within the recurring series.{/ts}
+{/htxt} + {htxt id="processor-id-title"} {ts}Processor ID{/ts} {/htxt} diff --git a/templates/CRM/Contribute/Form/Search/Common.tpl b/templates/CRM/Contribute/Form/Search/Common.tpl index 5564d23fa07e..8f79a3bf409b 100644 --- a/templates/CRM/Contribute/Form/Search/Common.tpl +++ b/templates/CRM/Contribute/Form/Search/Common.tpl @@ -110,6 +110,12 @@ {$form.contribution_recurring.html} +