// Normalize

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12691 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-01-25 16:39:34 +00:00
parent b2e21e6ce1
commit 359b51d1ea
14 changed files with 61 additions and 64 deletions
@@ -39,7 +39,7 @@ class AdminAccountingExportControllerCore extends AdminController
public $exportSelected = ''; public $exportSelected = '';
public $fd = NULL; public $fd = null;
public $date = array( public $date = array(
'begin' => '', 'begin' => '',
@@ -157,7 +157,7 @@ class AdminAccountingExportControllerCore extends AdminController
'urlDownload' => Tools::getShopDomain().'/download/' 'urlDownload' => Tools::getShopDomain().'/download/'
)); ));
foreach($this->exportTypeList as $exportType) foreach ($this->exportTypeList as $exportType)
{ {
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'title' => $exportType['name'], 'title' => $exportType['name'],
@@ -189,7 +189,7 @@ class AdminAccountingExportControllerCore extends AdminController
// Switch to ajax if there is any problems with time // Switch to ajax if there is any problems with time
ini_set('max_execution_time', 0); ini_set('max_execution_time', 0);
switch($this->exportSelected) switch ($this->exportSelected)
{ {
case 'reconciliation_export': case 'reconciliation_export':
$this->runReconciliationExport(); $this->runReconciliationExport();
@@ -218,10 +218,10 @@ class AdminAccountingExportControllerCore extends AdminController
{ {
$this->checkRights(); $this->checkRights();
if (!count($this->errors) && $this->fd !== NULL) if (!count($this->errors) && $this->fd !== null)
{ {
$buffer = ''; $buffer = '';
foreach($this->exportTypeList[$this->exportSelected]['fields'] as $key => $translation) foreach ($this->exportTypeList[$this->exportSelected]['fields'] as $key => $translation)
$buffer .= '"'.$translation.'";'; $buffer .= '"'.$translation.'";';
fwrite($this->fd, mb_convert_encoding(rtrim($buffer, ';')."\r\n", 'UTF-16LE')); fwrite($this->fd, mb_convert_encoding(rtrim($buffer, ';')."\r\n", 'UTF-16LE'));
@@ -293,7 +293,7 @@ class AdminAccountingExportControllerCore extends AdminController
$line[9] = $row['wording']; $line[9] = $row['wording'];
// Override case depending of the whished line // Override case depending of the whished line
switch($line_number) switch ($line_number)
{ {
case 0: case 0:
$line[2] = $row['account_client']; $line[2] = $row['account_client'];
@@ -301,7 +301,7 @@ class AdminAccountingExportControllerCore extends AdminController
break; break;
case 1: case 1:
$line[2] = !empty($row['account']) ? $row['account'] : $line[2] = !empty($row['account']) ? $row['account'] :
Configuration::get('default_account_number', NULL, NULL, $row['id_shop']); Configuration::get('default_account_number', null, null, $row['id_shop']);
// Force an empty string if Configuration send false // Force an empty string if Configuration send false
$line[2] = empty($line[2]) ? '' : $line[2]; $line[2] = empty($line[2]) ? '' : $line[2];
$line[5] = $row['product_price_ht']; $line[5] = $row['product_price_ht'];
@@ -328,7 +328,7 @@ class AdminAccountingExportControllerCore extends AdminController
// Cache list to merge easily the content with the same accounting for different invoice number // Cache list to merge easily the content with the same accounting for different invoice number
$cache_list = array(); $cache_list = array();
$num = 0; $num = 0;
foreach($db_details as $row) foreach ($db_details as $row)
{ {
// Init the list for the current invoice number // Init the list for the current invoice number
if (!array_key_exists($row['invoice_number'], $cache_list)) if (!array_key_exists($row['invoice_number'], $cache_list))
@@ -337,7 +337,7 @@ class AdminAccountingExportControllerCore extends AdminController
// Need to Generate 3 lines for a product // Need to Generate 3 lines for a product
for ($i = 0; $i < 3; ++$i) for ($i = 0; $i < 3; ++$i)
// Create the two first line and check if a tax exist for the last one // Create the two first line and check if a tax exist for the last one
if ($i < 2 || ($i == 2 && $row['id_tax'] !== NULL)) if ($i < 2 || ($i == 2 && $row['id_tax'] !== null))
{ {
// Generate a product line // Generate a product line
$line = $this->createLine($row, $i); $line = $this->createLine($row, $i);
@@ -379,9 +379,9 @@ class AdminAccountingExportControllerCore extends AdminController
// If advanced stock management enable then we foreach the cache_list to know // If advanced stock management enable then we foreach the cache_list to know
// if a product use the system to store back the movement price. // if a product use the system to store back the movement price.
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
foreach($cache_list as $invoice_list) foreach ($cache_list as $invoice_list)
foreach($invoice_list as $product_list) foreach ($invoice_list as $product_list)
foreach($product_list as $id_product => $product_detail) foreach ($product_list as $id_product => $product_detail)
if ($product_detail['advanced_stock_management']) if ($product_detail['advanced_stock_management'])
{ {
// Get stock product stock movement detail // Get stock product stock movement detail
@@ -465,7 +465,7 @@ class AdminAccountingExportControllerCore extends AdminController
protected function downloadFile($fileName) protected function downloadFile($fileName)
{ {
$path = $this->downloadDir.$fileName; $path = $this->downloadDir.$fileName;
header('Content-length: ' . filesize($path)); header('Content-length: '.filesize($path));
header('Content-Disposition: attachment; filename="'.$fileName.'"'); header('Content-Disposition: attachment; filename="'.$fileName.'"');
// Flush buffered data before reading the file // Flush buffered data before reading the file
@@ -49,15 +49,14 @@ class AdminAccountingManagementControllerCore extends AdminController
$id_shop = $this->context->shop->getID(); $id_shop = $this->context->shop->getID();
// Set default zone value to the shop and sort it // Set default zone value to the shop and sort it
foreach($zones as $zone) foreach ($zones as $zone)
{ {
$shop['zones'][$zone['id_zone']]['name'] = $zone['name']; $shop['zones'][$zone['id_zone']]['name'] = $zone['name'];
$shop['zones'][$zone['id_zone']]['account_number'] = ''; $shop['zones'][$zone['id_zone']]['account_number'] = '';
$shop['name'] = $this->context->shop->name; $shop['name'] = $this->context->shop->name;
} }
$shop['default_account_number'] = Configuration::get('default_account_number', $shop['default_account_number'] = Configuration::get('default_account_number', null, null, $id_shop);
NULL, NULL, $id_shop);
ksort($shop['zones']); ksort($shop['zones']);
$zoneShopList = Accounting::getAccountNumberZoneShop($id_shop); $zoneShopList = Accounting::getAccountNumberZoneShop($id_shop);
@@ -391,11 +391,11 @@ class AdminAddressesControllerCore extends AdminController
foreach (array('inv','dlv') as $adr_type) foreach (array('inv','dlv') as $adr_type)
{ {
foreach (${$adr_type.'_adr_fields'} as $fields_line) foreach (${$adr_type.'_adr_fields'} as $fields_line)
foreach(explode(' ',$fields_line) as $field_item) foreach (explode(' ', $fields_line) as $field_item)
${$adr_type.'_all_fields'}[] = trim($field_item); ${$adr_type.'_all_fields'}[] = trim($field_item);
$out[$adr_type.'_adr_fields'] = ${$adr_type.'_adr_fields'}; $out[$adr_type.'_adr_fields'] = ${$adr_type.'_adr_fields'};
$out[$adr_type.'_all_fields'] = ${$adr_type.'_all_fields'}; $out[$adr_type.'_all_fields'] = ${$adr_type.'_all_fields'};
} }
return $out; return $out;
@@ -329,7 +329,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
$str_attributes_groups = ''; $str_attributes_groups = '';
foreach ($attributes_groups as $attribute_group) foreach ($attributes_groups as $attribute_group)
$str_attributes_groups .= '"'.$attribute_group['id_attribute_group'].'" : '.($attribute_group['group_type'] == 'color' ? '1' : '0' ) .', '; $str_attributes_groups .= '"'.$attribute_group['id_attribute_group'].'" : '.($attribute_group['group_type'] == 'color' ? '1' : '0' ).', ';
$image = _PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$obj->id.'.jpg'; $image = _PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$obj->id.'.jpg';
$this->tpl_form_vars = array( $this->tpl_form_vars = array(
@@ -84,7 +84,7 @@ class AdminCartRulesControllerCore extends AdminController
$this->afterAdd($currentObject); $this->afterAdd($currentObject);
} }
// TODO Move this function into CartRule /* @TODO Move this function into CartRule */
public function afterAdd($currentObject) public function afterAdd($currentObject)
{ {
// Add restrictions for generic entities like country, carrier and group // Add restrictions for generic entities like country, carrier and group
@@ -289,20 +289,20 @@ class AdminCartRulesControllerCore extends AdminController
// All the filter are prefilled with the correct information // All the filter are prefilled with the correct information
$customer_filter = ''; $customer_filter = '';
if (Validate::isUnsignedId($current_object->id_customer) AND if (Validate::isUnsignedId($current_object->id_customer) &&
$customer = new Customer($current_object->id_customer) AND ($customer = new Customer($current_object->id_customer)) &&
Validate::isLoadedObject($customer)) Validate::isLoadedObject($customer))
$customer_filter = $customer->firstname.' '.$customer->lastname.' ('.$customer->email.')'; $customer_filter = $customer->firstname.' '.$customer->lastname.' ('.$customer->email.')';
$gift_product_filter = ''; $gift_product_filter = '';
if (Validate::isUnsignedId($current_object->gift_product) AND if (Validate::isUnsignedId($current_object->gift_product) &&
$product = new Product($current_object->gift_product, false, Context::getContext()->language->id) AND ($product = new Product($current_object->gift_product, false, Context::getContext()->language->id)) &&
Validate::isLoadedObject($product)) Validate::isLoadedObject($product))
$gift_product_filter = trim($product->reference.' '.$product->name); $gift_product_filter = trim($product->reference.' '.$product->name);
$reduction_product_filter = ''; $reduction_product_filter = '';
if (Validate::isUnsignedId($current_object->reduction_product) AND if (Validate::isUnsignedId($current_object->reduction_product) &&
$product = new Product($current_object->reduction_product, false, Context::getContext()->language->id) AND ($product = new Product($current_object->reduction_product, false, Context::getContext()->language->id)) &&
Validate::isLoadedObject($product)) Validate::isLoadedObject($product))
$reduction_product_filter = trim($product->reference.' '.$product->name); $reduction_product_filter = trim($product->reference.' '.$product->name);
+2 -4
View File
@@ -245,7 +245,7 @@ class AdminCartsControllerCore extends AdminController
return; return;
if ($this->context->cart->OrderExists()) if ($this->context->cart->OrderExists())
$errors[] = Tools::displayError('An order already placed with this cart'); $errors[] = Tools::displayError('An order already placed with this cart');
elseif (!($id_product = (int)Tools::getValue('id_product')) OR !($product = new Product((int)$id_product, true, $this->context->language->id))) elseif (!($id_product = (int)Tools::getValue('id_product')) || !($product = new Product((int)$id_product, true, $this->context->language->id)))
$errors[] = Tools::displayError('Invalid product'); $errors[] = Tools::displayError('Invalid product');
elseif (!($qty = Tools::getValue('qty')) || $qty == 0) elseif (!($qty = Tools::getValue('qty')) || $qty == 0)
$errors[] = Tools::displayError('Invalid quantity'); $errors[] = Tools::displayError('Invalid quantity');
@@ -355,9 +355,7 @@ class AdminCartsControllerCore extends AdminController
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
$errors = array(); $errors = array();
$customer = new Customer((int)$this->context->cart->id_customer); if (!$id_cart_rule = Tools::getValue('id_cart_rule') || !$cart_rule = new CartRule((int)$id_cart_rule))
if (!$id_cart_rule = Tools::getValue('id_cart_rule') OR !$cart_rule = new CartRule((int)$id_cart_rule))
$errors[] = Tools::displayError('Invalid voucher'); $errors[] = Tools::displayError('Invalid voucher');
else if ($err = $cart_rule->checkValidity($this->context)) else if ($err = $cart_rule->checkValidity($this->context))
$errors[] = $err; $errors[] = $err;
@@ -160,7 +160,7 @@ class AdminCategoriesControllerCore extends AdminController
asort($categories_tree); asort($categories_tree);
$this->tpl_list_vars['categories_tree'] = $categories_tree; $this->tpl_list_vars['categories_tree'] = $categories_tree;
if (Tools::isSubmit('submitBulkdelete'.$this->table) OR Tools::isSubmit('delete'.$this->table)) if (Tools::isSubmit('submitBulkdelete'.$this->table) || Tools::isSubmit('delete'.$this->table))
{ {
$category = new Category(Tools::getValue('id_category')); $category = new Category(Tools::getValue('id_category'));
if ($category->is_root_category) if ($category->is_root_category)
@@ -265,9 +265,9 @@ class AdminCategoriesControllerCore extends AdminController
$guest = new Group(Configuration::get('PS_GUEST_GROUP')); $guest = new Group(Configuration::get('PS_GUEST_GROUP'));
$default = new Group(Configuration::get('PS_CUSTOMER_GROUP')); $default = new Group(Configuration::get('PS_CUSTOMER_GROUP'));
$unidentified_group_information = sprintf($this->l('%s - All persons without a customer account or unauthenticated.'), "<b>".$unidentified->name[$this->context->language->id]."</b>"); $unidentified_group_information = sprintf($this->l('%s - All persons without a customer account or unauthenticated.'), '<b>'.$unidentified->name[$this->context->language->id].'</b>');
$guest_group_information = sprintf($this->l('%s - Customer who placed an order with the Guest Checkout.'), "<b>".$guest->name[$this->context->language->id]."</b>"); $guest_group_information = sprintf($this->l('%s - Customer who placed an order with the Guest Checkout.'), '<b>'.$guest->name[$this->context->language->id].'</b>');
$default_group_information = sprintf($this->l('%s - All persons who created an account on this site.'), "<b>".$default->name[$this->context->language->id]."</b>"); $default_group_information = sprintf($this->l('%s - All persons who created an account on this site.'), '<b>'.$default->name[$this->context->language->id].'</b>');
$root_category = Category::getRootCategory(); $root_category = Category::getRootCategory();
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name); $root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
$this->fields_form = array( $this->fields_form = array(
@@ -511,9 +511,8 @@ class AdminCategoriesControllerCore extends AdminController
if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings)) if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings))
{ {
if ($object->isRootCategoryForAShop()) if ($object->isRootCategoryForAShop())
{
$this->errors[] = Tools::displayError('You cannot remove this category because a shop uses this category as a root category.'); $this->errors[] = Tools::displayError('You cannot remove this category because a shop uses this category as a root category.');
}// check if request at least one object with noZeroObject // check if request at least one object with noZeroObject
elseif (isset($object->noZeroObject) && elseif (isset($object->noZeroObject) &&
count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1) count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
$this->errors[] = Tools::displayError('You need at least one object.').' <b>'. $this->errors[] = Tools::displayError('You need at least one object.').' <b>'.
@@ -73,7 +73,7 @@ class AdminCmsCategoriesControllerCore extends AdminController
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop); parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
} }
public function postProcess($token = NULL) public function postProcess($token = null)
{ {
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id); $this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
if (Tools::isSubmit('submitAdd'.$this->table)) if (Tools::isSubmit('submitAdd'.$this->table))
@@ -89,7 +89,7 @@ class AdminCmsCategoriesControllerCore extends AdminController
} }
} }
/* Change object statuts (active, inactive) */ /* Change object statuts (active, inactive) */
elseif (isset($_GET['statuscms_category']) AND Tools::getValue($this->identifier)) elseif (isset($_GET['statuscms_category']) && Tools::getValue($this->identifier))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
@@ -111,10 +111,10 @@ class AdminCmsCategoriesControllerCore extends AdminController
{ {
if ($this->tabAccess['delete'] === '1') if ($this->tabAccess['delete'] === '1')
{ {
if (Validate::isLoadedObject($object = $this->loadObject()) AND isset($this->fieldImageSettings)) if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings))
{ {
// check if request at least one object with noZeroObject // check if request at least one object with noZeroObject
if (isset($object->noZeroObject) AND sizeof($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1) if (isset($object->noZeroObject) && count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
$this->errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.'); $this->errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
else else
{ {
@@ -34,7 +34,7 @@ class AdminCmsContentControllerCore extends AdminController
private $adminCMS; private $adminCMS;
/** @var object Category() instance for navigation*/ /** @var object Category() instance for navigation*/
private static $_category = NULL; private static $_category = null;
public function __construct() public function __construct()
{ {
+11 -11
View File
@@ -185,12 +185,12 @@ class AdminCmsControllerCore extends AdminController
return parent::renderList(); return parent::renderList();
} }
public function displayList($token = NULL) public function displayList($token = null)
{ {
/* Display list header (filtering, pagination and column names) */ /* Display list header (filtering, pagination and column names) */
$this->displayListHeader($token); $this->displayListHeader($token);
if (!sizeof($this->_list)) if (!count($this->_list))
echo '<tr><td class="center" colspan="'.(sizeof($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>'; echo '<tr><td class="center" colspan="'.(count($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>';
/* Show the content of the table */ /* Show the content of the table */
$this->displayListContent($token); $this->displayListContent($token);
@@ -212,15 +212,15 @@ class AdminCmsControllerCore extends AdminController
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop); parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
} }
function postProcess() public function postProcess()
{ {
if (Tools::isSubmit('viewcms') AND ($id_cms = (int)(Tools::getValue('id_cms'))) AND $cms = new CMS($id_cms, $this->context->language->id) AND Validate::isLoadedObject($cms)) if (Tools::isSubmit('viewcms') && ($id_cms = (int)Tools::getValue('id_cms')) && ($cms = new CMS($id_cms, $this->context->language->id)) && Validate::isLoadedObject($cms))
{ {
$redir = $this->context->link->getCMSLink($cms); $redir = $this->context->link->getCMSLink($cms);
if (!$cms->active) if (!$cms->active)
{ {
$admin_dir = dirname($_SERVER['PHP_SELF']); $admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1); $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$redir .= '?adtoken='.Tools::encrypt('PreviewCMS'.$cms->id).'&ad='.$admin_dir; $redir .= '?adtoken='.Tools::encrypt('PreviewCMS'.$cms->id).'&ad='.$admin_dir;
} }
Tools::redirectAdmin($redir); Tools::redirectAdmin($redir);
@@ -262,10 +262,10 @@ class AdminCmsControllerCore extends AdminController
else else
$this->errors[] = Tools::displayError('You do not have permission to delete here.'); $this->errors[] = Tools::displayError('You do not have permission to delete here.');
} }
elseif (Tools::isSubmit('submitAddcms') OR Tools::isSubmit('submitAddcmsAndPreview')) elseif (Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndPreview'))
{ {
parent::validateRules(); parent::validateRules();
if (!sizeof($this->errors)) if (!count($this->errors))
{ {
if (!$id_cms = (int)(Tools::getValue('id_cms'))) if (!$id_cms = (int)(Tools::getValue('id_cms')))
{ {
@@ -282,7 +282,7 @@ class AdminCmsControllerCore extends AdminController
if (!$cms->active) if (!$cms->active)
{ {
$admin_dir = dirname($_SERVER['PHP_SELF']); $admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1); $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$token = Tools::encrypt('PreviewCMS'.$cms->id); $token = Tools::encrypt('PreviewCMS'.$cms->id);
$preview_url .= $cms->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir; $preview_url .= $cms->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir;
@@ -306,7 +306,7 @@ class AdminCmsControllerCore extends AdminController
if (!$cms->active) if (!$cms->active)
{ {
$admin_dir = dirname($_SERVER['PHP_SELF']); $admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1); $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$token = Tools::encrypt('PreviewCMS'.$cms->id); $token = Tools::encrypt('PreviewCMS'.$cms->id);
$preview_url .= $object->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir; $preview_url .= $object->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir;
@@ -330,7 +330,7 @@ class AdminCmsControllerCore extends AdminController
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=4'.(($id_category = (int)(Tools::getValue('id_cms_category'))) ? ('&id_cms_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCmsContent')); Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=4'.(($id_category = (int)(Tools::getValue('id_cms_category'))) ? ('&id_cms_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCmsContent'));
} }
/* Change object statuts (active, inactive) */ /* Change object statuts (active, inactive) */
elseif (Tools::isSubmit('status') AND Tools::isSubmit($this->identifier)) elseif (Tools::isSubmit('status') && Tools::isSubmit($this->identifier))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
+5 -5
View File
@@ -43,11 +43,11 @@ class AdminContactControllerCore extends AdminController
$this->context = Context::getContext(); $this->context = Context::getContext();
$countryList = array(); $countryList = array();
$countryList[] = array('id' => '0', 'name' => $this->l('Choose your country')); $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'));
foreach (Country::getCountries($this->context->language->id) AS $country) foreach (Country::getCountries($this->context->language->id) as $country)
$countryList[] = array('id' => $country['id_country'], 'name' => $country['name']); $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']);
$stateList = array(); $stateList = array();
$stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)')); $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)'));
foreach (State::getStates($this->context->language->id) AS $state) foreach (State::getStates($this->context->language->id) as $state)
$stateList[] = array('id' => $state['id_state'], 'name' => $state['name']); $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']);
$formFields = array( $formFields = array(
@@ -81,12 +81,12 @@ class AdminContactControllerCore extends AdminController
$fields = array(); $fields = array();
$orderedFields = AddressFormat::getOrderedAddressFields(Configuration::get('PS_SHOP_COUNTRY_ID'), false, true); $orderedFields = AddressFormat::getOrderedAddressFields(Configuration::get('PS_SHOP_COUNTRY_ID'), false, true);
foreach($orderedFields as $lineFields) foreach ($orderedFields as $lineFields)
if (($patterns = explode(' ', $lineFields))) if (($patterns = explode(' ', $lineFields)))
foreach($patterns as $pattern) foreach ($patterns as $pattern)
if (($key = array_search($pattern, $associatedOrderKey))) if (($key = array_search($pattern, $associatedOrderKey)))
$fields[$key] = $formFields[$key]; $fields[$key] = $formFields[$key];
foreach($formFields as $key => $value) foreach ($formFields as $key => $value)
if (!isset($fields[$key])) if (!isset($fields[$key]))
$fields[$key] = $formFields[$key]; $fields[$key] = $formFields[$key];
@@ -296,7 +296,7 @@ class AdminCurrenciesControllerCore extends AdminController
public function processExchangeRates($token) public function processExchangeRates($token)
{ {
if (!$this->errors[] = Currency::refreshCurrencies()) if (!$this->errors[] = Currency::refreshCurrencies())
Tools::redirectAdmin(self::$currentIndex . '&conf=6' . '&token=' . $this->token); Tools::redirectAdmin(self::$currentIndex.'&conf=6&token='.$this->token);
} }
/** /**
@@ -199,7 +199,7 @@ class AdminCustomersControllerCore extends AdminController
LIMIT 1 LIMIT 1
) as connect'; ) as connect';
if (Tools::isSubmit('submitBulkdelete'.$this->table) OR Tools::isSubmit('delete'.$this->table)) if (Tools::isSubmit('submitBulkdelete'.$this->table) || Tools::isSubmit('delete'.$this->table))
$this->tpl_list_vars = array( $this->tpl_list_vars = array(
'delete_customer' => true, 'delete_customer' => true,
'REQUEST_URI' => $_SERVER['REQUEST_URI'], 'REQUEST_URI' => $_SERVER['REQUEST_URI'],
@@ -397,13 +397,14 @@ class AdminCustomersControllerCore extends AdminController
); );
} }
if (Configuration::get('PS_B2B_ENABLE')) { if (Configuration::get('PS_B2B_ENABLE'))
{
$risks = Risk::getRisks(); $risks = Risk::getRisks();
$list_risks = array(); $list_risks = array();
foreach ($risks as $key => $risk) foreach ($risks as $key => $risk)
{ {
$list_risks[$key]['id_risk'] = (int) $risk->id; $list_risks[$key]['id_risk'] = (int)$risk->id;
$list_risks[$key]['name'] = $risk->name; $list_risks[$key]['name'] = $risk->name;
} }
+2 -2
View File
@@ -34,7 +34,7 @@ class AdminEmailsControllerCore extends AdminController
parent::__construct(); parent::__construct();
foreach (Contact::getContacts($this->context->language->id) AS $contact) foreach (Contact::getContacts($this->context->language->id) as $contact)
$arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']); $arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
$this->options = array( $this->options = array(
@@ -89,7 +89,7 @@ class AdminEmailsControllerCore extends AdminController
if (isset($_POST['PS_SHOP_EMAIL'])) if (isset($_POST['PS_SHOP_EMAIL']))
$_POST['PS_SHOP_EMAIL'] = Configuration::get('PS_SHOP_EMAIL'); $_POST['PS_SHOP_EMAIL'] = Configuration::get('PS_SHOP_EMAIL');
if ($_POST['PS_MAIL_METHOD'] == 2 AND (empty($_POST['PS_MAIL_SERVER']) OR empty($_POST['PS_MAIL_SMTP_PORT']))) if ($_POST['PS_MAIL_METHOD'] == 2 && (empty($_POST['PS_MAIL_SERVER']) || empty($_POST['PS_MAIL_SMTP_PORT'])))
$this->errors[] = Tools::displayError('You must define a SMTP server and a SMTP port. If you do not know, use the PHP mail() function instead.'); $this->errors[] = Tools::displayError('You must define a SMTP server and a SMTP port. If you do not know, use the PHP mail() function instead.');
} }
} }