X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sql%2Falter2.2.php;h=d6827b8e977f0d3b4e51c365c07a7b42955d7267;hb=3ff9ed87cb909f19c8fe3e7dfda5df79d0c01a6c;hp=30219a7079c9cd0ebbbef04543198e09b80f070d;hpb=2916061723b7db16539237b22abf487066cfbf36;p=fa-stable.git diff --git a/sql/alter2.2.php b/sql/alter2.2.php index 30219a70..d6827b8e 100644 --- a/sql/alter2.2.php +++ b/sql/alter2.2.php @@ -14,6 +14,12 @@ class fa2_2 { var $version = '2.2'; // version installed var $description = 'Version 2.2'; var $sql = 'alter2.2.sql'; + var $preconf = true; + + function fa2_2() { + $this->preconf = fix_extensions(); + } + // // Install procedure. All additional changes // not included in sql file should go here. @@ -21,6 +27,10 @@ class fa2_2 { function install($pref, $force) { global $db, $systypes_array; + + if (!$this->preconf) + return false; + // set item category dflt accounts to values from company GL setup $prefs = get_company_prefs(); $sql = "UPDATE {$pref}stock_category SET " @@ -46,7 +56,7 @@ class fa2_2 { if (db_num_rows($result)) { while ($row = db_fetch($result)) { $res2 = db_query("INSERT INTO {$pref}refs VALUES(" - . $row['id'].",".$typeno.",'".$row['ref']."')"); + . $row['id'].",".$typeno.",'".addslashes($row['ref'])."')"); if (!$res2) { display_error(_("Cannot copy references from $tbl") .':
'. db_error_msg($db)); @@ -157,7 +167,7 @@ function convert_roles($pref) 'SA_SALESBULKREP', 'SA_CUSTSTATREP', 'SA_SUPPLIERANALYTIC', 'SA_SUPPPAYMREP', 'SA_SUPPBULKREP', 'SA_ITEMSVALREP', 'SA_ITEMSANALYTIC', 'SA_BOMREP', 'SA_MANUFBULKREP', 'SA_DIMENSIONREP', 'SA_BANKREP', 'SA_GLREP', - 'SA_GLANALYTIC', 'SA_TAXREP', 'SA_SALESANALYTIC'), + 'SA_GLANALYTIC', 'SA_TAXREP', 'SA_SALESANALYTIC', 'SA_SALESQUOTE'), 3 => array('SA_GLACCOUNTGROUP', 'SA_GLACCOUNTCLASS','SA_PAYMENT', 'SA_DEPOSIT', 'SA_JOURNALENTRY', 'SA_INVENTORYMOVETYPE', 'SA_LOCATIONTRANSFER', 'SA_INVENTORYADJUSTMENT', 'SA_WORKCENTRES', @@ -183,7 +193,7 @@ function convert_roles($pref) 15 => array('SA_PRINTERS', 'SA_PRINTPROFILE', 'SA_BACKUP', 'SA_USERS', 'SA_POSSETUP'), 20 => array('SA_CREATECOMPANY', 'SA_CREATELANGUAGE', 'SA_CREATEMODULES', - 'SA_SOFTWAREUPGRADE', 'SA_SECROLES') + 'SA_SOFTWAREUPGRADE', 'SA_SECROLES', 'SA_DIMTAGS', 'SA_GLACCOUNTTAGS') ); $new_ids = array(); foreach ($security_groups as $role_id => $areas) { @@ -227,6 +237,52 @@ function import_security_role($pref, $name, $sections, $areas) db_query($sql, "could not add new security role"); } +/* + Changes in extensions system. + This function is executed once on first Upgrade System display. +*/ +function fix_extensions() { + global $path_to_root, $db_connections; + + if (!file_exists($path_to_root.'/modules/installed_modules.php')) + return true; // already converted + + if (!is_writable($path_to_root.'/modules/installed_modules.php')) { + display_error(_('Cannot upgrade extensions system: file /modules/installed_modules.php is not writeable')); + return false; + } + + $exts = array(); + include($path_to_root.'/installed_extensions.php'); + foreach($installed_extensions as $ext) { + $ext['filename'] = $ext['app_file']; unset($ext['app_file']); + $ext['tab'] = $ext['name']; + $ext['name'] = access_string($ext['title'], true); + $ext['path'] = $ext['folder']; unset($ext['folder']); + $ext['type'] = 'module'; + $ext['active'] = '1'; + $exts[] = $ext; + } + + include($path_to_root.'/modules/installed_modules.php'); + foreach($installed_modules as $mod) { + $mod['title'] = $mod['name']; + $mod['name'] = access_string($mod['name'], true); + $mod['type'] = 'plugin'; + $ext['active'] = '1'; + $exts[] = $mod; + } + if (!write_extensions($exts)) + return false; + + $cnt = count($db_connections); + for ($i = 0; $i < $cnt; $i++) + write_extensions($exts, $i); + + unlink($path_to_root.'/modules/installed_modules.php'); + return true; +} + $install = new fa2_2; ?> \ No newline at end of file