Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19045

Regression!!! total_amount cannot be returned using operators

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.9
    • Fix Version/s: 4.7.10
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Sprint:
      4.7.10 api
    • Funding Source:
      Contributed Code

      Description

      Failure can be demonstrated with this test.

      I haven't quite gotten to it but it seems to be adding LOWER('total_amount') - which may or may not be the problem but the mysql use of LOWER is incompatible with indexes and mysql is case insensitive anyway so we should NOT use LOWER unless we really really need to.

      Works in 4.6 - I think it maybe worked in 4.7.7 - but I think maybe not in 4.7.8?? I haven't identified the cause of the fail - although I have found a fix

        /**
         * Test retrieval by total_amount works.
         * 
         * @throws Exception
         */
        public function testGetContributionByTotalAmount() {
          $this->callAPISuccess('Contribution', 'create', array_merge($this->_params, array('total_amount' => '5')));
          $this->callAPISuccess('Contribution', 'create', array_merge($this->_params, array('total_amount' => '10')));
          $this->callAPISuccessGetCount('Contribution', array('total_amount' => 10), 1);
          $this->callAPISuccessGetCount('Contribution', array('total_amount' => array('>' => 6)), 1);
          $this->callAPISuccessGetCount('Contribution', array('total_amount' => array('>' => 0)), 2);
          $this->callAPISuccessGetCount('Contribution', array('total_amount' => array('>' => -5)), 2);
          $this->callAPISuccessGetCount('Contribution', array('total_amount' => array('<' => 0)), 0);
          $this->callAPISuccessGetCount('Contribution', array(), 2);
        }
      

        Attachments

          Activity

            People

            • Assignee:
              yashodha Yashodha Chaku
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: