X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Fcreate_coy.php;h=f500feb9cd26b85ca6c17684cf1179286b197bbf;hb=67ec1888ea14a50f6df62e0599e50d209e7b0c6c;hp=21861a0f83c8bb9343f4be3fb3956824b89ef3c2;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/admin/create_coy.php b/admin/create_coy.php index 21861a0f..f500feb9 100644 --- a/admin/create_coy.php +++ b/admin/create_coy.php @@ -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 settings are not specified.")); + return false; + } foreach($db_connections as $id=>$con) { @@ -281,11 +284,6 @@ function display_company_edit($selected_id) { global $def_coy, $db_connections, $tb_pref_counter; - if ($selected_id != -1) - $n = $selected_id; - else - $n = count($db_connections); - start_form(); start_table(TABLESTYLE2); @@ -309,9 +307,17 @@ 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); + text_row_ex(_("Host"), 'host', 30, 60); text_row_ex(_("Database User"), 'dbuser', 30); if ($selected_id == -1) text_row_ex(_("Database Password"), 'dbpassword', 30);