In pay_update_6004(), one of the db_update() calls uses a non-existent query method join().

  // Special case - successful transactions (e.g. from CIM) on $0 transactions.
  $query = db_update('pay_transaction', 't')
    ->fields(array(
      'state' => "pending",
    ));
  $query->join('pay_activity', 'a', 't.pxid = a.pxid');
  $query->condition('t.state', "canceled")
    ->condition('a.result', '1')
    ->execute();

UPDATE queries don't support JOINing to other tables. I'm guessing that this needs to be written as either a SELECT statement and then a loop to update the records, or using an WHERE clause with a subquery (UPDATE pay_transaction ... WHERE paid IN (SELECT paid FROM pay_activity ...)).

Comments

quicksketch’s picture

Title: Drupal 6 Upgrade Path Fails: Call to undefined method UpdateQuery::join() » Call to undefined method UpdateQuery::join() in pay_update_6004() when upgrading from D6

Here's the relevant diff from the patch in #998736: Drupal 7 porting that added this change:

   // Special case - successful transactions (e.g. from CIM) on $0 transactions.
-  $ret[] = update_sql("UPDATE {pay_transaction} t, {pay_activity} a
-    SET state = 'pending'
-    WHERE t.pxid = a.pxid AND t.state = 'canceled' AND a.result = '1'");
+  $query = db_update('pay_transaction', 't')
+    ->fields(array(
+      'state' => "pending",
+    ));
+  $query->join('pay_activity', 'a', 't.pxid = a.pxid');
+  $query->condition('t.state', "canceled")
+    ->condition('a.result', '1')
+    ->execute();

In all fairness, we could probably update our Drupal 6 installation of Pay module first and this wouldn't be a problem in D7. Though it'd be nice to get this upgrade path working directly.