CiviCRM Profiles bleed through when using volunteer

macdoggie - February 15, 2006 - 23:06
Project:volunteer
Version:HEAD
Component:Code
Category:bug report
Priority:normal
Assigned:Torenware
Status:closed
Description

Hello all!

I'm having trouble with other CRM profiles "bleeding" through on my volunteer page. In other words,

1. create additional CRM profiles at => PathToDomain/civicrm/admin/uf/group

2. in the profile settings, if "Profile" is selected (as opposed to User Registration or View/Edit User Account), all those CRM profiles that are marked "used for profile" appear when a user volunteers for an event. This is regardless of the permissions set on the profile itself as in... User and User Admin Only or Public User Pages and Listings.

If I understand the volunteer module correctly, the behavior I would expect is that an admin selects the CiviCRM profile form for volunteers here => PathToDomain/admin/settings/volunteer

Only the profile selected in the volunteer admin settings should appear when a user volunteers for an event.

Right now, ALL profiles appear when a user volunteers for an event that have been designated as => "user for profile"
thx,

#1

macdoggie - February 15, 2006 - 23:07
Version:4.6.x-1.x-dev» HEAD

I snatched this from CVS, not Drupal 4.6 - sorry!

#2

Torenware - February 16, 2006 - 06:05

This appears to be a function of whether the user is logged in or not.

If logged in, you get the correct profile as specified in admin/settings/volunteer.

If not logged in, you get all eligable profiles (i.e., any profile that has an email field).

I'll investigate the uid = 0 case and see why this is.

#3

Torenware - February 16, 2006 - 06:24

Lobo's given me something to try. Patch coming up soon.

#4

Torenware - February 16, 2006 - 19:17
Assigned to:Anonymous» Torenware
Status:active» patch (code needs review)

Figured the buggah out. Patch is against CivicSpace trunk.

If someone can verify that this makes the pain go away, much obliged.

AttachmentSize
volunteer-49606-1.patch1.37 KB

#5

Amazon - February 16, 2006 - 19:21

All patches need to be against CVS. I believe head in this case.

Kieran

#6

Torenware - February 16, 2006 - 19:29

Hm... patched against the wrong tree. Here's the patch against Drupal CVS.

AttachmentSize
volunteer-49606-2.patch5.29 KB

#7

Gerhard Killesreiter - February 17, 2006 - 01:14
Priority:critical» normal
Status:patch (code needs review)» patch (code needs work)

please run cvs up before creating patch, it was created against an old version of volunteer.module.

#8

Torenware - February 20, 2006 - 01:21

Will do. For now, I'm going to post the module as I have it, since I'll need to resolve any conflicts later. For now, let's figure out if this puppy works.

After working with Lobo, it's clear that the module for interacting with CRM is a little different than most of us thought; short version is that crm_get_profile_html() is the Swiss Army knife of the API for playing with profiles; it not only generates the html used in profile edit forms, it also does any extraction or writing of data to the data store as well. So protocol needs to be (1) call crm_get_profile_html(), and (2) get back the affected contact object and get your munged data from there (and not from $_POST). The code in volunteer_volunteer and volunteer_volunteer_form is commented a fair bit, so you should be able to see the method in all the madness.

As soon as Lobo and you are happy with the beast, I'll check it into the CVS HEAD.

Rob

AttachmentSize
rmt-csl-modules.tar.gz141.14 KB

#9

Torenware - February 20, 2006 - 01:22
Status:patch (code needs work)» patch (code needs review)

changing status for previous entry.

#10

Torenware - February 20, 2006 - 05:37

Gehrhart -- actually, you're gonna be doing the checking in. But same general idea...

Rob

#11

Torenware - February 21, 2006 - 06:14
Status:patch (code needs review)» patch (reviewed & tested by the community)

Gerhard -- OK, hopefully this patch is in the form you want. Against CVS v 1.53, which is at the tip as I write this.

AttachmentSize
volunteer-20060220.patch8.78 KB

#12

killes@www.drop.org - February 28, 2006 - 23:20

Rob, why did you remove my calls to db_set_active()?

#13

Torenware - March 1, 2006 - 06:42

> Rob, why did you remove my calls to db_set_active()?

They are unneeded since db_set_active() is a Drupal API, and does not in fact affect CRM in any way. CRM is using PEAR libraries to access the database, and ignores db_set_active(), which is setting a global used by the Drupal database abstraction layer:

<?php
function db_set_active($name = 'default') {
  global
$db_url, $db_type, $active_db;
  static
$db_conns;
?>

While you were extremely careful to match calls (and therefore, was causing no harm), a less careful coder might forget to make the restoring call to db_set_active(), which would not be so good. I spoke with Lobo about this, and the recommendation was to remove the calls.

#14

Torenware - March 1, 2006 - 21:11

killes --

OK, here's a patch that:

1) includes db_set_active around all the places it used to be, and has db_set_active bracketing any new CRM calls I've introduced.

2) It resolves http://drupal.org/node/51833 , the crm_contact_search issue that Robin found (#51883).

This patch is against Drupal CVS HEAD (1.53 being the previous revision).

AttachmentSize
volunteer-20060301.diff10.5 KB

#15

killes@www.drop.org - March 1, 2006 - 23:15
Status:patch (reviewed & tested by the community)» fixed

applied

#16

Torenware - March 2, 2006 - 01:51

Cool. Bravo Robin.

Looks like we're live on RC6. K'einaharah. (i.e., no hubris just yet).

#17

Anonymous - March 16, 2006 - 02:01
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.