$statusNames = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id', 'validate');
}
- $statusNamesToUnset = [];
+ $statusNamesToUnset = [
+ // For records which represent a data template for a recurring
+ // contribution that may not yet have a payment. This status should not
+ // be available from forms. 'Template' contributions should only be created
+ // in conjunction with a ContributionRecur record, and should have their
+ // is_template field set to 1. This status excludes them from reports
+ // that are still ignorant of the is_template field.
+ 'Template',
+ ];
// on create fetch statuses on basis of component
if (!$id) {
- $statusNamesToUnset = [
+ $statusNamesToUnset = array_merge($statusNamesToUnset, [
'Refunded',
'Chargeback',
'Pending refund',
- ];
+ ]);
// Event registration and New Membership backoffice form support partially paid payment,
// so exclude this status only for 'New Contribution' form
$this->addTask('Add order_reference field to civicrm_financial_trxn', 'addColumn', 'civicrm_financial_trxn', 'order_reference',
"varchar(255) COMMENT 'Payment Processor external order reference'", FALSE, '5.20.alpha1');
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+ $this->addTask('Add "Template" contribution status', 'templateStatus');
+ }
+
+ public static function templateStatus(CRM_Queue_TaskContext $ctx) {
+ CRM_Core_BAO_OptionValue::ensureOptionValueExists([
+ 'option_group_id' => 'contribution_status',
+ 'name' => 'Template',
+ 'label' => ts('Template'),
+ 'is_active' => TRUE,
+ 'component_id' => 'CiviContribute',
+ ]);
+ return TRUE;
}
}
(@option_group_id_cs, '{ts escape="sql"}Partially paid{/ts}', 8, 'Partially paid', NULL, 0, NULL, 8, NULL, 0, 1, 1, NULL, NULL, NULL),
(@option_group_id_cs, '{ts escape="sql"}Pending refund{/ts}', 9, 'Pending refund', NULL, 0, NULL, 9, NULL, 0, 1, 1, NULL, NULL, NULL),
(@option_group_id_cs, '{ts escape="sql"}Chargeback{/ts}', 10, 'Chargeback', NULL, 0, NULL, 10, NULL, 0, 1, 1, NULL, NULL, NULL),
+ (@option_group_id_cs, '{ts escape="sql"}Template{/ts}' , 11, 'Template', NULL, 0, NULL, 11, '{ts escape="sql"}Status for contribution records which represent a template for a recurring contribution rather than an actual contribution. This status is transitional, to ensure that said contributions don\'t appear in reports. The is_template field is the preferred way to find and filter these contributions.{/ts}', 0, 1, 1, NULL, NULL, NULL),
(@option_group_id_pcp, '{ts escape="sql"}Waiting Review{/ts}', 1, 'Waiting Review', NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL, NULL),
(@option_group_id_pcp, '{ts escape="sql"}Approved{/ts}' , 2, 'Approved' , NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL, NULL),