// Revert normalization
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8019 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -86,7 +86,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
$attributeCombinations = Db::getInstance()->ExecuteS('SELECT pac.`id_attribute`, pa.`id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pa.`id_product_attribute` = pac.`id_product_attribute`)');
|
||||
$toRemove = array();
|
||||
foreach ($attributeCombinations AS $attributeCombination)
|
||||
if ($attributeCombination['id_attribute'] == 0)
|
||||
if ((int)($attributeCombination['id_attribute']) == 0)
|
||||
$toRemove[] = (int)($attributeCombination['id_product_attribute']);
|
||||
if (!empty($toRemove) AND Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` IN ('.implode(', ', $toRemove).')') === false)
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ class CMSCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
foreach ($res AS $cms)
|
||||
if ((int)$cms['id_cms'] == (int)$this->id)
|
||||
if ((int)($cms['id_cms']) == (int)($this->id))
|
||||
$movedCms = $cms;
|
||||
|
||||
if (!isset($movedCms) || !isset($position))
|
||||
|
||||
@@ -576,7 +576,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
))
|
||||
return false;
|
||||
foreach ($res AS $category)
|
||||
if ((int)$category['id_cms_category'] == (int)$this->id)
|
||||
if ((int)($category['id_cms_category']) == (int)($this->id))
|
||||
$movedCategory = $category;
|
||||
|
||||
if (!isset($movedCategory) || !isset($position))
|
||||
|
||||
+3
-3
@@ -156,7 +156,7 @@ class CarrierCore extends ObjectModel
|
||||
return false;
|
||||
if (!$numRows = Db::getInstance()->NumRows())
|
||||
return false;
|
||||
if ($numRows == 1)
|
||||
if ((int)($numRows) == 1)
|
||||
Configuration::updateValue('PS_CARRIER_DEFAULT', (int)($this->id));
|
||||
return true;
|
||||
}
|
||||
@@ -689,7 +689,7 @@ class CarrierCore extends ObjectModel
|
||||
VALUES ('.$this->id.','.(int)$val['id_zone'].')');
|
||||
|
||||
//Copy default carrier
|
||||
if (Configuration::get('PS_CARRIER_DEFAULT') == $oldId)
|
||||
if ((int)(Configuration::get('PS_CARRIER_DEFAULT')) == $oldId)
|
||||
Configuration::updateValue('PS_CARRIER_DEFAULT', (int)($this->id));
|
||||
}
|
||||
|
||||
@@ -718,7 +718,7 @@ class CarrierCore extends ObjectModel
|
||||
if ($this->shipping_method == Carrier::SHIPPING_METHOD_DEFAULT)
|
||||
{
|
||||
// backward compatibility
|
||||
if (Configuration::get('PS_SHIPPING_METHOD'))
|
||||
if ((int)Configuration::get('PS_SHIPPING_METHOD'))
|
||||
$method = Carrier::SHIPPING_METHOD_WEIGHT;
|
||||
else
|
||||
$method = Carrier::SHIPPING_METHOD_PRICE;
|
||||
|
||||
+6
-6
@@ -464,7 +464,7 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
$paImplode = array();
|
||||
foreach ($ipaList as $id_product_attribute)
|
||||
if ($id_product_attribute AND !array_key_exists($id_product_attribute.'-'.$id_lang, self::$_attributesLists))
|
||||
if ((int)$id_product_attribute AND !array_key_exists($id_product_attribute.'-'.$id_lang, self::$_attributesLists))
|
||||
{
|
||||
$paImplode[] = (int)$id_product_attribute;
|
||||
self::$_attributesLists[(int)$id_product_attribute.'-'.$id_lang] = array('attributes' => '', 'attributes_small' => '');
|
||||
@@ -569,7 +569,7 @@ class CartCore extends ObjectModel
|
||||
unset(self::$_nbProducts[$this->id]);
|
||||
if (isset(self::$_totalWeight[$this->id]))
|
||||
unset(self::$_totalWeight[$this->id]);
|
||||
if ($quantity <= 0)
|
||||
if ((int)$quantity <= 0)
|
||||
return $this->deleteProduct($id_product, $id_product_attribute, (int)$id_customization);
|
||||
elseif (!$product->available_for_order OR Configuration::get('PS_CATALOG_MODE'))
|
||||
return false;
|
||||
@@ -631,10 +631,10 @@ class CartCore extends ObjectModel
|
||||
WHERE p.id_product = '.$id_product;
|
||||
$result2 = Db::getInstance()->getRow($sql);
|
||||
if (!Product::isAvailableWhenOutOfStock((int)$result2['out_of_stock']))
|
||||
if ($quantity > $result2['quantity'])
|
||||
if ((int)$quantity > $result2['quantity'])
|
||||
return false;
|
||||
|
||||
if ($quantity < $minimalQuantity)
|
||||
if ((int)$quantity < $minimalQuantity)
|
||||
return -1;
|
||||
|
||||
$resultAdd = Db::getInstance()->AutoExecute(_DB_PREFIX_.'cart_product', array(
|
||||
@@ -799,7 +799,7 @@ class CartCore extends ObjectModel
|
||||
unset(self::$_nbProducts[$this->id]);
|
||||
if (isset(self::$_totalWeight[$this->id]))
|
||||
unset(self::$_totalWeight[$this->id]);
|
||||
if ($id_customization)
|
||||
if ((int)($id_customization))
|
||||
{
|
||||
$productTotalQuantity = (int)(Db::getInstance()->getValue('SELECT `quantity`
|
||||
FROM `'._DB_PREFIX_.'cart_product`
|
||||
@@ -1101,7 +1101,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
if (empty($id_carrier))
|
||||
{
|
||||
if ($this->id_customer)
|
||||
if ((int)($this->id_customer))
|
||||
{
|
||||
$customer = new Customer((int)($this->id_customer));
|
||||
$result = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true, false, (int)($id_zone), $customer->getGroups());
|
||||
|
||||
@@ -262,7 +262,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if ((int)$this->id === 0 OR (int)$this->id === 1) return false;
|
||||
if ((int)($this->id) === 0 OR (int)($this->id) === 1) return false;
|
||||
|
||||
$this->clearCache();
|
||||
|
||||
@@ -891,7 +891,7 @@ class CategoryCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
foreach ($res AS $category)
|
||||
if ((int)$category['id_category'] == $this->id)
|
||||
if ((int)($category['id_category']) == (int)($this->id))
|
||||
$movedCategory = $category;
|
||||
|
||||
if (!isset($movedCategory) || !isset($position))
|
||||
@@ -903,8 +903,8 @@ class CategoryCore extends ObjectModel
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
'.($way
|
||||
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)$position
|
||||
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)$position).'
|
||||
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
|
||||
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
|
||||
AND `id_parent`='.(int)($movedCategory['id_parent']))
|
||||
AND Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'category`
|
||||
|
||||
@@ -158,7 +158,7 @@ class FrontControllerCore
|
||||
$_MODULES = array();
|
||||
|
||||
/* Cart already exists */
|
||||
if ($this->context->cookie->id_cart)
|
||||
if ((int)$this->context->cookie->id_cart)
|
||||
{
|
||||
$cart = new Cart($this->context->cookie->id_cart);
|
||||
if ($cart->OrderExists())
|
||||
|
||||
+1
-1
@@ -257,7 +257,7 @@ class ImageCore extends ObjectModel
|
||||
return ;
|
||||
foreach ($combinationImages['new'] AS $id_product_attribute => $imageIds)
|
||||
foreach ($imageIds AS $key => $imageId)
|
||||
if ((int)$imageId == (int)$saved_id)
|
||||
if ((int)($imageId) == (int)($saved_id))
|
||||
$combinationImages['new'][$id_product_attribute][$key] = (int)($id_image);
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ class ManufacturerCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < sizeof($manufacturers); $i++)
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
if ((int)(Configuration::get('PS_REWRITING_SETTINGS')))
|
||||
$manufacturers[$i]['link_rewrite'] = Tools::link_rewrite($manufacturers[$i]['name'], false);
|
||||
else
|
||||
$manufacturers[$i]['link_rewrite'] = 0;
|
||||
|
||||
+1
-1
@@ -948,7 +948,7 @@ abstract class ModuleCore
|
||||
continue;
|
||||
|
||||
foreach ($res AS $key => $values)
|
||||
if ((int)$values[$this->identifier] == (int)$this->id)
|
||||
if ((int)($values[$this->identifier]) == (int)($this->id))
|
||||
{
|
||||
$k = $key ;
|
||||
break ;
|
||||
|
||||
@@ -115,7 +115,7 @@ class OrderReturnCore extends ObjectModel
|
||||
if (!isset($orderedCustomizations[$customizationId]))
|
||||
return false;
|
||||
$quantity = (isset($customizationQtyInput[$customizationId]) ? (int)($customizationQtyInput[$customizationId]) : 0);
|
||||
if ((int)$orderedCustomizations[$customizationId]['quantity'] - $quantity < 0)
|
||||
if ((int)($orderedCustomizations[$customizationId]['quantity']) - $quantity < 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -563,7 +563,7 @@ class PDFCore extends PDF_PageGroupCore
|
||||
$pdf->Cell(0, 6, self::l('SLIP #').' '.sprintf('%06d', self::$orderSlip->id).' '.self::l('from') . ' ' .Tools::displayDate(self::$orderSlip->date_upd, self::$order->id_lang), 1, 2, 'L', 1);
|
||||
elseif (self::$delivery)
|
||||
$pdf->Cell(0, 6, self::l('DELIVERY SLIP #').Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_DELIVERY_PREFIX', $context->language->id)).sprintf('%06d', self::$delivery).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1);
|
||||
elseif (self::$order->invoice_date)
|
||||
elseif ((int)self::$order->invoice_date)
|
||||
$pdf->Cell(0, 6, self::l('INVOICE #').' '.Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_INVOICE_PREFIX', $context->language->id)).sprintf('%06d', self::$order->invoice_number).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1);
|
||||
else
|
||||
$pdf->Cell(0, 6, self::l('Invoice draft'), 1, 2, 'L', 1);
|
||||
|
||||
@@ -431,7 +431,7 @@ abstract class PaymentModuleCore extends Module
|
||||
$data = array_merge($data, $extraVars);
|
||||
|
||||
// Join PDF invoice
|
||||
if (Configuration::get('PS_INVOICE') AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)
|
||||
if ((int)(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)
|
||||
{
|
||||
$fileAttachment['content'] = PDF::invoice($order, 'S');
|
||||
$fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf';
|
||||
|
||||
+6
-6
@@ -456,7 +456,7 @@ class ProductCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
foreach ($res AS $product)
|
||||
if ((int)$product['id_product'] == (int)$this->id)
|
||||
if ((int)($product['id_product']) == (int)($this->id))
|
||||
$movedProduct = $product;
|
||||
|
||||
if (!isset($movedProduct) || !isset($position))
|
||||
@@ -1678,7 +1678,7 @@ class ProductCore extends ObjectModel
|
||||
$cur_cart = new Cart($id_cart);
|
||||
}
|
||||
|
||||
if ($id_cart)
|
||||
if ((int)($id_cart))
|
||||
{
|
||||
if (!isset(self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)]) OR self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)] != (int)($quantity))
|
||||
self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
@@ -2398,7 +2398,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$productImplode = array();
|
||||
foreach ($productIds as $id_product)
|
||||
if ($id_product AND !array_key_exists($id_product, self::$_cacheFeatures))
|
||||
if ((int)$id_product AND !array_key_exists($id_product, self::$_cacheFeatures))
|
||||
$productImplode[] = (int)$id_product;
|
||||
if (!count($productImplode))
|
||||
return;
|
||||
@@ -2419,7 +2419,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$productImplode = array();
|
||||
foreach ($productIds as $id_product)
|
||||
if ($id_product AND !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures))
|
||||
if ((int)$id_product AND !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures))
|
||||
$productImplode[] = (int)$id_product;
|
||||
if (!count($productImplode))
|
||||
return;
|
||||
@@ -2970,11 +2970,11 @@ class ProductCore extends ObjectModel
|
||||
public function createLabels($uploadableFiles, $textFields)
|
||||
{
|
||||
$languages = Language::getLanguages();
|
||||
if ($uploadableFiles > 0)
|
||||
if ((int)($uploadableFiles) > 0)
|
||||
for ($i = 0; $i < (int)($uploadableFiles); $i++)
|
||||
if (!$this->_createLabel($languages, _CUSTOMIZE_FILE_))
|
||||
return false;
|
||||
if ((int)$textFields > 0)
|
||||
if ((int)($textFields) > 0)
|
||||
for ($i = 0; $i < (int)($textFields); $i++)
|
||||
if (!$this->_createLabel($languages, _CUSTOMIZE_TEXTFIELD_))
|
||||
return false;
|
||||
|
||||
@@ -241,7 +241,7 @@ class ReferrerCore extends ObjectModel
|
||||
|
||||
$implode = array();
|
||||
foreach ($result as $row)
|
||||
if ($row['id_order'])
|
||||
if ((int)$row['id_order'])
|
||||
$implode[] = (int)$row['id_order'];
|
||||
|
||||
if ($implode)
|
||||
@@ -339,7 +339,7 @@ class ReferrerCore extends ObjectModel
|
||||
$statsSales = $referrer->getStatsSales($id_product, $employee);
|
||||
|
||||
// If it's a product and it has no visits nor orders
|
||||
if ($id_product AND !$statsVisits['visits'] AND !$statsSales['orders'])
|
||||
if ((int)($id_product) AND !$statsVisits['visits'] AND !$statsSales['orders'])
|
||||
exit;
|
||||
|
||||
$jsonArray = array();
|
||||
|
||||
@@ -151,7 +151,7 @@ class SupplierCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < sizeof($suppliers); $i++)
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
if ((int)(Configuration::get('PS_REWRITING_SETTINGS')))
|
||||
$suppliers[$i]['link_rewrite'] = Tools::link_rewrite($suppliers[$i]['name'], false);
|
||||
else
|
||||
$suppliers[$i]['link_rewrite'] = 0;
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ class ToolsCore
|
||||
$url = substr($url, strlen($baseUri));
|
||||
if (strpos($url, 'index.php?controller=') !== FALSE && strpos($url, 'index.php/') == 0) {
|
||||
$url = substr($url, strlen('index.php?controller='));
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
if((int)(Configuration::get('PS_REWRITING_SETTINGS') == 1))
|
||||
$url = self::strReplaceFirst('&', '?' , $url);
|
||||
}
|
||||
|
||||
|
||||
@@ -813,7 +813,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((int)Configuration::get('PS_IMAGE_GENERATION_METHOD') == 2 OR ((int)Configuration::get('PS_IMAGE_GENERATION_METHOD') == 0 AND $widthDiff > $heightDiff))
|
||||
if ((int)(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR ((int)(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff > $heightDiff))
|
||||
{
|
||||
$nextHeight = $destHeight;
|
||||
$nextWidth = (int)(($sourceWidth * $nextHeight) / $sourceHeight);
|
||||
|
||||
Reference in New Issue
Block a user