*
* @return array
*/
- public static function &getFields($checkPermission = TRUE) {
- $fields = CRM_Pledge_BAO_Pledge::exportableFields($checkPermission);
- return $fields;
+ public static function getFields($checkPermission = TRUE) {
+ return CRM_Pledge_BAO_Pledge::exportableFields($checkPermission);
}
/**
* Build select for Pledge.
*
- * @param $query
+ * @param CRM_Contact_BAO_Query $query
*/
public static function select(&$query) {
+
$statusId = implode(',', array_keys(CRM_Core_PseudoConstant::accountOptionValues("contribution_status", NULL, " AND v.name IN ('Pending', 'Overdue')")));
if (($query->_mode & CRM_Contact_BAO_Query::MODE_PLEDGE) || !empty($query->_returnProperties['pledge_id'])) {
$query->_select['pledge_id'] = 'civicrm_pledge.id as pledge_id';
);
return;
+ case 'pledge_installments_low':
+ case 'pledge_installments_high':
+ // process min/max amount
+ $query->numberRangeBuilder($values,
+ 'civicrm_pledge', 'pledge_installments', 'installments', 'Number of Installments'
+ );
+ return;
+
+ case 'pledge_acknowledge_date_is_not_null':
+ if ($value) {
+ $op = "IS NOT NULL";
+ $query->_qill[$grouping][] = ts('Pledge Acknowledgement Sent');
+ }
+ else {
+ $op = "IS NULL";
+ $query->_qill[$grouping][] = ts('Pledge Acknowledgement Not Sent');
+ }
+ $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_pledge.acknowledge_date", $op);
+ return;
+
case 'pledge_payment_status_id':
case 'pledge_status_id':
if ($name == 'pledge_status_id') {
$form->addRule('pledge_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
$statusValues = CRM_Contribute_PseudoConstant::contributionStatus();
-
// Remove status values that are only used for recurring contributions for now (Failed and In Progress).
unset($statusValues['4']);
-
+ // unset in progress for payment
+ unset($statusValues['5']);
$form->add('select', 'pledge_status_id',
ts('Pledge Status'), $statusValues,
FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple')
);
- // unset in progress for payment
- unset($statusValues['5']);
+ $form->addYesNo('pledge_acknowledge_date_is_not_null', ts('Acknowledgement sent?'), TRUE);
+
+ $form->add('text', 'pledge_installments_low', ts('From'), array('size' => 8, 'maxlength' => 8));
+ $form->addRule('pledge_installments_low', ts('Please enter a number'), 'integer');
+
+ $form->add('text', 'pledge_installments_high', ts('To'), array('size' => 8, 'maxlength' => 8));
+ $form->addRule('pledge_installments_high', ts('Please enter number.'), 'integer');
$form->add('select', 'pledge_payment_status_id',
ts('Pledge Payment Status'), $statusValues,
*/
public function preProcess() {
- // set the button names
-
$this->_searchButtonName = $this->getButtonName('refresh');
$this->_actionButtonName = $this->getButtonName('next', 'action');
$this->_done = FALSE;
$this->defaults = array();
-
// we allow the controller to set force/reset externally, useful when we are being
// driven by the wizard framework
-
+
$this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
$this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
*
* @param array $fields
* Posted values of the form.
+ *
+ * @return array|bool
*/
public static function formRule($fields) {
$errors = array();