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

Validation broken on back-end membership form for membership price set with quantity field

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      Same issue as CRM-9577 but for back-end membership form CRM/Member/Form/Membership.php using price set. See description in that issue.

      I verified that what happened was exactly as Deepak describes in his comment on that issue:

      "The problem was that the quantity entered was being misinterpreted as price_field_value.id and whenever it happened to match with a record in price_field_value table with a membership-type-id of a non-selected membership from the radio list - it would consider it as multiple selection of memberships & would throw that error."

      The following change fixed it for me.

      --- CRM/Member/Form/Membership.php.orig	2015-10-07 12:48:20.000000000 +0100
      +++ CRM/Member/Form/Membership.php	2015-12-14 16:19:41.000000000 +0000
      @@ -772,7 +772,7 @@
             CRM_Price_BAO_PriceField::priceSetValidation($priceSetId, $params, $errors);
       
             $priceFieldIDS = array();
      -      foreach ($self->_priceSet['fields'] as $priceIds => $dontCare) {
      +      foreach ($self->_priceSet['fields'] as $priceIds => $field) {
       
               if (!empty($params['price_' . $priceIds])) {
                 if (is_array($params['price_' . $priceIds])) {
      @@ -782,7 +782,7 @@
                     }
                   }
                 }
      -          else {
      +          elseif (!$field['is_enter_qty']) {
                   $priceFieldIDS[] = $params['price_' . $priceIds];
                 }
               }
      

      I expect a pull request will be wanted - against which branch?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dgg David Greenberg
                Reporter:
                davej Dave Jenkins
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: