--- ./OLD/sites/all/modules/hierarchical_select/modules/hs_taxonomy.module	2011-09-07 11:57:57.000000000 -0300
+++ ./NEW/sites/all/modules/hierarchical_select/modules/hs_taxonomy.module	2012-09-12 11:02:53.803220842 -0300
@@ -152,43 +152,76 @@
     return;
   }
 
-  // Build an appropriate config, that inherits the level_labels settings
-  // from the vocabulary's Hierarchical Select config.
   $vid = $form['#vocabulary']->vid;
-  module_load_include('inc', 'hierarchical_select', 'includes/common');
-  $vocabulary_config = hierarchical_select_common_config_get("taxonomy-$vid");
-  $config = array(
-    'module' => 'hs_taxonomy',
-    'params' => array(
-      'vid'         => $vid,
-      'exclude_tid' => isset($form['#term']['tid']) ? $form['#term']['tid'] : NULL,
-      'root_term'   => TRUE,
-    ),
-    'enforce_deepest' => 0,
-    'entity_count'    => 0,
-    'require_entity'  => 0,
-    'save_lineage'    => 0,
-    'level_labels'    => $vocabulary_config['level_labels'],
-    'dropbox' => array(
-      'status' => 1,
-      'limit'  => 0,
-    ),
-    'editability' => array(
-      'status' => 0,
-    ),
-    'render_flat_select' => 0,
-  );
-
-  // Use Hierarchical Select for selecting the parent term(s).
   $parent = isset($form['#term']['tid']) ? array_keys(taxonomy_get_parents($form['#term']['tid'])) : array(0);
-  $form['relations']['parent'] = array(
-    '#type'          => 'hierarchical_select',
-    '#title'         => t('Parents'),
-    '#required'      => TRUE,
-    '#default_value' => $parent,
-    '#config'        => $config,
-  );
-  $form['relations']['parent']['#config']['dropbox']['title'] = t('All parent terms');
+
+  // Don't alter the form if Dropbox is disabled for parent selection.
+  if (variable_get('hierarchical_select_taxonomy_parent_dropbox', TRUE) === TRUE) {   
+
+    // Build an appropriate config, that inherits the level_labels settings
+    // from the vocabulary's Hierarchical Select config.
+    module_load_include('inc', 'hierarchical_select', 'includes/common');
+    $vocabulary_config = hierarchical_select_common_config_get("taxonomy-$vid");
+    $config = array(
+      'module' => 'hs_taxonomy',
+      'params' => array(
+        'vid'         => $vid,
+        'exclude_tid' => isset($form['#term']['tid']) ? $form['#term']['tid'] : NULL,
+        'root_term'   => TRUE,
+      ),
+      'enforce_deepest' => 0,
+      'entity_count'    => 0,
+      'require_entity'  => 0,
+      'save_lineage'    => 0,
+      'level_labels'    => $vocabulary_config['level_labels'],
+      'dropbox' => array(
+        'status' => 1,
+        'limit'  => 0,
+      ),
+      'editability' => array(
+        'status' => 0,
+      ),
+      'render_flat_select' => 0,
+    );
+
+    // Use Hierarchical Select for selecting the parent term(s).
+    $form['relations']['parent'] = array(
+      '#type'          => 'hierarchical_select',
+      '#title'         => t('Parents'),
+      '#required'      => TRUE,
+      '#default_value' => $parent,
+      '#config'        => $config,
+    );
+    $form['relations']['parent']['#config']['dropbox']['title'] = t('All parent terms');
+  }
+  else {
+    // original field generation from Taxonomy module.
+    $children = taxonomy_get_tree($vid, $form['#term']['tid']);
+
+    // A term can't be the child of itself, nor of its children.
+    foreach ($children as $child) {
+      $exclude[] = $child->tid;
+    }
+    $exclude[] = $form['#term']['tid'];
+
+    $tree = taxonomy_get_tree($vid);
+    $options = array('<' . t('root') . '>');
+    if (empty($parent)) {
+      $parent = array(0);
+    }
+    foreach ($tree as $item) {
+      if (!in_array($item->tid, $exclude)) {
+        $options[$item->tid] = str_repeat('-', $item->depth) . $item->name;
+      }
+    }
+    $form['relations']['parent'] = array(
+      '#type' => 'select',
+      '#title' => t('Parent terms'),
+      '#options' => $options,
+      '#default_value' => $parent,
+      '#multiple' => TRUE,
+    );
+  }
 }
 
 
