diff --git a/taxonomy_title.module b/taxonomy_title.module old mode 100644 new mode 100755 index 7d2ee65..4d475f7 --- a/taxonomy_title.module +++ b/taxonomy_title.module @@ -54,8 +54,7 @@ function taxonomy_title_taxonomy_term_delete($op, $type, $array = NULL) { * Implements hook_taxonomy_term_update(). */ function taxonomy_title_taxonomy_term_update($term) { - _taxonomy_title_delete_title($term->tid); - _taxonomy_title_insert_title($term->tid, $term->taxonomy_title); + _taxonomy_title_update($term->tid, $term->taxonomy_title); } /** @@ -152,12 +151,15 @@ function _taxonomy_title_insert_title($tid, $title) { * The taxonomy term title to use for this term. */ function _taxonomy_title_update($tid, $title) { - if (db_result(db_query("SELECT title FROM {taxonomy_title} WHERE tid = %d", $tid))) { - db_query("UPDATE {taxonomy_title} SET title = '%s' WHERE tid = %d", $title, $tid); - } - else { - db_query("INSERT INTO {taxonomy_title} (tid, title) VALUES (%d, '%s')", $tid, $title); - } + db_merge('taxonomy_title') + ->key(array( + 'tid'=>$tid + )) + ->fields(array( + 'title' => $title + )) + ->execute(); + // Add Suppot for i18nstrings. if (function_exists('i18nstrings_update')) { i18nstrings_update("taxonomy_title:term:$tid:title", $title);