Parse error in ui_list.inc. Fix in other files
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 24 Mar 2010 09:33:40 +0000 (09:33 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 24 Mar 2010 09:33:40 +0000 (09:33 +0000)
CHANGELOG.txt
gl/includes/db/gl_db_account_types.inc
gl/manage/gl_account_types.php
includes/ui/ui_lists.inc

index b3ba4b8cfeda8c1a4aea4c12ed3260cbeb00351b..76b202f0ad8cd5f471dd789a8347e751eba7f3e3 100644 (file)
@@ -19,11 +19,14 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+24-Mar-2010 Janusz Dobrowolski/Joe Hunt
 # Fixed problem with multiply zeros a value of option in list selectors
+# Parse error in ui_list.inc. Fix in other files.
 $ /includes/ui/ui_lists.inc
+  /gl/includes/db/gl_db_account_types.inc
+  /gl/manage/gl_account_types.php
 
 22-Mar-2010 Joe Hunt
-
 # Error editing (updating) Account Groups and problem
   with "00" == "0" in php.
 $ /gl/includes/db/gl_db_account_types.inc
index b76b6efc81f820a41fe3497c1be7123baab950fc..5f1da519747d5a5b7e5c14c99d739ca2d49254d7 100644 (file)
@@ -20,7 +20,7 @@ function add_account_type($id, $name, $class_id, $parent)
 function update_account_type($id, $name, $class_id, $parent, $old_id)
 {
        begin_transaction();
-       if ($old_id != $id)
+       if ($old_id !== $id)
        {
                $sql = "SELECT id FROM ".TB_PREF."chart_types WHERE parent = ".db_escape($old_id);
 
index 628cbc2f8ed8a5a5fb9d3c5863e3a6fd8c9af367..7cc32aa44f835b5b5113864f288895f35a05ad8a 100644 (file)
@@ -24,8 +24,6 @@ simple_page_mode(false);
 
 function can_process() 
 {
-       global $selected_id;
-
        if ($_POST['id'] == "")
        {
            display_error( _("The account group id cannot be empty."));
@@ -39,10 +37,10 @@ function can_process()
                return false;
        }
 
-       if (strcmp($_POST['id'], $_POST['parent']) == 0) 
+       //if (strcmp($_POST['id'], $_POST['parent']) == 0) 
+       if ($_POST['id'] === $_POST['parent']) 
        {
-               display_error("id = {$_POST['id']}, parent = {$_POST['parent']}");
-               //display_error(_("You cannot set an account group to be a subgroup of itself."));
+               display_error(_("You cannot set an account group to be a subgroup of itself."));
                return false;
        }
 
@@ -66,9 +64,9 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
        {
                if (add_account_type($_POST['id'], $_POST['name'], $_POST['class_id'], $_POST['parent'])) {
                                display_notification(_('New account type has been added'));
-                               $Mode = 'RESET';
                        }
        }
+               $Mode = 'RESET';
        }
 }
 
@@ -171,10 +169,14 @@ if ($selected_id != "")
                if ($_POST['parent'] == '-1')
                        $_POST['parent'] == "";
                $_POST['class_id']  = $myrow["class_id"];
-               hidden('selected_id', $selected_id);
+               hidden('selected_id', $myrow['id']);
                hidden('old_id', $myrow["id"]);
        }
-       hidden('id');
+       else
+       {
+               hidden('selected_id', $selected_id);
+               hidden('old_id', $_POST["old_id"]);
+       }       
 }
 text_row_ex(_("ID:"), 'id', 10);
 text_row_ex(_("Name:"), 'name', 50);
index ab9a96592452cc0dac5442927f100fb0781901a4..8d905f635b70dd266224f8c41c71c3864ee5e25a 100644 (file)
@@ -344,7 +344,7 @@ $opts = array(              // default options
 //if($name=='SelectStockFromList') display_error($sql);
                foreach($items as $value=>$descr) {
                        $sel = '';
-                       if (in_array((string)$value, $selected_id), true) {
+                       if (in_array((string)$value, $selected_id, true)) {
                                $sel = "selected='selected'";
                                $found = $value;
                        }