From d424105541040a975f03001cc051f1ec63797606 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Mon, 28 Sep 2009 13:53:31 +0000 Subject: [PATCH] Additional extension system related fixes. --- CHANGELOG.txt | 2 +- admin/db/maintenance_db.inc | 2 +- admin/inst_module.php | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 0aa8c075..a3107eb0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -39,7 +39,7 @@ $ /frontaccounting.php /includes/session.inc /includes/ui/ui_lists.inc /sql/alter2.2.php - + /modules/installed_modules.php (Removed) # Prevented switching off access to security role editor for current role. $ /admin/security_roles.php diff --git a/admin/db/maintenance_db.inc b/admin/db/maintenance_db.inc index 18bcf3aa..3df97cda 100644 --- a/admin/db/maintenance_db.inc +++ b/admin/db/maintenance_db.inc @@ -134,7 +134,7 @@ function write_extensions($extensions=null, $company = null) $n = count($exts); $msg = " '); diff --git a/admin/inst_module.php b/admin/inst_module.php index 11c30bfa..5b5788e6 100644 --- a/admin/inst_module.php +++ b/admin/inst_module.php @@ -81,7 +81,7 @@ function handle_submit() global $path_to_root, $db_connections, $selected_id; $extensions = get_company_extensions(); - if (!check_data($selected_id), $extensions) + if (!check_data($selected_id, $extensions)) return false; $id = $_GET['id']; @@ -142,7 +142,7 @@ function handle_submit() function handle_delete() { - global $path_to_root; + global $path_to_root, $db_connections; $extensions = get_company_extensions(); @@ -167,15 +167,27 @@ function handle_delete() } rmdir($filename); + $ident = $extensions[$id]['name']; unset($extensions[$id]); $mods = array_values($extensions); $extensions = $mods; if (!write_extensions($extensions)) return; - - // should we also delete module form per company extension files? - + + // update per company files + $cnt = count($db_connections); + for($i = 0; $i < $cnt; $i++) + { + $exts = get_company_extensions($i); + foreach($exts as $key => $ext) { + if ($ext['name'] == $ident) { + unset($exts[$key]); + break; + } + } + write_extensions($exts, $i); + } meta_forward($_SERVER['PHP_SELF']); } -- 2.30.2