$db->updateConfigureValue('COMPANY_POSTAL_CODE', $store_postal_code); $db->updateConfigureValue('COMPANY_COUNTRY', $store_country); $db->updateConfigureValue('COMPANY_EMAIL', $store_email); $db->updateConfigureValue('COMPANY_WEBSITE', $store_website); $db->updateConfigureValue('COMPANY_TELEPHONE1', $store_telephone1); $db->updateConfigureValue('COMPANY_TELEPHONE2', $store_telephone2); $db->updateConfigureValue('COMPANY_FAX', $store_fax); $db->updateConfigureValue('DEFAULT_CURRENCY', $store_default_currency); // update the default setting in journal_main to default to the selected value $db->Execute("ALTER TABLE " . TABLE_JOURNAL_MAIN . " CHANGE `currencies_code` `currencies_code` CHAR(3) NOT NULL DEFAULT '" . $store_default_currency . "'"); $db->Close(); // create/update the config.php file with the new company name install_build_co_config_file(DB_DATABASE, DB_DATABASE . '_TITLE', $store_name); install_build_co_config_file(DB_DATABASE, 'DB_SERVER_USERNAME', DB_SERVER_USERNAME); install_build_co_config_file(DB_DATABASE, 'DB_SERVER_PASSWORD', DB_SERVER_PASSWORD); install_build_co_config_file(DB_DATABASE, 'DB_SERVER', DB_SERVER); header('location: index.php?main_page=chart_setup&language=' . $language); exit; } } //if not submit, set some defaults $sql = "select countries_iso_code_3, countries_name from " . DB_PREFIX . "countries"; $country = $db->Execute($sql); $country_string = ''; while (!$country->EOF) { $country_string .= '<option value="' . $country->fields['countries_iso_code_3'] . '"' . setSelected($country->fields['countries_iso_code_3'], $_POST['store_country']) . '>' . htmlspecialchars($country->fields['countries_name']) . '</option>'; $country->MoveNext(); } $sql = "select title, code from " . DB_PREFIX . "currencies"; $currency = $db->Execute($sql) or die("error in {$sql}" . $db->ErrorMsg()); $currency_string = '';
// write the db config.php in the company directory if (!file_exists(DIR_FS_ADMIN . PATH_TO_MY_FILES . $db_name)) { if (!@mkdir(DIR_FS_ADMIN . PATH_TO_MY_FILES . $db_name)) { $error = $messageStack->add(sprintf(MSG_ERROR_CREATE_MY_FILES, DIR_FS_ADMIN . PATH_TO_MY_FILES), 'error'); } } if (!install_build_co_config_file($db_name, $db_name . '_TITLE', $co_name)) { $error = true; } if (!install_build_co_config_file($db_name, 'DB_SERVER_USERNAME', $db_user)) { $error = true; } if (!install_build_co_config_file($db_name, 'DB_SERVER_PASSWORD', $db_pw)) { $error = true; } if (!install_build_co_config_file($db_name, 'DB_SERVER_HOST', $db_server)) { $error = true; } } $copy_modules = $core_modules; foreach ($loaded_modules as $entry) { if (isset($_POST[$entry])) { $copy_modules[] = $entry; } } $backup = new backup(); $backup->source_dir = DIR_FS_MY_FILES . $db_name . '/temp/'; $backup->source_file = 'temp.sql'; if (!$error) { foreach ($copy_modules as $entry) { gen_pull_language($entry, 'admin');
$result = load_startup_table_data($language = 'en_us'); if (!$result) { $messageStack->add(SETUP_CO_MGR_ERROR_2, 'error'); break; } } // create the new directory and sub-directories if (!install_build_dirs($company, $cb_demo)) { $messageStack->add(SETUP_CO_MGR_ERROR_3, 'error'); break; } // create the config.php file and update COMPANY_NAME configuration parameter in table install_build_co_config_file(DB_DATABASE, DB_DATABASE . '_TITLE', $company_name); install_build_co_config_file(DB_DATABASE, 'DB_SERVER_USERNAME', $db_user); install_build_co_config_file(DB_DATABASE, 'DB_SERVER_PASSWORD', $db_pw); install_build_co_config_file(DB_DATABASE, 'DB_SERVER', $db_server); $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $company_name . "' where configuration_key = 'COMPANY_NAME'"; $db->Execute($sql); $temp_file = DIR_FS_ADMIN . 'my_files/' . $company . '/temp/temp.sql'; if ($action == 'copy') { if ($cb_all || $cb_inventory) { // duplicate the inventory table since new fields may have been entered if (!copy_db_table($db_old, array('inventory'), $temp_file, 'structure')) { $error = true; } } if ($cb_all && !$error) { $result = $db->Execute("show tables"); // pull table list from new install to avoid PhreeHelp tables $table_list = array(); while (!$result->EOF) {