From daf0fe2200659df7403c2f51855795b014c420b5 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Wed, 24 Mar 2010 09:33:40 +0000 Subject: [PATCH] Parse error in ui_list.inc. Fix in other files --- CHANGELOG.txt | 5 ++++- gl/includes/db/gl_db_account_types.inc | 2 +- gl/manage/gl_account_types.php | 18 ++++++++++-------- includes/ui/ui_lists.inc | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b3ba4b8c..76b202f0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/gl/includes/db/gl_db_account_types.inc b/gl/includes/db/gl_db_account_types.inc index b76b6efc..5f1da519 100644 --- a/gl/includes/db/gl_db_account_types.inc +++ b/gl/includes/db/gl_db_account_types.inc @@ -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); diff --git a/gl/manage/gl_account_types.php b/gl/manage/gl_account_types.php index 628cbc2f..7cc32aa4 100644 --- a/gl/manage/gl_account_types.php +++ b/gl/manage/gl_account_types.php @@ -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); diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index ab9a9659..8d905f63 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -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; } -- 2.30.2