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

Online contribution with membership option: fatal error if membership not selected

    Details

      Description

      Fatal error inserting line_item for online contribution (error details attached) if the contribution page is configured as follows:

      Amounts tab

      • Test (dummy) processor
      • Contribution Amounts section enabled TRUE
      • Allow other amounts TRUE
      • no Fixed Contribution Amounts defined

      Membership tab

      • Require Membership Signup FALSE
      • Separate Membership Payment FALSE

      ... and user does online contribution and says "No Thank You" for membership, and only fills in Additional Contribution amount.

      (see attachment 12018_4.2.txt for fatal error details on this)
      ===
      If I then add a few Fixed Contribution Amounts to the same online contribution page, and try again - I get this fatal:

      INSERT INTO civicrm_line_item (entity_table , entity_id , unit_price , line_total ) VALUES ('civicrm_contribution' , 101 , 500 , 500 ) [nativecode=1364 ** Field 'qty' doesn't have a default value]

      Backtrace:
      #13 /Users/dgg/git/crm_v4.3/CRM/Price/BAO/LineItem.php(291): CRM_Price_BAO_LineItem::create((Array:4))
      #14 /Users/dgg/git/crm_v4.3/CRM/Contribute/BAO/Contribution.php(2770): CRM_Price_BAO_LineItem::processPriceSet(101, (Array:1), Object(CRM_Contribute_BAO_Contribution), "civicrm_contribution", FALSE)
      #15 /Users/dgg/git/crm_v4.3/CRM/Contribute/BAO/Contribution.php(178): CRM_Contribute_BAO_Contribution::recordFinancialAccounts((Array:31), (Array:0))
      #16 /Users/dgg/git/crm_v4.3/CRM/Contribute/Form/Contribution/Confirm.php(1281): CRM_Contribute_BAO_Contribution::add((Array:31), (Array:0))
      #17 /Users/dgg/git/crm_v4.3/CRM/Contribute/BAO/Contribution/Utils.php(292): CRM_Contribute_Form_Contribution_Confirm::processContribution(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:52), (Array:51), "202", Object(CRM_Financial_DAO_FinancialType), TRUE, FALSE, TRUE)
      #18 /Users/dgg/git/crm_v4.3/CRM/Contribute/Form/Contribution/Confirm.php(939): CRM_Contribute_BAO_Contribution_Utils::processConfirm(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:51), (Array:37), "202", "1", "contribution", (Array:0))
      #19 /Users/dgg/git/crm_v4.3/CRM/Core/Form.php(246): CRM_Contribute_Form_Contribution_Confirm->postProcess()
      #
      — Original Post —
      to reproduce:

      create a contribution page.
      enable "other amount" option.
      enable membership options (may not be necessary).
      complete the form, selecting "no thanks" for membership options and entering an amount in the other field.
      on submit, you receive an FK constraint error on the civicrm_line_item table

      I think what's happening is that we're not creating the necessary hidden priceset line item for the other amount field. the breakdown occurs in:
      civicrm/CRM/Price/BAO/LineItem.php(65): CRM_Core_DAO->save()

      this is reproducible in both 4.2 and 4.3
      http://sandbox.drupal.civicrm.org/civicrm/contribute/transact?reset=1&id=4
      http://drupal.demo.civicrm.org/civicrm/contribute/transact?reset=1&id=6

        Attachments

        1. 12018_4.2.txt
          6 kB
          Brian Shaughnessy
        2. 12018_4.3.png
          33 kB
          Brian Shaughnessy
        3. 12018_4.3.txt
          1 kB
          Brian Shaughnessy
        4. Screen Shot 2013-03-05 at 5.33.41 PM.PNG
          127 kB
          David Greenberg
        5. Screen Shot 2013-03-05 at 5.34.20 PM.PNG
          172 kB
          David Greenberg
        6. Screen Shot 2013-03-05 at 5.53.12 PM.PNG
          55 kB
          David Greenberg
        7. Screen Shot 2013-03-05 at 5.58.16 PM.PNG
          58 kB
          David Greenberg
        8. Screen Shot 2013-03-07 at 4.48.29 PM.PNG
          36 kB
          David Greenberg

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              lcdweb Brian Shaughnessy
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: