X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FPledge%2FBAO%2FQuery.php;h=d1c0464c0aef7cb9185372cf296a2eda7522f9b8;hb=dbc6f6d6ef466bec4c2935cd9e2c5dbcf56a5dfb;hp=c21945c4afaf05d0a2e52d13931f4617c7d1e90e;hpb=b9500f7b49adf5041c16db0121be8b873dea69b6;p=civicrm-core.git diff --git a/CRM/Pledge/BAO/Query.php b/CRM/Pledge/BAO/Query.php index c21945c4af..d1c0464c0a 100644 --- a/CRM/Pledge/BAO/Query.php +++ b/CRM/Pledge/BAO/Query.php @@ -2,9 +2,9 @@ /* +--------------------------------------------------------------------+ - | CiviCRM version 4.4 | + | CiviCRM version 4.5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2013 | + | Copyright CiviCRM LLC (c) 2004-2014 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -29,11 +29,14 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2013 + * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ * */ class CRM_Pledge_BAO_Query { + /** + * @return array + */ static function &getFields() { $fields = CRM_Pledge_BAO_Pledge::exportableFields(); return $fields; @@ -42,6 +45,8 @@ class CRM_Pledge_BAO_Query { /** * build select for Pledge * + * @param $query + * * @return void * @access public */ @@ -196,6 +201,9 @@ class CRM_Pledge_BAO_Query { } } + /** + * @param $query + */ static function where(&$query) { $grouping = NULL; foreach (array_keys($query->_params) as $id) { @@ -212,6 +220,10 @@ class CRM_Pledge_BAO_Query { } } + /** + * @param $values + * @param $query + */ static function whereClauseSingle(&$values, &$query) { list($name, $op, $value, $grouping, $wildcard) = $values; @@ -265,13 +277,12 @@ class CRM_Pledge_BAO_Query { $status = implode(',', $val); - if (count($val) > 1) { + if (count($val) > 0) { $op = 'IN'; $status = "({$status})"; } } else { - $op = '='; $status = $value; } @@ -284,7 +295,9 @@ class CRM_Pledge_BAO_Query { } } else { - $names[] = $statusValues[$value]; + if (!empty($value) ) { + $names[] = $statusValues[$value]; + } } $query->_qill[$grouping][] = ts('Pledge Status %1', array(1 => $op)) . ' ' . implode(' ' . ts('or') . ' ', $names); @@ -312,7 +325,6 @@ class CRM_Pledge_BAO_Query { } } else { - $op = '='; $status = $value; } @@ -325,7 +337,9 @@ class CRM_Pledge_BAO_Query { } } else { - $names[] = $statusValues[$value]; + if (!empty($value) ) { + $names[] = $statusValues[$value]; + } } $query->_qill[$grouping][] = ts('Pledge Payment Status %1', array(1 => $op)) . ' ' . implode(' ' . ts('or') . ' ', $names); @@ -402,6 +416,13 @@ class CRM_Pledge_BAO_Query { } } + /** + * @param $name + * @param $mode + * @param $side + * + * @return null|string + */ static function from($name, $mode, $side) { $from = NULL; @@ -511,6 +532,9 @@ class CRM_Pledge_BAO_Query { return $properties; } + /** + * @param $form + */ static function buildSearchForm(&$form) { // pledge related dates CRM_Core_Form_Date::buildDateRange($form, 'pledge_start_date', 1, '_low', '_high', ts('From'), FALSE); @@ -520,7 +544,7 @@ class CRM_Pledge_BAO_Query { // pledge payment related dates CRM_Core_Form_Date::buildDateRange($form, 'pledge_payment_date', 1, '_low', '_high', ts('From'), FALSE); - $form->addYesNo('pledge_test', ts('Pledge is a Test?')); + $form->addYesNo('pledge_test', ts('Pledge is a Test?'), TRUE); $form->add('text', 'pledge_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('pledge_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); @@ -549,16 +573,14 @@ class CRM_Pledge_BAO_Query { $form->add('select', 'pledge_financial_type_id', ts( 'Financial Type' ), - array( - '' => ts('- select -')) + - CRM_Contribute_PseudoConstant::financialType() + array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), + FALSE, array('class' => 'crm-select2') ); $form->add('select', 'pledge_contribution_page_id', ts('Contribution Page'), - array( - '' => ts('- any -')) + - CRM_Contribute_PseudoConstant::contributionPage() + array('' => ts('- any -')) + CRM_Contribute_PseudoConstant::contributionPage(), + FALSE, array('class' => 'crm-select2') ); //add fields for pledge frequency @@ -571,8 +593,7 @@ class CRM_Pledge_BAO_Query { $form->add('select', 'pledge_frequency_unit', ts('Pledge Frequency'), - array( - '' => ts('- any -')) + $freqUnitsDisplay + array('' => ts('- any -')) + $freqUnitsDisplay ); // add all the custom searchable fields @@ -599,8 +620,15 @@ class CRM_Pledge_BAO_Query { $form->setDefaults(array('pledge_test' => 0)); } + /** + * @param $row + * @param $id + */ static function searchAction(&$row, $id) {} + /** + * @param $tables + */ static function tableNames(&$tables) { //add status table if (!empty($tables['pledge_status']) || !empty($tables['civicrm_pledge_payment'])) {