本文整理汇总了PHP中db_perform函数的典型用法代码示例。如果您正苦于以下问题:PHP db_perform函数的具体用法?PHP db_perform怎么用?PHP db_perform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_perform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$category_name = db_prepare_input($_POST['category_name']);
$sql_data_array = array('category_name' => db_prepare_input($_POST['category_name']), 'category_description' => db_prepare_input($_POST['category_description']), 'sort_order' => db_prepare_input($_POST['sort_order']));
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "category_id = " . $id);
gen_add_audit_log(INV_TABS_LOG . TEXT_UPDATE, $category_name);
} else {
// Test for duplicates.
$result = $db->Execute("select category_id from " . TABLE_INVENTORY_CATEGORIES . " where category_name = '" . $category_name . "'");
if ($result->RecordCount() > 0) {
$messageStack->add(INV_INFO_DELETE_ERROR, 'error');
return false;
}
$sql_data_array['category_id'] = db_prepare_input($_POST['rowSeq']);
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(INV_TABS_LOG . TEXT_ADD, $category_name);
}
return true;
}
示例2: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 3) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$title = db_prepare_input($_POST['title']);
$code = strtoupper(db_prepare_input($_POST['code']));
$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_session(SETUP_ERROR_CANNOT_CHANGE_DEFAULT, 'error');
} else {
$db->Execute("update " . TABLE_CONFIGURATION . " set configuration_value = '" . db_input($code) . "'\r\n\t\t\twhere configuration_key = 'DEFAULT_CURRENCY'");
$db->Execute("alter table " . TABLE_JOURNAL_MAIN . " \r\n\t\t\tchange `currencies_code` `currencies_code` CHAR(3) NOT NULL DEFAULT '" . db_input($code) . "'");
}
}
return true;
}
示例3: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($_SESSION['admin_security'][SECURITY_ID_CONFIGURATION] < 2) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$tab_name = db_prepare_input($_POST['tab_name']);
$sql_data_array = array('module_id' => 'assets', 'tab_name' => db_prepare_input($_POST['tab_name']), 'description' => db_prepare_input($_POST['description']), 'sort_order' => db_prepare_input($_POST['sort_order']));
if ($id) {
db_perform(TABLE_EXTRA_TABS, $sql_data_array, 'update', "id = " . $id);
gen_add_audit_log(sprintf(EXTRA_TABS_LOG, TEXT_UPDATE), $tab_name);
} else {
// Test for duplicates.
$result = $db->Execute("select id from " . TABLE_EXTRA_TABS . " where module_id='assets' and tab_name='" . $tab_name . "'");
if ($result->RecordCount() > 0) {
$messageStack->add(EXTRA_TABS_DELETE_ERROR, 'error');
return false;
}
$sql_data_array['id'] = db_prepare_input($_POST['rowSeq']);
db_perform(TABLE_EXTRA_TABS, $sql_data_array);
gen_add_audit_log(sprintf(EXTRA_TABS_LOG, TEXT_ADD), $tab_name);
}
return true;
}
示例4: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add(ERROR_NO_PERMISSION, 'error');
return false;
}
if ($_POST['subdepartment'] && !$_POST['primary_dept_id']) {
$_POST['subdepartment'] = '0';
}
if (!$_POST['subdepartment']) {
$_POST['primary_dept_id'] = '';
}
if ($_POST['primary_dept_id'] == $id) {
$messageStack->add(HR_DEPARTMENT_REF_ERROR, 'error');
$this->error = true;
return false;
}
// OK to save
$sql_data_array = array('description_short' => db_prepare_input($_POST['description_short']), 'description' => db_prepare_input($_POST['description']), 'subdepartment' => db_prepare_input($_POST['subdepartment']), 'primary_dept_id' => db_prepare_input($_POST['primary_dept_id']), 'department_type' => db_prepare_input($_POST['department_type']), 'department_inactive' => db_prepare_input($_POST['department_inactive'] ? '1' : '0'));
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "id = '" . $id . "'");
gen_add_audit_log(HR_LOG_DEPARTMENTS . TEXT_UPDATE, $id);
} else {
$sql_data_array['id'] = db_prepare_input($_POST['id']);
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(HR_LOG_DEPARTMENTS . TEXT_ADD, $id);
}
return true;
}
示例5: btn_save
function btn_save($id = '')
{
if (parent::btn_save($id = '')) {
$sql_data_array['use_in_inventory_filter'] = db_prepare_input($_POST['use_in_inventory_filter']);
db_perform(TABLE_EXTRA_FIELDS, $sql_data_array, 'update', "id = {$this->id}");
return true;
}
return false;
}
示例6: validate_fiscal_year
function validate_fiscal_year($next_fy, $next_period, $next_start_date, $num_periods = 12)
{
global $db;
for ($i = 0; $i < $num_periods; $i++) {
$fy_array = array('period' => $next_period, 'fiscal_year' => $next_fy, 'start_date' => $next_start_date, 'end_date' => gen_specific_date($next_start_date, $day_offset = -1, $month_offset = 1), 'date_added' => date('Y-m-d'));
db_perform(TABLE_ACCOUNTING_PERIODS, $fy_array, 'insert');
$next_period++;
$next_start_date = gen_specific_date($next_start_date, $day_offset = 0, $month_offset = 1);
}
return $next_period--;
}
示例7: install
function install($module)
{
global $db, $messageStack;
$error = false;
// load some default currency values
$db->Execute("TRUNCATE TABLE " . TABLE_CURRENCIES);
$currencies_list = array(array('title' => 'US Dollar', 'code' => 'USD', 'symbol_left' => '$', 'symbol_right' => '', 'decimal_point' => '.', 'thousands_point' => ',', 'decimal_places' => '2', 'decimal_precise' => '2', 'value' => 1.0, 'last_updated' => date('Y-m-d H:i:s')), array('title' => 'Euro', 'code' => 'EUR', 'symbol_left' => '', 'symbol_right' => 'EUR', 'decimal_point' => '.', 'thousands_point' => ',', 'decimal_places' => '2', 'decimal_precise' => '2', 'value' => 0.75, 'last_updated' => date('Y-m-d H:i:s')));
foreach ($currencies_list as $entry) {
db_perform(TABLE_CURRENCIES, $entry, 'insert');
}
write_configure('DEFAULT_CURRENCY', 'USD');
// Enter some data into table current status
$db->Execute("TRUNCATE TABLE " . TABLE_CURRENT_STATUS);
$db->Execute("insert into " . TABLE_CURRENT_STATUS . " set id = 1");
return $error;
}
示例8: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add(ERROR_NO_PERMISSION, 'error');
return false;
}
$sql_data_array = array('type' => $this->type, 'description_short' => $this->description_short, 'description_long' => $this->description_long, 'account_id' => $this->account_id, 'vendor_id' => $this->vendor_id, 'tax_rate' => $this->tax_rate);
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "tax_auth_id = '" . $id . "'");
gen_add_audit_log(SETUP_TAX_AUTHS_LOG . TEXT_UPDATE, $this->description_short);
} else {
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(SETUP_TAX_AUTHS_LOG . TEXT_ADD, $this->description_short);
}
return true;
}
示例9: btn_save
function btn_save($id = '')
{
global $db, $messageStack, $coa_types_list;
if ($this->security_id < 2) {
$messageStack->add(ERROR_NO_PERMISSION, 'error');
return false;
}
$this->heading_only = $this->heading_only == 1 ? '1' : '0';
$this->account_inactive = $this->account_inactive == 1 ? '1' : '0';
if ($this->account_type == '') {
$messageStack->add(ERROR_ACCT_TYPE_REQ, 'error');
$this->error = true;
return false;
}
if (!$this->primary_acct_id == '') {
$result = $db->Execute("select account_type from " . $this->db_table . " where id = '" . $this->primary_acct_id . "'");
if ($result->fields['account_type'] != $this->account_type) {
$messageStack->add('set account_type to ' . $coa_types_list[$result->fields['account_type']]['text'] . ' this is the same as the parent', 'error');
$this->error = true;
return false;
}
}
if ($this->heading_only == 1 && $this->rowSeq != 0) {
// see if this was a non-heading account converted to a heading account
$sql = "select max(debit_amount) as debit, max(credit_amount) as credit, max(beginning_balance) as beg_bal \n\t\tfrom " . TABLE_CHART_OF_ACCOUNTS_HISTORY . " where account_id = '" . $this->id . "'";
$result = $db->Execute($sql);
if ($result->fields['debit'] != 0 || $result->fields['credit'] != 0 || $result->fields['beg_bal'] != 0) {
$messageStack->add(GL_ERROR_CANT_MAKE_HEADING, 'error');
$this->error = true;
return false;
}
}
$sql_data_array = array('description' => $this->description, 'heading_only' => $this->heading_only, 'primary_acct_id' => $this->primary_acct_id, 'account_type' => $this->account_type, 'account_inactive' => $this->account_inactive);
if ($this->rowSeq != 0) {
db_perform($this->db_table, $sql_data_array, 'update', "id = '" . $this->id . "'");
gen_add_audit_log(GL_LOG_CHART_OF_ACCOUNTS . TEXT_UPDATE, $this->id);
} else {
$sql_data_array['id'] = $this->id;
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(GL_LOG_CHART_OF_ACCOUNTS . TEXT_ADD, $this->id);
}
build_and_check_account_history_records();
// add/modify account to history table
return true;
}
示例10: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$countries_name = db_prepare_input($_POST['countries_name']);
$sql_data_array = array('countries_name' => $countries_name, 'countries_iso_code_2' => db_prepare_input($_POST['countries_iso_code_2']), 'countries_iso_code_3' => db_prepare_input($_POST['countries_iso_code_3']), 'address_format_id' => db_prepare_input($_POST['address_format_id']));
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "countries_id = " . (int) $id);
gen_add_audit_log(SETUP_LOG_COUNTRIES . TEXT_UPDATE, $countries_name);
} else {
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(SETUP_LOG_COUNTRIES . TEXT_ADD, $countries_name);
}
return true;
}
示例11: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$zone_name = db_prepare_input($_POST['zone_name']);
$sql_data_array = array('countries_iso_code_3' => db_prepare_input($_POST['countries_iso_code_3']), 'zone_code' => db_prepare_input($_POST['zone_code']), 'zone_name' => $zone_name);
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "zone_id = '" . (int) $id . "'");
gen_add_audit_log(SETUP_ZONES_LOG . TEXT_UPDATE, $zone_name);
} else {
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(SETUP_ZONES_LOG . TEXT_ADD, $zone_name);
}
return true;
}
示例12: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add(ERROR_NO_PERMISSION, 'error');
return false;
}
$description_short = db_prepare_input($_POST['description_short']);
$sql_data_array = array('description_short' => $description_short, 'description_long' => db_prepare_input($_POST['description_long']), 'cost_type' => db_prepare_input($_POST['cost_type']), 'inactive' => isset($_POST['inactive']) ? '1' : '0');
if (!$this->id == '') {
db_perform($this->db_table, $sql_data_array, 'update', "cost_id = '" . $this->id . "'");
gen_add_audit_log(SETUP_PROJECT_COSTS_LOG . TEXT_UPDATE, $description_short);
} else {
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(SETUP_PROJECT_COSTS_LOG . TEXT_ADD, $description_short);
}
return true;
}
示例13: btn_save
function btn_save($id = '')
{
global $db, $messageStack, $currencies;
validate_security($this->security_id, 2);
if ($this->gl_acct_id == '') {
$messageStack->add(GL_SELECT_STD_CHART, 'error');
return false;
}
$sql_data_array = array('description' => $this->description, 'gl_acct_id' => $this->gl_acct_id, 'bank_account' => $this->bank_account);
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "kt_id = '" . $id . "'");
gen_add_audit_log(SETUP_TAX_AUTHS_LOG . TEXT_UPDATE, $this->description);
} else {
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(SETUP_TAX_AUTHS_LOG . TEXT_ADD, $this->description);
}
return true;
}
示例14: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add(ERROR_NO_PERMISSION, 'error');
return false;
}
$this->combine_rates();
$sql_data_array = array('type' => $this->type, 'description_short' => $this->description_short, 'description_long' => $this->description_long, 'rate_accounts' => $this->rate_accounts, 'freight_taxable' => $this->freight_taxable);
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "tax_rate_id = '" . $id . "'");
gen_add_audit_log(SETUP_TAX_RATES_LOG . TEXT_UPDATE, $this->description_short);
} else {
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(SETUP_TAX_RATES_LOG . TEXT_ADD, $this->description_short);
}
return true;
}
示例15: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$description = db_prepare_input($_POST['description']);
$sql_data_array = array('description' => $description);
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "id = '" . (int) $id . "'");
gen_add_audit_log(SETUP_DEPT_TYPES_LOG . TEXT_UPDATE, $description);
} else {
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(SETUP_DEPT_TYPES_LOG . TEXT_ADD, $description);
}
return true;
}