if ($class_id != false)
$sql .= " AND class_id=".db_escape($class_id);
if ($parent == -1)
- $sql .= " AND parent <= 0";
+ $sql .= " AND (parent = '' OR parent = '-1')";
elseif ($parent != false)
$sql .= " AND parent=".db_escape($parent);
$sql .= " ORDER BY class_id, id, parent";
include($path_to_root . "/includes/ui.inc");
-simple_page_mode(true);
+simple_page_mode(false);
//-----------------------------------------------------------------------------------
function can_process()
if (can_process())
{
- if ($selected_id != -1)
+ if ($selected_id != "")
{
if(update_account_class($selected_id, $_POST['name'], $_POST['ctype']))
display_notification(_('Selected account class settings has been updated'));
function can_delete($selected_id)
{
- if ($selected_id == -1)
+ if ($selected_id == "")
return false;
if (key_in_foreign_table($selected_id, 'chart_types', 'class_id'))
{
//-----------------------------------------------------------------------------------
if ($Mode == 'RESET')
{
- $selected_id = -1;
+ $selected_id = "";
$_POST['id'] = $_POST['name'] = $_POST['ctype'] = '';
}
//-----------------------------------------------------------------------------------
start_table($table_style2);
-if ($selected_id != -1)
+if ($selected_id != "")
{
if ($Mode == 'Edit') {
//editing an existing status code
end_table(1);
-submit_add_or_update_center($selected_id == -1, '', 'both');
+submit_add_or_update_center($selected_id == "", '', 'both');
end_form();
include($path_to_root . "/includes/ui.inc");
-simple_page_mode(true);
+simple_page_mode(false);
//-----------------------------------------------------------------------------------
function can_process()
if (can_process())
{
- if ($selected_id != -1)
+ if ($selected_id != "")
{
if (update_account_type($_POST['id'], $_POST['name'], $_POST['class_id'], $_POST['parent'], $_POST['old_id']))
display_notification(_('Selected account type has been updated'));
function can_delete($selected_id)
{
- if ($selected_id == -1)
+ if ($selected_id == "")
return false;
$type = db_escape($selected_id);
}
if ($Mode == 'RESET')
{
- $selected_id = -1;
+ $selected_id = "";
$_POST['id'] = $_POST['name'] = '';
unset($_POST['parent']);
unset($_POST['class_id']);
$bs_text = get_account_class_name($myrow["class_id"]);
- if ($myrow["parent"] == '0' || $myrow["parent"] == '-1')
+ if ($myrow["parent"] == '-1')
{
$parent_text = "";
}
start_table($table_style2);
-if ($selected_id != -1)
+if ($selected_id != "")
{
if ($Mode == 'Edit')
{
$_POST['id'] = $myrow["id"];
$_POST['name'] = $myrow["name"];
$_POST['parent'] = $myrow["parent"];
+ if ($_POST['parent'] == '-1')
+ $_POST['parent'] == "";
$_POST['class_id'] = $myrow["class_id"];
hidden('selected_id', $selected_id);
hidden('old_id', $myrow["id"]);
}
hidden('id');
- text_row_ex(_("ID:"), 'id', 10);
}
-else
- text_row_ex(_("ID:"), 'id', 10);
+text_row_ex(_("ID:"), 'id', 10);
text_row_ex(_("Name:"), 'name', 50);
gl_account_types_list_row(_("Subgroup Of:"), 'parent', null, _("None"), true);
//-----------------------------------------------------------------------------------------------
-function gl_account_types_list($name, $selected_id=null, $all_option=false, $all_option_numeric=true)
+function gl_account_types_list($name, $selected_id=null, $all_option=false, $all=true)
{
global $all_items;
array(
'order' => 'class_id', 'id',
'spec_option' =>$all_option,
- 'spec_id' => $all_option_numeric ? 0 : $all_items
+ 'spec_id' => $all_items
) );
}
-function gl_account_types_list_cells($label, $name, $selected_id=null, $all_option=false,
- $all_option_numeric=false)
+function gl_account_types_list_cells($label, $name, $selected_id=null, $all_option=false, $all=false)
{
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- echo gl_account_types_list($name, $selected_id, $all_option, $all_option_numeric);
+ echo gl_account_types_list($name, $selected_id, $all_option, $all);
echo "</td>\n";
}
-function gl_account_types_list_row($label, $name, $selected_id=null, $all_option=false,
- $all_option_numeric=false)
+function gl_account_types_list_row($label, $name, $selected_id=null, $all_option=false, $all=false)
{
echo "<tr><td class='label'>$label</td>";
gl_account_types_list_cells(null, $name, $selected_id, $all_option,
- $all_option_numeric);
+ $all);
echo "</tr>\n";
}