From 0955d6b96861e3234bf8551e7dffa6a09c946006 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Mon, 14 Sep 2015 12:12:16 +1200 Subject: [PATCH] fixes to comments & remove unused vars comment fixes --- CRM/Core/Form/Search.php | 4 +-- CRM/Member/BAO/Query.php | 62 +++++++++++++++++++++++--------------- CRM/Member/Form/Search.php | 36 ++++++++++------------ 3 files changed, 56 insertions(+), 46 deletions(-) diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index 0ce0bcf8eb..4ff32c0c12 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -92,7 +92,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form { } /** - * Common buildform tasks required by all searches + * Common buildForm tasks required by all searches. */ public function buildQuickform() { CRM_Core_Resources::singleton() @@ -116,7 +116,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form { } /** - * Add checkboxes for each row plus a master checkbox + * Add checkboxes for each row plus a master checkbox. */ public function addRowSelectors($rows) { $this->addElement('checkbox', 'toggleSelect', NULL, NULL, array('class' => 'select-rows')); diff --git a/CRM/Member/BAO/Query.php b/CRM/Member/BAO/Query.php index 524302bde8..6100658aa3 100644 --- a/CRM/Member/BAO/Query.php +++ b/CRM/Member/BAO/Query.php @@ -33,6 +33,8 @@ class CRM_Member_BAO_Query { /** + * Get available fields. + * * @return array */ public static function &getFields() { @@ -41,9 +43,9 @@ class CRM_Member_BAO_Query { } /** - * If membership are involved, add the specific membership fields + * If membership are involved, add the specific membership fields. * - * @param $query + * @param CRM_Contact_BAO_Query $query */ public static function select(&$query) { // if membership mode add membership id @@ -127,10 +129,11 @@ class CRM_Member_BAO_Query { } /** - * @param $query + * Generate where clause. + * + * @param CRM_Contact_BAO_Query $query */ public static function where(&$query) { - $grouping = NULL; foreach (array_keys($query->_params) as $id) { if (empty($query->_params[$id][0])) { continue; @@ -139,18 +142,19 @@ class CRM_Member_BAO_Query { if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) { $query->_useDistinct = TRUE; } - $grouping = $query->_params[$id][3]; self::whereClauseSingle($query->_params[$id], $query); } } } /** - * @param $values - * @param $query + * Generate where for a single parameter. + * + * @param array $values + * @param CRM_Contact_BAO_Query $query */ public static function whereClauseSingle(&$values, &$query) { - list($name, $op, $value, $grouping, $wildcard) = $values; + list($name, $op, $value, $grouping) = $values; switch ($name) { case 'member_join_date_low': case 'member_join_date_high': @@ -181,7 +185,6 @@ class CRM_Member_BAO_Query { $date = CRM_Utils_Date::format($value); if ($date) { $query->_where[$grouping][] = "civicrm_membership.join_date {$op} {$date}"; - $date = CRM_Utils_Date::customFormat($value); $format = CRM_Utils_Date::customFormat(CRM_Utils_Date::format(array_reverse($value), '-')); $query->_qill[$grouping][] = ts('Member Since %2 %1', array(1 => $format, 2 => $op)); } @@ -233,7 +236,11 @@ class CRM_Member_BAO_Query { "Integer" ); list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Member_DAO_Membership', $name, $value, $op); - $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $qillName, 2 => $op, 3 => $value)); + $query->_qill[$grouping][] = ts('%1 %2 %3', array( + 1 => $qillName, + 2 => $op, + 3 => $value, + )); $query->_tables['civicrm_membership'] = $query->_whereTables['civicrm_membership'] = 1; return; @@ -300,11 +307,13 @@ class CRM_Member_BAO_Query { } /** + * Generate from clause. + * * @param string $name - * @param $mode - * @param $side + * @param int $mode + * @param string $side * - * @return null|string + * @return string */ public static function from($name, $mode, $side) { $from = NULL; @@ -340,7 +349,9 @@ class CRM_Member_BAO_Query { } /** - * @param $mode + * Get default return properties. + * + * @param string $mode * @param bool $includeCustomFields * * @return array|null @@ -386,17 +397,17 @@ class CRM_Member_BAO_Query { } /** + * Build the search form. + * * @param CRM_Core_Form $form */ public static function buildSearchForm(&$form) { $membershipStatus = CRM_Member_PseudoConstant::membershipStatus(); - $form->add('select', 'membership_status_id', ts('Membership Status(s)'), $membershipStatus, FALSE, - array('id' => 'membership_status_id', 'multiple' => 'multiple', 'class' => 'crm-select2') - ); - - $form->addSelect('membership_type_id', - array('entity' => 'membership', 'multiple' => 'multiple', 'label' => ts('Membership Type(s)'), 'option_url' => NULL, 'placeholder' => ts('- any -')) - ); + $form->add('select', 'membership_status_id', ts('Membership Status(s)'), $membershipStatus, FALSE, array( + 'id' => 'membership_status_id', + 'multiple' => 'multiple', + 'class' => 'crm-select2', + )); $form->addElement('text', 'member_source', ts('Source')); @@ -436,17 +447,20 @@ class CRM_Member_BAO_Query { } /** - * @param $row + * Possibly un-required function. + * + * @param array $row * @param int $id */ public static function searchAction(&$row, $id) { } /** - * @param $tables + * Add membership table. + * + * @param array $tables */ public static function tableNames(&$tables) { - //add membership table if (!empty($tables['civicrm_membership_log']) || !empty($tables['civicrm_membership_status']) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) { $tables = array_merge(array('civicrm_membership' => 1), $tables); } diff --git a/CRM/Member/Form/Search.php b/CRM/Member/Form/Search.php index 24d205d80a..47c6e488f3 100644 --- a/CRM/Member/Form/Search.php +++ b/CRM/Member/Form/Search.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** @@ -38,7 +36,9 @@ */ /** - * This file is for civimember search + * Membership search. + * + * Class is a pane in advanced search and the membership search page. */ class CRM_Member_Form_Search extends CRM_Core_Form_Search { @@ -70,15 +70,10 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { /** * Processing needed for buildForm and later. - * - * @return void */ public function preProcess() { $this->set('searchFormName', 'Search'); - /** - * set the button names - */ $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); @@ -152,9 +147,6 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { /** * Build the form object. - * - * - * @return void */ public function buildQuickForm() { parent::buildQuickForm(); @@ -186,10 +178,6 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { * done. * The processing consists of using a Selector / Controller framework for getting the * search results. - * - * @param - * - * @return void */ public function postProcess() { if ($this->_done) { @@ -262,15 +250,23 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { $controller->run(); } + /** + * Set default values. + * + * @todo - can this function override be removed? + * + * @return array + */ public function setDefaultValues() { return $this->_defaults; } + /** + * If this search has been forced then see if there are any get values, and if so over-ride the post values. + * + * Note that this means that GET over-rides POST :) & that force with no parameters can be very destructive. + */ public function fixFormValues() { - // if this search has been forced - // then see if there are any get values, and if so over-ride the post values - // note that this means that GET over-rides POST :) - if (!$this->_force) { return; } @@ -352,7 +348,7 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { } /** - * Return a descriptive name for the page, used in wizard header + * Return a descriptive name for the page, used in wizard header. * * @return string */ -- 2.25.1