CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.6 Release Testing »
  • Fatal error: Call to a member function getVar() on a non-object ['_contactID']
Pages: [1]

Author Topic: Fatal error: Call to a member function getVar() on a non-object ['_contactID']  (Read 1055 times)

magnolia61

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 0
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34 / Joomla 3.3.6
  • MySQL version: MySQL 5.5.40
  • PHP version: PHP 5.5.19
Fatal error: Call to a member function getVar() on a non-object ['_contactID']
April 29, 2015, 08:08:10 am
An extension that worked in 4.5 throws a white screen with a fatal error in 4.6 with the message:

Code: [Select]
Fatal error: Call to a member function getVar() on a non-object in /home/ozk/domains/ourdomain.nl/public_html/crm/sites/all/modules/civicrm_extensions/org.project60.sepa/CRM/Core/Payment/SDD.php on line 155
That line says:
Code: [Select]
$params['contact_id'] = $this->getForm()->getVar('_contactID');
Is this way to derive the contact_id depreciated?
Would anyone be able to help me understand what changes in 4.6 would cause this? How does 4.6 deal differently with _contactID. What would be a start of a proper solution?
« Last Edit: April 29, 2015, 08:12:31 am by magnolia61 »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Fatal error: Call to a member function getVar() on a non-object ['_contactID']
April 29, 2015, 08:31:28 am
Which hook are you working in ? alterPaymentParams?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

magnolia61

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 0
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34 / Joomla 3.3.6
  • MySQL version: MySQL 5.5.40
  • PHP version: PHP 5.5.19
Re: Fatal error: Call to a member function getVar() on a non-object ['_contactID']
April 29, 2015, 08:34:54 am
Yep.

Code from the extension reads:
Code: [Select]
  function doDirectPayment(&$params) {
    $original_parameters = $params;

    // prepare the creation of an incomplete mandate
    $params['creditor_id']   = $this->_creditorId;
    $params['contact_id']    = $this->getForm()->getVar('_contactID');
    $params['source']        = $params['description'];
    $params['iban']          = $params['bank_account_number'];
    $params['bic']           = $params['bank_identification_number'];
    $params['creation_date'] = date('YmdHis');
    $params['status']        = 'PARTIAL';

    // Allow further manipulation of the arguments via custom hooks ..
    CRM_Utils_Hook::alterPaymentProcessorParams($this, $original_parameters, $params);

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Fatal error: Call to a member function getVar() on a non-object ['_contactID']
April 29, 2015, 10:04:30 am
Try $params['contactID']

Also for 4.6 you should be aware of the new supports methods

https://issues.civicrm.org/jira/browse/CRM-15555

So, your payment processor should override things like supportsBackOffice to declare whether it should show as an option on the backoffice form.

validatePaymentInstrument overrides form validation - ideally you should be able to implement it without using hooks now & if you are still using hooks we should ensure we have the things requiring the use of hooks on our road map
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.6 Release Testing »
  • Fatal error: Call to a member function getVar() on a non-object ['_contactID']

This forum was archived on 2017-11-26.