# {0000481] No warning when user does not supply db credentials in create_coy
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 17 Jan 2011 00:51:02 +0000 (00:51 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 17 Jan 2011 00:51:02 +0000 (00:51 +0000)
CHANGELOG.txt
admin/create_coy.php

index 3d2a021909d2fd71e9ca26222885deea8b09abac..e2e29ac6c9bae8cbbe5d807f32865566f558081b 100644 (file)
@@ -22,6 +22,8 @@ $ -> Affected files
 17-Jan-2011 Joe Hunt
 # [0000494] Cannot set second company pref when setup System and General GL 
 $ /admin/db/company_db.inc
+# {0000481] No warning when user does not supply db credentials in create_coy 
+$ /admin/create_coy.php
 
 12-Jan-2011 Janusz Dobrowolski
 + Added access extensions hook method, cleanup
index 348c3634c7b604e81454dd93029aa7632674494f..6ed2c7743429950a4da971a43db48e5ef5946428 100644 (file)
@@ -41,7 +41,10 @@ function check_data()
        global $db_connections, $tb_pref_counter, $selected_id;
 
        if ($_POST['name'] == "" || $_POST['host'] == "" || $_POST['dbuser'] == "" || $_POST['dbname'] == "")
-               return false;
+       {
+               display_error(_("Database setting are not specified."));
+               return false;
+       }
 
        foreach($db_connections as $id=>$con)
        {
@@ -309,7 +312,15 @@ function display_company_edit($selected_id)
                hidden('dbpassword', $_POST['dbpassword']);
        }
        else
+       {
                $_POST['tbpref'] = $tb_pref_counter."_";
+               // Insert the current settings as default
+               $conn = $db_connections[user_company()];
+               $_POST['host']  = $conn['host'];
+               $_POST['dbuser']  = $conn['dbuser'];
+               $_POST['dbpassword']  = $conn['dbpassword'];
+               $_POST['dbname']  = $conn['dbname'];
+       }
        text_row_ex(_("Company"), 'name', 30);
        text_row_ex(_("Host"), 'host', 30, 60);
        text_row_ex(_("Database User"), 'dbuser', 30);