CRM-18010: Ensure type of each report filters
authorWeb Access <rohan.katkar@webaccessglobal.com>
Wed, 10 Feb 2016 13:03:29 +0000 (18:33 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Wed, 10 Feb 2016 13:03:29 +0000 (18:33 +0530)
18 files changed:
CRM/Report/Form.php
CRM/Report/Form/Activity.php
CRM/Report/Form/ActivitySummary.php
CRM/Report/Form/Contact/CurrentEmployer.php
CRM/Report/Form/Contact/Relationship.php
CRM/Report/Form/Contribute/Bookkeeping.php
CRM/Report/Form/Contribute/History.php
CRM/Report/Form/Contribute/Repeat.php
CRM/Report/Form/Contribute/SoftCredit.php
CRM/Report/Form/Contribute/Sybunt.php
CRM/Report/Form/Contribute/TopDonor.php
CRM/Report/Form/Event/ParticipantListing.php
CRM/Report/Form/Mailing/Bounce.php
CRM/Report/Form/Member/ContributionDetail.php
CRM/Report/Form/Member/Lapse.php
CRM/Report/Form/Member/Summary.php
CRM/Report/Form/Pledge/Detail.php
CRM/Report/Form/Pledge/Pbnp.php

index 350ab376f20008b52170a3c180b9d69fc5a56a89..dd348ac5103c4a15b0032004158f186cccfd3eb8 100644 (file)
@@ -1665,6 +1665,7 @@ class CRM_Report_Form extends CRM_Core_Form {
           'tagid' => array(
             'name' => 'tag_id',
             'title' => ts('Tag'),
+            'type' => CRM_Utils_Type::T_INT,
             'tag' => TRUE,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => $contactTags,
@@ -1682,6 +1683,7 @@ class CRM_Report_Form extends CRM_Core_Form {
       'gid' => array(
         'name' => 'group_id',
         'title' => ts('Group'),
+        'type' => CRM_Utils_Type::T_INT,
         'operatorType' => CRM_Report_Form::OP_MULTISELECT,
         'group' => TRUE,
         'options' => CRM_Core_PseudoConstant::nestedGroup(),
@@ -1760,6 +1762,11 @@ class CRM_Report_Form extends CRM_Core_Form {
   public function whereClause(&$field, $op, $value, $min, $max) {
 
     $type = CRM_Utils_Type::typeToString(CRM_Utils_Array::value('type', $field));
+
+    // CRM-18010: Ensure type of each report filters
+    if (!$type) {
+      trigger_error('Type is not defined for field ' . $field['name'], E_USER_WARNING);
+    }
     $clause = NULL;
 
     switch ($op) {
index 672d16edcb5c42c6f80e6718306ec2e74c5ce459..a1500f9b566a6d1a56f331add441b1d449846e33 100644 (file)
@@ -250,6 +250,7 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
           ),
           'status_id' => array(
             'title' => ts('Activity Status'),
+            'type' => CRM_Utils_Type::T_STRING,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::activityStatus(),
           ),
index d31d5d80281ab896e03ca376b51cd6fdb7196d43..fd1da6cba9e9c614dd04d614683bac1569f07a40 100644 (file)
@@ -135,11 +135,13 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
           ),
           'status_id' => array(
             'title' => ts('Activity Status'),
+            'type' => CRM_Utils_Type::T_STRING,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::activityStatus(),
           ),
           'priority_id' => array(
             'title' => ts('Priority'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'),
           ),
index 56e003213d961f1879ef3bbed7c5d72856c60af8..94b258708628987187cf5d412c879b2fa59c2f1b 100644 (file)
@@ -192,11 +192,13 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form {
         'filters' => array(
           'country_id' => array(
             'title' => ts('Country'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::country(NULL, FALSE),
           ),
           'state_province_id' => array(
             'title' => ts('State/Province'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::stateProvince(),
           ),
@@ -209,6 +211,7 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form {
           'gid' => array(
             'name' => 'group_id',
             'title' => ts('Group'),
+            'type' => CRM_Utils_Type::T_INT,
             'group' => TRUE,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::staticGroup(),
index 92ef86431e17b60efb84d4f083e61def3688e889..79644b2deec19b4f53b57a0375f98e4e15fe3c03 100644 (file)
@@ -261,11 +261,13 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form {
         'filters' => array(
           'country_id' => array(
             'title' => ts('Country'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::country(),
           ),
           'state_province_id' => array(
             'title' => ts('State/Province'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::stateProvince(),
           ),
index b8e854fd2994de6403fc8f47dbe85c8b3fc3cf71..2e82d86456b1eef8b4bf935c117d2bd3d00af175 100644 (file)
@@ -190,11 +190,13 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
           ),
           'credit_accounting_code' => array(
             'title' => ts('Financial Account Code - Credit'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialAccount(NULL, NULL, 'accounting_code', 'accounting_code'),
           ),
           'debit_name' => array(
             'title' => ts('Financial Account Name - Debit'),
+            'type' => CRM_Utils_Type::T_STRING,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialAccount(),
             'name' => 'id',
@@ -202,6 +204,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
           ),
           'credit_name' => array(
             'title' => ts('Financial Account Name - Credit'),
+            'type' => CRM_Utils_Type::T_STRING,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialAccount(),
           ),
@@ -218,6 +221,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
         'filters' => array(
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(),
           ),
@@ -288,6 +292,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
         'filters' => array(
           'payment_instrument_id' => array(
             'title' => ts('Payment Method'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::paymentInstrument(),
           ),
index dd030e020f7e90656fbce7ad7c89d535abb57362..cbc2de59e86414192ecee5c3b9dc382a438ff235 100644 (file)
@@ -253,6 +253,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
           ),
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialType(),
           ),
index 4adb3cc61d5c037e0a5c28be9a6b8c54f632fb81..c4e844b44498784069c8cd046267df32110d2eed 100644 (file)
@@ -217,6 +217,7 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form {
           ),
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(),
           ),
index d5474f4703c48adfed58dd1542844174bb59b769..7a4afff37db37a88677b8aaeb0aa919e1414bc98 100644 (file)
@@ -218,6 +218,7 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form {
           'id' => array(
             'name' => 'id',
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(),
           ),
index b8a664b589e682eedfd912ab6d6ef1ca7448fd36..60d4ea9ce6b1b4053b974ea316996831a64ba174 100644 (file)
@@ -224,6 +224,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
           ),
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(),
           ),
index 1a515f4606579380c78fb439d427dcf0015e99f8..945c7074d5e38996cc2331edf3523acf37e84f8d 100644 (file)
@@ -139,10 +139,12 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
         'filters' => array(
           'sort_name' => array(
             'title' => ts('Participant Name'),
+            'type' => CRM_Utils_Type::T_STRING,
             'operator' => 'like',
           ),
           'id' => array(
             'title' => ts('Contact ID'),
+            'type' => CRM_Utils_Type::T_INT,
             'no_display' => TRUE,
           ),
           'birth_date' => array(
@@ -151,9 +153,11 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
           ),
           'contact_type' => array(
             'title' => ts('Contact Type'),
+            'type' => CRM_Utils_Type::T_STRING,
           ),
           'contact_sub_type' => array(
             'title' => ts('Contact Subtype'),
+            'type' => CRM_Utils_Type::T_STRING,
           ),
           'receive_date' => array(
             'default' => 'this.year',
@@ -174,6 +178,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
           'financial_type_id' => array(
             'name' => 'financial_type_id',
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(),
           ),
index b26974d4642bfb6b17a9a356aaef061b2800fcf9..5de0add791f7e0c4873b70bf0c1b0bf2608857fa 100644 (file)
@@ -217,6 +217,7 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
           'sid' => array(
             'name' => 'status_id',
             'title' => ts('Participant Status'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'),
           ),
@@ -278,6 +279,7 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
           'eid' => array(
             'name' => 'event_type_id',
             'title' => ts('Event Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_OptionGroup::values('event_type'),
           ),
@@ -331,6 +333,7 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
           ),
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialType(),
           ),
@@ -343,6 +346,7 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
           ),
           'payment_instrument_id' => array(
             'title' => ts('Payment Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::paymentInstrument(),
           ),
@@ -361,6 +365,7 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
           'price_field_value_id' => array(
             'name' => 'price_field_value_id',
             'title' => ts('Fee Level'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => $this->getPriceLevels(),
           ),
index cf7f8ce1bf27cc3286344edcca242af227df7561..4f8438a48b7c712fb44259cd1275901eb35bcb74 100644 (file)
@@ -137,6 +137,7 @@ class CRM_Report_Form_Mailing_Bounce extends CRM_Report_Form {
       'filters' => array(
         'bounce_reason' => array(
           'title' => ts('Bounce Reason'),
+          'type' => CRM_Utils_Type::T_STRING,
         ),
         'time_stamp' => array(
           'title' => ts('Bounce Date'),
index c2d2fe243f32ab142be68e529c4094eb1970ca09..8ead99bd24d9e761399ae15cab3ad653ff6b33ac 100644 (file)
@@ -195,6 +195,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
           'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE),
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialType(),
           ),
@@ -207,6 +208,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
           ),
           'payment_instrument_id' => array(
             'title' => ts('Payment Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::paymentInstrument(),
           ),
@@ -252,6 +254,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
         'filters' => array(
           'ordinality' => array(
             'title' => ts('Contribution Ordinality'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => array(
               0 => 'First by Contributor',
index 882342fe2b8deaec5dca702a93eab876b240f672..cc45121c13a243fa4675235ad8f6f2986df4aae5 100644 (file)
@@ -102,6 +102,7 @@ class CRM_Report_Form_Member_Lapse extends CRM_Report_Form {
           'tid' => array(
             'name' => 'id',
             'title' => ts('Membership Types'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Member_PseudoConstant::membershipType(),
           ),
index 56279ecb2830de420d0bdef72fb0152f205d8c01..99d5183705457bc2ccb85517c6d159e1eb35bcf0 100644 (file)
@@ -100,11 +100,13 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form {
           ),
           'membership_type_id' => array(
             'title' => ts('Membership Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Member_PseudoConstant::membershipType(),
           ),
           'status_id' => array(
             'title' => ts('Membership Status'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'),
           ),
index 3e8e93410701a12db70319519307be4ee434c35f..ddf69d413af2e673ab13903896cb5ab4e15b71e2 100644 (file)
@@ -155,11 +155,13 @@ class CRM_Report_Form_Pledge_Detail extends CRM_Report_Form {
           'sid' => array(
             'name' => 'status_id',
             'title' => ts('Pledge Status'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_OptionGroup::values('contribution_status'),
           ),
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialType(),
           ),
index 197866b5540c79bab470722068d707fc559dd63b..80d56f7a907c5f762cbde98278f0cbc005230ae3 100644 (file)
@@ -113,6 +113,7 @@ class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form {
           ),
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialType(),
           ),
@@ -165,6 +166,7 @@ class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form {
           'gid' => array(
             'name' => 'group_id',
             'title' => ts('Group'),
+            'type' => CRM_Utils_Type::T_INT,
             'group' => TRUE,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::staticGroup(),