- // Unlock selected email
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='NEW' WHERE id=%d AND data_type='ADMIN' LIMIT 1",
- array($id), __FILE__, __LINE__);
- if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 1)
- {
- // Order placed in queue...
- $result = SQL_QUERY_ESC("SELECT url, subject, sender FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1",
- array($id), __FILE__, __LINE__);
- $DATA = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ // Order placed in queue...
+ $result = SQL_QUERY_ESC("SELECT
+ po.`url`, po.`subject`, po.`sender`, pay.`payment`, po.`payment_id`
+FROM
+ `{?_MYSQL_PREFIX?}_pool` AS `po`
+INNER JOIN
+ `{?_MYSQL_PREFIX?}_payments` AS `pay`
+ON
+ po.`payment_id`=pay.`id`
+WHERE
+ po.`id`=%s
+LIMIT 1",
+ array($id), __FILE__, __LINE__);
+
+ // Update wents fine?
+ if (SQL_NUMROWS($result) == 1) {
+ // Load data
+ $content = SQL_FETCHARRAY($result);
+
+ // Is the surfbar installed?
+ // @TODO Rewrite these if-blocks to a filter
+ if ((isExtensionActive('surfbar')) && (getConfig('surfbar_migrate_order') == 'Y')) {
+ // Then "migrate" the URL to the surfbar
+ SURFBAR_ADMIN_MIGRATE_URL($content['url'], $content['sender']);
+ } // END - if