customers.php
来自「this the oscommerce 3.0 aplha 4」· PHP 代码 · 共 352 行 · 第 1/2 页
PHP
352 行
'country_id' => $_POST['ab_country'], 'telephone' => (isset($_POST['ab_telephone']) ? $_POST['ab_telephone'] : ''), 'fax' => (isset($_POST['ab_fax']) ? $_POST['ab_fax'] : ''), 'primary' => (isset($_POST['ab_primary']) && ($_POST['ab_primary'] == 'on') ? true : false)); $error = false; if ( ACCOUNT_GENDER > 0 ) { if ( ($data['gender'] != 'm') && ($data['gender'] != 'f') ) { $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_gender'), 'error'); $error = true; } } if ( strlen(trim($data['firstname'])) < ACCOUNT_FIRST_NAME ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_first_name'), ACCOUNT_FIRST_NAME), 'error'); $error = true; } if ( strlen(trim($data['lastname'])) < ACCOUNT_LAST_NAME ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_last_name'), ACCOUNT_LAST_NAME), 'error'); $error = true; } if ( ACCOUNT_COMPANY > 0 ) { if ( strlen(trim($data['company'])) < ACCOUNT_COMPANY ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_company'), ACCOUNT_COMPANY), 'error'); $error = true; } } if ( strlen(trim($data['street_address'])) < ACCOUNT_STREET_ADDRESS ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_street_address'), ACCOUNT_STREET_ADDRESS), 'error'); $error = true; } if ( ACCOUNT_SUBURB > 0 ) { if ( strlen(trim($data['suburb'])) < ACCOUNT_SUBURB ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_suburb'), ACCOUNT_SUBURB), 'error'); $error = true; } } if ( ACCOUNT_POST_CODE > 0 ) { if ( strlen(trim($data['postcode'])) < ACCOUNT_POST_CODE ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('entry_post_code'), ACCOUNT_POST_CODE), 'error'); $error = true; } } if ( strlen(trim($data['city'])) < ACCOUNT_CITY ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_city'), ACCOUNT_CITY), 'error'); $error = true; } if ( ACCOUNT_STATE > 0 ) { $Qcheck = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id limit 1'); $Qcheck->bindTable(':table_zones', TABLE_ZONES); $Qcheck->bindInt(':zone_country_id', $data['country_id']); $Qcheck->execute(); $entry_state_has_zones = ( $Qcheck->numberOfRows() > 0 ); $Qcheck->freeResult(); if ( $entry_state_has_zones === true ) { $Qzone = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_code = :zone_code'); $Qzone->bindTable(':table_zones', TABLE_ZONES); $Qzone->bindInt(':zone_country_id', $data['country_id']); $Qzone->bindValue(':zone_code', strtoupper($data['state'])); $Qzone->execute(); if ( $Qzone->numberOfRows() === 1 ) { $data['zone_id'] = $Qzone->valueInt('zone_id'); } else { $Qzone = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_name like :zone_name'); $Qzone->bindTable(':table_zones', TABLE_ZONES); $Qzone->bindInt(':zone_country_id', $data['country_id']); $Qzone->bindValue(':zone_name', $data['state'] . '%'); $Qzone->execute(); if ( $Qzone->numberOfRows() === 1 ) { $data['zone_id'] = $Qzone->valueInt('zone_id'); } else { $osC_MessageStack->add($this->_module, $osC_Language->get('ms_warning_state_select_from_list'), 'warning'); $error = true; } } $Qzone->freeResult(); } else { if ( strlen(trim($data['state'])) < ACCOUNT_STATE ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_state'), ACCOUNT_STATE), 'error'); $error = true; } } } if ( !is_numeric($data['country_id']) || ($data['country_id'] < 1) ) { $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_country'), 'error'); $error = true; } if ( ACCOUNT_TELEPHONE > 0 ) { if ( strlen(trim($data['telephone'])) < ACCOUNT_TELEPHONE ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_telephone_number'), ACCOUNT_TELEPHONE), 'error'); $error = true; } } if ( ACCOUNT_FAX > 0 ) { if ( strlen(trim($data['fax'])) < ACCOUNT_FAX ) { $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_error_fax_number'), ACCOUNT_FAX), 'error'); $error = true; } } if ( $error === false ) { if ( osC_Customers_Admin::saveAddress((isset($_GET['abID']) && is_numeric($_GET['abID']) ? $_GET['abID'] : null), $data) ) { $osC_MessageStack->add_session($this->_module, $osC_Language->get('ms_success_action_performed'), 'success'); } else { $osC_MessageStack->add_session($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error'); } osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&cID=' . $_GET['cID'] . '&search=' . $_GET['search'] . '&page=' . $_GET['page'] . '&action=save&tabIndex=tabAddressBook')); } } break; case 'deleteAddress': $this->_page_contents = 'address_book_delete.php'; if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) { if ( osC_Customers_Admin::deleteAddress($_GET['abID'], $_GET['cID']) ) { $osC_MessageStack->add_session($this->_module, $osC_Language->get('ms_success_action_performed'), 'success'); } else { $osC_MessageStack->add_session($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error'); } osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&cID=' . $_GET['cID'] . '&page=' . $_GET['page'] . '&search=' . $_GET['search'] . '&action=save&tabIndex=tabAddressBook')); } break; case 'batchDelete': if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) { $this->_page_contents = 'batch_delete.php'; if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) { $error = false; foreach ($_POST['batch'] as $id) { if ( !osC_Customers_Admin::delete($id, (isset($_POST['delete_reviews']) && ($_POST['delete_reviews'] == 'on') ? true : false)) ) { $error = true; break; } } if ( $error === false ) { $osC_MessageStack->add_session($this->_module, $osC_Language->get('ms_success_action_performed'), 'success'); } else { $osC_MessageStack->add_session($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error'); } osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&page=' . $_GET['page'] . '&search=' . $_GET['search'])); } } break; } } } }?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?