Index: og2list.install =================================================================== RCS file: /cvs/drupal/contributions/modules/og2list/og2list.install,v retrieving revision 1.15 diff -u -r1.15 og2list.install --- og2list.install 28 Nov 2006 18:07:25 -0000 1.15 +++ og2list.install 23 Jul 2007 08:37:37 -0000 @@ -242,3 +242,16 @@ } return $ret; } + +// now using db_next_id() from Drupal API instead of mysql_next_id() when inserting new messages. +function og2list_update_9() { + $ret = array(); + + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $ret[] = update_sql(" ALTER TABLE og2list_outgoing_content CHANGE `mid` `mid` INT( 10 ) UNSIGNED NOT NULL"); + $ret[] = update_sql("REPLACE INTO {sequences} (name,id) SELECT 'og2list_outgoing_content_mid' AS name, MAX(mid) AS id FROM og2list_outgoing_content"); + } + return $ret; +} Index: og2list.module =================================================================== RCS file: /cvs/drupal/contributions/modules/og2list/og2list.module,v retrieving revision 1.106 diff -u -r1.106 og2list.module --- og2list.module 7 May 2007 11:54:05 -0000 1.106 +++ og2list.module 23 Jul 2007 08:37:38 -0000 @@ -531,9 +531,9 @@ foreach($edit['og_nids'] as $og) { $node = node_load($og); $subject = $node->og2list_subject_prefix .' '. $subject; - db_query("INSERT INTO {og2list_outgoing_content} (to_name, to_address, from_name, from_address, subject, msgid, body, is_node, id) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)", $edit['ogs'][$og]['name'], $edit['ogs'][$og]['address'], $edit['name'], $edit['mail'], $subject, $msg_id, "$body", $edit['cid'] ? 0 : 1, $edit['cid'] ? $edit['cid'] : $edit['nid']); - $mid = mysql_insert_id(); - + $mid = db_next_id("{og2list_outgoing_content}_mid"); + db_query("INSERT INTO {og2list_outgoing_content} (mid, to_name, to_address, from_name, from_address, subject, msgid, body, is_node, id) VALUES (%d,'%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)", $mid, $edit['ogs'][$og]['name'], $edit['ogs'][$og]['address'], $edit['name'], $edit['mail'], $subject, $msg_id, "$body", $edit['cid'] ? 0 : 1, $edit['cid'] ? $edit['cid'] : $edit['nid']); + // see og2list.install for status codes $result = db_query('INSERT INTO {og2list_outgoing_arguments} (mid, nid, timestamp, status, uid) VALUES (%d, %d, %d, %d, %d)', $mid, $og, time(), $node->og2list_ml_status ? (($node->og2list_ml_moderate || ($status == 0)) ? OG2LIST_OUTGOING_MODERATED : OG2LIST_OUTGOING_NOT_SENT) : OG2LIST_OUTGOING_POSTPONED, $account->uid); }