0

We have a contribution page with the option to mark the donation as recurring with the ability to specify the term (how many months). This was working well, until recently, we are receiving a big red notice at the top of the page, even though the contribution appears to have registered correctly with CiviCRM as well as with Paypal. Here's the error:

Notice: Undefined index: installments in CRM_Core_Payment_PayPalImpl->doDirectPayment() (line 371 of /[PATH_TO_CIVI]/crm/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).

Any ideas as to what I need to do to make this error/notice go away?

EDIT: I checked line 371 in the file specified and this is the line:

 $args['totalbillingcycles'] = $params['installments'];

Which exists in the middle of the following If statement starting on line 356:

if (CRM_Utils_Array::value('is_recur', $params) == 1) {
      $start_time = strtotime(date('m/d/Y'));
      $start_date = date('Y-m-d\T00:00:00\Z', $start_time);

      $args['PaymentAction'] = 'Sale';
      $args['billingperiod'] = ucwords($params['frequency_unit']);
      $args['billingfrequency'] = $params['frequency_interval'];
      $args['method'] = "CreateRecurringPaymentsProfile";
      $args['profilestartdate'] = $start_date;
      $args['desc'] = "" .
        $params['description'] . ": " .
        $params['amount'] . " Per " .
        $params['frequency_interval'] . " " .
        $params['frequency_unit'];
      $args['amt'] = $params['amount'];
      $args['totalbillingcycles'] = $params['installments'];
      $args['version'] = 56.0;
      $args['PROFILEREFERENCE'] = "" .
        "i=" . $params['invoiceID'] . "&m=" . $component .
        "&c=" . $params['contactID'] . "&r=" . $params['contributionRecurID'] .
        "&b=" . $params['contributionID'] . "&p=" . $params['contributionPageID'];
    }

Any thoughts?

1

I'm guessing you aren't using the most recent version of CiviCRM (4.7.27). In the current version of this file, that line has been replaced with:

$args['totalbillingcycles'] = CRM_Utils_Array::value('installments', $params);

The CRM_Utils_Array function is meant to prevent missing indices or variables that aren't even arrays from throwing warnings. (https://issues.civicrm.org/jira/browse/CRM-13288).

I have no idea when the change in the code happened (what version/date).

I suggest you upgrade your CiviCRM. It looks like it would be relatively harmless to update the code manually, in this case.

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.