// Manual merge PS 1.5.6.0
This commit is contained in:
+9
-6
@@ -430,7 +430,7 @@ class CartCore extends ObjectModel
|
||||
product_shop.`available_for_order`, product_shop.`price`, product_shop.`active`, product_shop.`unity`, product_shop.`unit_price_ratio`,
|
||||
stock.`quantity` AS quantity_available, p.`width`, p.`height`, p.`depth`, stock.`out_of_stock`, p.`weight`,
|
||||
p.`date_add`, p.`date_upd`, IFNULL(stock.quantity, 0) as quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category,
|
||||
CONCAT(cp.`id_product`, IFNULL(cp.`id_product_attribute`, 0), IFNULL(cp.`id_address_delivery`, 0)) AS unique_id, cp.id_address_delivery,
|
||||
CONCAT(LPAD(cp.`id_product`, 10, 0), LPAD(IFNULL(cp.`id_product_attribute`, 0), 10, 0), IFNULL(cp.`id_address_delivery`, 0)) AS unique_id, cp.id_address_delivery,
|
||||
product_shop.`wholesale_price`, product_shop.advanced_stock_management, ps.product_supplier_reference supplier_reference');
|
||||
|
||||
// Build FROM
|
||||
@@ -1677,6 +1677,7 @@ class CartCore extends ObjectModel
|
||||
$warehouse_count_by_address[$product['id_address_delivery']][$warehouse['id_warehouse']]++;
|
||||
}
|
||||
}
|
||||
unset($product);
|
||||
|
||||
arsort($warehouse_count_by_address);
|
||||
|
||||
@@ -1694,9 +1695,12 @@ class CartCore extends ObjectModel
|
||||
$id_warehouse = 0;
|
||||
foreach ($warehouse_count_by_address[$product['id_address_delivery']] as $id_war => $val)
|
||||
{
|
||||
$product['carrier_list'] = array_merge($product['carrier_list'], Carrier::getAvailableCarrierList(new Product($product['id_product']), $id_war, $product['id_address_delivery'], null, $this));
|
||||
if (in_array((int)$id_war, $product['warehouse_list']) && $id_warehouse == 0)
|
||||
$id_warehouse = (int)$id_war;
|
||||
if (in_array((int)$id_war, $product['warehouse_list']))
|
||||
{
|
||||
$product['carrier_list'] = array_merge($product['carrier_list'], Carrier::getAvailableCarrierList(new Product($product['id_product']), $id_war, $product['id_address_delivery'], null, $this));
|
||||
if (!$id_warehouse)
|
||||
$id_warehouse = (int)$id_war;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($grouped_by_warehouse[$product['id_address_delivery']]['in_stock'][$id_warehouse]))
|
||||
@@ -1715,6 +1719,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
$grouped_by_warehouse[$product['id_address_delivery']][$key][$id_warehouse][] = $product;
|
||||
}
|
||||
unset($product);
|
||||
|
||||
// Step 3 : grouped product from grouped_by_warehouse by available carriers
|
||||
$grouped_by_carriers = array();
|
||||
@@ -1733,7 +1738,6 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
if (!isset($grouped_by_carriers[$id_address_delivery][$key][$id_warehouse]))
|
||||
$grouped_by_carriers[$id_address_delivery][$key][$id_warehouse] = array();
|
||||
|
||||
foreach ($product_list as $product)
|
||||
{
|
||||
$package_carriers_key = implode(',', $product['carrier_list']);
|
||||
@@ -1798,7 +1802,6 @@ class CartCore extends ObjectModel
|
||||
);
|
||||
$package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'] =
|
||||
array_intersect($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'], $data['carrier_list']);
|
||||
|
||||
$package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['product_list'] =
|
||||
array_merge($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['product_list'], $data['product_list']);
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ class CategoryCore extends ObjectModel
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
|
||||
// Lang fields
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64),
|
||||
'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 64),
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
|
||||
'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 128),
|
||||
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
|
||||
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
|
||||
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
|
||||
|
||||
@@ -188,8 +188,9 @@ class CurrencyCore extends ObjectModel
|
||||
4 => array('left' => '', 'right' => &$formated_strings['right']),
|
||||
5 => array('left' => '', 'right' => &$formated_strings['right'])
|
||||
);
|
||||
|
||||
return ($formats[$this->format][$side]);
|
||||
if (isset($formats[$this->format][$side]))
|
||||
return ($formats[$this->format][$side]);
|
||||
return $this->sign;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+34
-24
@@ -128,34 +128,44 @@ class FeatureValueCore extends ObjectModel
|
||||
return $tab['value'];
|
||||
}
|
||||
|
||||
public static function addFeatureValueImport($id_feature, $name)
|
||||
public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null)
|
||||
{
|
||||
$rq = Db::getInstance()->executeS('
|
||||
SELECT fv.`id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl
|
||||
ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
||||
WHERE `value` = \''.pSQL($name).'\'
|
||||
AND fv.`id_feature` = '.(int)$id_feature.'
|
||||
GROUP BY fv.`id_feature_value` LIMIT 1
|
||||
');
|
||||
|
||||
if (!isset($rq[0]['id_feature_value']) || !$id_feature_value = (int)$rq[0]['id_feature_value'])
|
||||
if (!is_null($id_product) && $id_product)
|
||||
{
|
||||
// Feature doesn't exist, create it
|
||||
$feature_value = new FeatureValue();
|
||||
$id_feature_value = Db::getInstance()->getValue('
|
||||
SELECT `id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_product
|
||||
WHERE `id_feature` = '.(int)$id_feature.'
|
||||
AND `id_product` = '.(int)$id_product);
|
||||
|
||||
$languages = Language::getLanguages();
|
||||
foreach ($languages as $language)
|
||||
$feature_value->value[$language['id_lang']] = strval($name);
|
||||
|
||||
$feature_value->id_feature = (int)$id_feature;
|
||||
$feature_value->custom = 1;
|
||||
$feature_value->add();
|
||||
|
||||
return (int)$feature_value->id;
|
||||
if ($id_feature_value && !is_null($id_lang) && $id_lang)
|
||||
Db::getInstance()->execute('
|
||||
UPDATE '._DB_PREFIX_.'feature_value_lang
|
||||
SET `value` = \''.pSQL($value).'\'
|
||||
WHERE `id_feature_value` = '.(int)$id_feature_value.'
|
||||
AND `id_lang` = '.(int)$id_lang);
|
||||
}
|
||||
return (int)$id_feature_value;
|
||||
else
|
||||
$id_feature_value = Db::getInstance()->getValue('
|
||||
SELECT fv.`id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
||||
WHERE `value` = \''.pSQL($value).'\'
|
||||
AND fv.`id_feature` = '.(int)$id_feature.'
|
||||
GROUP BY fv.`id_feature_value`');
|
||||
|
||||
if ($id_feature_value)
|
||||
return (int)$id_feature_value;
|
||||
|
||||
// Feature doesn't exist, create it
|
||||
$feature_value = new FeatureValue();
|
||||
$feature_value->id_feature = (int)$id_feature;
|
||||
$feature_value->custom = 0;
|
||||
foreach (Language::getLanguages() as $language)
|
||||
$feature_value->value[$language['id_lang']] = $value;
|
||||
$feature_value->add();
|
||||
|
||||
return (int)$feature_value->id;
|
||||
}
|
||||
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
|
||||
@@ -137,6 +137,7 @@ class GroupReductionCore extends ObjectModel
|
||||
SELECT `reduction`
|
||||
FROM `'._DB_PREFIX_.'product_group_reduction_cache`
|
||||
WHERE `id_product` = '.(int)$id_product.' AND `id_group` = '.(int)$id_group);
|
||||
// Should return string (decimal in database) and not a float
|
||||
return self::$reduction_cache[$id_product.'-'.$id_group];
|
||||
}
|
||||
|
||||
|
||||
+15
-13
@@ -688,26 +688,28 @@ class LanguageCore extends ObjectModel
|
||||
if (Language::getIdByIso($iso_code))
|
||||
return true;
|
||||
|
||||
// Initialize the language
|
||||
$lang = new Language();
|
||||
$lang->iso_code = $iso_code;
|
||||
$lang->language_code = $iso_code;
|
||||
$lang->active = true;
|
||||
|
||||
// If the language pack has not been provided, retrieve it from prestashop.com
|
||||
if (!$lang_pack)
|
||||
$lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$iso_code));
|
||||
|
||||
// If a language pack has been found or provided, prefill the language object with the value
|
||||
if ($lang_pack)
|
||||
{
|
||||
if (isset($lang_pack->name)
|
||||
&& isset($lang_pack->version)
|
||||
&& isset($lang_pack->iso_code))
|
||||
$lang->name = $lang_pack->name;
|
||||
}
|
||||
elseif ($params_lang !== null && is_array($params_lang))
|
||||
foreach (get_object_vars($lang_pack) as $key => $value)
|
||||
if ($key != 'iso_code' && isset(Language::$definition['fields'][$key]))
|
||||
$lang->$key = $value;
|
||||
|
||||
// Use the values given in parameters to override the data retrieved automatically
|
||||
if ($params_lang !== null && is_array($params_lang))
|
||||
foreach ($params_lang as $key => $value)
|
||||
$lang->$key = $value;
|
||||
else
|
||||
return false;
|
||||
|
||||
if ($key != 'iso_code' && isset(Language::$definition['fields'][$key]))
|
||||
$lang->$key = $value;
|
||||
|
||||
if (!$lang->add(true, false, $only_add))
|
||||
return false;
|
||||
|
||||
@@ -725,7 +727,7 @@ class LanguageCore extends ObjectModel
|
||||
}
|
||||
else
|
||||
Language::_copyNoneFlag((int)$lang->id);
|
||||
|
||||
|
||||
$files_copy = array(
|
||||
'/en.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('thickbox').'.jpg',
|
||||
@@ -735,7 +737,7 @@ class LanguageCore extends ObjectModel
|
||||
'/en-default-'.ImageType::getFormatedName('small').'.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('scene').'.jpg'
|
||||
);
|
||||
|
||||
|
||||
foreach (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to)
|
||||
foreach ($files_copy as $file)
|
||||
@copy(dirname(__FILE__).'/../img/l'.$file, $to.str_replace('/en', '/'.$iso_code, $file));
|
||||
|
||||
+6
-6
@@ -1368,8 +1368,8 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
$product_supplier->product_supplier_reference = pSQL($supplier_reference);
|
||||
$product_supplier->product_supplier_price_te = (float)$price;
|
||||
$product_supplier->id_currency = (int)$id_currency;
|
||||
$product_supplier->product_supplier_price_te = !is_null($price) ? (float)$price : (float)$product_supplier->product_supplier_price_te;
|
||||
$product_supplier->id_currency = !is_null($id_currency) ? (int)$id_currency : (int)$product_supplier->id_currency;
|
||||
$product_supplier->save();
|
||||
}
|
||||
}
|
||||
@@ -2509,7 +2509,7 @@ class ProductCore extends ObjectModel
|
||||
$id_state = 0;
|
||||
$zipcode = 0;
|
||||
|
||||
if (!$id_address)
|
||||
if (!$id_address && Validate::isLoadedObject($cur_cart))
|
||||
$id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
|
||||
|
||||
if ($id_address)
|
||||
@@ -2720,8 +2720,7 @@ class ProductCore extends ObjectModel
|
||||
if ($use_group_reduction)
|
||||
{
|
||||
$reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group);
|
||||
|
||||
if (!empty($reduction_from_category) && (float)$reduction_from_category == 0)
|
||||
if ($reduction_from_category !== false)
|
||||
$price -= $price * (float)$reduction_from_category;
|
||||
else // apply group reduction if there is no group reduction for this category
|
||||
$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
|
||||
@@ -3160,8 +3159,9 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE `id_product_1` = '.(int)$this->id.
|
||||
($active ? ' AND product_shop.`active` = 1' : '').'
|
||||
($active ? ' AND product_shop.`active` = 1 AND product_shop.`visibility` != \'none\'' : '').'
|
||||
GROUP BY product_shop.id_product';
|
||||
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
foreach ($result as &$row)
|
||||
|
||||
@@ -103,7 +103,7 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p').'
|
||||
WHERE product_shop.`active` = 1
|
||||
AND p.`visibility` != \'none\'
|
||||
AND product_shop.`visibility` != \'none\'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -156,7 +156,7 @@ class ProductSaleCore
|
||||
ON cl.`id_category` = product_shop.`id_category_default`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE product_shop.`active` = 1
|
||||
AND p.`visibility` != \'none\'
|
||||
AND product_shop.`visibility` != \'none\'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
|
||||
@@ -169,7 +169,8 @@ class SpecificPriceCore extends ObjectModel
|
||||
|
||||
$priority = SpecificPrice::getPriority($id_product);
|
||||
foreach (array_reverse($priority) as $k => $field)
|
||||
$select .= ' IF (`'.bqSQL($field).'` = '.(int)$$field.', '.pow(2, $k + 1).', 0) + ';
|
||||
if (!empty($field))
|
||||
$select .= ' IF (`'.bqSQL($field).'` = '.(int)$$field.', '.pow(2, $k + 1).', 0) + ';
|
||||
|
||||
return rtrim($select, ' +').') AS `score`';
|
||||
}
|
||||
@@ -228,7 +229,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
||||
)
|
||||
AND id_cart IN (0, '.(int)$id_cart.')'.
|
||||
(($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) ? ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')' : 'AND `from_quantity` <= '.(int)$real_quantity).'
|
||||
(($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) ? ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')' : 'AND `from_quantity` <= '.max(1, (int)$real_quantity)).'
|
||||
ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC');
|
||||
}
|
||||
return self::$_specificPriceCache[$key];
|
||||
@@ -301,7 +302,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
if (!isset($last_quantity[(int)$specific_price['id_product_attribute']]))
|
||||
$last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
|
||||
elseif ($last_quantity[(int)$specific_price['id_product_attribute']] == $specific_price['from_quantity'])
|
||||
break;
|
||||
continue;
|
||||
|
||||
$last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
|
||||
if ($specific_price['from_quantity'] > 1)
|
||||
|
||||
@@ -183,7 +183,7 @@ class SpecificPriceRuleCore extends ObjectModel
|
||||
|
||||
if ($conditions_group)
|
||||
{
|
||||
$where .= ' AND (';
|
||||
$where .= ' AND ((';
|
||||
foreach ($conditions_group as $id_condition_group => $condition_group)
|
||||
{
|
||||
$fields = array(
|
||||
@@ -235,7 +235,7 @@ class SpecificPriceRuleCore extends ObjectModel
|
||||
|
||||
$where = rtrim($where, ' AND ').') OR (';
|
||||
}
|
||||
$where = rtrim($where, 'OR (');
|
||||
$where = rtrim($where, 'OR (').')';
|
||||
}
|
||||
if ($products && count($products))
|
||||
$where .= ' AND p.id_product IN ('.implode(', ', array_map('intval', $products)).')';
|
||||
@@ -267,7 +267,7 @@ class SpecificPriceRuleCore extends ObjectModel
|
||||
public static function applyRuleToProduct($id_rule, $id_product, $id_product_attribute = null)
|
||||
{
|
||||
$rule = new SpecificPriceRule((int)$id_rule);
|
||||
if (!Validate::isLoadedObject($rule))
|
||||
if (!Validate::isLoadedObject($rule) || !$id_product)
|
||||
return false;
|
||||
|
||||
$specific_price = new SpecificPrice();
|
||||
|
||||
+17
-15
@@ -40,7 +40,7 @@ class TagCore extends ObjectModel
|
||||
'primary' => 'id_tag',
|
||||
'fields' => array(
|
||||
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -100,22 +100,24 @@ class TagCore extends ObjectModel
|
||||
$tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
|
||||
|
||||
$list = array();
|
||||
foreach ($tag_list as $tag)
|
||||
{
|
||||
if (!Validate::isGenericName($tag))
|
||||
return false;
|
||||
$tag_obj = new Tag(null, trim($tag), (int)$id_lang);
|
||||
|
||||
/* Tag does not exist in database */
|
||||
if (!Validate::isLoadedObject($tag_obj))
|
||||
if (is_array($tag_list))
|
||||
foreach ($tag_list as $tag)
|
||||
{
|
||||
$tag_obj->name = trim($tag);
|
||||
$tag_obj->id_lang = (int)$id_lang;
|
||||
$tag_obj->add();
|
||||
if (!Validate::isGenericName($tag))
|
||||
return false;
|
||||
$tag = trim(substr($tag, 0, self::$definition['fields']['name']['size']));
|
||||
$tag_obj = new Tag(null, $tag, (int)$id_lang);
|
||||
|
||||
/* Tag does not exist in database */
|
||||
if (!Validate::isLoadedObject($tag_obj))
|
||||
{
|
||||
$tag_obj->name = $tag;
|
||||
$tag_obj->id_lang = (int)$id_lang;
|
||||
$tag_obj->add();
|
||||
}
|
||||
if (!in_array($tag_obj->id, $list))
|
||||
$list[] = $tag_obj->id;
|
||||
}
|
||||
if (!in_array($tag_obj->id, $list))
|
||||
$list[] = $tag_obj->id;
|
||||
}
|
||||
$data = '';
|
||||
foreach ($list as $tag)
|
||||
$data .= '('.(int)$tag.','.(int)$id_product.'),';
|
||||
|
||||
+16
-2
@@ -494,6 +494,20 @@ class ToolsCore
|
||||
if (($is_negative = ($price < 0)))
|
||||
$price *= -1;
|
||||
$price = Tools::ps_round($price, $c_decimals);
|
||||
|
||||
/*
|
||||
* If the language is RTL and the selected currency format contains spaces as thousands separator
|
||||
* then the number will be printed in reverse since the space is interpreted as separating words.
|
||||
* To avoid this we replace the currency format containing a space with the one containing a comma (,) as thousand
|
||||
* separator when the language is RTL.
|
||||
*
|
||||
* TODO: This is not ideal, a currency format should probably be tied to a language, not to a currency.
|
||||
*/
|
||||
if(($c_format == 2) && ($context->language->is_rtl == 1))
|
||||
{
|
||||
$c_format = 4;
|
||||
}
|
||||
|
||||
switch ($c_format)
|
||||
{
|
||||
/* X 0,000.00 */
|
||||
@@ -512,9 +526,9 @@ class ToolsCore
|
||||
case 4:
|
||||
$ret = number_format($price, $c_decimals, '.', ',').$blank.$c_char;
|
||||
break;
|
||||
/* 0 000.00 X Added for the switzerland currency */
|
||||
/* 0'000.00 X Added for the switzerland currency */
|
||||
case 5:
|
||||
$ret = number_format($price, $c_decimals, '.', ' ').$blank.$c_char;
|
||||
$ret = number_format($price, $c_decimals, '.', "'").$blank.$c_char;
|
||||
break;
|
||||
}
|
||||
if ($is_negative)
|
||||
|
||||
@@ -654,7 +654,7 @@ class AdminControllerCore extends Controller
|
||||
'export_content' => $content
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$this->layout = 'layout-export.tpl';
|
||||
}
|
||||
|
||||
@@ -2112,6 +2112,7 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
@@ -2166,12 +2167,20 @@ class AdminControllerCore extends Controller
|
||||
$order_by = $this->fields_list[$order_by]['order_key'];
|
||||
|
||||
/* Determine offset from current page */
|
||||
|
||||
|
||||
if ((isset($_POST['submitFilter'.$this->list_id]) ||
|
||||
isset($_POST['submitFilter'.$this->list_id.'_x']) ||
|
||||
isset($_POST['submitFilter'.$this->list_id.'_y'])) &&
|
||||
!empty($_POST['submitFilter'.$this->list_id]) &&
|
||||
is_numeric($_POST['submitFilter'.$this->list_id]))
|
||||
$start = ((int)$_POST['submitFilter'.$this->list_id] - 1) * $limit;
|
||||
elseif (empty($start) && isset($this->context->cookie->{$this->list_id.'_start'}) && Tools::isSubmit('export'.$this->table))
|
||||
$start = $this->context->cookie->{$this->list_id.'_start'};
|
||||
else
|
||||
$start = 0;
|
||||
|
||||
$this->context->cookie->{$this->list_id.'_start'} = $start;
|
||||
|
||||
/* Cache */
|
||||
$this->_lang = (int)$id_lang;
|
||||
@@ -2241,8 +2250,6 @@ class AdminControllerCore extends Controller
|
||||
$having_clause .= $this->_having.' ';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->_listsql = '
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '');
|
||||
@@ -2464,8 +2471,27 @@ class AdminControllerCore extends Controller
|
||||
$this->errors[$field] = $error;
|
||||
}
|
||||
|
||||
|
||||
/* Overload this method for custom checking */
|
||||
$this->_childValidation();
|
||||
|
||||
/* Checking for multilingual fields validity */
|
||||
if (isset($rules['validateLang']) && is_array($rules['validateLang']))
|
||||
foreach ($rules['validateLang'] as $field_lang => $function)
|
||||
foreach ($languages as $language)
|
||||
if (($value = Tools::getValue($field_lang.'_'.$language['id_lang'])) !== false && !empty($value))
|
||||
{
|
||||
if (Tools::strtolower($function) == 'iscleanhtml' && Configuration::get('PS_ALLOW_HTML_IFRAME'))
|
||||
$res = Validate::$function($value, true);
|
||||
else
|
||||
$res = Validate::$function($value);
|
||||
if (!$res)
|
||||
$this->errors[$field_lang.'_'.$language['id_lang']] = sprintf(
|
||||
Tools::displayError('The %1$s field (%2$s) is invalid.'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
||||
$language['name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,7 +60,7 @@ class ModuleFrontControllerCore extends FrontController
|
||||
elseif (Tools::file_exists_cache($this->getTemplatePath().$template))
|
||||
$this->template = $this->getTemplatePath().$template;
|
||||
else
|
||||
throw new PrestaShopException("Template '$template'' not found");
|
||||
throw new PrestaShopException("Template '$template' not found");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
class HelperCore
|
||||
{
|
||||
public $currentIndex;
|
||||
public $table;
|
||||
public $table = 'configuration';
|
||||
public $identifier;
|
||||
public $token;
|
||||
public $toolbar_btn;
|
||||
|
||||
@@ -37,8 +37,6 @@ class HelperFormCore extends Helper
|
||||
|
||||
/** @var array values of form fields */
|
||||
public $fields_value = array();
|
||||
|
||||
public $table = 'configuration';
|
||||
public $name_controller = '';
|
||||
|
||||
/** @var string if not null, a title will be added on that list */
|
||||
|
||||
@@ -1730,7 +1730,7 @@ abstract class ModuleCore
|
||||
{
|
||||
Tools::enableCache();
|
||||
if ($cache_id === null)
|
||||
$cache_id = Module::getCacheId($this->name);
|
||||
$cache_id = $this->name;
|
||||
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath($template), $cache_id, $compile_id);
|
||||
Tools::restoreCacheSettings();
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
WHERE od.`id_order` = '.(int)$this->id_order.'
|
||||
AND od.`id_order_invoice` = '.(int)$this->id.'
|
||||
AND od.`tax_computation_method` = '.(int)TaxCalculator::ONE_AFTER_ANOTHER_METHOD
|
||||
);
|
||||
) || Configuration::get('PS_INVOICE_TAXES_BREAKDOWN');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,7 +301,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
{
|
||||
// sum by order details in order to retrieve real taxes rate
|
||||
$taxes_infos = Db::getInstance()->executeS('
|
||||
SELECT odt.`id_order_detail`, t.`rate` AS `name`, SUM(od.`total_price_tax_excl`) AS total_price_tax_excl, SUM(t.`rate`) AS rate, SUM(`total_amount`) AS `total_amount`, od.`ecotax`, od.`ecotax_tax_rate`, od.`product_quantity`
|
||||
SELECT odt.`id_order_detail`, t.`rate` AS `name`, od.`total_price_tax_excl` AS total_price_tax_excl, SUM(t.`rate`) AS rate, SUM(`total_amount`) AS `total_amount`, od.`ecotax`, od.`ecotax_tax_rate`, od.`product_quantity`
|
||||
FROM `'._DB_PREFIX_.'order_detail_tax` odt
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = odt.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = odt.`id_order_detail`)
|
||||
|
||||
@@ -49,7 +49,7 @@ class OrderPaymentCore extends ObjectModel
|
||||
'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true),
|
||||
'payment_method' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
||||
'conversion_rate' => array('type' => self::TYPE_INT, 'validate' => 'isFloat'),
|
||||
'conversion_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'transaction_id' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
|
||||
'card_number' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
|
||||
'card_brand' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
|
||||
|
||||
@@ -90,7 +90,7 @@ class HTMLTemplateDeliverySlipCore extends HTMLTemplate
|
||||
*/
|
||||
public function getFilename()
|
||||
{
|
||||
return Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id, null, $this->order->id_shop).sprintf('%06d', $this->order->invoice_number).'.pdf';
|
||||
return Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id, null, $this->order->id_shop).sprintf('%06d', $this->order->delivery_number).'.pdf';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1187,7 +1187,7 @@ class WebserviceRequestCore
|
||||
else
|
||||
{
|
||||
$object = new $this->resourceConfiguration['retrieveData']['className']();
|
||||
if ($object->isMultiShopField($this->resourceConfiguration['fields'][$fieldName]['sqlId']))
|
||||
if ($object->isMultiShopField($this->resourceConfiguration['fields'][$fieldName]['sqlId']) || $fieldName == 'id')
|
||||
$table_alias = 'multi_shop_'.$this->resourceConfiguration['retrieveData']['table'];
|
||||
else
|
||||
$table_alias = '';
|
||||
|
||||
Reference in New Issue
Block a user