Here's a patch on HEAD for getting petition to be Drupal 5 compatible. Testing with CiviCRM 1.6 went smoothly, but additional testing is appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mcarbone’s picture

FileSize
128 bytes

A .info file. (Rename w/o the .txt extension.)

mcarbone’s picture

FileSize
12.32 KB

Here's a new patch with the following basic fixes:

1) Validation when anonymous users sign (check for existing email that's already signed or for a drupal account) -- http://drupal.org/node/74284

2) If authenticated user has already signed, present text saying that instead of form -- http://drupal.org/node/74285

j.q’s picture

I patched the petition module using Cygwin and installed the petition module on my site running Drupal 5.1/PhP5.2.1 and it doesnot show up on the list of modules to enable; any idea why?

thanks.

j.q’s picture

Ah... I had to upload the .info file. Got it. But now I'm getting these error messages:

.../public_html/modules/civicrm/CRM/Core/Error.php, backtrace, 236
.../public_html/modules/civicrm/CRM/Core/BAO/UFGroup.php, fatal, 389
.../public_html/modules/civicrm/api/UFGroup.php, getFields, 101
.../public_html/modules/petition/petition.module, crm_uf_get_profile_fields, 532
, petition_admin_settings,
...public_html/includes/form.inc, call_user_func_array, 218
, drupal_retrieve_form,
.../public_html/includes/form.inc, call_user_func_array, 69
, drupal_get_form,
.../public_html/includes/menu.inc, call_user_func_array, 418
.../public_html/index.php, menu_execute_active_handler, 15

Any pointers? I'm using CiviCRM 1.7

thanks.

mcarbone’s picture

Did you select a profile to use on the settings page at admin/settings/petition? I'm pretty sure that's required. (And, of course, the profile needs to be created in CiviCRM.)

mcarbone’s picture

FileSize
14.05 KB

Here's a new patch with a couple of tweaks which you may or may not want to incorporate:

1) Include view_only civicrm profiile fields on the signatories page and in the csv. (It was omitting email for me because we have that set as view only on the user edit page, since its redundant.)

2) Include the comments field in the csv file.

3) Format dates in the csv files.

Jerimee’s picture

I hope you are going to continue work on this . . .

some instruction on how to patch would also hit the spot.

j.q’s picture

mcarbone - thanks for working on the patch.

i uploaded a patched version of the petition module and when i go to admin/settings/petition or node/add/petition i get a system error:

Sorry. A non-recoverable error has occurred.
This profile is not configured for the requested action.

these other pages turn up fine: /petition and admin/content/petition

any suggestions on how to configure the profile? also, is there a chance that you can share your patched file?

jerimee -- see this link for instructions on how to patch

http://drupal.org/node/32875

mcarbone’s picture

j.q., check out this thread:

http://forum.civicrm.org/index.php/topic,152.0.html

You're probably butting into a civicrm restriction on that profile.

j.q’s picture

That was the problem. I activated the default profile and it all worked after that. Thanks for the tip!

I'm now testing out the module with a test petition...all seems to be working fine exept the reply email come back with all this extra code, any idea why?

"From: noreply@domain.org
Reply-to: noreply"@opensocialsites.com ["=?UTF-8?B?RnJvbTogbm9yZXBseUBibHVlbGF0aW5vcy5vcmcKUmVwbHktdG86IG5vcmVwbHk=?="@opensocialsites.com]

I found this code in line 431 in the module:

$headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
drupal_mail('petition_mail', $form_values['email'], t($subject, $wildcards), t($message, $wildcards), $headers);

What would you change to clean up the reply email header?

mcarbone’s picture

FileSize
14.05 KB

Good call, I missed that when changing user_mail to drupal_mail. Here's a new version of the patch with a fix.

seanr’s picture

FileSize
125 bytes

+1, patch appears to work well, minus a missing info file (attached).

hsthompson’s picture

Using drupal 5.3 and CivicRM 1.9:

First off, even when placing "petition.info" in /sites/all/modules/petition/, I don't see the petition module in Administer...Site Building...Modules...

Also, when running the patch, I get the following error:

$patch petition.module < petition_drupal5_3.patch
patching file petition.module
Hunk #11 succeeded at 597 with fuzz 1 (offset 7 lines).
Hunk #12 succeeded at 654 (offset 7 lines).
Hunk #13 succeeded at 717 (offset 7 lines).
Hunk #14 succeeded at 748 (offset 7 lines).
Hunk #15 FAILED at 759.
Hunk #16 succeeded at 776 (offset 7 lines).
1 out of 16 hunks FAILED -- saving rejects to file petition.module.rej

petition.module.rej contains:

***************
*** 691,701 ****
}
$header[] = t('Contact ID');
$header[] = t('Date Signed');
$headers = $header;

$rows = array();

- $sql = db_query(db_rewrite_sql("SELECT DISTINCT(cid), created FROM {petition_signatories} WHERE pid = %d ORDER BY created"), $arg1);

while($row = db_fetch_object($sql)){

--- 759,770 ----
}
$header[] = t('Contact ID');
$header[] = t('Date Signed');
+ $header[] = t('Comment');
$headers = $header;

$rows = array();

+ $sql = db_query(db_rewrite_sql("SELECT DISTINCT(cid), created, comment FROM {petition_signatories} WHERE pid = %d ORDER BY created"), $arg1);

while($row = db_fetch_object($sql)){

Any ideas?

Owen Barton’s picture

FileSize
20.61 KB

FWIW, here is a patch that includes CiviCRM 2.x support, although it still had a couple of error messages before I gave up.