Fixed extension module update and deletion.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 23 Oct 2009 20:32:42 +0000 (20:32 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 23 Oct 2009 20:32:42 +0000 (20:32 +0000)
CHANGELOG.txt
admin/inst_module.php

index 113c0ab59a6a6269e6a3706dbd190fdc097ccf8b..00ef861541857535125eadb31fc32397fe1e8399 100644 (file)
@@ -21,6 +21,14 @@ $ -> Affected files
 
 
 ------------------------------- Release 2.2 RC ----------------------------------
+23-Oct-2009 Janusz Dobrowolski
+# Fixed 2.2 upgrade pre_check
+$ /sql/alter2.2.php
+# Fixed check_table() to avoid sparse messages in error log
+$ /admin/inst_update.php
+# Fixed module update and deletion.
+$ /admin/inst_module.php
+
 22-Oct-2009 Tom Hallman
 + Added generic tags support and tags for dimensions/gl accounts.
 $ /applications/dimensions.php
index 3571b6929aac329a32439c299ac883e50329e4fa..2329146cf05af39c4ac60adbbb82f917221cdd6f 100644 (file)
@@ -92,7 +92,7 @@ function handle_submit()
                return false;
        $id = $selected_id==-1 ? $next_extension_id : $selected_id;
 
-       if ($extensions[$id]['type'] != 'plugin') {
+       if ($selected_id != -1 && $extensions[$id]['type'] != 'plugin') {
                display_error(_('Module installation support is not implemented yet. You have to do it manually.'));
                return;
        }
@@ -101,7 +101,7 @@ function handle_submit()
        $extensions[$id]['name'] = $_POST['name'];
        $extensions[$id]['path'] = $_POST['path'];
        $extensions[$id]['title'] = $_POST['title'];
-       $extensions[$id]['active'] = $_POST['active'];
+       $extensions[$id]['active'] = check_value('active');
 
        // Currently we support only plugin extensions here.
        $extensions[$id]['type'] = 'plugin';
@@ -171,32 +171,16 @@ function handle_delete()
        $extensions = get_company_extensions();
 
        $id = $selected_id;
-       $removed_ext = $extensions[$id];
-
-       unset($extensions[$id]);
-       $mods = array_values($extensions);
-       $extensions = $mods;
-
-       unset($extensions[$id]);
-
-       update_extensions($extensions);
 
        $filename = $path_to_root
                . ($extensions[$id]['type']=='plugin' ? "/modules/": '/')
                . $extensions[$id]['path'];
 
-       if ($h = opendir($filename))
-       {
-               while (($file = readdir($h)) !== false)
-               {
-                       if (is_file("$filename/$file"))
-                               unlink("$filename/$file");
-               }
-               closedir($h);
-       }
+       flush_dir($filename);
        rmdir($filename);
-
-       display_notification(_("Selected extension has been successfully deleted"));
+       unset($extensions[$id]);
+       if (update_extensions($extensions))
+               display_notification(_("Selected extension has been successfully deleted"));
        return true;
 }