--- taxonomy_menu.module	Fri Jan 22 02:47:02 2010
+++ taxonomy_menu_705944.module	Fri Feb 12 10:55:00 2010
@@ -9,7 +9,9 @@
  * @author Mark Theunissen    <http://drupal.org/user/108606>
  * @author Afief Halumi       <http://drupal.org/user/237472>
  */
-
+/**
+ * 2010/02/12  hovel  Issue:http://drupal.org/node/705944	Allways rebuild never update.
+ */
 //include the database layer
 require_once(drupal_get_path('module', 'taxonomy_menu') .'/taxonomy_menu.database.inc');
 
@@ -124,7 +126,7 @@
     $variable_name = _taxonomy_menu_build_variable($key, $vid);
 
     //check to see if the vocab enable options has changed
-    if ($key = 'voc_item') {
+    if ($key == 'voc_item') {
       if (_taxonomy_menu_check_variable($variable_name, $value)) {
         $change_vocab_item = TRUE;
       }
@@ -206,19 +208,22 @@
   $menu_name = variable_get('taxonomy_menu_vocab_menu_'. $vid, FALSE);
 
   //get a list of the current menu links
-  $menu_links = _taxonomy_menu_get_terms($vid);
-
+  $menu_links = _taxonomy_menu_get_menu_items($vid);
+    
   //cycle through the
-  foreach ($menu_links as $menu_link) {
-    if ($menu_link->tid == 0) {
-      $args['vid'] = $menu_link->vid;
+  foreach ($menu_links as $tid => $mlid) {
+    if ($tid == 0) {
+      $args['vid'] = $vid;
     }
     else {
-      $args['term'] = taxonomy_get_term($menu_link->tid);
+      $args['term'] = taxonomy_get_term($tid);
+      //since taxonomy_get_term does not return the parents, fetch them now
+      $args['term']->parents = _taxonomy_menu_get_parents($tid);
     }
 
     //set the mneu name
     $args['menu_name'] = $menu_name;
+    $args['mlid'] = $mlid;
 
     //update the menu link
     taxonomy_menu_handler('update', $args);
