diff --git a/admin-dev/themes/template/adminShopUrl.tpl b/admin-dev/themes/template/adminShopUrl.tpl
index bbe05ff5c..8a796b3ae 100644
--- a/admin-dev/themes/template/adminShopUrl.tpl
+++ b/admin-dev/themes/template/adminShopUrl.tpl
@@ -131,7 +131,7 @@
{l s ='Enable or disable URL'}
-
+
* {l s ='Required field'}
diff --git a/cache/class_index.php b/cache/class_index.php
index 0927fde94..d41e50e7f 100644
--- a/cache/class_index.php
+++ b/cache/class_index.php
@@ -104,6 +104,8 @@
'HelpAccess' => 'override/classes/HelpAccess.php',
'HelperCore' => 'classes/Helper.php',
'Helper' => 'override/classes/Helper.php',
+ 'HelperFormCore' => 'classes/HelperForm.php',
+ 'HelperForm' => '',
'HelperListCore' => 'classes/HelperList.php',
'HelperList' => '',
'HookCore' => 'classes/Hook.php',
@@ -272,8 +274,8 @@
'StockManagerFactory' => '',
'StockManagerInterface' => 'classes/stock/StockManagerInterface.php',
'StockManagerModule' => 'classes/stock/StockManagerModule.php',
- 'StockWarehouseCore' => 'classes/stock/StockWarehouse.php',
- 'StockWarehouse' => '',
+ 'WarehouseCore' => 'classes/stock/Warehouse.php',
+ 'Warehouse' => '',
'TaxCore' => 'classes/tax/Tax.php',
'Tax' => 'override/classes/tax/Tax.php',
'TaxCalculatorCore' => 'classes/tax/TaxCalculator.php',
@@ -322,6 +324,8 @@
'AdminShopUrlController' => '',
'AdminStatesControllerCore' => 'controllers/admin/AdminStatesController.php',
'AdminStatesController' => '',
+ 'AdminTaxRulesGroupControllerCore' => 'controllers/admin/AdminTaxRulesGroupController.php',
+ 'AdminTaxRulesGroupController' => '',
'AdminToolsControllerCore' => 'controllers/admin/AdminToolsController.php',
'AdminToolsController' => 'override/controllers/admin/AdminToolsController.php',
'AdminTrackingController' => 'controllers/admin/AdminTrackingController.php',
diff --git a/classes/HelperForm.php b/classes/HelperForm.php
index 86ff2c904..383939cf2 100644
--- a/classes/HelperForm.php
+++ b/classes/HelperForm.php
@@ -70,7 +70,6 @@ class HelperFormCore extends Helper
else
$defaultFormLanguage = (int)($this->context->cookie->employee_form_lang);
- info($this->fields_value);
$this->context->smarty->assign(array(
'firstCall' => $this->first_call,
'current' => self::$currentIndex,
diff --git a/controllers/admin/AdminRequestSqlController.php b/controllers/admin/AdminRequestSqlController.php
index cca728ee6..8b136b631 100644
--- a/controllers/admin/AdminRequestSqlController.php
+++ b/controllers/admin/AdminRequestSqlController.php
@@ -27,9 +27,6 @@
class AdminRequestSqlControllerCore extends AdminController
{
- private $info = true;
- private $warning = true;
-
public function __construct()
{
$this->table = 'request_sql';
@@ -41,6 +38,7 @@ class AdminRequestSqlControllerCore extends AdminController
$this->export = true;
$this->requiredDatabase = true;
$this->context = Context::getContext();
+
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')),
'export' => array('text' => $this->l('Export selected')));
@@ -53,7 +51,32 @@ class AdminRequestSqlControllerCore extends AdminController
'sql' => array('title' => $this->l('Request'), 'width' => 500)
);
- $this->template = 'adminRequestSql.tpl';
+ $this->fields_form = array(
+ 'legend' => array(
+ 'title' => $this->l('Request')
+ ),
+ 'input' => array(
+ array(
+ 'type' => 'text',
+ 'label' => $this->l('Name:'),
+ 'name' => 'name',
+ 'size' => 103,
+ 'required' => true
+ ),
+ array(
+ 'type' => 'textarea',
+ 'label' => $this->l('Request:'),
+ 'name' => 'sql',
+ 'cols' => 100,
+ 'rows' => 10,
+ 'required' => true
+ )
+ ),
+ 'submit' => array(
+ 'title' => $this->l(' Save '),
+ 'class' => 'button'
+ )
+ );
parent::__construct();
}
@@ -134,7 +157,7 @@ class AdminRequestSqlControllerCore extends AdminController
return $val;
}
- public function viewRequest_sql()
+ public function viewRequestSql()
{
if (!($obj = $this->loadObject(true)))
return;
@@ -145,17 +168,19 @@ class AdminRequestSqlControllerCore extends AdminController
{
foreach (array_keys($results[0]) as $key)
$tab_key[] = $key;
-
+
$view['name'] = $obj->name;
$view['key'] = $tab_key;
$view['results'] = $results;
-
+
$request_sql = new RequestSql();
$view['attributes'] = $request_sql->attributes;
}
else
$view['error'] = true;
- return $view;
+
+ $this->context->smarty->assign('view', $view);
+ return $this->context->smarty->fetch('requestSql/view.tpl');
}
public function _childValidation()
@@ -258,23 +283,6 @@ class AdminRequestSqlControllerCore extends AdminController
}
}
- public function displayForm($isMainTab = true)
- {
- $this->content .= parent::displayForm();
-
- if (!($obj = $this->loadObject(true)))
- return;
-
- $smarty = $this->context->smarty;
- $smarty->assign('tab_form', array(
- 'current' => self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token,
- 'id' => $obj->id,
- 'table' => $this->table,
- 'name' => $this->getFieldValue($obj, 'name'),
- 'sql' => $this->getFieldValue($obj, 'sql')
- ));
- }
-
public function init()
{
if (isset($_GET['view'.$this->table]) && isset($_GET['id_'.$this->table]))
@@ -289,27 +297,31 @@ class AdminRequestSqlControllerCore extends AdminController
public function initContent()
{
+ $this->displayWarning($this->l('When saving the query, only the request type "SELECT" are allowed.'));
+ $this->displayInformation(''.$this->l('How to create a new sql query?').'
+
+
+ - '.$this->l('Click "Add new".').'
+ - '.$this->l('Fill in the fields and click "Save".').'
+ - '.$this->l('You can then view the query results by clicking on the tab: ').'

+ - '.$this->l('You can then export the query results as a file. Csv file by clicking on the tab: ').'

+
');
+
$smarty = $this->context->smarty;
switch ($this->display)
{
case 'edit':
- $this->info = false;
+ $this->informations = false;
break;
case 'view':
- $this->info = false;
- $this->warning = false;
- $smarty->assign('view', $this->viewRequest_sql());
+ $this->informations = false;
+ $smarty->assign('view', $this->viewRequestSql());
break;
default:
$this->display = 'list';
break;
}
- $smarty->assign(array(
- 'info' => $this->info,
- 'warning' =>$this->warning,
- ));
-
parent::initContent();
}
diff --git a/override/classes/Tools.php b/override/classes/Tools.php
index 55c14e2ea..2fa87facf 100644
--- a/override/classes/Tools.php
+++ b/override/classes/Tools.php
@@ -1,7 +1,314 @@
+* @copyright 2007-2011 PrestaShop SA
+* @version Release: $Revision$
+* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+//
+// IMPORTANT : don't forget to delete the underscore _ in the file name if you want to use it !
+//
+
+// if FB class is already loaded, just enable it. else, enable it only if fb.php exists and is loaded
+if (!defined('PS_USE_FIREPHP') AND class_exists('FB'))
+ define('PS_USE_FIREPHP',true);
+elseif (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'fb.php'))
+{
+ if (!defined('PS_USE_FIREPHP'))
+ {
+ require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'fb.php');
+ define('PS_USE_FIREPHP',true);
+ }
+ else
+ define('PS_USE_FIREPHP',false);
+}
+else
+ define('PS_USE_FIREPHP',class_exists('FB'));
class Tools extends ToolsCore
{
+ /**
+ * Redirect user to another page after 5 sec
+ *
+ * @param string $url Desired URL
+ * @param string $baseUri Base URI (optional)
+ */
+ public static function redirect($url, $baseUri = __PS_BASE_URI__, Link $link = null)
+ {
+ if (!$link)
+ $link = Context::getContext()->link;
+ if (strpos($url, 'http://') === FALSE && strpos($url, 'https://') === FALSE)
+ {
+ if (strpos($url, $baseUri) !== FALSE && strpos($url, $baseUri) == 0)
+ $url = substr($url, strlen($baseUri));
+ $explode = explode('?', $url);
+ $url = $link->getPageLink($explode[0], true);
+ if (isset($explode[1]))
+ $url .= '?'.$explode[1];
+ $baseUri = '';
+ }
+ if (isset($_SERVER['HTTP_REFERER']) AND ($url == $_SERVER['HTTP_REFERER']))
+ header('Refresh: 5; url='.$_SERVER['HTTP_REFERER']);
+ else
+ header('Refresh: 5; url='.$baseUri.$url);
+ echo 'Redirection automatique dans 5 secondes
'.$url.'';
+ exit;
+ }
+
+
+ /**
+ * Redirect url wich allready PS_BASE_URI after 5 sec
+ *
+ * @param string $url Desired URL
+ */
+ public static function redirectLink($url)
+ {
+ if (!preg_match('@^https?://@i', $url))
+ {
+ if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0)
+ $url = substr($url, strlen(__PS_BASE_URI__));
+ $explode = explode('?', $url);
+ $url = Context::getContext()->link->getPageLink($explode[0]);
+ if (isset($explode[1]))
+ $url .= '?'.$explode[1];
+ }
+
+ header('Refresh: 5; url='.$url);
+ echo 'Redirection automatique dans 5 secondes
'.$url.'';
+ exit;
+ }
+ /**
+ * Redirect user to another admin page after 5 sec
+ *
+ * @param string $url Desired URL
+ */
+ public static function redirectAdmin($url)
+ {
+ header('Refresh: 5; url='.$url);
+ echo 'Redirection automatique dans 5 secondes
'.$url.'';
+ exit;
+ }
+
+
+ /**
+ * Display an error with detailed object
+ * (display in firefox console if Firephp is enabled)
+ *
+ * @param mixed $object
+ * @param boolean $kill
+ * @return $object if $kill = false;
+ */
+ public static function dieObject($object, $kill = true)
+ {
+ if(PS_USE_FIREPHP)
+ FB::error($object);
+ else
+ return parent::dieObject($object,$kill);
+
+ if ($kill)
+ die('END');
+ return $object;
+ }
+
+ /**
+ * ALIAS OF dieObject() - Display an error with detailed object
+ * (display in firefox console if Firephp is enabled)
+ *
+ * @param object $object Object to display
+ */
+ public static function d($obj, $kill = true)
+ {
+ if(PS_USE_FIREPHP)
+ FB::error($obj);
+ else
+ parent::d($obj,$kill);
+
+ if ($kill)
+ die('END');
+ return $object;
+ }
+
+ /**
+ * ALIAS OF dieObject() - Display an error with detailed object but don't stop the execution
+ * (display in firefox console if Firephp is enabled)
+ *
+ * @param object $object Object to display
+ */
+ public static function p($object)
+ {
+ if(PS_USE_FIREPHP)
+ FB::info($object);
+ else
+ return parent::p($object);
+ return $object;
+ }
+
+ /**
+ * Display a warning message indicating that the method is deprecated
+ * (display in firefox console if Firephp is enabled)
+ */
+ public static function displayAsDeprecated()
+ {
+ if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
+ {
+ $backtrace = debug_backtrace();
+ $callee = next($backtrace);
+ if (PS_USE_FIREPHP)
+ FB::warn('Function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['line'].'
', 'Deprecated method');
+ else
+ trigger_error('Function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['line'].'
', E_USER_WARNING);
+
+ $message = Tools::displayError('The function').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
+ Logger::addLog($message, 3, $callee['class']);
+ }
+ }
+
+ /**
+ * Display a warning message indicating that the parameter is deprecated
+ * (display in firefox console if Firephp is enabled)
+ */
+ public static function displayParameterAsDeprecated($parameter)
+ {
+ if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
+ {
+ $backtrace = debug_backtrace();
+ $callee = next($backtrace);
+ trigger_error('Parameter '.$parameter.' in function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['Line'].'
', E_USER_WARNING);
+
+ if(PS_USE_FIREPHP)
+ FB::trace('Parameter '.$parameter.' in function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['Line'].'
', 'deprecated parameter');
+ else
+ $message = Tools::displayError('The parameter').' '.$parameter.' '.Tools::displayError(' in function ').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['Line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
+
+ Logger::addLog($message, 3, $callee['class']);
+ }
+ }
+
+ /**
+ * use of FirePHP::error() if allowed
+ *
+ * @param mixed $obj
+ * @param string $label
+ * @return void
+ */
+ public static function error($obj, $label = '')
+ {
+ if(PS_USE_FIREPHP)
+ FB::error($obj, $label);
+ }
+
+ /**
+ * use of FirePHP::warn() if allowed
+ *
+ * @param mixed $obj
+ * @param string $label
+ * @return void
+ */
+ public static function warn($obj, $label = '')
+ {
+ if(PS_USE_FIREPHP)
+ FB::warn($obj, $label);
+ }
+
+ /**
+ * use of FirePHP::info() if allowed
+ *
+ * @param mixed $obj
+ * @param string $label
+ * @return void
+ */
+ public static function info($obj, $label = '')
+ {
+ if(PS_USE_FIREPHP)
+ FB::info($obj, $label);
+ }
+
+ /**
+ * use of FirePHP::log() if allowed
+ *
+ * @param mixed $obj
+ * @param string $label
+ * @return void
+ */
+ public static function log($obj, $label = '')
+ {
+ if(PS_USE_FIREPHP)
+ FB::log($obj,$label);
+ }
+ /**
+ * display debug_backtrace()
+ * (display in firefox console if Firephp is enabled)
+ *
+ * @param mixed $obj
+ * @return void
+ */
+ public static function trace($obj = NULL, $label = '')
+ {
+ if(PS_USE_FIREPHP)
+ FB::trace($obj, $label);
+ else{
+ Tools::p($obj);
+ echo''.$label.'
';
+ debug_print_backtrace();
+ echo '
';
+ }
+ }
+}
+// Add some convenient shortcut
+
+if (!function_exists('error'))
+{
+ function error($obj, $label = ''){
+ return Tools::error($obj, $label);
+ }
+}
+
+if (!function_exists('warn'))
+{
+ function warn($obj, $label = ''){
+ return Tools::warn($obj,$label);
+ }
+}
+
+if (!function_exists('info'))
+{
+ function info($obj, $label = ''){
+ return Tools::info($obj, $label);
+ }
+}
+
+if (!function_exists('log'))
+{
+ function log($obj, $label = ''){
+ return Tools::log($obj, $label);
+ }
+}
+
+if (!function_exists('trace'))
+{
+ function trace($obj, $label = ''){
+ return Tools::trace($obj, $label);
+ }
}