? 760336.patch
? 808790.patch
? 839640.patch
? 839640.patch.hold
? LICENSE.txt
? ucs.diff
? views/760336.patch
? views/LICENSE.txt
? views/uc_signup.views.inc
? views/uc_signup.views_default.inc
? views/uc_signup_field_signup_order_handler.inc
Index: uc_signup.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_signup/uc_signup.install,v
retrieving revision 1.4
diff -u -p -r1.4 uc_signup.install
--- uc_signup.install	3 Jul 2009 15:23:47 -0000	1.4
+++ uc_signup.install	28 Jun 2010 20:07:09 -0000
@@ -19,6 +19,13 @@ function uc_signup_schema() {
         'size' => 'normal',
         'not null' => TRUE,
       ),
+      'uid' => array(
+        'description' => t("The user associated with the signup."),
+        'type' => 'int',
+        'size' => 'normal',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
       'type' => array(
         'description' => t("The Signup type. 0: pre-charge placeholder, 1: finalized signup."),
         'type' => 'int',
@@ -42,4 +49,47 @@ function uc_signup_install() {
  */
 function uc_signup_uninstall() {
   drupal_uninstall_schema('uc_signup');
+}
+
+/**
+ * Ensure that uc_signup hooks are executed before payment modules.
+ */
+function uc_signup_update_6000() {
+  $ret = array();
+  $ret[] = update_sql('UPDATE {system} SET weight = -1 WHERE name = "uc_signup"');
+  return $ret;
+}
+
+/**
+ * Add the UID column to {uc_signup_log} and update placeholder signups to the
+ * new format per http://drupal.org/node/839640.
+ */
+function uc_signup_update_6001() {
+  $ret = array();
+  $attributes = array(
+    'type' => 'int',
+    'size' => 'normal',
+    'not null' => TRUE,
+    'default' => 0,
+  );
+  db_add_field($ret, 'uc_signup_log', 'uid', $attributes);
+  // Preserve the association between placeholder signups and users.
+  $ret[] = db_query("UPDATE {uc_signup_log} ucl INNER JOIN {signup_log} sl on sl.sid = ucl.sid SET ucl.uid = sl.uid");
+  // Assign placeholder signups to anonymous users.
+  // First, load all placeholder signups.
+  $query = db_query("SELECT sl.* FROM {signup_log} sl INNER JOIN {uc_signup_log} ucl ON ucl.sid = sl.sid WHERE ucl.type = 0");
+  while ($result = db_fetch_object($query)) {
+    $temp_signups[] = $result;
+  }
+  // Then, switch the signup to an anonymous (placeholder) user and save the signup.
+  if (!empty($temp_signups)) {
+    foreach ($temp_signups as $temp_signup) {
+      $temp_signup->uid = 0;
+      $temp_signup->anon_mail = 'placeholder-' . rand(111111, 99999) . '@example.com';
+      $temp_signup = (array)$temp_signup;
+      signup_save_signup($temp_signup);
+    }
+  }
+
+  return $ret;
 }
\ No newline at end of file
Index: uc_signup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_signup/uc_signup.module,v
retrieving revision 1.54
diff -u -p -r1.54 uc_signup.module
--- uc_signup.module	22 Apr 2010 19:44:35 -0000	1.54
+++ uc_signup.module	28 Jun 2010 20:07:09 -0000
@@ -552,6 +552,7 @@ function uc_signup_attendees_pane($op, $
           $signups = TRUE;
         }
         if ($signups && $product->data['uc_signup_enabled'] && (empty($_SESSION['uc_signup']['nids'][$product->nid]) || count($_SESSION['uc_signup']['nids'][$product->nid]) < $product->qty)) {
+          // TODO: make it impossible to rediret infinitely.
           drupal_goto('uc_signup/attendees/emails');
         }
       }
@@ -669,15 +670,7 @@ function uc_signup_order($op, &$arg1, $a
             return array(array('pass' => FALSE, 'message' => t($message)));
           }
           foreach ($uids as $key => $uid) {
-            $signup_form = array(
-              'nid' => $nid,
-              'uid' => $uid,
-            );
-            $sid = NULL;
-            $sid = signup_sign_up_user($signup_form, FALSE);
-            if (is_numeric($sid)) {
-              db_query("INSERT INTO {uc_signup_log} (oid, sid, type) VALUES (%d, %d, %d)", $arg1->order_id, $sid, 0);
-            }
+            uc_signup_create_placeholder_signup($nid, $uid, $arg1->order_id);
           }
         }
       }
@@ -685,6 +678,50 @@ function uc_signup_order($op, &$arg1, $a
 }
 
 
+/*
+ * Create a placeholder signup for a user.
+ */
+function uc_signup_create_placeholder_signup($nid, $uid, $oid) {
+  $mail = 'placeholder-' . rand(111111, 99999) . '@example.com';
+  $signup_form = array(
+    'uid' => 0,
+    'signup_anon_mail' => $mail,
+    'nid' => $nid,
+  );
+  $sid = signup_sign_up_user($signup_form, FALSE);
+  if (is_numeric($sid)) {
+    db_query("INSERT INTO {uc_signup_log} (oid, sid, type, uid) VALUES (%d, %d, %d, %d)", $oid, $sid, 0, $uid);
+  }
+}
+
+function uc_signup_mark_paid($order, $settings = array()) {
+  // TODO: save this in the order.
+  $signups = _uc_signup_get_temporary_signups($order);
+  if (is_array($signups)) {
+    foreach ($signups as $signup) {
+      if (!isset($nodes[$signup->nid])) {
+        $nodes[$signup->nid] = node_load($signup->nid);
+      }
+      // Assign the signup to the appropriate account.
+      $signup->anon_mail = '';
+      // The uid is provided by _uc_signup_get_temporary_signups() but has not been saved to signup_log.
+      $signup = (array)$signup;
+      signup_save_signup($signup);
+      db_query("UPDATE {uc_signup_log} SET type = 1 WHERE sid = %d", $signup['sid']);
+      if ($nodes[$signup->nid]->signup_send_confirmation) {
+        signup_send_confirmation_mail($signup, $nodes[$signup->nid]);
+      }
+      //Signup.module checks for $node->signup_forwarding_email for us.
+      signup_send_forwarding_mail($signup, $nodes[$signup->nid]);
+      
+      unset($account);
+      unset($signup);
+    }
+  }
+
+  unset($_SESSION['uc_signup']);
+}
+
 function _uc_signup_node_available($node, $qty, &$message) {
   $type_name = db_result(db_query("SELECT name from {node_type} WHERE type = '%s'", $node->type));
 
@@ -747,38 +784,8 @@ function uc_signup_cancel_temporary_sign
   }
 }
 
-function uc_signup_mark_paid($order, $settings = array()) {
-  // TODO: save this in the order.
-  $signups = _uc_signup_get_temporary_signups($order);
-  db_query("UPDATE {uc_signup_log} SET type = 1 WHERE oid = %d", $order->order_id);
-  if (is_array($signups)) {
-    foreach ($signups as $signup) {
-      if (!isset($nodes[$signup->nid])) {
-        $nodes[$signup->nid] = node_load($signup->nid);
-      }
-      if (!isset($accounts[$signup->uid])) {
-        $accounts[$signup->uid] = user_load(array('uid' => $signup->uid));
-      }
-      $account = (array)$accounts[$signup->uid];
-      $signup = (array)$signup;
-      $signup = array_merge($account, $signup);
-      $signup = (object)$signup;
-      if ($nodes[$signup->nid]->signup_send_confirmation) {
-        signup_send_confirmation_mail($signup, $nodes[$signup->nid]);
-      }
-      //Signup.module checks for $node->signup_forwarding_email for us.
-      signup_send_forwarding_mail($signup, $nodes[$signup->nid]);
-      
-      unset($account);
-      unset($signup);
-    }
-  }
-
-  unset($_SESSION['uc_signup']);
-}
-
 function _uc_signup_get_temporary_signups($order) {
-  $query = db_query("SELECT sl.* FROM {signup_log} sl INNER JOIN {uc_signup_log} ucl ON ucl.sid = sl.sid WHERE ucl.oid = %d AND ucl.type = 0", $order->order_id);
+  $query = db_query("SELECT sl.*, ucl.uid FROM {signup_log} sl INNER JOIN {uc_signup_log} ucl ON ucl.sid = sl.sid WHERE ucl.oid = %d AND ucl.type = 0", $order->order_id);
   while ($result = db_fetch_object($query)) {
     $signups[$result->sid] = $result;
   }
