X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Finst_module.php;h=5bce6ba6c509bf96a51de8834e4b00ab0eb8fa02;hb=2a0f29497517eca1cde8b2832da5761edefb2268;hp=11c30bfa5d2f62a6c53093e53a73331e4d01cff8;hpb=c70823611ef71079c28542f4810cc50c183a8cd5;p=fa-stable.git diff --git a/admin/inst_module.php b/admin/inst_module.php index 11c30bfa..5bce6ba6 100644 --- a/admin/inst_module.php +++ b/admin/inst_module.php @@ -34,18 +34,6 @@ else $selected_id = -1; //--------------------------------------------------------------------------------------------- -function get_company_extensions($id = -1) { - - global $path_to_root; - - $file = $path_to_root.($id == -1 ? '' : '/company/'.$id).'/installed_extensions.php'; - $installed_extensions = array(); - if (is_file($file)) { - include($file); - } - return $installed_extensions; -} - function check_data($id, $exts) { if ($_POST['name'] == "") { @@ -81,7 +69,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 +130,7 @@ function handle_submit() function handle_delete() { - global $path_to_root; + global $path_to_root, $db_connections; $extensions = get_company_extensions(); @@ -167,15 +155,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']); }