function post_updateItem($history = 1)
 {
     if (in_array('name', $this->updates) || in_array($this->getForeignKeyField(), $this->updates)) {
         if (in_array($this->getForeignKeyField(), $this->updates)) {
             CleanFields($this->getTable(), array('ancestors_cache', 'sons_cache'));
         }
         regenerateTreeCompleteNameUnderID($this->getTable(), $this->input['id']);
     }
 }
/**
 * Compute completename of Dropdown Tree table under the element of ID $ID
 *
 * @param $table : dropdown tree table to compute
 * @param $ID : root ID to used : regenerate all under this element
 *
 * @return nothing
**/
function regenerateTreeCompleteNameUnderID($table, $ID)
{
    global $DB;
    $parentIDfield = getForeignKeyFieldForTable($table);
    list($name, $level) = getTreeValueName($table, $ID);
    $query = "UPDATE `{$table}`\n             SET `completename` = '" . addslashes($name) . "',\n                 `level` = '{$level}'\n             WHERE `id` = '{$ID}'";
    $DB->query($query);
    $query = "SELECT `id`\n             FROM `{$table}`\n             WHERE `{$parentIDfield}` = '{$ID}'";
    $result = $DB->query($query);
    if ($DB->numrows($result) > 0) {
        while ($data = $DB->fetch_array($result)) {
            regenerateTreeCompleteNameUnderID($table, $data["id"]);
        }
    }
}