break; case "critlist": $CritListings['defaults'] = $NewDefaults['defaults']; $CritListings['defaults']['buttonvalue'] = $NewDefaults['defaults']['buttonvalue']; break; } } break; // End Step 7 // End Step 7 case "step8": // Entered from import report form switch ($_POST['todo']) { case RPT_BTN_IMPORT: // Error check input and import the new report $success = ImportReport(trim($_POST['reportname'])); $usrMsg[] = array('message' => $success['message'], 'level' => $success['result']); if ($success['result'] == 'error') { $FormParams = PrepStep('imp'); break; } // All through and imported successfully, return to reports home page // All through and imported successfully, return to reports home page case RPT_BTN_BACK: default: $DropDownString = RetrieveReports(); $FormParams = PrepStep('1'); } break; // End Step 8 }
break; case 'import_all': $output = array(); if ($handle = opendir($import_path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $output[] = $file; } } } else { $messageStack->add('error opening the directory for reading!', 'error'); break; } closedir($handle); foreach ($output as $file) { if (!($success = ImportReport(NULL, $file, $import_path))) { $error = true; } } if (!$error) { $messageStack->add(PHREEFORM_DIR_IMPORT_SUCCESS, 'success'); $self_close = true; } break; default: } /***************** prepare to display templates *************************/ $sel_yes_no = array(array('id' => '0', 'text' => TEXT_NO), array('id' => '1', 'text' => TEXT_YES)); $include_header = false; $include_footer = false; switch ($_REQUEST['action']) {
function admin_add_reports($module, $save_path = PF_DIR_MY_REPORTS) { $error = false; if (!is_dir(DIR_FS_MODULES . $module)) { return $error; } if (file_exists(DIR_FS_MODULES . $module . '/language/' . $_SESSION['language'] . '/reports/')) { $read_path = DIR_FS_MODULES . $module . '/language/' . $_SESSION['language'] . '/reports/'; } elseif (file_exists(DIR_FS_MODULES . $module . '/language/en_us/reports/')) { $read_path = DIR_FS_MODULES . $module . '/language/en_us/reports/'; } else { return $error; // nothing to import } $files = scandir($read_path); foreach ($files as $file) { if (strtolower(substr($file, -4)) == '.xml') { if (!ImportReport('', $file, $read_path, $save_path)) { $error = true; } } } return $error; }
if ($GroupBy == "General") { $NoGroupBy = true; $GroupBy = false; } $ExportCsv = false; $ExportSep = ","; $ExportNoLimit = false; $ExportExpanded = false; if (ValidArr($ExportReport)) { $ExportCsv = true; $ExportSep = ValidVar($ExportReport['Separator']) ? $ExportReport['Separator'] : ","; $ExportNoLimit = ValidVar($ExportReport['NoLimit']) == 1 ? true : false; $ExportExpanded = ValidVar($ExportReport['Expanded']) == 1 ? true : false; } if (ValidId($ConstId)) { ImportReport($ConstId); } if ($GroupBy && !$OrderBy && !$OrderTo && !$CurrentId && !$Redir) { if (isset($WhereArr[count($WhereArr) - 1]['OrderBy'])) { $OrderBy = $WhereArr[count($WhereArr) - 1]['OrderBy']; } if (isset($WhereArr[count($WhereArr) - 1]['OrderTo'])) { $OrderTo = $WhereArr[count($WhereArr) - 1]['OrderTo']; } } if ($OrderTo != "DESC" && $OrderTo != "ASC") { $OrderTo = "DESC"; } $OrderByArr[0]['Key'] = "CNT"; $OrderByArr[0]['Name'] = $Lang['ByHits']; $OrderByArr[1]['Key'] = "UNI";
function load_startup_table_data($language = 'en_us') { global $db; // set current status to intial levels $db->Execute("INSERT INTO " . TABLE_CURRENT_STATUS . " VALUES (1, 5000, '10000', 20000, 100, '1', 1, 'CM1000', 'VCM1000', 'RFQ1000', 'QU1000', 'C10000', 'V10000')"); // set the project db version require_once DIR_FS_INCLUDES . 'version.php'; $db->Execute("INSERT INTO " . TABLE_PROJECT_VERSION . " VALUES (1, 'PhreeBooks Database', '" . PROJECT_VERSION_MAJOR . "', '" . PROJECT_VERSION_MINOR . "', 'Fresh Installation', '" . date('Y-m-d H:i:s', time()) . "');"); // load the configuration values (config_data.php) require_once DIR_FS_MODULES . 'install/language/' . $language . '/config_data.php'; require_once DIR_FS_MODULES . 'install/includes/config_data.php'; foreach ($config_data as $entry) { db_perform(TABLE_CONFIGURATION, $entry, 'insert'); } // TBD - set the accounting period and period start and end dates // load the chart_of_accounts_types_list require_once DIR_FS_MODULES . 'install/language/' . $language . '/chart_of_accounts_types_list.php'; foreach ($chart_of_accounts_types_list as $entry) { db_perform(TABLE_CHART_OF_ACCOUNTS_TYPES, $entry, 'insert'); } // load the countries_list require_once DIR_FS_MODULES . 'install/language/' . $language . '/countries_list.php'; foreach ($countries_list as $entry) { db_perform(TABLE_COUNTRIES, $entry, 'insert'); } // load the currencies_list require_once DIR_FS_MODULES . 'install/language/' . $language . '/currencies_list.php'; foreach ($currencies_list as $entry) { db_perform(TABLE_CURRENCIES, $entry, 'insert'); } // load the import_export_list require_once DIR_FS_MODULES . 'install/language/' . $language . '/import_export_list.php'; foreach ($import_export_list as $entry) { db_perform(TABLE_IMPORT_EXPORT, $entry, 'insert'); } // load the state_province_list require_once DIR_FS_MODULES . 'install/language/' . $language . '/state_province_list.php'; foreach ($state_province_list as $entry) { db_perform(TABLE_ZONES, $entry, 'insert'); } // load the reports and forms (import from my_files); require_once DIR_FS_MODULES . 'reportwriter/functions/builder_functions.php'; require_once DIR_FS_MODULES . 'reportwriter/language/' . $language . '/language.php'; require_once DIR_FS_MODULES . 'install/report_list.php'; define('DIR_FS_REPORTS', '../../my_files/reports/'); foreach ($report_list as $report) { $_POST['RptFileName'] = $report; // to fake out the import function to load report from my_files if (file_exists(DIR_FS_REPORTS . $report)) { ImportReport($RptName = ''); } } // synchronize the inventory fields before any customization is done to them require DIR_FS_MODULES . 'inventory/functions/inventory.php'; inv_sync_inv_field_list(); return true; }