*** taxonomy_builder.modulebackup	2010-06-29 12:22:28.000000000 -0400
--- taxonomy_builder.module	2010-07-28 19:11:43.000000000 -0400
***************
*** 102,108 ****
    }
  
    // If the term doesn't exist, add it to the database.
!   if (!$next_parent = taxonomy_builder_get_term($form_values['name'], $parent_id)) {
  
      // Normalizes synonyms which allows us to pass a more developer friendly
      // array as opposed string with words separated by line endings.
--- 102,108 ----
    }
  
    // If the term doesn't exist, add it to the database.
!   if (!$next_parent = taxonomy_builder_get_term($vid, $form_values['name'], $parent_id)) {
  
      // Normalizes synonyms which allows us to pass a more developer friendly
      // array as opposed string with words separated by line endings.
***************
*** 145,151 ****
   * @return
   *   A term ID, FALSE if no match is found.
   */
! function taxonomy_builder_get_term($name, $parent_id = NULL) {
    if (NULL === $parent_id) {
      $parent_id = 0;
    }
--- 145,151 ----
   * @return
   *   A term ID, FALSE if no match is found.
   */
! function taxonomy_builder_get_term($vid, $name, $parent_id = NULL) {
    if (NULL === $parent_id) {
      $parent_id = 0;
    }
***************
*** 155,165 ****
      SELECT t.tid
      FROM {term_data} t
      INNER JOIN {term_hierarchy} h ON h.tid = t.tid
!     WHERE t.name = '%s' AND h.parent = %d
    ";
  
    // If term exists, returns term ID.
!   if ($result = db_query($sql, $name, $parent_id)) {
      while ($term = db_fetch_object($result)) {
        return $term->tid;
      }
--- 155,165 ----
      SELECT t.tid
      FROM {term_data} t
      INNER JOIN {term_hierarchy} h ON h.tid = t.tid
!     WHERE t.name = '%s' AND h.parent = %d AND t.vid = %d
    ";
  
    // If term exists, returns term ID.
!   if ($result = db_query($sql, $name, $parent_id, $vid)) {
      while ($term = db_fetch_object($result)) {
        return $term->tid;
      }
