• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP vat_validation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中vat_validation函数的典型用法代码示例。如果您正苦于以下问题:PHP vat_validation函数的具体用法?PHP vat_validation怎么用?PHP vat_validation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了vat_validation函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: validate_main_tax_id

 public function validate_main_tax_id($value, $fields)
 {
     $this->load->helper('vat');
     $this->load->model('localisation/country');
     $this->language->load('account/register');
     $country_id = $fields['main_country_id']['value'];
     $country = $this->model_localisation_country->getCountry($country_id);
     if ($country && !empty($country['iso_code_2']) && vat_validation($country['iso_code_2'], $value) == 'invalid') {
         return $this->language->get('error_vat');
     }
     return '';
 }
开发者ID:sasha-adm-in,项目名称:project,代码行数:12,代码来源:simpledata.php


示例2: validateForm

 protected function validateForm()
 {
     if (!$this->user->hasPermission('modify', 'sale/order')) {
         $this->error['warning'] = $this->language->get('error_permission');
     }
     if (utf8_strlen($this->request->post['firstname']) < 1 || utf8_strlen($this->request->post['firstname']) > 32) {
         $this->error['firstname'] = $this->language->get('error_firstname');
     }
     if (utf8_strlen($this->request->post['lastname']) < 1 || utf8_strlen($this->request->post['lastname']) > 32) {
         $this->error['lastname'] = $this->language->get('error_lastname');
     }
     if (utf8_strlen($this->request->post['email']) > 96 || !preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $this->request->post['email'])) {
         $this->error['email'] = $this->language->get('error_email');
     }
     if (utf8_strlen($this->request->post['telephone']) < 3 || utf8_strlen($this->request->post['telephone']) > 32) {
         $this->error['telephone'] = $this->language->get('error_telephone');
     }
     if (utf8_strlen($this->request->post['payment_firstname']) < 1 || utf8_strlen($this->request->post['payment_firstname']) > 32) {
         $this->error['payment_firstname'] = $this->language->get('error_firstname');
     }
     if (utf8_strlen($this->request->post['payment_lastname']) < 1 || utf8_strlen($this->request->post['payment_lastname']) > 32) {
         $this->error['payment_lastname'] = $this->language->get('error_lastname');
     }
     if (utf8_strlen($this->request->post['payment_address_1']) < 3 || utf8_strlen($this->request->post['payment_address_1']) > 128) {
         $this->error['payment_address_1'] = $this->language->get('error_address_1');
     }
     if (utf8_strlen($this->request->post['payment_city']) < 3 || utf8_strlen($this->request->post['payment_city']) > 128) {
         $this->error['payment_city'] = $this->language->get('error_city');
     }
     $this->load->model('localisation/country');
     $country_info = $this->model_localisation_country->getCountry($this->request->post['payment_country_id']);
     if ($country_info) {
         if ($country_info['postcode_required'] && utf8_strlen($this->request->post['payment_postcode']) < 2 || utf8_strlen($this->request->post['payment_postcode']) > 10) {
             $this->error['payment_postcode'] = $this->language->get('error_postcode');
         }
         // VAT Validation
         $this->load->helper('vat');
         if ($this->config->get('config_vat') && $this->request->post['payment_tax_id'] && vat_validation($country_info['iso_code_2'], $this->request->post['payment_tax_id']) == 'invalid') {
             $this->error['payment_tax_id'] = $this->language->get('error_vat');
         }
     }
     if ($this->request->post['payment_country_id'] == '') {
         $this->error['payment_country'] = $this->language->get('error_country');
     }
     if (!isset($this->request->post['payment_zone_id']) || $this->request->post['payment_zone_id'] == '') {
         $this->error['payment_zone'] = $this->language->get('error_zone');
     }
     if ($this->request->post['payment_method'] == '') {
         $this->error['payment_zone'] = $this->language->get('error_zone');
     }
     if (!$this->request->post['payment_method']) {
         $this->error['payment_method'] = $this->language->get('error_payment');
     }
     // Check if any products require shipping
     $shipping = false;
     if (isset($this->request->post['order_product'])) {
         $this->load->model('catalog/product');
         foreach ($this->request->post['order_product'] as $order_product) {
             $product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
             if ($product_info && $product_info['shipping']) {
                 $shipping = true;
             }
         }
     }
     if ($shipping) {
         if (utf8_strlen($this->request->post['shipping_firstname']) < 1 || utf8_strlen($this->request->post['shipping_firstname']) > 32) {
             $this->error['shipping_firstname'] = $this->language->get('error_firstname');
         }
         if (utf8_strlen($this->request->post['shipping_lastname']) < 1 || utf8_strlen($this->request->post['shipping_lastname']) > 32) {
             $this->error['shipping_lastname'] = $this->language->get('error_lastname');
         }
         if (utf8_strlen($this->request->post['shipping_address_1']) < 3 || utf8_strlen($this->request->post['shipping_address_1']) > 128) {
             $this->error['shipping_address_1'] = $this->language->get('error_address_1');
         }
         if (utf8_strlen($this->request->post['shipping_city']) < 3 || utf8_strlen($this->request->post['shipping_city']) > 128) {
             $this->error['shipping_city'] = $this->language->get('error_city');
         }
         $this->load->model('localisation/country');
         $country_info = $this->model_localisation_country->getCountry($this->request->post['shipping_country_id']);
         if ($country_info && $country_info['postcode_required'] && utf8_strlen($this->request->post['shipping_postcode']) < 2 || utf8_strlen($this->request->post['shipping_postcode']) > 10) {
             $this->error['shipping_postcode'] = $this->language->get('error_postcode');
         }
         if ($this->request->post['shipping_country_id'] == '') {
             $this->error['shipping_country'] = $this->language->get('error_country');
         }
         if (!isset($this->request->post['shipping_zone_id']) || $this->request->post['shipping_zone_id'] == '') {
             $this->error['shipping_zone'] = $this->language->get('error_zone');
         }
         if (!$this->request->post['shipping_method']) {
             $this->error['shipping_method'] = $this->language->get('error_shipping');
         }
     }
     if ($this->error && !isset($this->error['warning'])) {
         $this->error['warning'] = $this->language->get('error_warning');
     }
     if (!$this->error) {
         return true;
     } else {
         return false;
     }
//.........这里部分代码省略.........
开发者ID:vandao,项目名称:vlpower,代码行数:101,代码来源:order.php


示例3: validate


//.........这里部分代码省略.........
         if ($this->request->post['payment_address'] == 'existing') {
             $this->load->model('account/address');
             if (empty($this->request->post['address_id'])) {
                 $json['error']['warning'] = $this->language->get('error_address');
             } elseif (!in_array($this->request->post['address_id'], array_keys($this->model_account_address->getAddresses()))) {
                 $json['error']['warning'] = $this->language->get('error_address');
             } else {
                 // Default Payment Address
                 $this->load->model('account/address');
                 $address_info = $this->model_account_address->getAddress($this->request->post['address_id']);
                 if ($address_info) {
                     $this->load->model('account/customer_group');
                     $customer_group_info = $this->model_account_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
                     // Company ID
                     if ($customer_group_info['company_id_display'] && $customer_group_info['company_id_required'] && !$address_info['company_id']) {
                         $json['error']['warning'] = $this->language->get('error_company_id');
                     }
                     // Tax ID
                     if ($customer_group_info['tax_id_display'] && $customer_group_info['tax_id_required'] && !$address_info['tax_id']) {
                         $json['error']['warning'] = $this->language->get('error_tax_id');
                     }
                 }
             }
             if (!$json) {
                 $this->session->data['payment_address_id'] = $this->request->post['address_id'];
                 if ($address_info) {
                     $this->session->data['payment_country_id'] = $address_info['country_id'];
                     $this->session->data['payment_zone_id'] = $address_info['zone_id'];
                 } else {
                     unset($this->session->data['payment_country_id']);
                     unset($this->session->data['payment_zone_id']);
                 }
                 unset($this->session->data['payment_method']);
                 unset($this->session->data['payment_methods']);
             }
         }
         $this->request->post['firstname'] = $this->model_checkout_checkout_tools->getFirstName($this->request->post['firstname']);
         $this->request->post['lastname'] = $this->model_checkout_checkout_tools->getLastName($this->request->post['firstname']);
         $this->request->post['address_2'] = '';
         if (!isset($this->request->post['company_id'])) {
             $this->request->post['company_id'] = '';
         }
         if (!isset($this->request->post['tax_id'])) {
             $this->request->post['tax_id'] = '';
         }
         if ($this->request->post['payment_address'] == 'new') {
             if (utf8_strlen($this->request->post['firstname']) < 1 || utf8_strlen($this->request->post['firstname']) > 32) {
                 $json['error']['firstname'] = $this->language->get('error_firstname');
             }
             // Customer Group
             $this->load->model('account/customer_group');
             $customer_group_info = $this->model_account_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
             if ($customer_group_info) {
                 // Company ID
                 if ($customer_group_info['company_id_display'] && $customer_group_info['company_id_required'] && empty($this->request->post['company_id'])) {
                     $json['error']['company_id'] = $this->language->get('error_company_id');
                 }
                 // Tax ID
                 if ($customer_group_info['tax_id_display'] && $customer_group_info['tax_id_required'] && empty($this->request->post['tax_id'])) {
                     $json['error']['tax_id'] = $this->language->get('error_tax_id');
                 }
             }
             if (utf8_strlen($this->request->post['address_1']) < 3 || utf8_strlen($this->request->post['address_1']) > 128) {
                 $json['error']['address_1'] = $this->language->get('error_address_1');
             }
             if (utf8_strlen($this->request->post['city']) < 2 || utf8_strlen($this->request->post['city']) > 32) {
                 $json['error']['city'] = $this->language->get('error_city');
             }
             $this->load->model('localisation/country');
             $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);
             if ($country_info) {
                 if ($country_info['postcode_required'] && utf8_strlen($this->request->post['postcode']) < 2 || utf8_strlen($this->request->post['postcode']) > 10) {
                     $json['error']['postcode'] = $this->language->get('error_postcode');
                 }
                 // VAT Validation
                 $this->load->helper('vat');
                 if ($this->config->get('config_vat') && isset($this->request->post['tax_id']) && $this->request->post['tax_id'] != '' && vat_validation($country_info['iso_code_2'], $this->request->post['tax_id']) == 'invalid') {
                     $json['error']['tax_id'] = $this->language->get('error_vat');
                 }
             }
             if ($this->request->post['country_id'] == '') {
                 $json['error']['country'] = $this->language->get('error_country');
             }
             if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') {
                 $json['error']['zone'] = $this->language->get('error_zone');
             }
             if (!$json) {
                 // Default Payment Address
                 $this->load->model('account/address');
                 $this->session->data['payment_address_id'] = $this->model_account_address->addAddress($this->request->post);
                 $this->session->data['payment_country_id'] = $this->request->post['country_id'];
                 $this->session->data['payment_zone_id'] = $this->request->post['zone_id'];
                 unset($this->session->data['payment_method']);
                 unset($this->session->data['payment_methods']);
             }
         }
     }
     $this->response->addHeader('Content-Type: application/json');
     $this->response->setOutput(json_encode($json));
 }
开发者ID:ahmatjan,项目名称:OpenCart-Overclocked,代码行数:101,代码来源:payment_address.php


示例4: validate

 protected function validate()
 {
     $this->load->model('account/customer_group');
     $this->load->model('catalog/information');
     $this->load->model('localisation/country');
     if (utf8_strlen($this->request->post['firstname']) < 1 || utf8_strlen($this->request->post['firstname']) > 32) {
         $this->error['firstname'] = Language::getVar('SUMO_NOUN_FIRSTNAME');
     }
     if (utf8_strlen($this->request->post['lastname']) < 1 || utf8_strlen($this->request->post['lastname']) > 32) {
         $this->error['lastname'] = Language::getVar('SUMO_NOUN_ERROR_LASTNAME');
     }
     if (empty($this->request->post['gender'])) {
         $this->error['gender'] = Language::getVar('SUMO_NOUN_ERROR_GENDER');
     }
     if (empty($this->request->post['birthdate']) || utf8_strlen($this->request->post['birthdate']) != 10) {
         $this->error['birthdate'] = Language::getVar('SUMO_NOUN_ERROR_BIRTHDATE');
     }
     if (!filter_var($this->request->post['email'], \FILTER_VALIDATE_EMAIL)) {
         $this->error['email'] = Language::getVar('SUMO_NOUN_ERROR_EMAIL');
     }
     if ($this->model_account_customer->getTotalCustomersByEmail($this->request->post['email'])) {
         $this->error['warning'] = Language::getVar('SUMO_NOUN_ERROR_EMAIL_IN_USE', $this->url->link('account/login', '', 'SSL'));
     }
     $this->request->post['telephone'] = preg_replace('/([^\\d]+)/', '', str_replace('+', '00', $this->request->post['telephone']));
     $this->request->post['mobile'] = preg_replace('/([^\\d]+)/', '', str_replace('+', '00', $this->request->post['mobile']));
     if (utf8_strlen($this->request->post['telephone']) < 8 || utf8_strlen($this->request->post['telephone']) > 15) {
         $this->error['telephone'] = Language::getVar('SUMO_NOUN_ERROR_TELEPHONE');
     }
     if (!empty($this->request->post['mobile'])) {
         if (utf8_strlen($this->request->post['mobile']) < 8 || utf8_strlen($this->request->post['mobile']) > 15) {
             $this->error['mobile'] = Language::getVar('SUMO_NOUN_ERROR_TELEPHONE');
         }
     }
     // Customer Group
     if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('customer_group_display'))) {
         $customer_group_id = $this->request->post['customer_group_id'];
     } else {
         $customer_group_id = $this->config->get('customer_group_id');
     }
     $customer_group = $this->model_account_customer_group->getCustomerGroup($customer_group_id);
     if ($customer_group) {
         // Company ID
         if ($customer_group['company_id_display'] && $customer_group['company_id_required'] && empty($this->request->post['company_id'])) {
             $this->error['company_id'] = Language::getVar('SUMO_NOUN_ERROR_COMPANY');
         }
         // Tax ID
         if ($customer_group['tax_id_display'] && $customer_group['tax_id_required'] && empty($this->request->post['tax_id'])) {
             $this->error['tax_id'] = Language::getVar('SUMO_NOUN_ERROR_TAX');
         }
     }
     if (utf8_strlen($this->request->post['address_1']) < 3 || utf8_strlen($this->request->post['address_1']) > 128) {
         $this->error['address_1'] = Language::getVar('SUMO_NOUN_ERROR_ADDRESS');
     }
     if (utf8_strlen($this->request->post['city']) < 2 || utf8_strlen($this->request->post['city']) > 128) {
         $this->error['city'] = Language::getVar('SUMO_NOUN_ERROR_CITY');
     }
     $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);
     if ($country_info) {
         if ($country_info['postcode_required'] && utf8_strlen($this->request->post['postcode']) < 2 || utf8_strlen($this->request->post['postcode']) > 6) {
             $this->error['postcode'] = Language::getVar('SUMO_NOUN_ERROR_POSTAL_CODE');
         }
         // VAT Validation
         $this->load->helper('vat');
         if ($this->request->post['tax_id'] && vat_validation($country_info['iso_code_2'], $this->request->post['tax_id']) == 'invalid') {
             $this->error['tax_id'] = Language::getVar('SUMO_NOUN_ERROR_VAT');
         }
     }
     if ($this->request->post['country_id'] == '') {
         $this->error['country'] = Language::getVar('SUMO_NOUN_ERROR_COUNTRY');
     }
     if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') {
         $this->error['zone'] = Language::getVar('SUMO_NOUN_ERROR_ZONE');
     }
     $password = $this->request->post['password'];
     if (empty($password) || utf8_strlen($this->request->post['password']) < 4) {
         $this->error['password'] = Language::getVar('SUMO_NOUN_ERROR_PASSWORD_UNSAFE');
     }
     if ($this->request->post['confirm'] != $this->request->post['password']) {
         $this->error['confirm'] = Language::getVar('SUMO_NOUN_ERROR_PASSWORD_CONFIRM');
     }
     if ($this->config->get('customer_policy_id')) {
         $information_info = $this->model_catalog_information->getInformation($this->config->get('customer_policy_id'));
         if ($information_info && !isset($this->request->post['agree'])) {
             $this->error['warning'] = Language::getVar('SUMO_NOUN_ACCOUNT_AGREE_PAGE', array($this->url->link('information/information/info', 'information_id=' . $information_info['information_id']), $information_info['title']));
         }
     }
     if (!$this->error) {
         return true;
     }
     return false;
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:91,代码来源:register.php


示例5: validateForm

 protected function validateForm()
 {
     if (!$this->user->hasPermission('modify', 'sale/customer')) {
         $this->error['warning'] = $this->language->get('error_permission');
     }
     if (utf8_strlen($this->request->post['firstname']) < 1 || utf8_strlen($this->request->post['firstname']) > 32) {
         $this->error['firstname'] = $this->language->get('error_firstname');
     }
     if (utf8_strlen($this->request->post['lastname']) < 1 || utf8_strlen($this->request->post['lastname']) > 32) {
         $this->error['lastname'] = $this->language->get('error_lastname');
     }
     if (utf8_strlen($this->request->post['email']) > 96 || !preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $this->request->post['email'])) {
         $this->error['email'] = $this->language->get('error_email');
     }
     $customer_info = $this->model_sale_customer->getCustomerByEmail($this->request->post['email']);
     if (!isset($this->request->get['customer_id'])) {
         if ($customer_info) {
             $this->error['warning'] = $this->language->get('error_exists');
         }
     } else {
         if ($customer_info && $this->request->get['customer_id'] != $customer_info['customer_id']) {
             $this->error['warning'] = $this->language->get('error_exists');
         }
     }
     if (utf8_strlen($this->request->post['telephone']) < 3 || utf8_strlen($this->request->post['telephone']) > 32) {
         $this->error['telephone'] = $this->language->get('error_telephone');
     }
     if (isset($this->request->post['date_of_birth']) && utf8_strlen($this->request->post['date_of_birth']) == 10) {
         if ($this->request->post['date_of_birth'] != date('Y-m-d', strtotime($this->request->post['date_of_birth']))) {
             $this->error['date_of_birth'] = $this->language->get('error_date_of_birth');
         }
     } else {
         $this->error['date_of_birth'] = $this->language->get('error_date_of_birth');
     }
     if ($this->request->post['password'] || !isset($this->request->get['customer_id'])) {
         if (utf8_strlen($this->request->post['password']) < 4 || utf8_strlen($this->request->post['password']) > 20) {
             $this->error['password'] = $this->language->get('error_password');
         }
         if ($this->request->post['password'] != $this->request->post['confirm']) {
             $this->error['confirm'] = $this->language->get('error_confirm');
         }
     }
     if (isset($this->request->post['address'])) {
         foreach ($this->request->post['address'] as $key => $value) {
             if (utf8_strlen($value['firstname']) < 1 || utf8_strlen($value['firstname']) > 32) {
                 $this->error['address_firstname'][$key] = $this->language->get('error_firstname');
             }
             if (utf8_strlen($value['lastname']) < 1 || utf8_strlen($value['lastname']) > 32) {
                 $this->error['address_lastname'][$key] = $this->language->get('error_lastname');
             }
             if (utf8_strlen($value['address_1']) < 3 || utf8_strlen($value['address_1']) > 128) {
                 $this->error['address_address_1'][$key] = $this->language->get('error_address_1');
             }
             if (utf8_strlen($value['city']) < 2 || utf8_strlen($value['city']) > 128) {
                 $this->error['address_city'][$key] = $this->language->get('error_city');
             }
             $this->load->model('localisation/country');
             $country_info = $this->model_localisation_country->getCountry($value['country_id']);
             if ($country_info) {
                 if ($country_info['postcode_required'] && utf8_strlen($value['postcode']) < 2 || utf8_strlen($value['postcode']) > 10) {
                     $this->error['address_postcode'][$key] = $this->language->get('error_postcode');
                 }
                 // VAT Validation
                 $this->load->model('sale/customer_group');
                 if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display'))) {
                     $customer_group_id = $this->request->post['customer_group_id'];
                 } else {
                     $customer_group_id = $this->config->get('config_customer_group_id');
                 }
                 $customer_group = $this->model_sale_customer_group->getCustomerGroup($customer_group_id);
                 if ($customer_group && $customer_group['tax_id_display']) {
                     $this->load->helper('vat');
                     if ($this->config->get('config_vat') && $value['tax_id'] != '' && vat_validation($country_info['iso_code_2'], $value['tax_id']) == 'invalid') {
                         $this->error['address_tax_id'][$key] = $this->language->get('error_vat');
                     }
                 }
             }
             if ($value['country_id'] == '') {
                 $this->error['address_country'][$key] = $this->language->get('error_country');
             }
             if (!isset($value['zone_id']) || $value['zone_id'] == '') {
                 $this->error['address_zone'][$key] = $this->language->get('error_zone');
             }
         }
     }
     if ($this->error && !isset($this->error['warning'])) {
         $this->error['warning'] = $this->language->get('error_warning');
     }
     if (!$this->error) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:ahmatjan,项目名称:OpenCart-Overclocked,代码行数:94,代码来源:customer.php


示例6: validateForm

 private function validateForm()
 {
     if (utf8_strlen($this->request->post['firstname']) < 1 || utf8_strlen($this->request->post['firstname']) > 32) {
         $this->error['firstname'] = $this->language->get('error_firstname');
     }
     if (utf8_strlen($this->request->post['lastname']) < 1 || utf8_strlen($this->request->post['lastname']) > 32) {
         $this->error['lastname'] = $this->language->get('error_lastname');
     }
     if (utf8_strlen($this->request->post['address_1']) < 3 || utf8_strlen($this->request->post['address_1']) > 128) {
         $this->error['address_1'] = $this->language->get('error_address_1');
     }
     if (utf8_strlen($this->request->post['city']) < 2 || utf8_strlen($this->request->post['city']) > 128) {
         $this->error['city'] = $this->language->get('error_city');
     }
     $this->load->model('localisation/country');
     $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);
     if ($country_info) {
         if ($country_info['postcode_required'] && utf8_strlen($this->request->post['postcode']) < 2 || utf8_strlen($this->request->post['postcode']) > 10) {
             $this->error['postcode'] = $this->language->get('error_postcode');
         }
         // VAT Validation
         $this->load->helper('vat');
         if ($this->config->get('config_vat') && !empty($this->request->post['tax_id']) && vat_validation($country_info['iso_code_2'], $this->request->post['tax_id']) == 'invalid') {
             $this->error['tax_id'] = $this->language->get('error_vat');
         }
     }
     if ($this->request->post['country_id'] == '') {
         $this->error['country'] = $this->language->get('error_country');
     }
     if ($this->request->post['zone_id'] == '') {
         $this->error['zone'] = $this->language->get('error_zone');
     }
     /*Verify Postal*/
     $this->load->model('ocean/urlredirect');
     $verifyPostal = $this->model_ocean_urlredirect->verifyPostal($this->request->post['postcode'], $this->request->post['city'], $this->request->post['zone_id'], $this->request->post['country_id']);
     if (empty($verifyPostal)) {
         $this->error['postcode'] = ERROR_POSTAL_VERIFICATION;
     }
     /*End Verify Postal*/
     /*Verify City*/
     $verifyCity = $this->model_ocean_urlredirect->verifyCity($this->request->post['city'], $this->request->post['zone_id'], $this->request->post['country_id']);
     if (empty($verifyCity)) {
         $this->error['city'] = ERROR_CITY_VERIFICATION;
     }
     /*End Verify City*/
     if (!$this->error) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:snomannaseem,项目名称:clothingnapparel,代码行数:51,代码来源:address.php


示例7: validate

 protected function validate()
 {
     if (utf8_strlen($this->request->post['firstname']) < 1 || utf8_strlen($this->request->post['firstname']) > 32) {
         $this->error['firstname'] = $this->language->get('error_firstname');
     }
     if (utf8_strlen($this->request->post['lastname']) < 1 || utf8_strlen($this->request->post['lastname']) > 32) {
         $this->error['lastname'] = $this->language->get('error_lastname');
     }
     if (utf8_strlen($this->request->post['email']) > 96 || !preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $this->request->post['email'])) {
         $this->error['email'] = $this->language->get('error_email');
     }
     if ($this->model_account_customer->getTotalCustomersByEmail($this->request->post['email'])) {
         $this->error['warning'] = $this->language->get('error_exists');
     }
     if (utf8_strlen($this->request->post['telephone']) < 3 || utf8_strlen($this->request->post['telephone']) > 32 || !is_numeric($this->request->post['telephone'])) {
         $this->error['telephone'] = $this->language->get('error_telephone');
     }
     // Customer Group
     $this->load->model('account/customer_group');
     if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display'))) {
         $customer_group_id = $this->request->post['customer_group_id'];
     } else {
         $customer_group_id = $this->config->get('config_customer_group_id');
     }
     $customer_group = $this->model_account_customer_group->getCustomerGroup($customer_group_id);
     if ($customer_group) {
         // Company ID
         if ($customer_group['company_id_display'] && $customer_group['company_id_required'] && empty($this->request->post['company_id'])) {
             $this->error['company_id'] = $this->language->get('error_company_id');
         }
         // Tax ID
         //			if ($customer_group['tax_id_display'] && $customer_group['tax_id_required'] && empty($this->request->post['tax_id'])) {
         //				$this->error['tax_id'] = $this->language->get('error_tax_id');
         //			}
     }
     if (utf8_strlen($this->request->post['address_1']) < 3 || utf8_strlen($this->request->post['address_1']) > 128) {
         $this->error['address_1'] = $this->language->get('error_address_1');
     }
     if (utf8_strlen($this->request->post['city']) < 2 || utf8_strlen($this->request->post['city']) > 128) {
         $this->error['city'] = $this->language->get('error_city');
     }
     $this->load->model('localisation/country');
     $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);
     if ($country_info) {
         if ($country_info['postcode_required'] && utf8_strlen($this->request->post['postcode']) < 6 || utf8_strlen($this->request->post['postcode']) > 6 || !is_numeric($this->request->post['postcode'])) {
             $this->error['postcode'] = $this->language->get('error_postcode');
         }
         // VAT Validation
         $this->load->helper('vat');
         if ($this->config->get('config_vat') && $this->request->post['tax_id'] && vat_validation($country_info['iso_code_2'], $this->request->post['tax_id']) == 'invalid') {
             $this->error['tax_id'] = $this->language->get('error_vat');
         }
     }
     if ($this->request->post['country_id'] == '') {
         $this->error['country'] = $this->language->get('error_country');
     }
     if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') {
         $this->error['zone'] = $this->language->get('error_zone');
     }
     if (utf8_strlen($this->request->post['password']) < 4 || utf8_strlen($this->request->post['password']) > 20) {
         $this->error['password'] = $this->language->get('error_password');
     }
     if ($this->request->post['confirm'] != $this->request->post['password']) {
         $this->error['confirm'] = $this->language->get('error_confirm');
     }
     if ($this->config->get('config_account_id')) {
         $this->load->model('catalog/information');
         $information_info = $this->model_catalog_information->getInformation($this->config->get('config_account_id'));
         if ($information_info && !isset($this->request->post['agree'])) {
             $this->error['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']);
         }
     }
     if (!$this->error) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:bgabor,项目名称:RenaniaOpencart,代码行数:78,代码来源:register_szept9.php


示例8: validateForm

 protected function validateForm()
 {
     if (!$this->user->hasPermission('modify', 'sale/customer')) {
         $this->error['warning'] = $this->language->get('error_permission');
     }
     if (utf8_strlen($this->request->post['firstname']) < 1 || utf8_strlen($this->request->post['firstname']) > 32) {
         $this->error['firstname'] = $this->language->get('error_firstname');
     }
     if (utf8_strlen($this->request->post['lastname']) < 1 || utf8_strlen($this->request->post['lastname']) > 32) {
         $this->error['lastname'] = $this->language->get('error_lastname');
     }
     if (utf8_strlen($this->request->post['email']) > 96 || !$this->ocstore->validate($this->request->post['email'])) {
         $this->error['email'] = $this->language->get('error_email');
     }
     $customer_info = $this->model_sale_customer->getCustomerByEmail($this->request->post['email']);
     if (!isset($this->request->get['customer_id'])) {
         if ($customer_info) {
             $this->error['warning'] = $this->language->get('error_exists');
         }
     } else {
         if ($customer_info && $this->request->get['customer_id'] != $customer_info['customer_id']) {
             $this->error['warning'] = $this->language->get('error_exists');
         }
     }
     if (utf8_strlen($this->request->post['telephone']) < 3 || utf8_strlen($this->request->post['telephone']) > 32) {
         $this->error['telephone'] = $this->language->get('error_telephone');
     }
     if ($this->request->post['password'] || !isset($this->request->get['customer_id'])) {
         if (utf8_strlen($this->request->post['password']) < 4 || utf8_strlen($this->request->post['password']) > 20) {
             $this->error['password'] = $this->language->get('error_password');
         }
         if ($this->request->post['password'] != $this->request->post['confirm']) {
             $this->error['confirm'] = $this->language->get('error_confirm');
         }
     }
     if (isset($this->request->post['address'])) {
         foreach ($this->request->post['address'] as $key => $value) {
             if (utf8_strlen($value['firstname']) < 1 || utf8_strlen($value['firstname']) > 32) {
                 $this->error['address_firstname'][$key] = $this->language->get('error_firstname');
             }
             if (utf8_strlen($value['lastname']) < 1 || utf8_strlen($value['lastname']) > 32) {
                 $this->error['address_lastname'][$key] = $this->language->get('error_lastname');
             }
             if (utf8_strlen($value['address_1']) < 3 || utf8_strlen($value['address_1']) > 128) {
                 $this->error['address_address_1'][$key] = $this->language->get('error_address_1');
             }
             if (utf8_strlen($value['city']) < 2 || utf8_strlen($value['city']) > 128) {
                 $this->error['address_city'][$key] = $this->language->get('error_city');
             }
             $this->load->model('localisation/country');
             $country_info = $this->model_localisation_country->getCountry($value['country_id']);
             if ($country_info) {
                 if ($country_info['postcode_required'] && utf8_strlen($value['postcode']) < 2 || utf8_strlen($value['postcode']) > 10) {
                     $this->error['address_postcode'][$key] = $this->language->get('error_postcode');
                 }
                 // VAT Validation
                 $this->load->helper('vat');
                 if ($this->config->get('config_vat') && $value['tax_id'] && vat_validation($country_info['iso_code_2'], $value['tax_id']) == 'invalid') {
                     $this->error['address_tax_id'][$key] = $this->language->get('error_vat');
                 }
             }
             if ($value['country_id'] == '') {
                 $this->error['address_country'][$key] = $this->language->get('error_country');
             }
             if (!isset($value['zone_id']) || $value['zone_id'] == '') {
                 $this->error['address_zone'][$key] = $this->language->get('error_zone');
             }
         }
     }
     if ($this->error && !isset($this->error['warning'])) {
         $this->error['warning'] = $this->language->get('error_warning');
     }
     if (!$this->error) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:AlesPravdin,项目名称:FOODYBOX_SITE,代码行数:78,代码来源:customer.php


示例9: invalid

 public function invalid($value, $data = array())
 {
     $result = false;
     if (isset($data['not_empty'])) {
         $result = empty($value) ? true : false;
     }
     if (isset($data['min_length']) && !$result) {
         $result = utf8_strlen($value) < $data['min_length'] ? true : false;
     }
     if (isset($data['max_length']) && !$result) {
         $result = utf8_strlen($value) > $data['max_length'] ? true : false;
     }
     if (isset($data['vat_address']) && !$result) {
         $result = vat_validation($this->checkout[$data['vat_address']]['iso_code_2'], $value) == 'invalid' ? true : false;
     }
     if (isset($data['compare_to']) && !$result) {
         $field = explode("[", $data['compare_to']);
         $field[1] = str_replace("]", "", $field[1]);
         $data['compare_to'] = isset($this->checkout[$field[0]][$field[1]]) ? $this->checkout[$field[0]][$field[1]] : '';
         $result = $value != $data['compare_to'] ? true : false;
     }
     if (isset($data['regex']) && !$result) {
         $result = !preg_match($data['regex'], $value) ? true : false;
     }
     if (isset($data['email_exists']) && !$result) {
         $result = $this->model_account_customer->getTotalCustomersByEmail($value) ? true : false;
     }
     if (isset($data['checked']) && !$result) {
         $result = !$value;
     }
     return $result;
 }
开发者ID:bgabor,项目名称:RenaniaOpencart,代码行数:32,代码来源:quickcheckout_nov14.php


示例10: payment_address_validate


//.........这里部分代码省略.........
                 }
             }
         }
     } else {
         if (!$json) {
             if (isset($this->request->post['payment_address']) && $this->request->post['payment_address'] == 'existing') {
                 $this->load->model('account/address');
                 if (empty($this->request->post['payment_address_id'])) {
                     $json['error']['warning'] = $this->language->get('error_address');
                 } elseif (!in_array($this->request->post['payment_address_id'], array_keys($this->model_account_address->getAddresses()))) {
                     $json['error']['warning'] = $this->language->get('error_address');
                 } else {
                     // Default Payment Address
                     $this->load->model('account/address');
                     $address_info = $this->model_account_address->getAddress($this->request->post['payment_address_id']);
                     if ($address_info) {
                         $this->load->model('account/customer_group');
                         $customer_group_info = $this->model_account_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
                         // Company ID
                         if ($customer_group_info['company_id_display'] && $customer_group_info['company_id_required'] && !$address_info['company_id']) {
                             $json['error']['warning'] = $this->language->get('error_company_id');
                         }
                         // Tax ID
                         if ($customer_group_info['tax_id_display'] && $customer_group_info['tax_id_required'] && !$address_info['tax_id']) {
                             $json['error']['warning'] = $this->language->get('error_tax_id');
                         }
                     }
                 }
                 if (!$json) {
                     $this->session->data['payment_address_id'] = $this->request->post['payment_address_id'];
                     if ($address_info) {
                         $this->session->data['payment_country_id'] = $address_info['country_id'];
                         $this->session->data['payment_zone_id'] = $address_info['zone_id'];
                     } else {
                         unset($this->session->data['payment_country_id']);
                         unset($this->session->data['payment_zone_id']);
                     }
                     //unset($this->session->data['payment_method']);
                     //unset($this->session->data['payment_methods']);
                 }
             } else {
                 if (!isset($this->request->post['firstname']) || (utf8_strlen(trim($this->request->post['firstname'])) < 1 || utf8_strlen(trim($this->request->post['firstname'])) > 32)) {
                     $json['error']['firstname'] = $this->language->get('error_firstname');
                 }
                 if (!isset($this->request->post['lastname']) || (utf8_strlen(trim($this->request->post['lastname'])) < 1 || utf8_strlen(trim($this->request->post['lastname'])) > 32)) {
                     $json['error']['lastname'] = $this->language->get('error_lastname');
                 }
                 if (!isset($this->request->post['address_1']) || (utf8_strlen(trim($this->request->post['address_1'])) < 3 || utf8_strlen(trim($this->request->post['address_1'])) > 128)) {
                     $json['error']['address_1'] = $this->language->get('error_address_1');
                 }
                 if (!isset($this->request->post['city']) || (utf8_strlen($this->request->post['city']) < 2 || utf8_strlen($this->request->post['city']) > 32)) {
                     $json['error']['city'] = $this->language->get('error_city');
                 }
                 // Customer Group
                 $this->load->model('account/customer_group');
                 $customer_group_info = $this->model_account_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
                 if ($customer_group_info) {
                     // Company ID
                     if ($customer_group_info['company_id_display'] && $customer_group_info['company_id_required'] && empty($this->request->post['company_id'])) {
                         $json['error']['company_id'] = $this->language->get('error_company_id');
                     }
                     // Tax ID
                     if ($customer_group_info['tax_id_display'] && $customer_group_info['tax_id_required'] && empty($this->request->post['tax_id'])) {
                         $json['error']['tax_id'] = $this->language->get('error_tax_id');
                     }
                 }
                 $this->load->model('localisation/country');
                 if (isset($this->request->post['country_id'])) {
                     $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);
                 }
                 if (isset($country_info)) {
                     if ($country_info['postcode_required'] && utf8_strlen($this->request->post['postcode']) < 2 || utf8_strlen($this->request->post['postcode']) > 10) {
                         $json['error']['postcode'] = $this->language->get('error_postcode');
                     }
                     // VAT Validation
                     $this->load->helper('vat');
                     if ($this->config->get('config_vat') && !empty($this->request->post['tax_id']) && vat_validation($country_info['iso_code_2'], $this->request->post['tax_id']) == 'invalid') {
                         $json['error']['tax_id'] = $this->language->get('error_vat');
                     }
                 }
                 if (!isset($this->request->post['country_id']) || $this->request->post['country_id'] == '') {
                     $json['error']['country_id'] = $this->language->get('error_country');
                 }
                 if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') {
                     $json['error']['zone_id'] = $this->language->get('error_zone');
                 }
                 if (!$json) {
                     // Default Payment Address
                     $this->load->model('account/address');
                     $this->session->data['payment_address_id'] = $this->model_account_address->addAddress($this->request->post);
                     $this->session->data['payment_country_id'] = $this->request->post['country_id'];
                     $this->session->data['payment_zone_id'] = $this->request->post['zone_id'];
                     //unset($this->session->data['payment_method']);
                     //unset($this->session->data['payment_methods']);
                 }
             }
         }
     }
     return $json;
 }
开发者ID:gnhub,项目名称:opencart-one-page-checkout,代码行数:101,代码来源:chechout.php


示例11: validate

 public function validate()
 {
     $this->language->load('onepage/checkout');
     $json = array();
     // Validate if customer is logged in.
     if (!$this->customer->isLogged()) {
         $json['redirect'] = $this->url->link('onepage/checkout', '', 'SSL');
     }
     // Validate cart has products and has stock.
     if (!$this->cart->hasProducts() && empty($this->session->data['vouchers']) || !$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
         $json['redirect'] = $this->url->link('onepage/cart');
     }
     

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP vatr函数代码示例发布时间:2022-05-23
下一篇:
PHP vartrue函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap