From 51a2700eed349e2ad70386f6e18e77ab750c8820 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Thu, 14 Oct 2010 09:54:53 +0000 Subject: [PATCH] Check for empty class ID and better test for type/account id/name --- CHANGELOG.txt | 6 ++++++ gl/manage/gl_account_classes.php | 9 +++++---- gl/manage/gl_account_types.php | 4 ++-- gl/manage/gl_accounts.php | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3c851080..b9c729c0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,12 @@ Legend: ! -> Note $ -> Affected files +14-Oct-2010 Joe Hunt +# Check for empty class ID and better test for type/account id/name. +$ /gl/manage/gl_account_classes.php + /gl/manage/gl_account_types.php + /gl/manage/gl_accounts.php + 12-Oct-2010 Janusz Dobrowolski # Upgrade failed when MySQL run in strict mode. $ /sql/alter2.3.sql diff --git a/gl/manage/gl_account_classes.php b/gl/manage/gl_account_classes.php index 2e9bf09a..238ffa0a 100644 --- a/gl/manage/gl_account_classes.php +++ b/gl/manage/gl_account_classes.php @@ -25,13 +25,14 @@ simple_page_mode(false); function can_process() { global $use_oldstyle_convert; - /*if (!is_numeric($_POST['id'])) + + if (strlen(trim($_POST['id'])) == 0) { - display_error( _("The account class ID must be numeric.")); + display_error( _("The account class ID cannot be empty.")); set_focus('id'); return false; - }*/ - if (strlen($_POST['name']) == 0) + } + if (strlen(trim($_POST['name'])) == 0) { display_error( _("The account class name cannot be empty.")); set_focus('name'); diff --git a/gl/manage/gl_account_types.php b/gl/manage/gl_account_types.php index b399725c..3cef7a07 100644 --- a/gl/manage/gl_account_types.php +++ b/gl/manage/gl_account_types.php @@ -24,13 +24,13 @@ simple_page_mode(false); function can_process() { - if ($_POST['id'] == "") + if (strlen(trim($_POST['id'])) == 0) { display_error( _("The account group id cannot be empty.")); set_focus('id'); return false; } - if (strlen($_POST['name']) == 0) + if (strlen(trim($_POST['name'])) == 0) { display_error( _("The account group name cannot be empty.")); set_focus('name'); diff --git a/gl/manage/gl_accounts.php b/gl/manage/gl_accounts.php index 900bf366..8944d385 100644 --- a/gl/manage/gl_accounts.php +++ b/gl/manage/gl_accounts.php @@ -47,13 +47,13 @@ if (isset($_POST['add']) || isset($_POST['update'])) $input_error = 0; - if (strlen($_POST['account_code']) == 0) + if (strlen(trim($_POST['account_code'])) == 0) { $input_error = 1; display_error( _("The account code must be entered.")); set_focus('account_code'); } - elseif (strlen($_POST['account_name']) == 0) + elseif (strlen(trim($_POST['account_name'])) == 0) { $input_error = 1; display_error( _("The account name cannot be empty.")); -- 2.30.2