Index: taxonomy_menu.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_menu/taxonomy_menu.module,v
retrieving revision 1.19.2.2.2.59
diff -u -p -r1.19.2.2.2.59 taxonomy_menu.module
--- taxonomy_menu.module	6 Jun 2010 16:47:46 -0000	1.19.2.2.2.59
+++ taxonomy_menu.module	14 Jun 2010 03:05:41 -0000
@@ -493,38 +493,27 @@ function taxonomy_menu_handler($op, $arg
  *     'mlid' => if this is filled in then the mlid will be updated
  */
 function _taxonomy_menu_save($item) {
-	$insert = TRUE;
+  // If this is an existing link pull the current link araray
+  if ($item['mlid']) {
+    $insert = TRUE;
+    $link = menu_link_load($item['mlid']);
+  } else {
+    $insert = FALSE;
+    $link = array();
+  }
+	
   //create the path.
   //use url to create he inital path
   //we need to remove the first '/' so menu_link_save will work correctly
   $path = taxonomy_menu_create_path($item['vid'], $item['tid']);
-  // get the parent mlid: this is either:
-  // - the parent tid's mlid
-  // - the vocab menu item's mlid
-  // - the menu parent setting for this vocab
-  $plid = _taxonomy_menu_get_mlid($item['ptid'], $item['vid']);
-  if (!$plid) {
-    $plid = variable_get('taxonomy_menu_vocab_parent_'. $item['vid'], NULL);
-  }
 
   // Make sure the path has less then 256 characters
+  // @TODO This basicly breaks these menu items. There has to be a better way.
   if (strlen($path) > 256) {
     preg_match('/(.{256}.*?)\b/', $path, $matches);
     $path = rtrim($matches[1]);
   }
 
-  $link = array(
-    'link_title' => check_plain($item['name']),
-    'menu_name' => $item['menu_name'],
-    'plid' => $plid,
-    'options' => array('attributes' => array('title' => trim($item['description'])
-      ? check_plain($item['description']) : check_plain($item['name']))),
-    'weight' => $item['weight'],
-    'module' => 'taxonomy_menu',
-    'expanded' => variable_get('taxonomy_menu_expanded_'. $item['vid'], TRUE),
-    'link_path' => $path,
-  );
-
   //Add setup the query paramater in the URL correctly
   if (strpos($path, '?') !== FALSE) {
    $split = explode('?', $path);
@@ -535,15 +524,30 @@ function _taxonomy_menu_save($item) {
      $link['options']['query'] = $split[1];
      $link['link_path'] = $split[0];
    }
- }
-
+  }
 
-  //if passed a mlid then add it
-  if ($item['mlid']) {
-    $link['mlid'] = $item['mlid'];
-    $insert = FALSE;
+  // get the parent mlid: this is either:
+  // - the parent tid's mlid
+  // - the vocab menu item's mlid
+  // - the menu parent setting for this vocab
+  $plid = _taxonomy_menu_get_mlid($item['ptid'], $item['vid']);
+  if (!$plid) {
+    $plid = variable_get('taxonomy_menu_vocab_parent_'. $item['vid'], NULL);
   }
 
+  // Add updates
+  $link['link_title'] = check_plain($item['name']);
+  $link['menu_name'] = $item['menu_name'];
+  $link['plid'] = $plid;
+  $link['weight'] = $item['weight'];
+  $link['module'] = 'taxonomy_menu';
+  $link['expanded'] = variable_get('taxonomy_menu_expanded_'. $item['vid'], TRUE);
+  $link['link_path'] = $path;
+  $link['options']['attributes']['title'] =
+    trim($item['description']) ?
+    check_plain($item['description']) :
+    check_plain($item['name']);
+
   //FIXME: i18nmenu need to be cleaned up to allow translation from other menu module
   if (module_exists('i18nmenu')) {
     $link['options']['alter'] = TRUE;
@@ -568,6 +572,7 @@ function _taxonomy_menu_save($item) {
   if ($item['remove']) {
     $link['hidden'] = 1;
   }
+
   //save the menu item
   if ($mlid = menu_link_save($link)) {
     //if inserting a new menu item then insert a record into the table
