) {
$result = array($id, 'IN', $values, 0, $wildcard);
}
+ // Hack for CRM-19325. This is ugly because it creates a dependency
+ // to the form, that returns the string 'NULL' if the user wants
+ // contributions that are not contained in any batch.
+ else if ($id == 'contribution_batch_id' && $values == 'NULL') {
+ $result = array($id, 'IS', 'NULL', 0, 0);
+ }
else {
$result = array($id, '=', $values, 0, $wildcard);
}
case 'contribution_batch_id':
$batches = CRM_Contribute_PseudoConstant::batch();
+ // The key 'NULL' indicates that the user is looking for contributions
+ // that are not contained in a batch, see CRM-19325.
+ $batches['NULL'] = ts('(none)');
$query->_where[$grouping][] = " civicrm_entity_batch.batch_id $op $value";
$query->_qill[$grouping][] = ts('Batch Name %1 %2', array(1 => $op, 2 => $batches[$value]));
$query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
if (!empty($batches)) {
$form->add('select', 'contribution_batch_id',
ts('Batch Name'),
- array('' => ts('- any -')) + $batches,
+ array(
+ '' => ts('- any -'),
+ // CRM-19325
+ 'NULL' => ts('None'),
+ ) + $batches,
FALSE, array('class' => 'crm-select2')
);
}
);
}
+ // Why is this called twice? (see line 317)
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
$selector = new CRM_Contribute_Selector_Search($this->_queryParams,
$this->_action,