Closed (fixed)
Project:
volunteer
Version:
master
Component:
Code
Priority:
Critical
Category:
Task
Assigned:
Reporter:
Created:
26 Apr 2006 at 00:54 UTC
Updated:
12 Jan 2007 at 17:13 UTC
Jump to comment: Most recent file
I'm in the process of translating volunteer module from 4.6 to 4.7. Here's the beginning of the patch. I'm most likely missing some stuff; needs lots and lots of testing.
- Ported forms API stuff
- Removed call to tablesort_pager()
- Added in module dependency check for CiviCRM
I also created a .install file which I'll upload momentarily.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | volunteer.module_3.patch | 3.25 KB | webchick |
| #9 | volunteer.install_0.txt | 2.06 KB | webchick |
| #8 | volunteer.module_2.patch | 17.86 KB | webchick |
| #6 | volunteer.module_1.patch | 33.12 KB | webchick |
| #3 | volunteer_0.patch | 28.65 KB | webchick |
Comments
Comment #1
webchickHere we go. Rename this file to 'volunteer.install' and place it in your volunteer module directory. It should automatically create the tables for you when you enable the module.
Comment #2
killes@www.drop.org commentednow, this is going to be interesting: How do we handle the different versions?
On the 4.6 branch there is the 4.6 compatible version which still uses contact_manager (which isn't available anymore) and on the HEAD branch we have a 4.6 compatible version which uses CiviCRM.
We could simply branch HEAD to 4.7 and only apply your patches on that branch, but would seem to be pretty awkward.
Comment #3
webchickProbably a 4.7 branch for now, I guess. I can talk w/ Steven next time I see him and ask if there's some alternate way we could tag it.
Here's an updated patch with what I have so far, which fixes a few more things. However, I'm completely and utterly stuck on the following in volunteer_volunteer_form:
$crm_form = crm_uf_get_profile_html( $userID, $title, $action, $register, $reset );
...
$form = $crm_form;
Obviously, forms are no longer HTML, so this won't work.
I tried the following:
$form['crm_form'] = array(
'#value' => $crm_form,
);
This works in that it displays the form, but doesn't in that you can't actually submit it at all (or you can, but it doesn't register anywhere).
I'm also getting two completely different outputs for ?q=volunteer/volunteer/1 on two servers. My CSL testbed provides three fields (without labels ;\), presumably for "first name," "last name," and "email (home)" as this would match what's in CivicSpace 0.8.4... my local testing server has a whole elaborate form with location information and "Most Important Issue Education Environment Social Justice" and stuff. Very bizarre. But at any rate, neither form is working, which makes this patch rather useless atm. :(
Any insight into how I could duplicate this behaviour in 4.7 would be greatly appreciated.
Comment #4
killes@www.drop.org commentedI think we need to make a "blind" form in Drupal.
Ie a form which has all the fields with the identifiers that CiviCRM expects, but we dont process the form and let CiviCRm handle it. CiviCRM looks at the POST values anyay and does not do anything with a Drupal form.
Comment #5
webchickOK excellent. Thanks, killes.. I'll work with that.
Comment #6
webchickNewest patch, still needs work though... ;(
Tried to go the route of creating dummy forms in 4.7, but the problem with that approach is that the form will change depending on what profile fields have been entered into CiviCRM. Instead, I tweaked the #value => $crn_form thing and think I got it working, although there are some other issues...
Also fixed some other misc. 4.6 => 4.7 things.
Comment #7
killes@www.drop.org commentedapplied the latest patch.
Comment #8
webchickOk here is an updated patch. not 100% perfect, as there are still things that could be FAPI-ized for maximum radness, but all the major areas seem to be functioning, so marking this up to "code needs review."
Summary of changes:
* Moved the "get all volunteer coordinators" stuff to a separate function, and updated the algorithm to not check the users_roles table since that no longer applies.
* Fixed a segfault error in PHP 5.1 w/ _volunteer_array_mergedown
* Fixed the WSODs on volunteer_question_coordinator()
* Fixed missing field labels on volunteer form (see .install file follow-up)
* Fixed rating form, and converted to validate/submit model
* Fixed some notices
* Added some PHP doc
* Fixed some minor whitespace stuff
KNOWN BUGS/TODOs:
- node/#/volunteer will not show first name/last name/email of volunteers. From reading the code, it appears that CiviCRM contacts used to be stored as arrays and now they are stored as objects. Therefore, when we do _volunteer_array_mergedown on the $contact array, these properties are still stuck in a CRM_Contact_BAO_Individual object under 'contact_type_object' so ['first_name'], ['last_name'], etc. do not exist. Need advice from someone who understands this module and CiviCRM better to know what to do here. (i.e. $civicrm_contact = $contact['contact_type_object']; ? will that work across CiviCRM versions?)
- I couldn't convert volunteer_volunteer or volunteer_volunteer_form to the validate/submit model, because their entire form is generated inside CiviCRM, and I've no idea how to tie into that from Drupal's Form API functions. ;(
- There are still a number of other validate/submit model translations I haven't had a chance to look at yet.
Anyway, please take a look and let me know what you think!
Comment #9
webchickAnd here's the .install file. Apparently there is a known issue that field labels from 1.3 to 1.4 get lost? (Rob mentioned something about this). So I've included an update script which sets them explicitly.
Comment #10
webchickFixed the "node/#/volunteer will not show first name/last name/email of volunteers" problem. This stemmed from my consolidation of mergedown and array_walk_recphp4 functions; it was no longer actually merging down the array properties.
The solution? Forward-porting object2array. :( Not what I wanted to do, but casting $val to an array explicitly gets us back in segfault land under PHP 5.
Still some outstanding validate/submit module conversions, but I'm really tempted to just leave well enough alone for now, since the module seems to be working okay with the forms the way they are.
Would highly appreciate someone other than me testing the CVS version of volunteer w/ CiviCRM 1.4 and Drupal 4.7 to see if anything's blatantly missing/not working. :)
Comment #11
killes@www.drop.org commentedthe reason why I didn't use object2array was that it would only merge down the fist layer of objects. if it orks with obect2array now, this will be fine, of course, but why didnt a simple (array) cast work as well?
Comment #12
webchickI've no idea. But as soon as I change:
$val = _volunteer_object2array($val);
to:
$val = (array)$val;
We're in "Your connection has been reset" land. ;( Maybe because the $val object is about 4-5 levels deep in some places?
Comment #13
disterics commentedI am running the CVS version with 4.7.
I had a problem with the array_walk_recphp4 function.
I was getting the error that it was already defined. Weirdly enough this error showed up for only one specific event. Not sure why.
I applied volunteer.module_3.patch and now its working okay.
Will let you know if i run into any problems.
Comment #14
robin monks commentedPatch was applied to cvs.
Comment #15
(not verified) commentedComment #16
TimmyB commentedG'day,
Im experience problems using the CVS version of this under Drupal 4.7 and CiviCRM v1.5.
What version of the civiCRM module is the HEAD version designed to be used with?
Comment #17
brianV commentedI would like to find out more about the status of this. I am hoping to integrate it into a site I am developing.
Is it working completely at this point?