0

After upgrading to 5.41.2 on Wordpress 5.8.1 I still have the problem with manual add a new member.

ott 04 14:42:55  [error] 
$Fatal Error Details = array:3 [
  "message" => "Mandatory key(s) missing from params array: membership_id"
  "code" => null
  "exception" => CiviCRM_API3_Exception {#29193
    -extraParams: array:6 [
      "fields" => array:1 [
        0 => "membership_id"
      ]
      "error_code" => "mandatory_missing"
      "entity" => "MembershipPayment"
      "action" => "create"
      "is_error" => 1
      "error_message" => "Mandatory key(s) missing from params array: membership_id"
    ]
    #message: "Mandatory key(s) missing from params array: membership_id"
    #code: 0
    #file: "/home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/api/api.php"
    #line: 134
    trace: {
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/api/api.php:134 {
        › if (is_array($result) && !empty($result['is_error'])) {
        ›   throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result);
        › }
      }
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php:2512 { …}
      /home/gragorg/staging.grag.org/wp-content/uploads/civicrm/custom_php/CRM/Member/Form/Membership.php:1324 { …}
      /home/gragorg/staging.grag.org/wp-content/uploads/civicrm/custom_php/CRM/Member/Form/Membership.php:881 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:526 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:152 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:119 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php:103 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:352 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/Page/Tab.php:314 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/Page/Tab.php:384 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:313 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
      /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm.php:1178 { …}
      /home/gragorg/staging.grag.org/wp-includes/class-wp-hook.php:292 { …}
      /home/gragorg/staging.grag.org/wp-includes/class-wp-hook.php:316 { …}
      /home/gragorg/staging.grag.org/wp-includes/plugin.php:484 { …}
      /home/gragorg/staging.grag.org/wp-admin/admin.php:259 { …}
    }
  }
]

The custom php is not relevant: the problem is identical with original file (the custom is very simple and very localized) I do more investigation and for me it is strange is the variable is not set and the https://lab.civicrm.org/dev/core/-/issues/2431 I understand that the problem is related to the form which pass the data. I have printed the values:

ott 04 15:43:46  [info] $$this->_params = Array
(
    [hidden_custom] => 1
    [hidden_custom_group_count] => Array
        (
            [] => 1
        )

    [qfKey] => CRMMemberFormMembership2dowfisuhgsgcs4wo0c4kw08occ0wswo0c0swcw00cc0kc8gkg_9712
    [entryURL] => https://staging.grag.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fmember%2Fadd&page=CiviCRM&reset=1&action=add&context=standalone
    [join_date] => 2021-10-04
    [start_date] => 
    [end_date] => 
    [price_set_id] => 
    [contact_id] => 798
    [max_related] => 
    [membership_type_id] => Array
        (
            [0] => 1
            [1] => 2
        )

    [num_terms] => 1
    [source] => 
    [campaign_id] => 
    [status_id] => 
    [is_override] => 
    [status_override_end_date] => 
    [record_contribution] => 1
    [total_amount] => 30,00
    [receive_date] => 2021-10-04 15:43:00
    [payment_instrument_id] => 5
    [trxn_id] => 
    [contribution_status_id] => 1
    [financial_type_id] => 2
    [soft_credit_type_id] => 
    [soft_credit_contact_id] => 
    [from_email_address] => 2
    [receipt_text] => 
    [MAX_FILE_SIZE] => 1073741824
    [discountcode] => 
)


ott 04 15:43:46  [info] $this->_mode is not set

ott 04 15:43:46  [info] $$params = Array
(
    [tax_amount] => 0
    [total_amount] => 30.00
    [contact_id] => 798
    [status_id] => 
    [source] => 
    [is_override] => 0
    [status_override_end_date] => 
    [campaign_id] => 
    [custom] => Array
        (
        )

    [exclude_is_admin] => 1
    [contribution_recur_id] => 
    [payment_instrument_id] => 5
    [trxn_id] => 
    [contribution_status_id] => 1
    [check_number] => 
    [receive_date] => 2021-10-04 15:43:00
    [card_type_id] => 
    [pan_truncation] => 
    [financial_type_id] => 2
    [contribution_source] => Ordinario Iscrizione: Registrazione Offline (di Giorgio Mazzacurati)
    [lineItems] => Array
        (
            [2] => Array
                (
                )

        )

    [processPriceSet] => 1
)

But doesn't see any membership_id, could you help to solve the problem and set this value?

0

After a long debug analysis I understand that the problem is related to missing linenumber associated to the membership type. I solved saving every records with a price without . (Maybe it is enough to save)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.