diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index af0eb276a3..24b1372846 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -223,6 +223,10 @@ else { $appstbl = 'phpgw_applications'; + if($this->amorethanb($setup_info['phpgwapi']['currentver'],'0.9.13.014')) + { + $use_appid = True; + } } if($DEBUG) @@ -237,9 +241,26 @@ { $tables = implode(',',$setup_info[$appname]['tables']); } + if($use_appid) + { + $this->db->query("SELECT MAX(app_id) FROM $appstbl"); + $this->db->next_record(); + if($this->db->f(0)) + { + $app_id = ($this->db->f(0) + 1) . ','; + $app_idstr = 'app_id,'; + } + else + { + srand(100000); + $app_id = rand(1,100000) . ','; + $app_idstr = 'app_id,'; + } + } $this->db->query("INSERT INTO $appstbl " - . "(app_name,app_title,app_enabled,app_order,app_tables,app_version) " + . "($app_idstr app_name,app_title,app_enabled,app_order,app_tables,app_version) " . "VALUES (" + . $app_id . "'" . $setup_info[$appname]['name'] . "'," . "'" . $setup_info[$appname]['title'] . "'," . $enable . ","