With Drupal 4.7 and the latest CVS version of CCK, I cannot select a contact when creating a CCK type with the civinode field. The field is there, but the selection list is blank (using the admin account). I'm not surre if this is a bug or a configuration issue. It looks like all three modules (civicrm, cck, and civinode) are correctly installed.

Comments

Torenware’s picture

Mark Fredrickson's probably the best person to look at this one. I've "pinged" him, and I suspect he'll have at least a suggestion how to deal with this.

mfredrickson’s picture

This is a "known" bug. When I wrote the original code, I used the default CiviCRM/Drupal API to check for permissions. When Rob decided to include this code in CiviNode, he asked me to use the CiviNode ACL system instead. This was a good suggestion, but there are a couple of small bugs from the transition.

The fix will be in civinode_utils.inc, but I don't know what it is yet. I need to understand the CiviNode ACL system better first before I can suggest a patch.

(PS. I've subscribed to all the CiviNode issues, so I will get new CiviCRMdata.module issues, as they emerge.)

bomarmonk’s picture

Thanks for your response to this issue. Integrating civicrm with cck has a great deal of potential, expecially if you can expose an entire group of contacts to a node. Thanks for your work so far and I will be following your progress (I'll test new developments as they become available).

Torenware’s picture

I'm debugging this now, and we're going to have to decide how this *should* behave. Here's the problem.

The admin user should access to *all* contacts. This means creating a pop-up menu that might have thousands of items. this is probably not a good idea.

Currently, the call civinode_get_drupal_allowed_groups() does not return any groups for an admin that has not explicitly created accesses for groups. This is arguably a bug, and I'll fix the behavior. But do we really want to create a menu of unbounded size?

This is up to Mark; most likely, we need to think more realistically how to select contacts. Any better ideas?

Torenware’s picture

Assigned: Unassigned » Torenware
Status: Active » Fixed

I've added code to check for user admin rights which will make sure that if you have the right to see all contacts, you'll be able to see all groups.

Try this one out and see if it does what you want.

Torenware’s picture

To be clear: code is now in CVS.

bomarmonk’s picture

I figured out my problem: civinode only displays contacts in the CCK select box that have been added through Drupal's "create content"->Nodify CRM contact. For some reason, I was thinking the cck would query the CiviCRM contacts without having to nodify them. Would there be a mass "Nodify" option, where all CRM contacts and groups could be nodified at once? Maybe. This issue can be closed and I'll submit a feature request perhaps. Sorry about my mistake.

mfredrickson’s picture

@torenware: In the long run, I think the solution should be a new widget. Preferably one that depends on the activeselect.module "drill down" feature. The widget would have two select boxes: the first would be all the groups a person has access to (in admin's case all of them). The second select box would populate with the users in the groups selected in box 1. It would be empty until 1+ groups were selected.

In the short run, I say let admin (or someone with an appropriate priv) choose from everyone. It might be irritating, but I think it is the correct behavior.

@bomarmonk: Thanks for trouble shooting this. I was unaware the contacts had to be nodified first. I think the solution is two fold:

  1. Create a 'CiviNode Contact Reference' field that links only to CiviNode contacts (and uses the CiviNode ACL).
  2. Modify the current Contact Reference field to use the standard Drupal/CiviCRM API, so that users can select contacts that are not nodified. (Rob - as a use case, I may only nodify contacts that are available to my drupal users to learn about (say, elected officials). But I may need to run a phone bank to contact thousands of potential voters.)

    #2 is trivial, as I already have that code. #1 is easy because that is what we currently have. I hope I can have a fix sometime today.

mfredrickson’s picture

Component: Code » CCK Integration
Status: Fixed » Active

I'm not sure this is "fixed" yet. I'm keeping it open to keep it on my radar screen.

mfredrickson’s picture

Ok. Things seem to be working. Closing this.

mfredrickson’s picture

Status: Active » Closed (fixed)