Index: nat.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nat/nat.module,v
retrieving revision 1.34.2.18
diff -u -p -r1.34.2.18 nat.module
--- nat.module	1 Mar 2009 07:27:51 -0000	1.34.2.18
+++ nat.module	3 Mar 2010 17:35:31 -0000
@@ -121,26 +121,25 @@ function nat_form_alter(&$form, &$form_s
       if (count($associations) && $form_id == $type .'_node_form') {
         $nat_terms = array();
 
-        // If this is a node update, remove this node's associated terms from
-        // its associated vocabularies.
-        // N.B. Free-tag vocabularies are unaffected by this.
-        if (isset($form['#node']->nid)) {
+        // Remove NAT Term and its children from Taxonomy
+        if (isset($form['#node']->nid) & !empty($form['#node']->nat)) {
           foreach ($form['#node']->nat as $tid => $term) {
-            $nat_terms[$term->vid] = $tid;
-            // Remove from taxonomy form.
-            if (isset($form['taxonomy'])) {
-              foreach ($form['taxonomy'] as $vid => $values) {
-                if ($term->vid == $vid) {
-                  foreach ($values['#options'] as $id => $option) {
-                    if (isset($option->option[$term->tid])) {
-                      unset($form['taxonomy'][$vid]['#options'][$id]);
-                      break;
-                    }
-                  }
-                  break;
+            $tids = taxonomy_get_tree($term->vid,$term->tid);
+            $tids[] = $term;
+            foreach($tids as $term) {
+              $forbidden_tids[$term->vid][$term->tid] = $term->tid;
+            }
+          }
+          foreach ($form['taxonomy'] as $vid => $values) {
+            if (isset($forbidden_tids[$vid])) {
+              unset($values['#options']['']);
+              foreach ($values['#options'] as $id => $option) {
+                $form_term=array_keys($option->option);
+                if (isset($forbidden_tids[$vid][$form_term[0]])) {
+                  unset($form['taxonomy'][$vid]['#options'][$id]);
                 }
               }
-            }
+            } 
           }
         }
 
