Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added user_agent column to {fundraiser_webform_order} to record

HTTP_USER_AGENT string for donation form submissions.
  • Loading branch information...
commit 9ae2ae7954f8206fd4f7383d48a4c30fbbca8f44 1 parent 28d595f
Joel Rothschild authored
Showing with 67 additions and 2 deletions.
  1. +23 −1 fundraiser/fundraiser.install
  2. +44 −1 fundraiser/fundraiser.module
View
24 fundraiser/fundraiser.install
@@ -200,6 +200,13 @@ function fundraiser_schema() {
'not null' => FALSE,
'default' => 0,
),
+ 'user_agent' => array(
+ 'description' => t('The HTTP_USER_AGENT server variable value when donation form was submitted.'),
+ 'type' => 'text',
+ 'size' => 'small',
+ 'not null' => FALSE,
+ 'default' => '',
+ ),
),
'primary key' => array('webform_nid', 'order_id'),
);
@@ -933,4 +940,19 @@ function fundraiser_update_6309() {
db_add_field($ret, 'fundraiser', 'confirmation_page_format', array('type' => 'int', 'not null' => FALSE));
variable_del('fundraiser_confirmation_message_body_format');
return $ret;
-}
+}
+
+/**
+ * Add column for remote agent identifier.
+ */
+function fundraiser_update_6310() {
+ $ret = array();
+ db_add_field($ret, 'fundraiser_webform_order', 'user_agent', array(
+ 'description' => t('The HTTP_USER_AGENT server variable value when donation form was submitted.'),
+ 'type' => 'text',
+ 'size' => 'small',
+ 'not null' => FALSE,
+ 'default' => '',
+ ));
+ return $ret;
+}
View
45 fundraiser/fundraiser.module
@@ -1572,7 +1572,13 @@ function fundraiser_webform_submit($form, &$form_state) {
uc_order_save($order);
// relate the order to submission before we try and process the payment
- db_query("INSERT INTO {fundraiser_webform_order} (webform_nid, order_id, sid, recurring_status) VALUES (%d, %d, %d, %d)", $node->nid, $order->order_id, $form_state['values']['details']['sid'], $order->data['recurring_status']);
+ db_query(
+ "INSERT INTO {fundraiser_webform_order}
+ (webform_nid, order_id, sid, recurring_status, user_agent) VALUES (%d, %d, %d, %d, '%s')
+ ;",
+ $node->nid, $order->order_id, $form_state['values']['details']['sid'],
+ $order->data['recurring_status'], $_SERVER['HTTP_USER_AGENT']
+ );
// additional data to pass to the payment gateway's charge function
$data = array(
@@ -2127,6 +2133,43 @@ function fundraiser_order($op, &$arg1, $arg2) {
}
/**
+ * Implementation of hook_order_pane().
+ */
+function fundraiser_order_pane() {
+ $panes[] = array(
+ 'id' => 'fundraiser',
+ 'callback' => 'fundraiser_order_pane_fundraiser',
+ 'title' => t('Fundraiser'),
+ 'desc' => t('Additional data for donation orders.'),
+ 'class' => 'abs-left',
+ 'weight' => 7,
+ 'show' => array('view', 'edit'),
+ );
+ return $panes;
+}
+
+/**
+ * Order pane callback.
+ */
+function fundraiser_order_pane_fundraiser($op, $arg1) {
+ switch ($op) {
+ case 'view':
+ $order_id = $arg1->order_id;
+ if ($submission = db_fetch_object(
+ db_query("SELECT webform_nid, sid FROM {fundraiser_webform_order} WHERE order_id=%d;", $order_id)
+ )) {
+ $output['webform-submission'] = array(
+ '#value' => l(
+ t('Donation form submission'),
+ "node/$submission->webform_nid/submission/$submission->sid"
+ ),
+ );
+ }
+ return drupal_render($output);
+ }
+}
+
+/**
* Implemenation of hook_mail_alter().
*
* Change the from address and subject for donation receipt emails.

0 comments on commit 9ae2ae7

Please sign in to comment.
Something went wrong with that request. Please try again.