本文整理汇总了PHP中write_configure函数的典型用法代码示例。如果您正苦于以下问题:PHP write_configure函数的具体用法?PHP write_configure怎么用?PHP write_configure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_configure函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
function update($module)
{
global $db, $messageStack;
$error = false;
// load all modules
$method_dir = DIR_FS_ADMIN . 'modules/' . $module . '/methods/';
$methods = array();
if ($dir = @dir($method_dir)) {
while ($choice = $dir->read()) {
if (file_exists($method_dir . $choice . '/' . $choice . '.php') && $choice != '.' && $choice != '..') {
$methods[] = $choice;
}
}
$dir->close();
//update keys
foreach ($methods as $method) {
require_once DIR_FS_ADMIN . 'modules/' . $module . '/methods/' . $method . '/' . $method . '.php';
$properties = new $method();
foreach ($properties->keys() as $key) {
if (!defined($key['key'])) {
write_configure($key['key'], $key['default']);
}
}
}
}
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:31,代码来源:install.php
示例2: update
function update()
{
foreach ($this->keys() as $key) {
$field = strtolower($key['key']);
if (isset($_POST[$field])) {
write_configure($key['key'], $_POST[$field]);
}
}
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:9,代码来源:item.php
示例3: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:10,代码来源:install.php
示例4: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_capa_desc')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_capa_desc");
}
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:13,代码来源:install.php
示例5: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (MODULE_PHREEFORM_STATUS == '3.0') {
write_configure('PDF_APP', 'TCPDF');
}
if (MODULE_PHREEFORM_STATUS < '3.5') {
// $id = admin_add_report_heading(TEXT_MISC, 'cust');
// if (admin_add_report_folder($id, TEXT_LETTERS, 'cust:ltr', 'fl')) $error = true;
// $id = admin_add_report_heading(TEXT_MISC, 'vend');
// if (admin_add_report_folder($id, TEXT_LETTERS, 'vend:ltr', 'fl')) $error = true;
}
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:19,代码来源:install.php
示例6: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (MODULE_PHREEHELP_STATUS < 3.0) {
foreach ($this->tables as $table => $create_table_sql) {
if (!db_table_exists($table)) {
if (!$db->Execute($create_table_sql)) {
$error = true;
}
}
}
}
write_configure(PHREEHELP_FORCE_RELOAD, '1');
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:20,代码来源:install.php
示例7: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (MODULE_ASSETS_STATUS < 3.1) {
$tab_map = array('0' => '0');
if (db_table_exists(DB_PREFIX . 'assets_tabs')) {
$result = $db->Execute("select * from " . DB_PREFIX . 'assets_tabs');
while (!$result->EOF) {
$updateDB = $db->Execute("insert into " . TABLE_EXTRA_TABS . " set \n\t\t\t module_id = 'assets',\n\t\t\t tab_name = '" . $result->fields['category_name'] . "',\n\t\t\t description = '" . $result->fields['category_description'] . "',\n\t\t\t sort_order = '" . $result->fields['sort_order'] . "'");
$tab_map[$result->fields['category_id']] = db_insert_id();
$result->MoveNext();
}
$db->Execute("DROP TABLE " . DB_PREFIX . "assets_tabs");
}
if (db_table_exists(DB_PREFIX . 'assets_fields')) {
$result = $db->Execute("select * from " . DB_PREFIX . 'assets_fields');
while (!$result->EOF) {
$updateDB = $db->Execute("insert into " . TABLE_EXTRA_FIELDS . " set \n\t\t\t module_id = 'assets',\n\t\t\t tab_id = '" . $tab_map[$result->fields['category_id']] . "',\n\t\t\t entry_type = '" . $result->fields['entry_type'] . "',\n\t\t\t field_name = '" . $result->fields['field_name'] . "',\n\t\t\t description = '" . $result->fields['description'] . "',\n\t\t\t params = '" . $result->fields['params'] . "'");
$result->MoveNext();
}
$db->Execute("DROP TABLE " . DB_PREFIX . "assets_fields");
}
xtra_field_sync_list('assets', TABLE_ASSETS);
}
if (MODULE_ASSETS_STATUS < 3.3) {
if (!db_field_exists(TABLE_ASSETS, 'attachments')) {
$db->Execute("ALTER TABLE " . TABLE_ASSETS . " ADD attachments TEXT NOT NULL AFTER terminal_date");
}
require_once DIR_FS_MODULES . 'phreedom/functions/phreedom.php';
xtra_field_sync_list('assets', TABLE_ASSETS);
}
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:38,代码来源:install.php
示例8: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 3) {
$messageStack->add(ERROR_NO_PERMISSION, 'error');
return false;
}
$title = db_prepare_input($_POST['title']);
$code = strtoupper(db_prepare_input($_POST['code']));
if ($_POST['decimal_precise'] == '') {
$_POST['decimal_precise'] = $_POST['decimal_places'];
}
$sql_data_array = array('title' => $title, 'code' => $code, 'symbol_left' => db_prepare_input($_POST['symbol_left']), 'symbol_right' => db_prepare_input($_POST['symbol_right']), 'decimal_point' => db_prepare_input($_POST['decimal_point']), 'thousands_point' => db_prepare_input($_POST['thousands_point']), 'decimal_places' => db_prepare_input($_POST['decimal_places']), 'decimal_precise' => db_prepare_input($_POST['decimal_precise']), 'value' => db_prepare_input($_POST['value']));
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "currencies_id = " . (int) $id);
gen_add_audit_log(SETUP_LOG_CURRENCY . TEXT_UPDATE, $title);
} else {
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(SETUP_LOG_CURRENCY . TEXT_ADD, $title);
}
if (isset($_POST['default']) && $_POST['default'] == 'on') {
// first check to see if there are any general ledger entries
$result = $db->Execute("SELECT id FROM " . TABLE_JOURNAL_MAIN . " LIMIT 1");
if ($result->RecordCount() > 0) {
$messageStack->add(SETUP_ERROR_CANNOT_CHANGE_DEFAULT, 'error');
} else {
write_configure('DEFAULT_CURRENCY', db_input($code));
db_perform($this->db_table, array('value' => 1), 'update', "code='{$code}'");
// change default exc rate to 1
$db->Execute("alter table " . TABLE_JOURNAL_MAIN . " \n\t\t\tchange currencies_code currencies_code CHAR(3) NOT NULL DEFAULT '" . db_input($code) . "'");
$this->def_currency = db_input($code);
$this->btn_update();
}
}
return true;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:36,代码来源:currency.php
示例9: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (MODULE_CONTACTS_STATUS < 3.3) {
$db->Execute("ALTER TABLE " . TABLE_CONTACTS . " CHANGE short_name short_name VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''");
if (!db_table_exists(TABLE_CONTACTS_LOG)) {
foreach ($this->tables as $table => $sql) {
if ($table == TABLE_CONTACTS_LOG) {
admin_install_tables(array($table => $sql));
}
}
}
if (db_table_exists(DB_PREFIX . 'contacts_extra_fields')) {
// first create a new tab
if (!defined('SETUP_TITLE_EXTRA_FIELDS')) {
define('SETUP_TITLE_EXTRA_FIELDS', 'New Tab');
}
$updateDB = $db->Execute("insert into " . TABLE_EXTRA_TABS . " set\n\t\t module_id = 'contacts',\n\t\t tab_name = '" . SETUP_TITLE_EXTRA_FIELDS . "',\n\t\t description = '" . SETUP_TITLE_EXTRA_FIELDS . "',\n\t\t sort_order = '20'");
$tab_id = db_insert_id();
$result = $db->Execute("select * from " . DB_PREFIX . 'contacts_extra_fields');
while (!$result->EOF) {
$params = unserialize($result->fields['params']);
// need to insert contact_type
$params['contact_type'] = $result->fields['contact_type'];
$updateDB = $db->Execute("insert into " . TABLE_EXTRA_FIELDS . " set\n\t\t module_id = 'contacts',\n\t\t tab_id = '" . $tab_id . "',\n\t\t entry_type = '" . $result->fields['entry_type'] . "',\n\t\t field_name = '" . $result->fields['field_name'] . "',\n\t\t description = '" . $result->fields['description'] . "',\n\t\t params = '" . serialize($params) . "'");
$result->MoveNext();
}
$db->Execute("DROP TABLE " . DB_PREFIX . "contacts_extra_fields");
}
xtra_field_sync_list('contacts', TABLE_CONTACTS);
}
if (MODULE_CONTACTS_STATUS < 3.5) {
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_cust_id_desc')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_cust_id_desc");
}
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_vend_id_desc')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_vend_id_desc");
}
if (!db_field_exists(TABLE_CONTACTS, 'attachments')) {
$db->Execute("ALTER TABLE " . TABLE_CONTACTS . " ADD attachments TEXT NOT NULL AFTER tax_id");
}
}
if (MODULE_CONTACTS_STATUS < 3.7) {
if (!db_field_exists(TABLE_CONTACTS_LOG, 'entered_by')) {
$db->Execute("ALTER TABLE " . TABLE_CONTACTS_LOG . " ADD entered_by INT(11) NOT NULL DEFAULT '0' AFTER contact_id");
}
}
if (MODULE_CONTACTS_STATUS < 3.72) {
$db->Execute("ALTER TABLE " . TABLE_CONTACTS . " CHANGE tax_id tax_id INT(11) NOT NULL DEFAULT '-1';");
}
if (MODULE_CONTACTS_STATUS < 3.73) {
if (!db_field_exists(TABLE_CONTACTS, 'contacts_level')) {
$db->Execute("ALTER TABLE " . TABLE_CONTACTS . " ADD contacts_level CHAR(1) NOT NULL DEFAULT 'r' AFTER type;");
}
xtra_field_sync_list('contacts', TABLE_CONTACTS);
}
if (!db_field_exists(TABLE_CURRENT_STATUS, 'next_crm_id_num')) {
$result = $db->Execute("Select MAX(short_name + 1) AS new FROM " . TABLE_CONTACTS . " WHERE TYPE = 'i'");
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " ADD next_crm_id_num VARCHAR( 16 ) NOT NULL DEFAULT '" . $result->fields['new'] . "';");
}
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:67,代码来源:install.php
示例10: changePassPhrase
function changePassPhrase()
{
global $messageStack;
$old_pp = db_prepare_input($_POST['pass_phrase_current']);
$new_pp = db_prepare_input($_POST['pass_phrase_new']);
$dup_pp = db_prepare_input($_POST['pass_phrase_confirm']);
// error check
if ($old_pp != MODULE_SHIPPING_ENDICIA_PASS_PHRASE) {
$messageStack->add(SHIPPING_ENDICIA_PASSPHRASE_OLD_NOT_MATCH, 'error');
return false;
}
if ($new_pp != $dup_pp) {
$messageStack->add(SHIPPING_ENDICIA_PASSPHRASE_NEW_NOT_MATCH, 'error');
return false;
}
$data = array('ChangePassPhraseRequest' => array('RequesterID' => MODULE_SHIPPING_ENDICIA_PARTNER_ID, 'RequestID' => time(), 'CertifiedIntermediary' => array('AccountID' => MODULE_SHIPPING_ENDICIA_ACCOUNT_NUMBER, 'PassPhrase' => MODULE_SHIPPING_ENDICIA_PASS_PHRASE), 'NewPassPhrase' => $new_pp));
$url = MODULE_SHIPPING_ENDICIA_TEST_MODE == 'Prod' ? MODULE_SHIPPING_ENDICIA_WSDL_URL : MODULE_SHIPPING_ENDICIA_TEST_WSDL_URL;
$client = new SoapClient($url, array('trace' => 1));
try {
$response = $client->ChangePassPhrase($data);
if ($response->ChangePassPhraseRequestResponse->Status == 0) {
write_configure('MODULE_SHIPPING_ENDICIA_PASS_PHRASE', $new_pp);
$messageStack->add(SHIPPING_ENDICIA_PASSPHRASE_SUCCESS_MSG, 'success');
} else {
$messageStack->add(TEXT_ERROR . ' (' . $response->ChangePassPhraseRequestResponse->Status . ') ' . $response->ChangePassPhraseRequestResponse->ErrorMessage, 'error');
}
} catch (SoapFault $exception) {
$messageStack->add("SOAP error ({$exception->faultcode}) {$exception->faultstring}", 'error');
}
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:30,代码来源:endicia.php
示例11: update
function update($module)
{
global $db, $messageStack;
foreach ($this->keys as $key => $value) {
if (!defined($key)) {
write_configure($key, $value);
}
}
$sql = "select id from " . TABLE_EXTRA_FIELDS . " where module_id = 'contacts' and (field_name like '%bank_account%' or field_name like '%iban%')";
$result = $db->Execute($sql);
if ($result->RecordCount() == 0) {
$result = $db->Execute("select id from " . TABLE_EXTRA_TABS . " where module_id='contacts' and tab_name = 'import_banking'");
if ($result->RecordCount() == 0) {
$db->Execute("INSERT INTO " . TABLE_EXTRA_TABS . " (module_id, tab_name, sort_order) VALUES( 'contacts','import_banking','100')");
$tab_id = $db->insert_ID();
} else {
$tab_id = $result->fields['id'];
}
$db->Execute("INSERT INTO " . TABLE_EXTRA_FIELDS . " (module_id, tab_id, entry_type, field_name, description, params) VALUES ('contacts', {$tab_id}, 'text', 'iban', 'IBAN', 'a:4:{s:4:\"type\";s:4:\"text\";s:12:\"contact_type\";s:4:\"c:v:\";s:6:\"length\";i:32;s:7:\"default\";s:0:\"\";}')");
}
foreach ($this->tables as $table => $sql) {
if ($table == TABLE_IMPORT_BANK) {
admin_install_tables(array($table => $sql));
}
}
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
}
开发者ID:TrinityComputers,项目名称:PhreeBooksERP,代码行数:28,代码来源:install.php
示例12: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (MODULE_RMA_STATUS < 3.1) {
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_rma_desc')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_rma_desc");
}
}
if (MODULE_RMA_STATUS < 3.3) {
if (!db_field_exists(TABLE_RMA, 'attachments')) {
$db->Execute("ALTER TABLE " . TABLE_RMA . " ADD attachments TEXT DEFAULT NULL AFTER closed_date");
}
if (!db_field_exists(TABLE_RMA, 'contact_id')) {
$db->Execute("ALTER TABLE " . TABLE_RMA . " ADD contact_id VARCHAR(32) DEFAULT NULL AFTER caller_email");
}
if (!db_field_exists(TABLE_RMA, 'contact_name')) {
$db->Execute("ALTER TABLE " . TABLE_RMA . " ADD contact_name VARCHAR(48) DEFAULT NULL AFTER contact_id");
}
if (!db_field_exists(TABLE_RMA, 'purch_order_id')) {
$db->Execute("ALTER TABLE " . TABLE_RMA . " ADD purch_order_id VARCHAR(24) DEFAULT NULL AFTER purchase_invoice_id");
}
if (!db_field_exists(TABLE_RMA, 'receive_details')) {
$db->Execute("ALTER TABLE " . TABLE_RMA . " ADD receive_details TEXT DEFAULT NULL AFTER receive_notes");
}
if (!db_field_exists(TABLE_RMA, 'close_notes')) {
$db->Execute("ALTER TABLE " . TABLE_RMA . " ADD close_notes VARCHAR(255) DEFAULT NULL AFTER receive_details");
}
if (!db_field_exists(TABLE_RMA, 'close_details')) {
$db->Execute("ALTER TABLE " . TABLE_RMA . " ADD close_details TEXT DEFAULT NULL AFTER close_notes");
}
if (!db_field_exists(TABLE_RMA, 'invoice_date')) {
$db->Execute("ALTER TABLE " . TABLE_RMA . " ADD invoice_date DATE NOT NULL DEFAULT '0000-00-00' AFTER creation_date");
}
$result = $db->Execute("select * from " . DB_PREFIX . 'rma_module_item');
$output = array();
while (!$result->EOF) {
$output[$result->fields['ref_id']][] = array('sku' => $result->fields['sku'], 'qty' => $result->fields['qty'], 'notes' => $result->fields['item_notes'], 'action' => $result->fields['item_action']);
$result->MoveNext();
}
if (sizeof($output > 0)) {
foreach ($output as $key => $value) {
db_perform(TABLE_RMA, array('close_details' => serialize($value)), 'update', 'id = ' . $key);
}
}
if (db_table_exists(DB_PREFIX . 'rma_module_item')) {
$db->Execute("drop table " . DB_PREFIX . 'rma_module_item');
}
}
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:TrinityComputers,项目名称:PhreeBooksERP,代码行数:55,代码来源:install.php
示例13: switch
}
// force complete copy of phreedom module
switch ($task) {
case 'core':
case 'demo':
if (admin_install_dirs($install_mod->dirlist, DIR_FS_MY_FILES . $db_name . '/')) {
$error = true;
} elseif (admin_install_tables($install_mod->tables)) {
// Create the tables
$error = true;
} else {
// Load the installed module version into db
write_configure('MODULE_' . strtoupper($entry) . '_STATUS', constant('MODULE_' . strtoupper($entry) . '_VERSION'));
// Load the remaining configuration constants
foreach ($install_mod->keys as $key => $value) {
write_configure($key, $value);
}
if ($task == 'demo') {
if ($install_mod->load_demo()) {
$error = true;
}
}
// load demo data
if ($entry != 'phreedom') {
$install_mod->load_reports($entry);
}
if ($entry == 'phreeform') {
$temp_mod = new phreedom_admin();
$temp_mod->load_reports('phreedom');
}
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:31,代码来源:pre_process.php
示例14: validate_user
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// +-----------------------------------------------------------------+
// Path: /modules/phreehelp/pages/main/pre_process.php
//
$security_level = validate_user(0, true);
/************** include page specific files *********************/
require_once DIR_FS_WORKING . 'defaults.php';
require_once DIR_FS_WORKING . 'functions/phreehelp.php';
/************** page specific initialization *************************/
if (PHREEHELP_FORCE_RELOAD == '1') {
// load/reload db tables if forced to
synchronize();
write_configure('PHREEHELP_FORCE_RELOAD', '0');
}
$frame_id = isset($_GET['fID']) ? $_GET['fID'] : 'main';
$context_ref = isset($_GET['idx']) ? $_GET['idx'] : '';
$result = false;
$start_page = DOC_ROOT_URL;
if ($context_ref) {
$result = $db->Execute("select doc_url from " . TABLE_PHREEHELP . " where doc_pos = '" . $context_ref . "'");
if ($result->RecordCount() > 0) {
$start_page = $result->fields['doc_url'];
}
}
$frame_url = 'index.php?module=phreehelp&page=main';
/*************** hook for custom actions ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/main/extra_actions.php';
if (file_exists($custom_path)) {
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:31,代码来源:pre_process.php
示例15: phreeform_admin
require_once DIR_FS_WORKING . 'defaults.php';
require_once DIR_FS_WORKING . 'functions/phreeform.php';
require_once DIR_FS_MODULES . 'phreedom/functions/phreedom.php';
require_once DIR_FS_WORKING . 'classes/install.php';
/************** page specific initialization *************************/
$error = false;
$install = new phreeform_admin();
/*************** Act on the action request *************************/
switch ($_REQUEST['action']) {
case 'save':
validate_security($security_level, 3);
// save general tab
foreach ($install->keys as $key => $default) {
$field = strtolower($key);
if (isset($_POST[$field])) {
write_configure($key, $_POST[$field]);
}
}
$messageStack->add(GENERAL_CONFIG_SAVED, 'success');
gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL'));
break;
case 'fix':
// drop the database
$db->Execute("truncate " . TABLE_PHREEFORM);
// load all the install classes to re-build directory structure
$install_mod = new phreeform_admin();
$install_mod->load_reports('phreeform');
$contents = scandir(DIR_FS_MODULES);
foreach ($contents as $entry) {
// install each module
if (!defined('MODULE_' . strtoupper($entry) . '_STATUS')) {
开发者ID:TrinityComputers,项目名称:PhreeBooksERP,代码行数:31,代码来源:pre_process.php
示例16: array
$install_mod->load_reports($entry);
}
}
}
// reload pages array since it doesn't exist at the start of the update
global $loaded_modules;
$loaded_modules = array();
$dirs = scandir(DIR_FS_MODULES);
foreach ($dirs as $dir) {
// first pull all module language files, loaded or not
if ($dir == '.' || $dir == '..') {
continue;
}
if (is_dir(DIR_FS_MODULES . $dir)) {
gen_pull_language($dir, 'menu');
}
}
foreach ($dirs as $dir) {
if ($dir == '.' || $dir == '..') {
continue;
}
if (defined('MODULE_' . strtoupper($dir) . '_STATUS')) {
// module is loaded
$loaded_modules[] = $dir;
require_once DIR_FS_MODULES . $dir . '/config.php';
}
}
write_configure('DATE_FORMAT', defined('DATE_FORMAT') ? DATE_FORMAT : 'm/d/Y');
write_configure('DATE_DELIMITER', defined('DATE_DELIMITER') ? DATE_DELIMITER : '/');
write_configure('DATE_TIME_FORMAT', defined('DATE_TIME_FORMAT') ? DATE_TIME_FORMAT : 'm/d/Y h:i:s a');
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:30,代码来源:PBtoR30.php
示例17: release_update
function release_update($module, $version, $path = '')
{
global $db, $messageStack;
$error = false;
if (file_exists($path)) {
include_once $path;
}
write_configure('MODULE_' . strtoupper($module) . '_STATUS', $version);
return $error ? false : $version;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:10,代码来源:install.php
示例18: gen_auto_update_period
function gen_auto_update_period($show_message = true)
{
global $db, $messageStack;
$period = gen_calculate_period(date('Y-m-d'), true);
if ($period == CURRENT_ACCOUNTING_PERIOD && defined('CURRENT_ACCOUNTING_PERIOD')) {
return;
}
// we're in the current period
if (!$period) {
// we're outside of the defined fiscal years
if ($show_message) {
$messageStack->add(ERROR_MSG_POST_DATE_NOT_IN_FISCAL_YEAR, 'error');
}
} else {
// update CURRENT_ACCOUNTING_PERIOD constant with this new period
$result = $db->Execute("select start_date, end_date from " . TABLE_ACCOUNTING_PERIODS . " where period = " . $period);
write_configure('CURRENT_ACCOUNTING_PERIOD', $period);
write_configure('CURRENT_ACCOUNTING_PERIOD_START', $result->fields['start_date']);
write_configure('CURRENT_ACCOUNTING_PERIOD_END', $result->fields['end_date']);
gen_add_audit_log(GEN_LOG_PERIOD_CHANGE);
if ($show_message) {
$messageStack->add(sprintf(ERROR_MSG_ACCT_PERIOD_CHANGE, $period), 'success');
}
}
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:25,代码来源:phreebooks.php
示例19: update
//.........这里部分代码省略.........
break;
case 'quantity_on_order':
case 'quantity_on_allocation':
$temp['inventory_type'] = 'ia:mi:sa:si:sr';
break;
case 'quantity_on_sales_order':
$temp['inventory_type'] = 'ia:ma:mi:sa:si:sr';
break;
case 'lead_time':
$temp['inventory_type'] = 'ai:ia:lb:ma:mb:mi:ms:ns:sa:sf:si:sr:sv';
break;
case 'upc_code':
$temp['inventory_type'] = 'ia:ma:mi:ns:sa:si:sr';
break;
default:
$temp['inventory_type'] = 'ai:ci:ds:ia:lb:ma:mb:mi:ms:ns:sa:sf:si:sr:sv';
}
$updateDB = $db->Execute("update " . TABLE_EXTRA_FIELDS . " set params = '" . serialize($temp) . "' where id = '" . $result->fields['id'] . "'");
$result->MoveNext();
}
$haystack = array('attachments', 'account_sales_income', 'item_taxable', 'purch_taxable', 'image_with_path', 'account_inventory_wage', 'account_cost_of_sales', 'cost_method', 'lead_time');
$result = $db->Execute("update " . TABLE_EXTRA_FIELDS . " set entry_type = 'check_box' where field_name = 'inactive'");
$result = $db->Execute("select * from " . TABLE_EXTRA_FIELDS . " where module_id = 'inventory'");
while (!$result->EOF) {
$use_in_inventory_filter = '1';
if (in_array($result->fields['field_name'], $haystack)) {
$use_in_inventory_filter = '0';
}
$updateDB = $db->Execute("update " . TABLE_EXTRA_FIELDS . " set use_in_inventory_filter = '" . $use_in_inventory_filter . "' where id = '" . $result->fields['id'] . "'");
$result->MoveNext();
}
if (!db_table_exists(TABLE_INVENTORY_PURCHASE)) {
foreach ($this->tables as $table => $sql) {
if ($table == TABLE_INVENTORY_PURCHASE) {
admin_install_tables(array($table => $sql));
}
}
if (db_field_exists(TABLE_INVENTORY, 'purch_package_quantity')) {
$result = $db->Execute("insert into " . TABLE_INVENTORY_PURCHASE . " ( sku, vendor_id, description_purchase, purch_package_quantity, purch_taxable, item_cost, price_sheet_v ) select sku, vendor_id, description_purchase, purch_package_quantity, purch_taxable, item_cost, price_sheet_v from " . TABLE_INVENTORY);
$db->Execute("ALTER TABLE " . TABLE_INVENTORY . " DROP purch_package_quantity");
} else {
$result = $db->Execute("insert into " . TABLE_INVENTORY_PURCHASE . " ( sku, vendor_id, description_purchase, purch_package_quantity, purch_taxable, item_cost, price_sheet_v ) select sku, vendor_id, description_purchase, 1, purch_taxable, item_cost, price_sheet_v from " . TABLE_INVENTORY);
}
}
require_once DIR_FS_MODULES . 'phreebooks/functions/phreebooks.php';
$tax_rates = ord_calculate_tax_drop_down('c');
$result = $db->Execute("SELECT id, item_taxable, full_price, item_cost FROM " . TABLE_INVENTORY);
while (!$result->EOF) {
$sql_data_array = array();
$sql_data_array['full_price_with_tax'] = round((1 + $tax_rates[$result->fields['item_taxable']]['rate'] / 100) * $result->fields['full_price'], $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
if ($result->fields['item_cost'] != '' && $result->fields['item_cost'] > 0) {
$sql_data_array['product_margin'] = round($sql_data_array['full_price_with_tax'] / $result->fields['item_cost'], $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
}
db_perform(TABLE_INVENTORY, $sql_data_array, 'update', "id = " . $result->fields['id']);
$result->MoveNext();
}
mkdir(DIR_FS_MY_FILES . $_SESSION['company'] . '/inventory/attachments/', 0755, true);
}
if (MODULE_INVENTORY_STATUS < 3.7) {
if (!db_field_exists(TABLE_INVENTORY_HISTORY, 'avg_cost')) {
$db->Execute("ALTER TABLE " . TABLE_INVENTORY_HISTORY . " ADD avg_cost FLOAT NOT NULL DEFAULT '0' AFTER unit_cost");
$db->Execute("UPDATE " . TABLE_INVENTORY_HISTORY . " SET avg_cost = unit_cost");
}
$result = $db->Execute("select id, params from " . TABLE_EXTRA_FIELDS . " where module_id = 'inventory' AND field_name = 'account_cost_of_sales'");
$temp = unserialize($result->fields['params']);
$temp['inventory_type'] = 'ai:ci:ds:ia:lb:ma:mb:mi:ms:ns:sa:sf:si:sr:sv';
$updateDB = $db->Execute("update " . TABLE_EXTRA_FIELDS . " set params='" . serialize($temp) . "' where id='" . $result->fields['id'] . "'");
$db->Execute("ALTER TABLE " . TABLE_INVENTORY . "\n\t\t\tCHANGE item_cost item_cost DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE full_price full_price DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE full_price_with_tax full_price_with_tax DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE product_margin product_margin DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE item_weight item_weight DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE quantity_on_hand quantity_on_hand DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE quantity_on_order quantity_on_order DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE quantity_on_sales_order quantity_on_sales_order DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE quantity_on_allocation quantity_on_allocation DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE minimum_stock_level minimum_stock_level DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE reorder_quantity reorder_quantity DOUBLE NOT NULL DEFAULT '0'");
$db->Execute("ALTER TABLE " . TABLE_INVENTORY_ASSY_LIST . " CHANGE qty qty double NOT NULL default '0'");
$db->Execute("ALTER TABLE " . TABLE_INVENTORY_COGS_OWED . " CHANGE qty qty double NOT NULL default '0'");
$db->Execute("ALTER TABLE " . TABLE_INVENTORY_COGS_USAGE . " CHANGE qty qty double NOT NULL default '0'");
$db->Execute("ALTER TABLE " . TABLE_INVENTORY_HISTORY . "\n\t\t\tCHANGE qty qty DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE remaining remaining DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE unit_cost unit_cost DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE avg_cost avg_cost DOUBLE NOT NULL DEFAULT '0'");
$db->Execute("ALTER TABLE " . TABLE_INVENTORY_PURCHASE . "\n\t\t\tCHANGE purch_package_quantity purch_package_quantity DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE item_cost item_cost DOUBLE NOT NULL DEFAULT '0'");
}
if (version_compare(MODULE_INVENTORY_STATUS, '3.7.4', '<')) {
if (!db_field_exists(TABLE_INVENTORY, 'product_markup')) {
$db->Execute("ALTER TABLE " . TABLE_INVENTORY . " CHANGE product_margin product_markup DOUBLE NOT NULL DEFAULT '0'");
$db->Execute("ALTER TABLE " . TABLE_INVENTORY . " ADD product_margin DOUBLE NOT NULL DEFAULT '0' AFTER product_markup");
$db->Execute("insert into " . TABLE_EXTRA_FIELDS . " set module_id = 'inventory', tab_id = '0', entry_type = 'decimal', field_name = 'product_markup',\n\t\t\t\tdescription = 'product_markup', params = 'a:2:{s:4:\"type\";N;s:14:\"inventory_type\";s:39:\"lb:ma:ia:mb:ms:ci:ns:sa:sr:sv:mi:sf:si:\";}'");
}
$result = $db->Execute("SELECT i.id, i.full_price, i.item_cost, max(p.item_cost) as purchase_cost FROM " . TABLE_INVENTORY . " i left join " . TABLE_INVENTORY_PURCHASE . " p on (p.sku = i.sku) ");
while (!$result->EOF) {
$sql_data_array = array();
if ($result->fields['purchase_cost'] > $result->fields['item_cost']) {
$sql_data_array['product_margin'] = round(($result->fields['full_price'] - $result->fields['purchase_cost']) / $result->fields['full_price'] * 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
db_perform(TABLE_INVENTORY, $sql_data_array, 'update', "id = " . $result->fields['id']);
} else {
$sql_data_array['product_margin'] = round(($result->fields['full_price'] - $result->fields['item_cost']) / $result->fields['full_price'] * 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
db_perform(TABLE_INVENTORY, $sql_data_array, 'update', "id = " . $result->fields['id']);
}
$result->MoveNext();
}
}
if (!$error) {
xtra_field_sync_list('inventory', TABLE_INVENTORY);
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:101,代码来源:install.php
示例20: update
function update($module)
{
global $db;
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
}
开发者ID:TrinityComputers,项目名称:PhreeBooksERP,代码行数:5,代码来源:install.php < |
请发表评论