Drupal 5 update

mcarbone - March 14, 2007 - 19:21
Project:Petition
Version:HEAD
Component:Code
Category:task
Priority:normal
Assigned:mcarbone
Status:needs review
Description

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.

AttachmentSize
petition_drupal5.patch10.6 KB

#1

mcarbone - March 14, 2007 - 19:23

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

AttachmentSize
petition.info_.txt 128 bytes

#2

mcarbone - March 14, 2007 - 22:32

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

AttachmentSize
petition_drupal5_1.patch 12.32 KB

#3

j.q - April 20, 2007 - 07:37

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.

#4

j.q - April 20, 2007 - 07:55

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.

#5

mcarbone - April 20, 2007 - 16:58

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.)

#6

mcarbone - April 20, 2007 - 17:02

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.

AttachmentSize
petition_drupal5_2.patch 14.05 KB

#7

Jerimee - May 11, 2007 - 00:22

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

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

#8

j.q - May 11, 2007 - 15:27

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

#9

mcarbone - May 11, 2007 - 23:05

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.

#10

j.q - May 13, 2007 - 02:25

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?

#11

mcarbone - May 25, 2007 - 23:27

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

AttachmentSize
petition_drupal5_3.patch 14.05 KB

#12

seanr - October 16, 2007 - 14:32

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

AttachmentSize
petition.info 125 bytes

#13

hsthompson - November 28, 2007 - 08:33

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?

#14

Owen Barton - April 16, 2008 - 16:57

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

AttachmentSize
petition_5.x_civicrm_2.patch 20.61 KB
 
 

Drupal is a registered trademark of Dries Buytaert.