// Release branch merged
This commit is contained in:
+41
-38
@@ -386,15 +386,15 @@ class DispatcherCore
|
||||
// Load custom routes from modules
|
||||
$modules_routes = Hook::exec('moduleRoutes', array(), null, true, false);
|
||||
if (is_array($modules_routes) && count($modules_routes))
|
||||
foreach($modules_routes as $module_route)
|
||||
foreach($module_route as $route => $route_details)
|
||||
if (array_key_exists('controller', $route_details) && array_key_exists('rule', $route_details)
|
||||
&& array_key_exists('keywords', $route_details) && array_key_exists('params', $route_details))
|
||||
{
|
||||
if (!isset($this->default_routes[$route]))
|
||||
$this->default_routes[$route] = array();
|
||||
$this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details);
|
||||
}
|
||||
foreach($modules_routes as $module_route)
|
||||
foreach($module_route as $route => $route_details)
|
||||
if (array_key_exists('controller', $route_details) && array_key_exists('rule', $route_details)
|
||||
&& array_key_exists('keywords', $route_details) && array_key_exists('params', $route_details))
|
||||
{
|
||||
if (!isset($this->default_routes[$route]))
|
||||
$this->default_routes[$route] = array();
|
||||
$this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details);
|
||||
}
|
||||
|
||||
// Set default routes
|
||||
foreach (Language::getLanguages() as $lang)
|
||||
@@ -674,38 +674,41 @@ class DispatcherCore
|
||||
if (!$this->request_uri)
|
||||
return strtolower($this->controller_not_found);
|
||||
$controller = $this->controller_not_found;
|
||||
|
||||
// If the request_uri matches a static file, then there is no need to check the routes, we keep "controller_not_found" (a static file should not go through the dispatcher)
|
||||
if (!preg_match('/\.(gif|jpe?g|png|css|js|ico)$/i', $this->request_uri))
|
||||
{
|
||||
// Add empty route as last route to prevent this greedy regexp to match request uri before right time
|
||||
if ($this->empty_route)
|
||||
$this->addRoute($this->empty_route['routeID'], $this->empty_route['rule'], $this->empty_route['controller'], Context::getContext()->language->id);
|
||||
|
||||
// Add empty route as last route to prevent this greedy regexp to match request uri before right time
|
||||
if ($this->empty_route)
|
||||
$this->addRoute($this->empty_route['routeID'], $this->empty_route['rule'], $this->empty_route['controller'], Context::getContext()->language->id);
|
||||
|
||||
if (isset($this->routes[Context::getContext()->language->id]))
|
||||
foreach ($this->routes[Context::getContext()->language->id] as $route)
|
||||
if (preg_match($route['regexp'], $this->request_uri, $m))
|
||||
{
|
||||
// Route found ! Now fill $_GET with parameters of uri
|
||||
foreach ($m as $k => $v)
|
||||
if (!is_numeric($k))
|
||||
$_GET[$k] = $v;
|
||||
|
||||
$controller = $route['controller'] ? $route['controller'] : $_GET['controller'];
|
||||
if (!empty($route['params']))
|
||||
foreach ($route['params'] as $k => $v)
|
||||
$_GET[$k] = $v;
|
||||
|
||||
// A patch for module friendly urls
|
||||
if (preg_match('#module-([a-z0-9_-]+)-([a-z0-9]+)$#i', $controller, $m))
|
||||
if (isset($this->routes[Context::getContext()->language->id]))
|
||||
foreach ($this->routes[Context::getContext()->language->id] as $route)
|
||||
if (preg_match($route['regexp'], $this->request_uri, $m))
|
||||
{
|
||||
$_GET['module'] = $m[1];
|
||||
$_GET['fc'] = 'module';
|
||||
$controller = $m[2];
|
||||
// Route found ! Now fill $_GET with parameters of uri
|
||||
foreach ($m as $k => $v)
|
||||
if (!is_numeric($k))
|
||||
$_GET[$k] = $v;
|
||||
|
||||
$controller = $route['controller'] ? $route['controller'] : $_GET['controller'];
|
||||
if (!empty($route['params']))
|
||||
foreach ($route['params'] as $k => $v)
|
||||
$_GET[$k] = $v;
|
||||
|
||||
// A patch for module friendly urls
|
||||
if (preg_match('#module-([a-z0-9_-]+)-([a-z0-9]+)$#i', $controller, $m))
|
||||
{
|
||||
$_GET['module'] = $m[1];
|
||||
$_GET['fc'] = 'module';
|
||||
$controller = $m[2];
|
||||
}
|
||||
|
||||
if (isset($_GET['fc']) && $_GET['fc'] == 'module')
|
||||
$this->front_controller = self::FC_MODULE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($_GET['fc']) && $_GET['fc'] == 'module')
|
||||
$this->front_controller = self::FC_MODULE;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if ($controller == 'index' || $this->request_uri == '/index.php')
|
||||
$controller = $this->default_controller;
|
||||
$this->controller = $controller;
|
||||
|
||||
@@ -51,7 +51,6 @@ class LocalizationPackCore
|
||||
$res &= $this->_installUnits($xml);
|
||||
$res &= $this->installConfiguration($xml);
|
||||
$res &= $this->installModules($xml);
|
||||
$res &= $this->updateDefaultGroupDisplayMethod($xml);
|
||||
$res &= $this->_installLanguages($xml, $install_mode);
|
||||
|
||||
if ($res && isset($this->iso_code_lang))
|
||||
@@ -233,7 +232,7 @@ class LocalizationPackCore
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return $this->updateDefaultGroupDisplayMethod($xml);
|
||||
}
|
||||
|
||||
protected function _installCurrencies($xml, $install_mode = false)
|
||||
@@ -391,10 +390,13 @@ class LocalizationPackCore
|
||||
$attributes = $xml->group_default->attributes();
|
||||
if (isset($attributes['price_display_method']) && in_array((int)$attributes['price_display_method'], array(0, 1)))
|
||||
{
|
||||
$group = new Group((int)Configuration::get('PS_CUSTOMER_GROUP'));
|
||||
$group->price_display_method = (int)$attributes['price_display_method'];
|
||||
if (!$group->save())
|
||||
$this->_errors[] = Tools::displayError('An error occurred during the default group update');
|
||||
foreach (array((int)Configuration::get('PS_CUSTOMER_GROUP'), (int)Configuration::get('PS_GUEST_GROUP'), (int)Configuration::get('PS_UNIDENTIFIED_GROUP')) as $id_group)
|
||||
{
|
||||
$group = new Group((int)$id_group);
|
||||
$group->price_display_method = (int)$attributes['price_display_method'];
|
||||
if (!$group->save())
|
||||
$this->_errors[] = Tools::displayError('An error occurred during the default group update');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error has occurred during the default group update');
|
||||
|
||||
+3
-3
@@ -1633,10 +1633,10 @@ class ToolsCore
|
||||
{
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}'._PS_PROD_IMG_.'$1-$2$3$4.jpg [L]'."\n");
|
||||
fwrite($write_fd, 'RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1-$2$3$4.jpg [L]'."\n");
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^([0-9]+)\-([0-9]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}'._PS_PROD_IMG_.'$1-$2$3.jpg [L]'."\n");
|
||||
fwrite($write_fd, 'RewriteRule ^([0-9]+)\-([0-9]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1-$2$3.jpg [L]'."\n");
|
||||
}
|
||||
|
||||
// Rewrite product images < 100 millions
|
||||
@@ -1651,7 +1651,7 @@ class ToolsCore
|
||||
$img_name .= '$'.$j;
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^'.str_repeat('([0-9])', $i).'(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}'._PS_PROD_IMG_.$img_path.$img_name.'$'.($j + 1).".jpg [L]\n");
|
||||
fwrite($write_fd, 'RewriteRule ^'.str_repeat('([0-9])', $i).'(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/'.$img_path.$img_name.'$'.($j + 1).".jpg [L]\n");
|
||||
}
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
|
||||
@@ -594,6 +594,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'export_precontent' => "\xEF\xBB\xBF",
|
||||
'export_headers' => $headers,
|
||||
'export_content' => $content
|
||||
)
|
||||
|
||||
@@ -384,21 +384,22 @@ class OrderInvoiceCore extends ObjectModel
|
||||
*/
|
||||
public function getEcoTaxTaxesBreakdown()
|
||||
{
|
||||
$res = Db::getInstance()->executeS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `ecotax_tax_rate` as `rate`, SUM(`ecotax` * `product_quantity`) as `ecotax_tax_excl`, SUM(`ecotax` * `product_quantity`) as `ecotax_tax_incl`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int)$this->id_order.'
|
||||
AND `id_order_invoice` = '.(int)$this->id.'
|
||||
GROUP BY `ecotax_tax_rate`'
|
||||
);
|
||||
GROUP BY `ecotax_tax_rate`');
|
||||
|
||||
if ($res)
|
||||
foreach ($res as &$row)
|
||||
$taxes = array();
|
||||
foreach ($result as $row)
|
||||
if ($row['ecotax_tax_excl'] > 0)
|
||||
{
|
||||
$row['ecotax_tax_incl'] = Tools::ps_round($row['ecotax_tax_excl'] + ($row['ecotax_tax_excl'] * $row['rate'] / 100), 2);
|
||||
$row['ecotax_tax_excl'] = Tools::ps_round($row['ecotax_tax_excl'], 2);
|
||||
$taxes[] = $row;
|
||||
}
|
||||
return $res;
|
||||
return $taxes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -308,7 +308,7 @@ class ShopCore extends ObjectModel
|
||||
WHERE (su.domain = \''.$host.'\' OR su.domain_ssl = \''.$host.'\')
|
||||
AND s.active = 1
|
||||
AND s.deleted = 0
|
||||
ORDER BY LENGTH(uri) DESC';
|
||||
ORDER BY LENGTH(CONCAT(su.physical_uri, su.virtual_uri)) DESC';
|
||||
|
||||
$id_shop = '';
|
||||
$found_uri = '';
|
||||
|
||||
Reference in New Issue
Block a user