当前位置: 首页>>代码示例>>PHP>>正文


PHP AddressFormat::checkFormatFields方法代码示例

本文整理汇总了PHP中AddressFormat::checkFormatFields方法的典型用法代码示例。如果您正苦于以下问题:PHP AddressFormat::checkFormatFields方法的具体用法?PHP AddressFormat::checkFormatFields怎么用?PHP AddressFormat::checkFormatFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AddressFormat的用法示例。


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

示例1: postProcess

 public function postProcess()
 {
     if (isset($_GET['delete' . $this->table]) or Tools::getValue('submitDel' . $this->table)) {
         $this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.');
     } else {
         if (Tools::getValue('submitAdd' . $this->table)) {
             $id_country = Tools::getValue('id_country');
             $tmp_addr_format = new AddressFormat($id_country);
             $save_status = false;
             $is_new = is_null($tmp_addr_format->id_country);
             if ($is_new) {
                 $tmp_addr_format = new AddressFormat();
                 $tmp_addr_format->id_country = $id_country;
             }
             $tmp_addr_format->format = Tools::getValue('address_layout');
             if (strlen($tmp_addr_format->format) > 0) {
                 if ($tmp_addr_format->checkFormatFields()) {
                     $save_status = $is_new ? $tmp_addr_format->save() : $tmp_addr_format->update();
                 } else {
                     $errorList = $tmp_addr_format->getErrorList();
                     foreach ($errorList as $numError => $error) {
                         $this->_errors[] = $error;
                     }
                 }
                 if (!$save_status) {
                     $this->_errors[] = Tools::displayError('Invalid address layout' . Db::getInstance()->getMsgError());
                 }
             }
             unset($tmp_addr_format);
         }
         return parent::postProcess();
     }
 }
开发者ID:greench,项目名称:prestashop,代码行数:33,代码来源:AdminCountries.php

示例2: registerAddressFormat

 public function registerAddressFormat()
 {
     $id_country = (int) Tools::getValue('id_country');
     $tmp_addr_format = new AddressFormat($id_country);
     $tmp_addr_format->id_country = $id_country;
     $tmp_addr_format->format = Tools::getValue('address_layout');
     if (strlen($tmp_addr_format->format) > 0) {
         if ($tmp_addr_format->checkFormatFields()) {
             $tmp_addr_format->save();
         } else {
             $errorList = $tmp_addr_format->getErrorList();
             foreach ($errorList as $numError => $error) {
                 $this->_errors[] = $error;
             }
         }
         if (!Validate::isLoadedObject($tmp_addr_format)) {
             $this->_errors[] = Tools::displayError('Invalid address layout ' . Db::getInstance()->getMsgError());
         }
     }
     if (isset($this->_errors) && count($this->_errors)) {
         return false;
     }
     return true;
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:24,代码来源:AdminCountries.php

示例3: processSave

 public function processSave()
 {
     if (!count($this->errors)) {
         $id_country = Tools::getValue('id_country');
         $tmp_addr_format = new AddressFormat($id_country);
         $save_status = false;
         $is_new = is_null($tmp_addr_format->id_country);
         if ($is_new) {
             $tmp_addr_format = new AddressFormat();
             $tmp_addr_format->id_country = $id_country;
         }
         $tmp_addr_format->format = Tools::getValue('address_layout');
         if (strlen($tmp_addr_format->format) > 0) {
             if ($tmp_addr_format->checkFormatFields()) {
                 $address_format_result = $tmp_addr_format->save();
             } else {
                 $error_list = $tmp_addr_format->getErrorList();
                 foreach ($error_list as $num_error => $error) {
                     $this->errors[] = $error;
                 }
             }
             if (!isset($address_format_result) || !$address_format_result) {
                 $this->errors[] = Tools::displayError('Invalid address layout ' . Db::getInstance()->getMsgError());
             }
         }
         unset($tmp_addr_format);
     }
     return parent::processSave();
 }
开发者ID:AmineBENCHEIKHBRAHIM,项目名称:LnsTech-Prestashop-WebSite,代码行数:29,代码来源:AdminCountriesController.php

示例4: postProcess

 public function postProcess()
 {
     if (!Tools::getValue('id_' . $this->table)) {
         if (Validate::isLanguageIsoCode(Tools::getValue('iso_code')) && Country::getByIso(Tools::getValue('iso_code'))) {
             $this->errors[] = Tools::displayError('This ISO code already exists, you cannot create two country with the same ISO code');
         }
     } else {
         if (Validate::isLanguageIsoCode(Tools::getValue('iso_code'))) {
             $id_country = Country::getByIso(Tools::getValue('iso_code'));
             if (!is_null($id_country) && $id_country != Tools::getValue('id_' . $this->table)) {
                 $this->errors[] = Tools::displayError('This ISO code already exists, you cannot create two country with the same ISO code');
             }
         }
     }
     if (!count($this->errors)) {
         $res = parent::postProcess();
     } else {
         return false;
     }
     if (Tools::getValue('submitAdd' . $this->table) && $res) {
         $id_country = ($id_country = Tools::getValue('id_country')) ? $id_country : $res['id'];
         $tmp_addr_format = new AddressFormat($id_country);
         $save_status = false;
         $is_new = is_null($tmp_addr_format->id_country);
         if ($is_new) {
             $tmp_addr_format = new AddressFormat();
             $tmp_addr_format->id_country = $id_country;
         }
         $tmp_addr_format->format = Tools::getValue('address_layout');
         if (strlen($tmp_addr_format->format) > 0) {
             if ($tmp_addr_format->checkFormatFields()) {
                 $save_status = $is_new ? $tmp_addr_format->save() : $tmp_addr_format->update();
             } else {
                 $error_list = $tmp_addr_format->getErrorList();
                 foreach ($error_list as $num_error => $error) {
                     $this->errors[] = $error;
                 }
             }
             if (!$save_status) {
                 $this->errors[] = Tools::displayError('Invalid address layout' . Db::getInstance()->getMsgError());
             }
         }
         unset($tmp_addr_format);
     }
     return $res;
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:46,代码来源:AdminCountriesController.php

示例5: processSave

 public function processSave()
 {
     if (!$this->id_object) {
         $tmp_addr_format = new AddressFormat();
     } else {
         $tmp_addr_format = new AddressFormat($this->id_object);
     }
     $tmp_addr_format->format = Tools::getValue('address_layout');
     if (!$tmp_addr_format->checkFormatFields()) {
         $error_list = $tmp_addr_format->getErrorList();
         foreach ($error_list as $num_error => $error) {
             $this->errors[] = $error;
         }
     }
     if (strlen($tmp_addr_format->format) <= 0) {
         $this->errors[] = $this->l('Address format invalid');
     }
     $country = parent::processSave();
     if (!count($this->errors)) {
         if (is_null($tmp_addr_format->id_country)) {
             $tmp_addr_format->id_country = $country->id;
         }
         if (!$tmp_addr_format->save()) {
             $this->errors[] = Tools::displayError('Invalid address layout ' . Db::getInstance()->getMsgError());
         }
     }
     return $country;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:28,代码来源:AdminCountriesController.php


注:本文中的AddressFormat::checkFormatFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。