? 255286_5x_code_flow_sync.patch
Index: pathauto.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v
retrieving revision 1.44.4.99
diff -u -p -r1.44.4.99 pathauto.module
--- pathauto.module	18 Jun 2008 22:16:37 -0000	1.44.4.99
+++ pathauto.module	20 Jun 2008 20:03:46 -0000
@@ -97,12 +97,6 @@ function pathauto_token_values($type, $o
       _pathauto_include();
       switch ($type) {
         case 'node':
-          $vid = db_result(db_query_range("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name", $object->nid, 0, 1));
-          $category = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight", $vid, $object->nid, 0, 1));
-          $category->vid = $vid;
-          // In the realm of nodes these are terms, in the realm of Taxonomy, cats
-          $label = 'term';
-
           // We're on a node and it's a book and it has a parent? Get the book path alias
           if (module_exists('book')) {
             if ($object->type == 'book' && $object->parent) {
@@ -113,6 +107,12 @@ function pathauto_token_values($type, $o
             }
           }
 
+          $vid = db_result(db_query_range("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name", $object->nid, 0, 1));
+          $category = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight", $vid, $object->nid, 0, 1));
+          $category->vid = $vid;
+          // In the realm of nodes these are terms, in the realm of Taxonomy, cats
+          $label = 'term';
+
         case 'taxonomy':
         default:
           if (!isset($category)) {
