Check for empty class ID and better test for type/account id/name
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 14 Oct 2010 09:54:53 +0000 (09:54 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 14 Oct 2010 09:54:53 +0000 (09:54 +0000)
CHANGELOG.txt
gl/manage/gl_account_classes.php
gl/manage/gl_account_types.php
gl/manage/gl_accounts.php

index 3c85108085f7e0ca2bb8500cb40ed81a175b4e7a..b9c729c00e84e47cfc58d916647c2541465026c1 100644 (file)
@@ -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
index 2e9bf09a08b9cccdbcef72b3b7d72dc18a4b4ead..238ffa0a2018c2f3efdd7c7b984934613872779e 100644 (file)
@@ -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');
index b399725c0fe716111d4f805377c51d43e873d45c..3cef7a07540acdc4e051ae30c8c8665eae737ae3 100644 (file)
@@ -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');
index 900bf3668382403b11acfff1591896e5e191ba41..8944d385f35a311682e97a83e49197f0a969d0e5 100644 (file)
@@ -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."));