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

Batch data entry does not allow pending contributions

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.7
    • Fix Version/s: 4.6
    • Component/s: None
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds

      Description

      I already reproduced this at:
      http://drupal.demo.civicrm.org/

      Steps to reproduce:
      1) Click menu "Contributions ... Batch Data Entry" then click button labeled "New Data Entry Batch"

      2) Set the batch type as "Contribution", then fill in any name, any number of items, and any amount. ( I choose 2 transactions totaling $10)

      3) Fill in a valid contact, amount and date for each contribution row. (I filled in each amount as $5 so the total would match the expected $10)

      4) Change contribution status to "Pending"

      5) At the bottom of the screen, click the button "Save and Continue Later"

      6) Click menu "Contributions ... Batch Data Entry" then click the link "Enter Records" for the batch started in step 2 above.

      7) Click the button "Validate and process the batch"

      You will now see the database error.
      Stack trace is:
      backTrace

      #0 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/Error.php(149): CRM_Core_Error::backtrace()
      #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
      #2 /home/dev1/public_html/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
      #3 /home/dev1/public_html/sites/all/modules/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: already exists", -5, 16, (Array:2), "INSERT INTO civicrm_entity_batch (entity_table , batch_id ) VALUES ('civicrm_...")
      #4 /home/dev1/public_html/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-5, 16, (Array:2), "INSERT INTO civicrm_entity_batch (entity_table , batch_id ) VALUES ('civicrm_...")
      #5 /home/dev1/public_html/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -5, NULL, NULL, "INSERT INTO civicrm_entity_batch (entity_table , batch_id ) VALUES ('civicrm_...", "DB_Error", TRUE)
      #6 /home/dev1/public_html/sites/all/modules/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-5, NULL, NULL, NULL, "1062 ** Duplicate entry '19-0-civicrm_financial_trxn' for key 'UI_batch_entity'")
      #7 /home/dev1/public_html/sites/all/modules/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
      #8 /home/dev1/public_html/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_entity_batch (entity_table , batch_id ) VALUES ('civicrm_...")
      #9 /home/dev1/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("INSERT INTO civicrm_entity_batch (entity_table , batch_id ) VALUES ('civicrm_...")
      #10 /home/dev1/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(1055): DB_DataObject->query("INSERT INTO civicrm_entity_batch (entity_table , batch_id ) VALUES ('civicrm...")
      #11 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(278): DB_DataObject->insert()
      #12 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Batch/BAO/Batch.php(143): CRM_Core_DAO->save()
      #13 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(2686): CRM_Batch_BAO_Batch::addBatchEntity((Array:3))
      #14 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(176): CRM_Contribute_BAO_Contribution::recordFinancialAccounts((Array:21), (Array:0))
      #15 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(241): CRM_Contribute_BAO_Contribution::add((Array:21), (Array:0))
      #16 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Batch/Form/Entry.php(487): CRM_Contribute_BAO_Contribution::create((Array:21), (Array:0))
      #17 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Batch/Form/Entry.php(363): CRM_Batch_Form_Entry->processContribution((Array:13))
      #18 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/Form.php(261): CRM_Batch_Form_Entry->postProcess()
      #19 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(151): CRM_Core_Form->mainProcess()
      #20 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(128): CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Batch_Form_Entry), "upload")
      #21 /home/dev1/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Batch_Form_Entry), "upload")
      #22 /home/dev1/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Batch_Form_Entry), "upload")
      #23 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/Controller.php(339): HTML_QuickForm_Page->handle("upload")
      #24 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(117): CRM_Core_Controller->run()
      #25 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(297): CRM_Utils_Wrapper->run("CRM_Batch_Form_Entry", NULL, NULL)
      #26 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(72): CRM_Core_Invoke::runItem((Array:12))
      #27 /home/dev1/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
      #28 /home/dev1/public_html/sites/all/modules/civicrm/drupal/civicrm.module(405): CRM_Core_Invoke::invoke((Array:3))
      #29 [internal function](): civicrm_invoke("batch", "entry")
      #30 /home/dev1/public_html/includes/menu.inc(348): call_user_func_array("civicrm_invoke", (Array:2))
      #31 /home/dev1/public_html/index.php(18): menu_execute_active_handler()
      #32

      {main}

      I created a temporary patch in my environment by changing the file "CRM/Contribute/BAO/Contribution.php"

      I changed the line
      if (CRM_Utils_Array::value('contribution_status_id', $params) != array_search('Failed', $contributionStatuses) && !(CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', $contributionStatuses) && !$params['contribution']->is_pay_later)) {

      to the line:
      if (CRM_Utils_Array::value('contribution_status_id', $params) != array_search('Failed', $contributionStatuses) )
      {

      But I am worried about unintended side affects of my code change.

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              sgladstone Sarah Gladstone
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: