Using CiviCRM Contact as view source I get 11 times the error:
Notice: Undefined index: group_type in views_handler_field->query() (line 67 of .../sites/all/modules/views/handlers/views_handler_field.inc).
There is no strange behavior in the created view. It's glogging up my logs in a severe way.
The issue was raised under CiviCRM on drupal.org project issue queue, but remains unassigned. Over at issues.civicrm.org (http://issues.civicrm.org/jira/browse/CRM-9322), Donald Lobo suggested that the issue be bounced back to Views.
Please let me know what other information would help to debug. Thanks.
(Thanks to Martin Niewzwaag and cmseasy for first raising the issue.)
Comments
Comment #1
dawehnerOkay after 5mins i figure out how to donwload it. Man that's quite complicated if you expect it to be a drupal module.
Which field do you use exactly? I have no clue of civicrm at the moment, so i guess it's the civicrm_handler_field_contact file.
The only thing i see there is that you should use init() instead of construct(), though this doesn't explain the group_type issue.
I'm wondering whether you could provide a short way to reproduce the problem.
Comment #2
ddunn commentedHi dereine,
Yeah - it's a bit more complicated than your usual module - but it's worth it. I've helped non-profits run their whole organisation with CiviCRM. There's quite a lot to it.
I've recreated the issue. Each time a CiviCRM contact address field is called by views, the error quoted gets thrown twice. In my new development site, I've got 7 address fields called in the one view, so each time the view is loaded, I've got 14 error notices :(
Simply create a view showing CiviCRM contacts, use a page display to call a CiviCRM address field I=(e.g. Full Street Address and/or City) and the error appear on that page display (not in preview in Views). The results of the display are not affected.
I've attached an export of this view which recreated the issue, and a screen grab showing how it comes out.
Thanks for your help looking into it.
d
Comment #3
merlinofchaos commentedThat would suggest that the field in question is not calling parent::option_definition() in its own option_definition() and ensuring that the group_type setting (and potentially other core options) exist.
Comment #4
dawehnerI looked through these handlers but couldn't find the problem in there. Is there some easy to install package thing for civicrm?
Comment #5
ddunn commentedHi dereine, I don't believe that there's any other option than to do a full install of CiviCRM as per (takes 5 mins):
1) get the latest dev code for Drupal 7 (civicrm-4.1.beta2-drupal.tar.gz) at http://sourceforge.net/projects/civicrm/files/civicrm-latest/4.1.beta2/
2) Follow the Drupal Installation Guide for CiviCRM 4.0 (http://wiki.civicrm.org/confluence/display/CRMDOC40/Drupal+Installation+...) [you can skip step 4. 'If Using Localization, install the localisation files']
Comment #6
epicflux commentedI was able to resolve the errors by adding a custom query function to the civicrm handler classes. Its set the $params variable to an empty array.
For example, in civicrm_handler_field_address.inc I added:
The group_type value is there in the option_definition function, but not when it gets to the query function. Perhaps there is something in views that would remove this value?
Comment #7
ddunn commentedHi epicflux, thanks for your help with this.
My programming knowledge is lacking, and I couldn't discover the line at which this should be inserted into civicrm_handler_field_address.inc.
Could you enlighten me? Thanks a million!
Comment #8
epicflux commentedI'm no expert at Views so you may want to wait for one to offer their opinion on this fix.
If civicrm is in your sites/all directory then you can find the files here: sites/all/modules/civicrm/drupal/modules/views/civicrm.
Each file in that directory creates a views handler class.
There a lot of handlers in there so it may not be obvious which classes you have to add this function to. It depends on what civicrm fields your View is using.
I added it to the civicrm_handler_field_address.inc and civicrm_handler_field_state.inc files.
In civicrm_handler_field_address.inc I put it at line 103, after the ensure_my_table function.
Comment #9
ddunn commentedYes, I had got the files, just not the right place for your code.
I seem to be getting places (it's now reduced from 14 errors to max 6 (sometimes 4 - it varies)).
The fields types I'm using are:
CiviCRM Contacts: First Name, Last Name, Contact ID,
CiviCRM Address: Address Name, Full Street Address, Supplemental Street Address, 2nd Supplemental Street Address, City / Suburb, ZIP / Postal Code
CiviCRM Custom: various custom fields
CiviCRM Phone Details: Phone Number
CiviCRM Email: Email Address
So, looking at the .inc files these would seem to be the ones that are pertinent
civicrm_handler_field_address.inc
civicrm_handler_field_custom.inc
civicrm_handler_field_email.inc and/or civicrm_handler_field_mail.inc
civicrm_handler_field_phone.inc
civicrm_handler_field_state.inc
And then there's civicrm_handler_field_location.inc which looks relevant too??
However, getting to the bottom of the remaining six errors is eluding me. As I have lots of referenced Custom fields in the view, I'm guessing it's not them.
I'm guessing email and phone might be where I should focus attention, but it doesn't look like I can simply use your code from #6 in civicrm_handler_field_email.inc or civicrm_handler_field_mail.inc, for example.
[it's great to get down from 14 notices to six, though - thanks so much]
Comment #10
joemaine commentedIs this a duplication of:
http://drupal.org/node/1349546
The errors still persist for me.I applied patch #15 from the above to the dev version of Views...seems fixed (for now)