From a1a2a83db067ec5444f056ad3fa00e85fdc176ec Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 19 Jan 2015 19:57:19 -0800 Subject: [PATCH] INFRA-132 - Misc --- CRM/ACL/Form/ACL.php | 30 +- CRM/Activity/Form/Activity.php | 2 +- CRM/Admin/Page/Navigation.php | 3 +- CRM/Case/Audit/Audit.php | 5 +- CRM/Case/Form/Activity.php | 4 +- CRM/Contact/BAO/Contact.php | 4 +- CRM/Contact/BAO/Group.php | 2 - CRM/Contact/Form/Task/Label.php | 2 - CRM/Contact/Page/View/Log.php | 2 +- CRM/Contact/Page/View/Note.php | 4 - CRM/Contribute/Form/Contribution/Confirm.php | 15 +- CRM/Core/BAO/Address.php | 6 +- CRM/Core/BAO/CustomField.php | 9 +- CRM/Core/BAO/CustomGroup.php | 16 +- CRM/Core/BAO/Discount.php | 2 +- CRM/Core/Form.php | 18 +- CRM/Core/Form/RecurringEntity.php | 4 +- CRM/Core/Payment/BaseIPN.php | 4 +- CRM/Core/Payment/PaymentExpress.php | 2 +- CRM/Core/Report/Excel.php | 3 +- CRM/Core/Smarty/plugins/function.docURL.php | 4 +- CRM/Core/Smarty/plugins/function.help.php | 2 +- .../Smarty/plugins/modifier.substring.php | 44 +- CRM/Event/BAO/Participant.php | 37 +- CRM/Logging/Reverter.php | 2 +- CRM/Mailing/Form/Browse.php | 1 - CRM/Report/Form/Contribute/Detail.php | 414 +++++++++--------- CRM/Report/Form/Contribute/Summary.php | 324 +++++++------- CRM/Report/Form/Contribute/Sybunt.php | 170 +++---- CRM/UF/Form/Field.php | 12 +- CRM/Utils/Cache/APCcache.php | 3 +- CRM/Utils/Weight.php | 2 +- api/v3/Constant.php | 8 +- api/v3/ContributionRecur.php | 1 - tests/phpunit/CRM/Core/ResourcesTest.php | 3 + .../WebTest/Contact/SearchBuilderTest.php | 4 +- tests/phpunit/api/v3/ContributionTest.php | 36 +- tests/phpunit/api/v3/DomainTest.php | 5 +- tests/phpunit/api/v3/MembershipStatusTest.php | 4 + .../phpunit/api/v3/SyntaxConformanceTest.php | 8 +- 40 files changed, 606 insertions(+), 615 deletions(-) diff --git a/CRM/ACL/Form/ACL.php b/CRM/ACL/Form/ACL.php index 14c1c188bb..d904767aa5 100644 --- a/CRM/ACL/Form/ACL.php +++ b/CRM/ACL/Form/ACL.php @@ -156,30 +156,30 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form { $label = ts('Role'); $role = array( - '-1' => ts('- select role -'), - '0' => ts('Everyone'), - ) + CRM_Core_OptionGroup::values('acl_role'); + '-1' => ts('- select role -'), + '0' => ts('Everyone'), + ) + CRM_Core_OptionGroup::values('acl_role'); $this->add('select', 'entity_id', $label, $role, TRUE); $group = array( - '-1' => ts('- select -'), - '0' => ts('All Groups'), - ) + CRM_Core_PseudoConstant::group(); + '-1' => ts('- select -'), + '0' => ts('All Groups'), + ) + CRM_Core_PseudoConstant::group(); $customGroup = array( - '-1' => ts('- select -'), - '0' => ts('All Custom Groups'), - ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); + '-1' => ts('- select -'), + '0' => ts('All Custom Groups'), + ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); $ufGroup = array( - '-1' => ts('- select -'), - '0' => ts('All Profiles'), - ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + '-1' => ts('- select -'), + '0' => ts('All Profiles'), + ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); $event = array( - '-1' => ts('- select -'), - '0' => ts('All Events'), - ) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )"); + '-1' => ts('- select -'), + '0' => ts('All Events'), + ) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )"); $this->add('select', 'group_id', ts('Group'), $group); $this->add('select', 'custom_group_id', ts('Custom Data'), $customGroup); diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index b8d9a6959f..5dbdc39f04 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -889,7 +889,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { CRM_Core_BAO_EntityTag::del($tagParams); CRM_Core_Session::setStatus(ts("Selected Activity has been deleted successfully."), ts('Record Deleted'), 'success'); - return; + return NULL; } // store the submitted values in an array diff --git a/CRM/Admin/Page/Navigation.php b/CRM/Admin/Page/Navigation.php index dad54f5b54..6b0b09c481 100644 --- a/CRM/Admin/Page/Navigation.php +++ b/CRM/Admin/Page/Navigation.php @@ -58,10 +58,11 @@ class CRM_Admin_Page_Navigation extends CRM_Core_Page_Basic { /** * Get action Links * - * @return array + * @return array|NULL * (reference) of action links */ public function &links() { + return NULL; } /** diff --git a/CRM/Case/Audit/Audit.php b/CRM/Case/Audit/Audit.php index fe711c3a00..1928fa4e43 100644 --- a/CRM/Case/Audit/Audit.php +++ b/CRM/Case/Audit/Audit.php @@ -212,15 +212,14 @@ class CRM_Case_Audit_Audit { } /** - * @param $xmlString + * @param string $xmlString * @param int $clientID * @param int $caseID * @param bool $printReport * * @return mixed */ - static - public function run($xmlString, $clientID, $caseID, $printReport = FALSE) { + public static function run($xmlString, $clientID, $caseID, $printReport = FALSE) { /* $fh = fopen('C:/temp/audit2.xml', 'w'); fwrite($fh, $xmlString); diff --git a/CRM/Case/Form/Activity.php b/CRM/Case/Form/Activity.php index 0330fd32d8..57cce896cf 100644 --- a/CRM/Case/Form/Activity.php +++ b/CRM/Case/Form/Activity.php @@ -281,9 +281,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { $openCaseID = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name'); unset($aTypes[$openCaseID]); asort($aTypes); - $this->_fields['followup_activity_type_id']['attributes'] = array( - '' => '- select activity type -', - ) + $aTypes; + $this->_fields['followup_activity_type_id']['attributes'] = array('' => '- select activity type -') + $aTypes; } $result = parent::buildQuickForm(); diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 677d8c5766..8c1731f84c 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -113,7 +113,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { * @param array $params * (reference) an assoc array of name/value pairs. * - * @return CRM_Contact_BAO_Contact|CRM_Core_Error + * @return CRM_Contact_BAO_Contact|CRM_Core_Error|NULL * Created or updated contact object or error object. * (error objects are being phased out in favour of exceptions) */ @@ -121,7 +121,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { $contact = new CRM_Contact_DAO_Contact(); if (empty($params)) { - return; + return NULL; } // Fix for validate contact sub type CRM-5143. diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 333e201d09..60d15129f9 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -72,8 +72,6 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { * * @param int $id * Group id. - * - * @return NULL */ public static function discard($id) { CRM_Utils_Hook::pre('delete', 'Group', $id, CRM_Core_DAO::$_nullArray); diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index d7b9ba0672..a0c77f777d 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -390,8 +390,6 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { * Format in which labels needs to be printed. * @param string $fileName * The name of the file to save the label in. - * - * @return null */ public function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf') { $pdf = new CRM_Utils_PDF_Label($format, 'mm'); diff --git a/CRM/Contact/Page/View/Log.php b/CRM/Contact/Page/View/Log.php index bac1c3e9d1..7403765adc 100644 --- a/CRM/Contact/Page/View/Log.php +++ b/CRM/Contact/Page/View/Log.php @@ -47,7 +47,7 @@ class CRM_Contact_Page_View_Log extends CRM_Core_Page { $this->assign('instanceUrl', CRM_Utils_System::url("civicrm/report/instance/{$loggingReport}", "reset=1&force=1&snippet=4§ion=2&altered_contact_id_op=eq&altered_contact_id_value={$this->_contactId}&cid={$this->_contactId}", FALSE, NULL, FALSE)); - return; + return NULL; } $log = new CRM_Core_DAO_Log(); diff --git a/CRM/Contact/Page/View/Note.php b/CRM/Contact/Page/View/Note.php index 9fe235af33..5a5deeb949 100644 --- a/CRM/Contact/Page/View/Note.php +++ b/CRM/Contact/Page/View/Note.php @@ -81,8 +81,6 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page { /** * called when action is browse - * - * @return null */ public function browse() { $note = new CRM_Core_DAO_Note(); @@ -160,8 +158,6 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page { /** * called when action is update or new - * - * @return null */ public function edit() { $controller = new CRM_Core_Controller_Simple('CRM_Note_Form_Note', ts('Contact Notes'), $this->_action); diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index c5a8048902..de244c49ed 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -89,22 +89,13 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr 'amount_level' => CRM_Utils_Array::value('amount_level', $params), 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], - 'source' => - (!$online || !empty($params['source'])) ? - CRM_Utils_Array::value('source', $params) : - CRM_Utils_Array::value('description', $params), + 'source' => (!$online || !empty($params['source'])) ? CRM_Utils_Array::value('source', $params) : CRM_Utils_Array::value('description', $params), 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), //configure cancel reason, cancel date and thankyou date //from 'contribution' type profile if included 'cancel_reason' => CRM_Utils_Array::value('cancel_reason', $params, 0), - 'cancel_date' => - isset($params['cancel_date']) ? - CRM_Utils_Date::format($params['cancel_date']) : - NULL, - 'thankyou_date' => - isset($params['thankyou_date']) ? - CRM_Utils_Date::format($params['thankyou_date']) : - NULL, + 'cancel_date' => isset($params['cancel_date']) ? CRM_Utils_Date::format($params['cancel_date']) : NULL, + 'thankyou_date' => isset($params['thankyou_date']) ? CRM_Utils_Date::format($params['thankyou_date']) : NULL, 'campaign_id' => $campaignId, 'is_test' => $isTest, 'address_id' => $addressID, diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 4305fd3e85..093c72bd5e 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -49,12 +49,12 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { * * @param null $entity * - * @return array + * @return array|NULL * array of created address */ public static function create(&$params, $fixAddress = TRUE, $entity = NULL) { if (!isset($params['address']) || !is_array($params['address'])) { - return; + return NULL; } CRM_Core_BAO_Block::sortPrimaryFirst($params['address']); $addresses = array(); @@ -1247,7 +1247,7 @@ SELECT is_primary, * * @param string $fieldName * @param string $context - * @see CRM_Core_DAO::buildOptionsContext. + * @see CRM_Core_DAO::buildOptionsContext * @param array $props * whatever is known about this dao object. * diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 2f5806ca5b..9e00a72393 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1083,9 +1083,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @param object $field * The field object. - * - * @return boolean - * */ public static function deleteField($field) { CRM_Utils_System::flushCache(); @@ -1103,8 +1100,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $field->delete(); CRM_Core_BAO_UFField::delUFField($field->id); CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_CustomField'); - - return; } /** @@ -1577,7 +1572,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @param bool $includeViewOnly * If true, fields marked 'View Only' are included. Required for APIv3. * - * @return array + * @return array|NULL * formatted custom field array */ public static function formatCustomField( @@ -1620,7 +1615,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { // return if field is a 'code' field if (!$includeViewOnly && !empty($customFields[$customFieldId]['is_view'])) { - return; + return NULL; } list($tableName, $columnName, $groupID) = self::getTableColumnGroup($customFieldId); diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 4c71e19ec3..c65935f198 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -241,7 +241,7 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup { * * @param int $id * Id of the database record. - * @param bool $is_activeValue we want to set the is_active field. + * @param bool $is_active * Value we want to set the is_active field. * * @return Object @@ -796,8 +796,8 @@ ORDER BY civicrm_custom_group.weight, 'name' => ts('Delete Attached File'), 'url' => 'civicrm/file', 'qs' => 'reset=1&id=%%id%%&eid=%%eid%%&fid=%%fid%%&action=delete', - 'extra' => 'onclick = "if (confirm( \'' . $deleteExtra . - '\' ) ) this.href+=\'&confirmed=1\'; else return false;"', + 'extra' => 'onclick = "if (confirm( \'' . $deleteExtra + . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"', ), ); $customValue['deleteURL'] = CRM_Core_Action::formLink($deleteURL, @@ -1977,7 +1977,7 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1, //changed isset CRM-4601 if (CRM_Utils_System::isNull($value)) { - return; + return NULL; } $htmlType = CRM_Utils_Array::value('html_type', $field); @@ -2203,12 +2203,12 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1, * @param array $fieldIds * Array of custom field ids. * - * @return array + * @return array|NULL * array consisting of groups and fields labels with ids. */ public static function getGroupTitles($fieldIds) { if (!is_array($fieldIds) && empty($fieldIds)) { - return; + return NULL; } $groupLabels = array(); @@ -2250,12 +2250,12 @@ SELECT civicrm_custom_group.id as groupID, civicrm_custom_group.title as groupT * @param int $gID * Custom group id. * - * @return boolean + * @return bool|NULL * true if empty otherwise false. */ public static function isGroupEmpty($gID) { if (!$gID) { - return; + return NULL; } $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', diff --git a/CRM/Core/BAO/Discount.php b/CRM/Core/BAO/Discount.php index 0cacf3a42e..496b8cf21d 100644 --- a/CRM/Core/BAO/Discount.php +++ b/CRM/Core/BAO/Discount.php @@ -83,7 +83,7 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount { * Determine whether the given table/id * has discount associated with it * - * @param int $entityIdEntity id to be searched. + * @param int $entityId * Entity id to be searched. * @param string $entityTable * Entity table to be searched. diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 9aee8a8933..4f35d1ab3b 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -388,10 +388,11 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * * access public * - * @return array + * @return array|NULL * reference to the array of default values */ public function setDefaultValues() { + return NULL; } /** @@ -1276,20 +1277,23 @@ class CRM_Core_Form extends HTML_QuickForm_Page { /** * Add date - * @param string $name - * Name of the element. - * @param string $label - * Label of the element. - * @param array $attributes - * Key / value pair. * + * @code * // if you need time * $attributes = array( * 'addTime' => true, * 'formatType' => 'relative' or 'birth' etc check advanced date settings * ); + * @endcode + * + * @param string $name + * Name of the element. + * @param string $label + * Label of the element. * @param bool $required * True if required. + * @param array $attributes + * Key / value pair. */ public function addDate($name, $label, $required = FALSE, $attributes = NULL) { if (!empty($attributes['formatType'])) { diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index 02d6be9972..743b5baadb 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -235,8 +235,8 @@ class CRM_Core_Form_RecurringEntity { /** * Global validation rules for the form * - * @param array $fields - * Posted values of the form . + * @param array $values + * Posted values of the form. * * @return array * list of errors to be posted back to the form diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index aaa911a2fb..f0f0499009 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -792,7 +792,7 @@ LIMIT 1;"; * it is unclear whether it is a function on the way in or on the way out * * @param array $params - * @return void|int + * @return void|NULL|int */ public function updateContributionStatus(&$params) { // get minimum required values. @@ -802,7 +802,7 @@ LIMIT 1;"; $contributionId = CRM_Utils_Array::value('contribution_id', $params); if (!$contributionId || !$componentId || !$componentName || !$statusId) { - return; + return NULL; } $input = $ids = $objects = array(); diff --git a/CRM/Core/Payment/PaymentExpress.php b/CRM/Core/Payment/PaymentExpress.php index 7cf9e374d1..91c3b2f6bd 100644 --- a/CRM/Core/Payment/PaymentExpress.php +++ b/CRM/Core/Payment/PaymentExpress.php @@ -129,7 +129,7 @@ class CRM_Core_Payment_PaymentExpress extends CRM_Core_Payment { * @param array $params * Assoc array of input parameters for this transaction. * - * @return array + * @return array|NULL * the result in an nice formatted array (or an error object) * @abstract */ diff --git a/CRM/Core/Report/Excel.php b/CRM/Core/Report/Excel.php index b18d509312..04a51a80d7 100644 --- a/CRM/Core/Report/Excel.php +++ b/CRM/Core/Report/Excel.php @@ -43,9 +43,8 @@ class CRM_Core_Report_Excel { * @param string $rows * (reference ) result set rows. * @param null $titleHeader - * @param bool $printShould the output be printed. + * @param bool $print * Should the output be printed. - * * @param bool $outputHeader * * @return mixed diff --git a/CRM/Core/Smarty/plugins/function.docURL.php b/CRM/Core/Smarty/plugins/function.docURL.php index b23152ed0e..dea7d73228 100644 --- a/CRM/Core/Smarty/plugins/function.docURL.php +++ b/CRM/Core/Smarty/plugins/function.docURL.php @@ -42,12 +42,12 @@ * @param CRM_Core_Smarty $smarty * Reference to the smarty object. * - * @return string + * @return string|NULL * HTML code of a link to documentation */ function smarty_function_docURL($params, &$smarty) { if (!isset($smarty)) { - return; + return NULL; } else { return CRM_Utils_System::docURL($params); diff --git a/CRM/Core/Smarty/plugins/function.help.php b/CRM/Core/Smarty/plugins/function.help.php index 68dc0c7763..d070f3e939 100644 --- a/CRM/Core/Smarty/plugins/function.help.php +++ b/CRM/Core/Smarty/plugins/function.help.php @@ -46,7 +46,7 @@ */ function smarty_function_help($params, &$smarty) { if (!isset($params['id']) || !isset($smarty->_tpl_vars['config'])) { - return; + return NULL; } if (empty($params['file']) && isset($smarty->_tpl_vars['tplFile'])) { diff --git a/CRM/Core/Smarty/plugins/modifier.substring.php b/CRM/Core/Smarty/plugins/modifier.substring.php index cf52f34403..8c6cd75059 100644 --- a/CRM/Core/Smarty/plugins/modifier.substring.php +++ b/CRM/Core/Smarty/plugins/modifier.substring.php @@ -33,28 +33,28 @@ * */ -/* - * Smarty plugin - * Type: modifier - * Name: substring - * Version: 0.1 - * Date: 2006-16-02 - * Author: Thorsten Albrecht - * Purpose: "substring" allows you to retrieve a small part (substring) of a string. - * Notes: The substring is specified by giving the start position and the length. - * Unlike the original function substr() in PHP the position of the characters - * in the string starts at 1 (not at 0 as usual in php). - * Example smarty code: - * {$my_string|substring:2:4} - * returns substring from character 2 until character 6 - * @link based on substr(): http://www.zend.com/manual/function.substr.php - * @param string - * @param position: startposition of the substring, beginning with 0 - * @param length: length of substring - * @return string - * - * ------------------------------------------------------------- - */ +/** + * Smarty plugin + * Type: modifier + * Name: substring + * Version: 0.1 + * Date: 2006-16-02 + * Author: Thorsten Albrecht + * Purpose: "substring" allows you to retrieve a small part (substring) of a string. + * Notes: The substring is specified by giving the start position and the length. + * Unlike the original function substr() in PHP the position of the characters + * in the string starts at 1 (not at 0 as usual in php). + * Example smarty code: + * {$my_string|substring:2:4} + * returns substring from character 2 until character 6 + * @link based on substr(): http://www.zend.com/manual/function.substr.php + * @param string + * @param position: startposition of the substring, beginning with 0 + * @param length: length of substring + * @return string + * + * ------------------------------------------------------------- + */ function smarty_modifier_substring($string, $position, $length) { return substr($string, $position, $length); } diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index f1171b0063..32a611db0b 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -750,29 +750,32 @@ GROUP BY participant.event_id 'title' => 'Participant Note', 'name' => 'participant_note', 'type' => CRM_Utils_Type::T_STRING, - )); + ), + ); - $participantStatus = array( + $participantStatus = array( 'participant_status' => array( 'title' => 'Participant Status', 'name' => 'participant_status', 'type' => CRM_Utils_Type::T_STRING, - )); + ), + ); - $participantRole = array( + $participantRole = array( 'participant_role' => array( 'title' => 'Participant Role', 'name' => 'participant_role', 'type' => CRM_Utils_Type::T_STRING, - )); + ), + ); - $discountFields = CRM_Core_DAO_Discount::export(); + $discountFields = CRM_Core_DAO_Discount::export(); - $fields = array_merge($participantFields, $participantStatus, $participantRole, $eventFields, $noteField, $discountFields); + $fields = array_merge($participantFields, $participantStatus, $participantRole, $eventFields, $noteField, $discountFields); - // add custom data - $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant')); - self::$_exportableFields = $fields; + // add custom data + $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant')); + self::$_exportableFields = $fields; } return self::$_exportableFields; @@ -915,11 +918,11 @@ WHERE civicrm_participant.id = {$participantId} /** * Checks duplicate participants * - * @param array $duplicates - * (reference ) an assoc array of name/value pairs. * @param array $input * An assosiative array of name /value pairs. * from other function + * @param array $duplicates + * (reference ) an assoc array of name/value pairs. * * @return CRM_Contribute_BAO_Contribution */ @@ -1148,11 +1151,11 @@ INNER JOIN civicrm_price_field_value value ON ( value.id = lineItem.price_field_ * @param int $newStatusID * @param bool $updatePrimaryStatus * - * @return bool|void + * @return bool|NULL */ public static function updateParticipantStatus($participantID, $oldStatusID, $newStatusID = NULL, $updatePrimaryStatus = FALSE) { if (!$participantID || !$oldStatusID) { - return; + return NULL; } if (!$newStatusID) { @@ -1223,14 +1226,14 @@ UPDATE civicrm_participant * @param bool $returnResult * @param bool $skipCascadeRule * - * @return array + * @return array|NULL */ public static function transitionParticipants( $participantIds, $toStatusId, $fromStatusId = NULL, $returnResult = FALSE, $skipCascadeRule = FALSE ) { if (!is_array($participantIds) || empty($participantIds) || !$toStatusId) { - return; + return NULL; } //thumb rule is if we triggering primary participant need to triggered additional @@ -2160,7 +2163,7 @@ WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantI * * @param string $fieldName * @param string $context - * @see CRM_Core_DAO::buildOptionsContext. + * @see CRM_Core_DAO::buildOptionsContext * @param array $props * whatever is known about this dao object. * diff --git a/CRM/Logging/Reverter.php b/CRM/Logging/Reverter.php index d2dfd18bea..b307a84579 100644 --- a/CRM/Logging/Reverter.php +++ b/CRM/Logging/Reverter.php @@ -116,7 +116,7 @@ class CRM_Logging_Reverter { // DAO-based tables case in_array($table, array_keys($daos)): - $dao = new $daos[$table]; + $dao = new $daos[$table](); foreach ($row as $id => $changes) { $dao->id = $id; foreach ($changes as $field => $value) { diff --git a/CRM/Mailing/Form/Browse.php b/CRM/Mailing/Form/Browse.php index a1ef35516d..f8e714d1ab 100644 --- a/CRM/Mailing/Form/Browse.php +++ b/CRM/Mailing/Form/Browse.php @@ -71,7 +71,6 @@ class CRM_Mailing_Form_Browse extends CRM_Core_Form { * * @return void */ - public function buildQuickForm() { $this->addButtons(array( array( diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index e9badb2211..e09cb847df 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -59,233 +59,233 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { asort($this->activeCampaigns); } $this->_columns = array( - 'civicrm_contact' => array( - 'dao' => 'CRM_Contact_DAO_Contact', - 'fields' => array( - 'sort_name' => array( - 'title' => ts('Donor Name'), - 'required' => TRUE, - ), - 'first_name' => array( - 'title' => ts('First Name'), - ), - 'last_name' => array( - 'title' => ts('Last Name'), - ), - 'id' => array( - 'no_display' => TRUE, - 'required' => TRUE, - ), - 'contact_type' => array( - 'title' => ts('Contact Type'), - ), - 'contact_sub_type' => array( - 'title' => ts('Contact Subtype'), - ), + 'civicrm_contact' => array( + 'dao' => 'CRM_Contact_DAO_Contact', + 'fields' => array( + 'sort_name' => array( + 'title' => ts('Donor Name'), + 'required' => TRUE, ), - 'filters' => array( - 'sort_name' => array( - 'title' => ts('Donor Name'), - 'operator' => 'like', - ), - 'id' => array( - 'title' => ts('Contact ID'), - 'no_display' => TRUE, - 'type' => CRM_Utils_Type::T_INT, - ), + 'first_name' => array( + 'title' => ts('First Name'), ), - 'order_bys' => array( - 'sort_name' => array( - 'title' => ts('Last Name, First Name'), - 'default' => '1', - 'default_weight' => '0', - 'default_order' => 'ASC', - ), + 'last_name' => array( + 'title' => ts('Last Name'), + ), + 'id' => array( + 'no_display' => TRUE, + 'required' => TRUE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), ), - 'grouping' => 'contact-fields', ), - 'civicrm_email' => array( - 'dao' => 'CRM_Core_DAO_Email', - 'fields' => array( - 'email' => array( - 'title' => ts('Donor Email'), - 'default' => TRUE, - ), + 'filters' => array( + 'sort_name' => array( + 'title' => ts('Donor Name'), + 'operator' => 'like', + ), + 'id' => array( + 'title' => ts('Contact ID'), + 'no_display' => TRUE, + 'type' => CRM_Utils_Type::T_INT, ), - 'grouping' => 'contact-fields', ), - 'civicrm_phone' => array( - 'dao' => 'CRM_Core_DAO_Phone', - 'fields' => array( - 'phone' => array( - 'title' => ts('Donor Phone'), - 'default' => TRUE, - 'no_repeat' => TRUE, - ), + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', ), - 'grouping' => 'contact-fields', ), - 'civicrm_contribution' => array( - 'dao' => 'CRM_Contribute_DAO_Contribution', - 'fields' => array( - 'contribution_id' => array( - 'name' => 'id', - 'no_display' => TRUE, - 'required' => TRUE, - ), - 'list_contri_id' => array( - 'name' => 'id', - 'title' => ts('Contribution ID'), - ), - 'financial_type_id' => array( - 'title' => ts('Financial Type'), - 'default' => TRUE, - ), - 'contribution_status_id' => array( - 'title' => ts('Contribution Status'), - ), - 'contribution_page_id' => array( - 'title' => ts('Contribution Page'), - ), - 'source' => array( - 'title' => ts('Source'), - ), - 'payment_instrument_id' => array( - 'title' => ts('Payment Type'), - ), - 'check_number' => array( - 'title' => ts('Check Number'), - ), - 'currency' => array( - 'required' => TRUE, - 'no_display' => TRUE, - ), - 'trxn_id' => NULL, - 'receive_date' => array('default' => TRUE), - 'receipt_date' => NULL, - 'total_amount' => array( - 'title' => ts('Amount'), - 'required' => TRUE, - 'statistics' => array('sum' => ts('Amount')), - ), - 'fee_amount' => NULL, - 'net_amount' => NULL, - 'contribution_or_soft' => array( - 'title' => ts('Contribution OR Soft Credit?'), - 'dbAlias' => "'Contribution'", - ), - 'soft_credits' => array( - 'title' => ts('Soft Credits'), - 'dbAlias' => "NULL", - ), - 'soft_credit_for' => array( - 'title' => ts('Soft Credit For'), - 'dbAlias' => "NULL", - ), + 'grouping' => 'contact-fields', + ), + 'civicrm_email' => array( + 'dao' => 'CRM_Core_DAO_Email', + 'fields' => array( + 'email' => array( + 'title' => ts('Donor Email'), + 'default' => TRUE, ), - 'filters' => array( - 'contribution_or_soft' => array( - 'title' => ts('Contribution OR Soft Credit?'), - 'clause' => "(1)", - 'operatorType' => CRM_Report_Form::OP_SELECT, - 'type' => CRM_Utils_Type::T_STRING, - 'options' => array( - 'both' => ts('Both'), - 'contributions_only' => ts('Contributions Only'), - 'soft_credits_only' => ts('Soft Credits Only'), - ), - ), - 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), - 'currency' => array( - 'title' => 'Currency', - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), - 'default' => NULL, - 'type' => CRM_Utils_Type::T_STRING, - ), - 'financial_type_id' => array( - 'title' => ts('Financial Type'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::financialType(), - 'type' => CRM_Utils_Type::T_INT, - ), - 'contribution_page_id' => array( - 'title' => ts('Contribution Page'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::contributionPage(), - 'type' => CRM_Utils_Type::T_INT, - ), - 'payment_instrument_id' => array( - 'title' => ts('Payment Type'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::paymentInstrument(), - 'type' => CRM_Utils_Type::T_INT, - ), - 'contribution_status_id' => array( - 'title' => ts('Contribution Status'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), - 'default' => array(1), - 'type' => CRM_Utils_Type::T_INT, - ), - 'total_amount' => array('title' => ts('Contribution Amount')), + ), + 'grouping' => 'contact-fields', + ), + 'civicrm_phone' => array( + 'dao' => 'CRM_Core_DAO_Phone', + 'fields' => array( + 'phone' => array( + 'title' => ts('Donor Phone'), + 'default' => TRUE, + 'no_repeat' => TRUE, + ), + ), + 'grouping' => 'contact-fields', + ), + 'civicrm_contribution' => array( + 'dao' => 'CRM_Contribute_DAO_Contribution', + 'fields' => array( + 'contribution_id' => array( + 'name' => 'id', + 'no_display' => TRUE, + 'required' => TRUE, + ), + 'list_contri_id' => array( + 'name' => 'id', + 'title' => ts('Contribution ID'), + ), + 'financial_type_id' => array( + 'title' => ts('Financial Type'), + 'default' => TRUE, + ), + 'contribution_status_id' => array( + 'title' => ts('Contribution Status'), + ), + 'contribution_page_id' => array( + 'title' => ts('Contribution Page'), + ), + 'source' => array( + 'title' => ts('Source'), + ), + 'payment_instrument_id' => array( + 'title' => ts('Payment Type'), + ), + 'check_number' => array( + 'title' => ts('Check Number'), + ), + 'currency' => array( + 'required' => TRUE, + 'no_display' => TRUE, + ), + 'trxn_id' => NULL, + 'receive_date' => array('default' => TRUE), + 'receipt_date' => NULL, + 'total_amount' => array( + 'title' => ts('Amount'), + 'required' => TRUE, + 'statistics' => array('sum' => ts('Amount')), ), - 'order_bys' => array( - 'financial_type_id' => array('title' => ts('Financial Type')), - 'contribution_status_id' => array('title' => ts('Contribution Status')), - 'payment_instrument_id' => array('title' => ts('Payment Instrument')), - 'receive_date' => array('title' => ts('Receive Date')), + 'fee_amount' => NULL, + 'net_amount' => NULL, + 'contribution_or_soft' => array( + 'title' => ts('Contribution OR Soft Credit?'), + 'dbAlias' => "'Contribution'", + ), + 'soft_credits' => array( + 'title' => ts('Soft Credits'), + 'dbAlias' => "NULL", + ), + 'soft_credit_for' => array( + 'title' => ts('Soft Credit For'), + 'dbAlias' => "NULL", ), - 'grouping' => 'contri-fields', ), - 'civicrm_contribution_soft' => array( - 'dao' => 'CRM_Contribute_DAO_ContributionSoft', - 'fields' => array( - 'soft_credit_type_id' => array('title' => ts('Soft Credit Type')), - ), - 'filters' => array( - 'soft_credit_type_id' => array( - 'title' => 'Soft Credit Type', - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), - 'default' => NULL, - 'type' => CRM_Utils_Type::T_STRING, + 'filters' => array( + 'contribution_or_soft' => array( + 'title' => ts('Contribution OR Soft Credit?'), + 'clause' => "(1)", + 'operatorType' => CRM_Report_Form::OP_SELECT, + 'type' => CRM_Utils_Type::T_STRING, + 'options' => array( + 'both' => ts('Both'), + 'contributions_only' => ts('Contributions Only'), + 'soft_credits_only' => ts('Soft Credits Only'), ), ), + 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), + 'currency' => array( + 'title' => 'Currency', + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), + 'default' => NULL, + 'type' => CRM_Utils_Type::T_STRING, + ), + 'financial_type_id' => array( + 'title' => ts('Financial Type'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::financialType(), + 'type' => CRM_Utils_Type::T_INT, + ), + 'contribution_page_id' => array( + 'title' => ts('Contribution Page'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::contributionPage(), + 'type' => CRM_Utils_Type::T_INT, + ), + 'payment_instrument_id' => array( + 'title' => ts('Payment Type'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::paymentInstrument(), + 'type' => CRM_Utils_Type::T_INT, + ), + 'contribution_status_id' => array( + 'title' => ts('Contribution Status'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), + 'default' => array(1), + 'type' => CRM_Utils_Type::T_INT, + ), + 'total_amount' => array('title' => ts('Contribution Amount')), ), - 'civicrm_contribution_ordinality' => array( - 'dao' => 'CRM_Contribute_DAO_Contribution', - 'alias' => 'cordinality', - 'filters' => array( - 'ordinality' => array( - 'title' => ts('Contribution Ordinality'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => array( - 0 => 'First by Contributor', - 1 => 'Second or Later by Contributor', - ), - 'type' => CRM_Utils_Type::T_INT, - ), + 'order_bys' => array( + 'financial_type_id' => array('title' => ts('Financial Type')), + 'contribution_status_id' => array('title' => ts('Contribution Status')), + 'payment_instrument_id' => array('title' => ts('Payment Instrument')), + 'receive_date' => array('title' => ts('Receive Date')), + ), + 'grouping' => 'contri-fields', + ), + 'civicrm_contribution_soft' => array( + 'dao' => 'CRM_Contribute_DAO_ContributionSoft', + 'fields' => array( + 'soft_credit_type_id' => array('title' => ts('Soft Credit Type')), + ), + 'filters' => array( + 'soft_credit_type_id' => array( + 'title' => 'Soft Credit Type', + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), + 'default' => NULL, + 'type' => CRM_Utils_Type::T_STRING, ), ), - 'civicrm_note' => array( - 'dao' => 'CRM_Core_DAO_Note', - 'fields' => array( - 'contribution_note' => array( - 'name' => 'note', - 'title' => ts('Contribution Note'), - ), + ), + 'civicrm_contribution_ordinality' => array( + 'dao' => 'CRM_Contribute_DAO_Contribution', + 'alias' => 'cordinality', + 'filters' => array( + 'ordinality' => array( + 'title' => ts('Contribution Ordinality'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => array( + 0 => 'First by Contributor', + 1 => 'Second or Later by Contributor', + ), + 'type' => CRM_Utils_Type::T_INT, ), - 'filters' => array( - 'note' => array( - 'name' => 'note', - 'title' => ts('Contribution Note'), - 'operator' => 'like', - 'type' => CRM_Utils_Type::T_STRING, - ), + ), + ), + 'civicrm_note' => array( + 'dao' => 'CRM_Core_DAO_Note', + 'fields' => array( + 'contribution_note' => array( + 'name' => 'note', + 'title' => ts('Contribution Note'), + ), + ), + 'filters' => array( + 'note' => array( + 'name' => 'note', + 'title' => ts('Contribution Note'), + 'operator' => 'like', + 'type' => CRM_Utils_Type::T_STRING, ), ), - ) + $this->addAddressFields(FALSE); + ), + ) + $this->addAddressFields(FALSE); $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index 51cf41d266..5361a4e22a 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -45,8 +45,6 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); - /** - */ /** */ public function __construct() { @@ -61,186 +59,186 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { } $this->_columns = array( - 'civicrm_contact' => array( - 'dao' => 'CRM_Contact_DAO_Contact', - 'fields' => array( - 'sort_name' => array( - 'title' => ts('Contact Name'), - 'no_repeat' => TRUE, - ), - 'postal_greeting_display' => array('title' => ts('Postal Greeting')), - 'id' => array( - 'no_display' => TRUE, - 'required' => TRUE, - ), - 'contact_type' => array( - 'title' => ts('Contact Type'), - ), - 'contact_sub_type' => array( - 'title' => ts('Contact Subtype'), - ), + 'civicrm_contact' => array( + 'dao' => 'CRM_Contact_DAO_Contact', + 'fields' => array( + 'sort_name' => array( + 'title' => ts('Contact Name'), + 'no_repeat' => TRUE, ), - 'grouping' => 'contact-fields', - 'group_bys' => array( - 'id' => array('title' => ts('Contact ID')), - 'sort_name' => array( - 'title' => ts('Contact Name'), - ), + 'postal_greeting_display' => array('title' => ts('Postal Greeting')), + 'id' => array( + 'no_display' => TRUE, + 'required' => TRUE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), ), ), - 'civicrm_email' => array( - 'dao' => 'CRM_Core_DAO_Email', - 'fields' => array( - 'email' => array( - 'title' => ts('Email'), - 'no_repeat' => TRUE, - ), + 'grouping' => 'contact-fields', + 'group_bys' => array( + 'id' => array('title' => ts('Contact ID')), + 'sort_name' => array( + 'title' => ts('Contact Name'), ), - 'grouping' => 'contact-fields', ), - 'civicrm_phone' => array( - 'dao' => 'CRM_Core_DAO_Phone', - 'fields' => array( - 'phone' => array( - 'title' => ts('Phone'), - 'no_repeat' => TRUE, - ), + ), + 'civicrm_email' => array( + 'dao' => 'CRM_Core_DAO_Email', + 'fields' => array( + 'email' => array( + 'title' => ts('Email'), + 'no_repeat' => TRUE, ), - 'grouping' => 'contact-fields', ), - 'civicrm_financial_type' => array( - 'dao' => 'CRM_Financial_DAO_FinancialType', - 'fields' => array('financial_type' => NULL), - 'grouping' => 'contri-fields', - 'group_bys' => array( - 'financial_type' => array('title' => ts('Financial Type')), + 'grouping' => 'contact-fields', + ), + 'civicrm_phone' => array( + 'dao' => 'CRM_Core_DAO_Phone', + 'fields' => array( + 'phone' => array( + 'title' => ts('Phone'), + 'no_repeat' => TRUE, ), ), - 'civicrm_contribution' => array( - 'dao' => 'CRM_Contribute_DAO_Contribution', + 'grouping' => 'contact-fields', + ), + 'civicrm_financial_type' => array( + 'dao' => 'CRM_Financial_DAO_FinancialType', + 'fields' => array('financial_type' => NULL), + 'grouping' => 'contri-fields', + 'group_bys' => array( + 'financial_type' => array('title' => ts('Financial Type')), + ), + ), + 'civicrm_contribution' => array( + 'dao' => 'CRM_Contribute_DAO_Contribution', //'bao' => 'CRM_Contribute_BAO_Contribution', - 'fields' => array( - 'contribution_source' => array('title' => ts('Source')), - 'currency' => array( - 'required' => TRUE, - 'no_display' => TRUE, - ), - 'total_amount' => array( - 'title' => ts('Contribution Amount Stats'), - 'default' => TRUE, - 'statistics' => array( - 'sum' => ts('Contribution Aggregate'), - 'count' => ts('Contributions'), - 'avg' => ts('Contribution Avg'), - ), - ), + 'fields' => array( + 'contribution_source' => array('title' => ts('Source')), + 'currency' => array( + 'required' => TRUE, + 'no_display' => TRUE, ), - 'grouping' => 'contri-fields', - 'filters' => array( - 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), - 'contribution_status_id' => array( - 'title' => ts('Contribution Status'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), - 'default' => array(1), - 'type' => CRM_Utils_Type::T_INT, - ), - 'currency' => array( - 'title' => 'Currency', - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), - 'default' => NULL, - 'type' => CRM_Utils_Type::T_STRING, - ), - 'financial_type_id' => array( - 'title' => ts('Financial Type'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::financialType(), - 'type' => CRM_Utils_Type::T_INT, - ), - 'contribution_page_id' => array( - 'title' => ts('Contribution Page'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::contributionPage(), - 'type' => CRM_Utils_Type::T_INT, - ), - 'total_amount' => array( - 'title' => ts('Contribution Amount'), - ), - 'total_sum' => array( - 'title' => ts('Contribution Aggregate'), - 'type' => CRM_Report_Form::OP_INT, - 'dbAlias' => 'civicrm_contribution_total_amount_sum', - 'having' => TRUE, - ), - 'total_count' => array( - 'title' => ts('Contribution Count'), - 'type' => CRM_Report_Form::OP_INT, - 'dbAlias' => 'civicrm_contribution_total_amount_count', - 'having' => TRUE, - ), - 'total_avg' => array( - 'title' => ts('Contribution Avg'), - 'type' => CRM_Report_Form::OP_INT, - 'dbAlias' => 'civicrm_contribution_total_amount_avg', - 'having' => TRUE, + 'total_amount' => array( + 'title' => ts('Contribution Amount Stats'), + 'default' => TRUE, + 'statistics' => array( + 'sum' => ts('Contribution Aggregate'), + 'count' => ts('Contributions'), + 'avg' => ts('Contribution Avg'), ), ), - 'group_bys' => array( - 'receive_date' => array( - 'frequency' => TRUE, - 'default' => TRUE, - 'chart' => TRUE, - ), - 'contribution_source' => NULL, + ), + 'grouping' => 'contri-fields', + 'filters' => array( + 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), + 'contribution_status_id' => array( + 'title' => ts('Contribution Status'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), + 'default' => array(1), + 'type' => CRM_Utils_Type::T_INT, + ), + 'currency' => array( + 'title' => 'Currency', + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), + 'default' => NULL, + 'type' => CRM_Utils_Type::T_STRING, + ), + 'financial_type_id' => array( + 'title' => ts('Financial Type'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::financialType(), + 'type' => CRM_Utils_Type::T_INT, + ), + 'contribution_page_id' => array( + 'title' => ts('Contribution Page'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::contributionPage(), + 'type' => CRM_Utils_Type::T_INT, + ), + 'total_amount' => array( + 'title' => ts('Contribution Amount'), + ), + 'total_sum' => array( + 'title' => ts('Contribution Aggregate'), + 'type' => CRM_Report_Form::OP_INT, + 'dbAlias' => 'civicrm_contribution_total_amount_sum', + 'having' => TRUE, + ), + 'total_count' => array( + 'title' => ts('Contribution Count'), + 'type' => CRM_Report_Form::OP_INT, + 'dbAlias' => 'civicrm_contribution_total_amount_count', + 'having' => TRUE, + ), + 'total_avg' => array( + 'title' => ts('Contribution Avg'), + 'type' => CRM_Report_Form::OP_INT, + 'dbAlias' => 'civicrm_contribution_total_amount_avg', + 'having' => TRUE, ), ), - 'civicrm_contribution_soft' => array( - 'dao' => 'CRM_Contribute_DAO_ContributionSoft', - 'fields' => array( - 'soft_amount' => array( - 'title' => ts('Soft Credit Amount Stats'), - 'name' => 'amount', - 'statistics' => array( - 'sum' => ts('Soft Credit Aggregate'), - 'count' => ts('Soft Credits'), - 'avg' => ts('Soft Credit Avg'), - ), - ), + 'group_bys' => array( + 'receive_date' => array( + 'frequency' => TRUE, + 'default' => TRUE, + 'chart' => TRUE, ), - 'grouping' => 'contri-fields', - 'filters' => array( - 'amount' => array( - 'title' => ts('Soft Credit Amount'), - ), - 'soft_credit_type_id' => array( - 'title' => 'Soft Credit Type', - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), - 'default' => NULL, - 'type' => CRM_Utils_Type::T_STRING, - ), - 'soft_sum' => array( - 'title' => ts('Soft Credit Aggregate'), - 'type' => CRM_Report_Form::OP_INT, - 'dbAlias' => 'civicrm_contribution_soft_soft_amount_sum', - 'having' => TRUE, - ), - 'soft_count' => array( - 'title' => ts('Soft Credits Count'), - 'type' => CRM_Report_Form::OP_INT, - 'dbAlias' => 'civicrm_contribution_soft_soft_amount_count', - 'having' => TRUE, - ), - 'soft_avg' => array( - 'title' => ts('Soft Credit Avg'), - 'type' => CRM_Report_Form::OP_INT, - 'dbAlias' => 'civicrm_contribution_soft_soft_amount_avg', - 'having' => TRUE, + 'contribution_source' => NULL, + ), + ), + 'civicrm_contribution_soft' => array( + 'dao' => 'CRM_Contribute_DAO_ContributionSoft', + 'fields' => array( + 'soft_amount' => array( + 'title' => ts('Soft Credit Amount Stats'), + 'name' => 'amount', + 'statistics' => array( + 'sum' => ts('Soft Credit Aggregate'), + 'count' => ts('Soft Credits'), + 'avg' => ts('Soft Credit Avg'), ), ), ), - ) + $this->addAddressFields(); + 'grouping' => 'contri-fields', + 'filters' => array( + 'amount' => array( + 'title' => ts('Soft Credit Amount'), + ), + 'soft_credit_type_id' => array( + 'title' => 'Soft Credit Type', + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), + 'default' => NULL, + 'type' => CRM_Utils_Type::T_STRING, + ), + 'soft_sum' => array( + 'title' => ts('Soft Credit Aggregate'), + 'type' => CRM_Report_Form::OP_INT, + 'dbAlias' => 'civicrm_contribution_soft_soft_amount_sum', + 'having' => TRUE, + ), + 'soft_count' => array( + 'title' => ts('Soft Credits Count'), + 'type' => CRM_Report_Form::OP_INT, + 'dbAlias' => 'civicrm_contribution_soft_soft_amount_count', + 'having' => TRUE, + ), + 'soft_avg' => array( + 'title' => ts('Soft Credit Avg'), + 'type' => CRM_Report_Form::OP_INT, + 'dbAlias' => 'civicrm_contribution_soft_soft_amount_avg', + 'having' => TRUE, + ), + ), + ), + ) + $this->addAddressFields(); // If we have a campaign, build out the relevant elements if ($campaignEnabled && !empty($this->activeCampaigns)) { diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index 196f63c944..78d937834c 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -63,101 +63,101 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { } $this->_columns = array( - 'civicrm_contact' => array( - 'dao' => 'CRM_Contact_DAO_Contact', - 'grouping' => 'contact-field', - 'fields' => array( - 'sort_name' => array( - 'title' => ts('Donor Name'), - 'required' => TRUE, - ), - 'first_name' => array( - 'title' => ts('First Name'), - ), - 'last_name' => array( - 'title' => ts('Last Name'), - ), - 'contact_type' => array( - 'title' => ts('Contact Type'), - ), - 'contact_sub_type' => array( - 'title' => ts('Contact Subtype'), - ), + 'civicrm_contact' => array( + 'dao' => 'CRM_Contact_DAO_Contact', + 'grouping' => 'contact-field', + 'fields' => array( + 'sort_name' => array( + 'title' => ts('Donor Name'), + 'required' => TRUE, ), - 'filters' => array( - 'sort_name' => array( - 'title' => ts('Donor Name'), - 'operator' => 'like', - ), + 'first_name' => array( + 'title' => ts('First Name'), + ), + 'last_name' => array( + 'title' => ts('Last Name'), + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), ), ), - 'civicrm_email' => array( - 'dao' => 'CRM_Core_DAO_Email', - 'grouping' => 'contact-field', - 'fields' => array( - 'email' => array( - 'title' => ts('Email'), - 'default' => TRUE, - ), + 'filters' => array( + 'sort_name' => array( + 'title' => ts('Donor Name'), + 'operator' => 'like', ), ), - 'civicrm_phone' => array( - 'dao' => 'CRM_Core_DAO_Phone', - 'grouping' => 'contact-field', - 'fields' => array( - 'phone' => array( - 'title' => ts('Phone'), - 'default' => TRUE, - ), + ), + 'civicrm_email' => array( + 'dao' => 'CRM_Core_DAO_Email', + 'grouping' => 'contact-field', + 'fields' => array( + 'email' => array( + 'title' => ts('Email'), + 'default' => TRUE, ), ), - ) - + $this->addAddressFields() - + array( - 'civicrm_contribution' => array( - 'dao' => 'CRM_Contribute_DAO_Contribution', - 'fields' => array( - 'contact_id' => array( - 'title' => ts('contactId'), - 'no_display' => TRUE, - 'required' => TRUE, - 'no_repeat' => TRUE, - ), - 'total_amount' => array( - 'title' => ts('Total Amount'), - 'no_display' => TRUE, - 'required' => TRUE, - 'no_repeat' => TRUE, - ), - 'receive_date' => array( - 'title' => ts('Year'), - 'no_display' => TRUE, - 'required' => TRUE, - 'no_repeat' => TRUE, - ), + ), + 'civicrm_phone' => array( + 'dao' => 'CRM_Core_DAO_Phone', + 'grouping' => 'contact-field', + 'fields' => array( + 'phone' => array( + 'title' => ts('Phone'), + 'default' => TRUE, + ), + ), + ), + ); + $this->_columns += $this->addAddressFields(); + $this->_columns += array( + 'civicrm_contribution' => array( + 'dao' => 'CRM_Contribute_DAO_Contribution', + 'fields' => array( + 'contact_id' => array( + 'title' => ts('contactId'), + 'no_display' => TRUE, + 'required' => TRUE, + 'no_repeat' => TRUE, + ), + 'total_amount' => array( + 'title' => ts('Total Amount'), + 'no_display' => TRUE, + 'required' => TRUE, + 'no_repeat' => TRUE, ), - 'filters' => array( - 'yid' => array( - 'name' => 'receive_date', - 'title' => ts('This Year'), - 'operatorType' => CRM_Report_Form::OP_SELECT, - 'options' => $optionYear, - 'default' => date('Y'), - ), - 'financial_type_id' => array( - 'title' => ts('Financial Type'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::financialType(), - ), - 'contribution_status_id' => array( - 'title' => ts('Contribution Status'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), - 'default' => array('1'), - ), + 'receive_date' => array( + 'title' => ts('Year'), + 'no_display' => TRUE, + 'required' => TRUE, + 'no_repeat' => TRUE, ), ), - ); + 'filters' => array( + 'yid' => array( + 'name' => 'receive_date', + 'title' => ts('This Year'), + 'operatorType' => CRM_Report_Form::OP_SELECT, + 'options' => $optionYear, + 'default' => date('Y'), + ), + 'financial_type_id' => array( + 'title' => ts('Financial Type'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::financialType(), + ), + 'contribution_status_id' => array( + 'title' => ts('Contribution Status'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), + 'default' => array('1'), + ), + ), + ), + ); // If we have a campaign, build out the relevant elements if ($campaignEnabled && !empty($this->activeCampaigns)) { diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index 8395807cc3..968bdf57e6 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -615,18 +615,14 @@ class CRM_UF_Form_Field extends CRM_Core_Form { /** * Validation rule for subtype. * - * @param array $groupType - * Contains all groupTypes. - * * @param string $fieldType * Type of field. - * + * @param array $groupType + * Contains all groupTypes. * @param array $errors - * - * @return array - * list of errors to be posted back to the form + * List of errors to be posted back to the form. */ - public static function formRuleSubType($fieldType, $groupType, $errors) { + public static function formRuleSubType($fieldType, $groupType, &$errors) { if (in_array($fieldType, array( 'Participant', 'Contribution', diff --git a/CRM/Utils/Cache/APCcache.php b/CRM/Utils/Cache/APCcache.php index c7a240478d..ea0a28164e 100644 --- a/CRM/Utils/Cache/APCcache.php +++ b/CRM/Utils/Cache/APCcache.php @@ -110,7 +110,8 @@ class CRM_Utils_Cache_APCcache { foreach ($keys as $key) { $name = $key['info']; - if ($prefix == substr($name, 0, $lp)) { // Ours? + if ($prefix == substr($name, 0, $lp)) { + // Ours? apc_delete($this->_prefix . $name); } } diff --git a/CRM/Utils/Weight.php b/CRM/Utils/Weight.php index 976c5bd46e..77d36873b6 100644 --- a/CRM/Utils/Weight.php +++ b/CRM/Utils/Weight.php @@ -303,7 +303,7 @@ class CRM_Utils_Weight { require_once str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php"; - $dao = new $daoName; + $dao = new $daoName(); $table = $dao->getTablename(); $fields = &$dao->fields(); $fieldlist = array_keys($fields); diff --git a/api/v3/Constant.php b/api/v3/Constant.php index ed59163a7b..5e379c7e54 100644 --- a/api/v3/Constant.php +++ b/api/v3/Constant.php @@ -183,12 +183,12 @@ function _civicrm_api3_constant_get_spec(&$params) { 'worldRegion', 'wysiwygEditor', ); - $params = (array( - 'name' => array( + $params = array( + 'name' => array( 'title' => 'Constant Name', 'name' => 'name', 'api.required' => 1, - 'options' => array_combine($options, $options), - )) + 'options' => array_combine($options, $options), + ), ); } diff --git a/api/v3/ContributionRecur.php b/api/v3/ContributionRecur.php index 459f0c2404..08b69df2d1 100644 --- a/api/v3/ContributionRecur.php +++ b/api/v3/ContributionRecur.php @@ -88,7 +88,6 @@ function civicrm_api3_contribution_recur_get($params) { * @return boolean * returns true is successfully cancelled */ - function civicrm_api3_contribution_recur_cancel($params) { civicrm_api3_verify_one_mandatory($params, NULL, array('id')); return CRM_Contribute_BAO_ContributionRecur::cancelRecurContribution($params['id'], CRM_Core_DAO::$_nullObject) ? civicrm_api3_create_success() : civicrm_api3_create_error(ts('Error while cancelling recurring contribution')); diff --git a/tests/phpunit/CRM/Core/ResourcesTest.php b/tests/phpunit/CRM/Core/ResourcesTest.php index 464ac2a238..1c69b36c72 100644 --- a/tests/phpunit/CRM/Core/ResourcesTest.php +++ b/tests/phpunit/CRM/Core/ResourcesTest.php @@ -84,6 +84,9 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { * } */ + /** + * Ensure that adding a script URL creates expected markup. + */ public function testAddScriptURL() { $this->res ->addScriptUrl('/whiz/foo%20bar.js', 0, 'testAddScriptURL') diff --git a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php index d034eead1f..5dd047fc16 100644 --- a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php +++ b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php @@ -378,7 +378,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("$name has been created.")); } - /* + /** * Webtest for CRM-12148 */ public function testSearchBuilderfinancialType() { @@ -433,7 +433,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent('6 Contacts'), 'Missing text: ' . '6 Contacts'); } - /* + /** * Webtest for CRM-12588 */ public function testSearchBuilderMembershipType() { diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index bb21ceeb5c..6ce910e490 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -262,6 +262,10 @@ class api_v3_ContributionTest extends CiviUnitTestCase { } ///////////////// civicrm_contribution_ + + /** + * Create an contribution_id=FALSE and financial_type_id=Donation. + */ public function testCreateEmptyContributionIDUseDonation() { $params = array( 'contribution_id' => FALSE, @@ -342,11 +346,10 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals(0, $lineItems['count']); } - /* + /** * Test checks that passing in line items suppresses the create mechanism */ public function testCreateContributionChainedLineItems() { - $params = array( 'contact_id' => $this->_individualId, 'receive_date' => '20120511', @@ -717,7 +720,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->contributionDelete($contributionId); } - /* + /** * Function tests that additional financial records are created when fee amount is recorded */ public function testCreateContributionWithFee() { @@ -856,7 +859,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->_checkFinancialRecords($contribution, 'payLater'); } - /* + /** * Function tests that additional financial records are created when online contribution with pending option * is created */ @@ -901,7 +904,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals('Check', $contribution['payment_instrument']); } - /* + /** * Function tests that line items, financial records are updated when contribution amount is changed */ public function testCreateUpdateContributionChangeTotal() { @@ -940,7 +943,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals('125.00', $fitemAmount); } - /* + /** * Function tests that line items, financial records are updated when pay later contribution is received */ public function testCreateUpdateContributionPayLater() { @@ -968,7 +971,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->_checkFinancialTrxn($contribution, 'payLater'); } - /* + /** * Function tests that financial records are updated when Payment Instrument is changed */ public function testCreateUpdateContributionPaymentInstrument() { @@ -993,7 +996,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->_checkFinancialTrxn($contribution, 'paymentInstrument', $instrumentId); } - /* + /** * Function tests that financial records are added when Contribution is Refunded */ public function testCreateUpdateContributionRefund() { @@ -1018,7 +1021,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->_checkFinancialItem($contribution['id'], 'refund'); } - /* + /** * Function tests invalid contribution status change */ public function testCreateUpdateContributionInValidStatusChange() { @@ -1040,7 +1043,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { } - /* + /** * Function tests that financial records are added when Pending Contribution is Canceled */ public function testCreateUpdateContributionCancelPending() { @@ -1065,7 +1068,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->_checkFinancialItem($contribution['id'], 'cancelPending'); } - /* + /** * Function tests that financial records are added when Financial Type is Changed */ public function testCreateUpdateContributionChangeFinancialType() { @@ -1101,8 +1104,11 @@ class api_v3_ContributionTest extends CiviUnitTestCase { )); $this->assertEquals(2, $contribution['contribution_status_id']); } - //To Update Contribution - //CHANGE: we require the API to do an incremental update + + /** + * To Update Contribution + * CHANGE: we require the API to do an incremental update + */ public function testCreateUpdateContribution() { $contributionID = $this->contributionCreate($this->_individualId, $this->_financialTypeId, 'idofsh', 212355); @@ -1171,6 +1177,10 @@ class api_v3_ContributionTest extends CiviUnitTestCase { } ///////////////// civicrm_contribution_delete methods + + /** + * Attempt (but fail) to delete a contribution without parameters. + */ public function testDeleteEmptyParamsContribution() { $params = array(); $this->callAPIFailure('contribution', 'delete', $params); diff --git a/tests/phpunit/api/v3/DomainTest.php b/tests/phpunit/api/v3/DomainTest.php index cc78516e20..3015a068e0 100644 --- a/tests/phpunit/api/v3/DomainTest.php +++ b/tests/phpunit/api/v3/DomainTest.php @@ -143,11 +143,10 @@ class api_v3_DomainTest extends CiviUnitTestCase { } ///////////////// civicrm_domain_create methods - /* + + /** * This test checks for a memory leak observed when doing 2 gets on current domain */ - - public function testGetCurrentDomainTwice() { $domain = $this->callAPISuccess('domain', 'getvalue', array( 'current_domain' => 1, diff --git a/tests/phpunit/api/v3/MembershipStatusTest.php b/tests/phpunit/api/v3/MembershipStatusTest.php index e03e3d4dee..3149530ef9 100644 --- a/tests/phpunit/api/v3/MembershipStatusTest.php +++ b/tests/phpunit/api/v3/MembershipStatusTest.php @@ -133,6 +133,10 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase { ///////////////// civicrm_membership_status_delete methods + + /** + * Attempt (and fail) to delete membership status without an parameters. + */ public function testDeleteEmptyParams() { $result = $this->callAPIFailure('membership_status', 'delete', array()); } diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index fa549353d1..a56149017b 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -932,10 +932,10 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { // create entities $baoObj1 = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD')); - $this->assertTrue(is_integer($baoObj1->id), 'check first id'); + $this->assertTrue(is_int($baoObj1->id), 'check first id'); $this->deletableTestObjects[$baoString][] = $baoObj1->id; $baoObj2 = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD')); - $this->assertTrue(is_integer($baoObj2->id), 'check second id'); + $this->assertTrue(is_int($baoObj2->id), 'check second id'); $this->deletableTestObjects[$baoString][] = $baoObj2->id; // fetch first by ID @@ -984,7 +984,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { } } - /** testing the _create **/ + /* ---- testing the _create ---- */ /** * @dataProvider toBeSkipped_create @@ -1407,7 +1407,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { while ($i < $count) { // create entities $baoObj = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD')); - $this->assertTrue(is_integer($baoObj->id), 'check first id'); + $this->assertTrue(is_int($baoObj->id), 'check first id'); $this->deletableTestObjects[$baoString][] = $baoObj->id; $baos[] = $baoObj; $i++; -- 2.25.1