// Normalize
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12694 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -388,12 +388,12 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$objects = scandir($dir);
|
$objects = scandir($dir);
|
||||||
foreach ($objects as $object)
|
foreach ($objects as $object)
|
||||||
if ($object != "." && $object != "..")
|
if ($object != '.' && $object != '..')
|
||||||
{
|
{
|
||||||
if (filetype($dir."/".$object) == "dir")
|
if (filetype($dir.'/'.$object) == 'dir')
|
||||||
$this->recursiveDeleteOnDisk($dir."/".$object);
|
$this->recursiveDeleteOnDisk($dir.'/'.$object);
|
||||||
else
|
else
|
||||||
unlink($dir."/".$object);
|
unlink($dir.'/'.$object);
|
||||||
}
|
}
|
||||||
reset($objects);
|
reset($objects);
|
||||||
rmdir($dir);
|
rmdir($dir);
|
||||||
@@ -510,9 +510,10 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
// Try to upload and unarchive the module
|
// Try to upload and unarchive the module
|
||||||
if ($this->tabAccess['add'] === '1')
|
if ($this->tabAccess['add'] === '1')
|
||||||
{
|
{
|
||||||
if (!isset($_FILES['file']['tmp_name']) OR empty($_FILES['file']['tmp_name']))
|
if (!isset($_FILES['file']['tmp_name']) || empty($_FILES['file']['tmp_name']))
|
||||||
$this->errors[] = $this->l('no file selected');
|
$this->errors[] = $this->l('no file selected');
|
||||||
elseif (substr($_FILES['file']['name'], -4) != '.tar' AND substr($_FILES['file']['name'], -4) != '.zip' AND substr($_FILES['file']['name'], -4) != '.tgz' AND substr($_FILES['file']['name'], -7) != '.tar.gz')
|
elseif (substr($_FILES['file']['name'], -4) != '.tar' && substr($_FILES['file']['name'], -4) != '.zip'
|
||||||
|
&& substr($_FILES['file']['name'], -4) != '.tgz' && substr($_FILES['file']['name'], -7) != '.tar.gz')
|
||||||
$this->errors[] = Tools::displayError('Unknown archive type');
|
$this->errors[] = Tools::displayError('Unknown archive type');
|
||||||
elseif (!@copy($_FILES['file']['tmp_name'], _PS_MODULE_DIR_.$_FILES['file']['name']))
|
elseif (!@copy($_FILES['file']['tmp_name'], _PS_MODULE_DIR_.$_FILES['file']['name']))
|
||||||
$this->errors[] = Tools::displayError('An error occurred while copying archive to module directory.');
|
$this->errors[] = Tools::displayError('An error occurred while copying archive to module directory.');
|
||||||
@@ -555,7 +556,7 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
if (Tools::getValue('module_name') != '')
|
if (Tools::getValue('module_name') != '')
|
||||||
{
|
{
|
||||||
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
||||||
if (Validate::isLoadedObject($module) AND !$module->getPermission('configure'))
|
if (Validate::isLoadedObject($module) && !$module->getPermission('configure'))
|
||||||
$this->errors[] = Tools::displayError('You do not have the permission to use this module');
|
$this->errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -581,7 +582,7 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
$modules = empty($modules) ? false : array($modules);
|
$modules = empty($modules) ? false : array($modules);
|
||||||
$module_errors = array();
|
$module_errors = array();
|
||||||
if ($modules)
|
if ($modules)
|
||||||
foreach ($modules AS $name)
|
foreach ($modules as $name)
|
||||||
{
|
{
|
||||||
// If Addons module, download and unzip it before installing it
|
// If Addons module, download and unzip it before installing it
|
||||||
if (!is_dir('../modules/'.$name.'/'))
|
if (!is_dir('../modules/'.$name.'/'))
|
||||||
@@ -612,15 +613,15 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
// Check potential error
|
// Check potential error
|
||||||
if (!($module = Module::getInstanceByName(urldecode($name))))
|
if (!($module = Module::getInstanceByName(urldecode($name))))
|
||||||
$this->errors[] = $this->l('module not found');
|
$this->errors[] = $this->l('module not found');
|
||||||
elseif ($key == 'install' AND $this->tabAccess['add'] !== '1')
|
elseif ($key == 'install' && $this->tabAccess['add'] !== '1')
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to install a module.');
|
$this->errors[] = Tools::displayError('You do not have permission to install a module.');
|
||||||
elseif ($key == 'uninstall' AND ($this->tabAccess['delete'] !== '1' OR !$module->getPermission('configure')))
|
elseif ($key == 'uninstall' && ($this->tabAccess['delete'] !== '1' || !$module->getPermission('configure')))
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to delete this module.');
|
$this->errors[] = Tools::displayError('You do not have permission to delete this module.');
|
||||||
elseif ($key == 'configure' AND ($this->tabAccess['edit'] !== '1' OR !$module->getPermission('configure')))
|
elseif ($key == 'configure' && ($this->tabAccess['edit'] !== '1' || !$module->getPermission('configure')))
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to configure this module.');
|
$this->errors[] = Tools::displayError('You do not have permission to configure this module.');
|
||||||
elseif ($key == 'install' AND Module::isInstalled($module->name))
|
elseif ($key == 'install' && Module::isInstalled($module->name))
|
||||||
$this->errors[] = Tools::displayError('This module is already installed:').' '.$module->name;
|
$this->errors[] = Tools::displayError('This module is already installed:').' '.$module->name;
|
||||||
elseif ($key == 'uninstall' AND !Module::isInstalled($module->name))
|
elseif ($key == 'uninstall' && !Module::isInstalled($module->name))
|
||||||
$this->errors[] = Tools::displayError('This module is already uninstalled:').' '.$module->name;
|
$this->errors[] = Tools::displayError('This module is already uninstalled:').' '.$module->name;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -660,7 +661,7 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
<th><a href="'.$backlink.'" style="padding:5px 10px">'.$this->l('Back').'</a></th>
|
<th><a href="'.$backlink.'" style="padding:5px 10px">'.$this->l('Back').'</a></th>
|
||||||
<th><a href="'.$hooklink.'" style="padding:5px 10px">'.$this->l('Manage hooks').'</a></th>
|
<th><a href="'.$hooklink.'" style="padding:5px 10px">'.$this->l('Manage hooks').'</a></th>
|
||||||
<th style="padding:5px 10px">'.$this->l('Manage translations:').' ';
|
<th style="padding:5px 10px">'.$this->l('Manage translations:').' ';
|
||||||
foreach (Language::getLanguages(false) AS $language)
|
foreach (Language::getLanguages(false) as $language)
|
||||||
$toolbar .= '<a href="'.$tradlink.$language['iso_code'].'#'.$module->name.'" style="margin-left:5px"><img src="'._THEME_LANG_DIR_.$language['id_lang'].'.jpg" alt="'.$language['iso_code'].'" title="'.$language['iso_code'].'" /></a>';
|
$toolbar .= '<a href="'.$tradlink.$language['iso_code'].'#'.$module->name.'" style="margin-left:5px"><img src="'._THEME_LANG_DIR_.$language['id_lang'].'.jpg" alt="'.$language['iso_code'].'" title="'.$language['iso_code'].'" /></a>';
|
||||||
$toolbar .= '</th></tr>';
|
$toolbar .= '</th></tr>';
|
||||||
|
|
||||||
@@ -787,10 +788,10 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
if ($module->id)
|
if ($module->id)
|
||||||
$return .= ' <span class="desactive-module"><a class="action_module" '.($module->active && method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('desactive', $href).'"' : '').' href="'.self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&'.($module->active ? 'enable=0' : 'enable=1').'&tab_module='.$module->tab.'" '.((Shop::isFeatureActive()) ? 'title="'.htmlspecialchars($module->active ? $this->translationsTab['Disable this module'] : $this->translationsTab['Enable this module for all shops']).'"' : '').'>'.($module->active ? $this->translationsTab['Disable'] : $this->translationsTab['Enable']).'</a></span>';
|
$return .= ' <span class="desactive-module"><a class="action_module" '.($module->active && method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('desactive', $href).'"' : '').' href="'.self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&'.($module->active ? 'enable=0' : 'enable=1').'&tab_module='.$module->tab.'" '.((Shop::isFeatureActive()) ? 'title="'.htmlspecialchars($module->active ? $this->translationsTab['Disable this module'] : $this->translationsTab['Enable this module for all shops']).'"' : '').'>'.($module->active ? $this->translationsTab['Disable'] : $this->translationsTab['Enable']).'</a></span>';
|
||||||
|
|
||||||
if ($module->id AND $module->active)
|
if ($module->id && $module->active)
|
||||||
$return .= (!empty($result) ? '|' : '').' <span class="reset-module"><a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('reset', $href).'"' : '').' href="'.self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&reset&tab_module='.$module->tab.'">'.$this->translationsTab['Reset'].'</a></span>';
|
$return .= (!empty($result) ? '|' : '').' <span class="reset-module"><a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('reset', $href).'"' : '').' href="'.self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&reset&tab_module='.$module->tab.'">'.$this->translationsTab['Reset'].'</a></span>';
|
||||||
|
|
||||||
if ($module->id AND (method_exists($module, 'getContent') OR (isset($module->is_configurable) AND $module->is_configurable)))
|
if ($module->id && (method_exists($module, 'getContent') || (isset($module->is_configurable) && $module->is_configurable)))
|
||||||
$return .= (!empty($result) ? '|' : '').' <span class="configure-module"><a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('configure', $href).'"' : '').' href="'.self::$currentIndex.'&configure='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'">'.$this->translationsTab['Configure'].'</a></span>';
|
$return .= (!empty($result) ? '|' : '').' <span class="configure-module"><a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('configure', $href).'"' : '').' href="'.self::$currentIndex.'&configure='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'">'.$this->translationsTab['Configure'].'</a></span>';
|
||||||
|
|
||||||
$hrefDelete = self::$currentIndex.'&delete='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name);
|
$hrefDelete = self::$currentIndex.'&delete='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name);
|
||||||
@@ -801,12 +802,12 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
|
|
||||||
public function initModulesList($modules)
|
public function initModulesList($modules)
|
||||||
{
|
{
|
||||||
foreach ($modules AS $module)
|
foreach ($modules as $module)
|
||||||
{
|
{
|
||||||
if (!in_array($module->name, $this->list_natives_modules))
|
if (!in_array($module->name, $this->list_natives_modules))
|
||||||
$this->serial_modules .= $module->name.' '.$module->version.'-'.($module->active ? 'a' : 'i')."\n";
|
$this->serial_modules .= $module->name.' '.$module->version.'-'.($module->active ? 'a' : 'i')."\n";
|
||||||
$module_author = $module->author;
|
$module_author = $module->author;
|
||||||
if (!empty($module_author)&& ($module_author != ""))
|
if (!empty($module_author) && ($module_author != ''))
|
||||||
$this->modules_authors[(string)$module_author] = 'notselected';
|
$this->modules_authors[(string)$module_author] = 'notselected';
|
||||||
}
|
}
|
||||||
$this->serial_modules = urlencode($this->serial_modules);
|
$this->serial_modules = urlencode($this->serial_modules);
|
||||||
@@ -832,7 +833,7 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
public function isModuleFiltered($module)
|
public function isModuleFiltered($module)
|
||||||
{
|
{
|
||||||
// Beware $module could be an instance of Module or stdClass, that explain the static call
|
// Beware $module could be an instance of Module or stdClass, that explain the static call
|
||||||
if ($module->id AND !Module::getPermissionStatic($module->id, 'view') AND !Module::getPermissionStatic($module->id, 'configure'))
|
if ($module->id && !Module::getPermissionStatic($module->id, 'view') && !Module::getPermissionStatic($module->id, 'configure'))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
@@ -877,7 +878,7 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
return true;
|
return true;
|
||||||
else if ($show_type_modules == 'partnerModules' && !in_array($module->name, $this->list_partners_modules))
|
else if ($show_type_modules == 'partnerModules' && !in_array($module->name, $this->list_partners_modules))
|
||||||
return true;
|
return true;
|
||||||
else if ($show_type_modules == 'otherModules' && (in_array($module->name, $this->list_partners_modules) OR in_array($module->name, $this->list_natives_modules)))
|
else if ($show_type_modules == 'otherModules' && (in_array($module->name, $this->list_partners_modules) || in_array($module->name, $this->list_natives_modules)))
|
||||||
return true;
|
return true;
|
||||||
else if (strpos($show_type_modules, 'authorModules[') !== false)
|
else if (strpos($show_type_modules, 'authorModules[') !== false)
|
||||||
{
|
{
|
||||||
@@ -907,7 +908,10 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
|
|
||||||
// Filter on country
|
// Filter on country
|
||||||
$show_country_modules = $this->filter_configuration['PS_SHOW_COUNTRY_MODULES_'.(int)$this->id_employee];
|
$show_country_modules = $this->filter_configuration['PS_SHOW_COUNTRY_MODULES_'.(int)$this->id_employee];
|
||||||
if ($show_country_modules AND (isset($module->limited_countries) AND !empty($module->limited_countries) AND ((is_array($module->limited_countries) AND sizeof($module->limited_countries) AND !in_array(strtolower($this->iso_default_country), $module->limited_countries)) OR (!is_array($module->limited_countries) AND strtolower($this->iso_default_country) != strval($module->limited_countries)))))
|
if ($show_country_modules && (isset($module->limited_countries) && !empty($module->limited_countries)
|
||||||
|
&& ((is_array($module->limited_countries) && count($module->limited_countries)
|
||||||
|
&& !in_array(strtolower($this->iso_default_country), $module->limited_countries))
|
||||||
|
|| (!is_array($module->limited_countries) && strtolower($this->iso_default_country) != strval($module->limited_countries)))))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
// Getting key value for display
|
// Getting key value for display
|
||||||
if (Tools::getValue('show_modules') AND strval(Tools::getValue('show_modules')) != 'all')
|
if (Tools::getValue('show_modules') && strval(Tools::getValue('show_modules')) != 'all')
|
||||||
$this->displayKey = (int)(Tools::getValue('show_modules'));
|
$this->displayKey = (int)(Tools::getValue('show_modules'));
|
||||||
|
|
||||||
// Change position in hook
|
// Change position in hook
|
||||||
@@ -66,9 +66,9 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$id_hook = (int)(Tools::getValue('id_hook'));
|
$id_hook = (int)(Tools::getValue('id_hook'));
|
||||||
$hook = new Hook($id_hook);
|
$hook = new Hook($id_hook);
|
||||||
|
|
||||||
if (!$id_module OR !Validate::isLoadedObject($module))
|
if (!$id_module || !Validate::isLoadedObject($module))
|
||||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||||
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
|
elseif (!$id_hook || !Validate::isLoadedObject($hook))
|
||||||
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||||
elseif (Hook::getModulesFromHook($id_hook, $id_module))
|
elseif (Hook::getModulesFromHook($id_hook, $id_module))
|
||||||
$this->errors[] = Tools::displayError('This module is already transplanted to this hook.');
|
$this->errors[] = Tools::displayError('This module is already transplanted to this hook.');
|
||||||
@@ -85,7 +85,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$exceptions = (isset($exceptions[0])) ? $exceptions[0] : array();
|
$exceptions = (isset($exceptions[0])) ? $exceptions[0] : array();
|
||||||
$exceptions = explode(',', str_replace(' ', '', $exceptions));
|
$exceptions = explode(',', str_replace(' ', '', $exceptions));
|
||||||
|
|
||||||
foreach ($exceptions AS $except)
|
foreach ($exceptions as $except)
|
||||||
if (!Validate::isFileName($except))
|
if (!Validate::isFileName($except))
|
||||||
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
||||||
|
|
||||||
@@ -112,9 +112,9 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$id_hook = (int)(Tools::getValue('id_hook'));
|
$id_hook = (int)(Tools::getValue('id_hook'));
|
||||||
$hook = new Hook($id_hook);
|
$hook = new Hook($id_hook);
|
||||||
|
|
||||||
if (!$id_module OR !Validate::isLoadedObject($module))
|
if (!$id_module || !Validate::isLoadedObject($module))
|
||||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||||
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
|
elseif (!$id_hook || !Validate::isLoadedObject($hook))
|
||||||
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -126,7 +126,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$exception = explode(',', str_replace(' ', '', $exception));
|
$exception = explode(',', str_replace(' ', '', $exception));
|
||||||
|
|
||||||
// Check files name
|
// Check files name
|
||||||
foreach ($exception AS $except)
|
foreach ($exception as $except)
|
||||||
if (!Validate::isFileName($except))
|
if (!Validate::isFileName($except))
|
||||||
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$exceptions = explode(',', str_replace(' ', '', $exceptions));
|
$exceptions = explode(',', str_replace(' ', '', $exceptions));
|
||||||
|
|
||||||
// Check files name
|
// Check files name
|
||||||
foreach ($exceptions AS $except)
|
foreach ($exceptions as $except)
|
||||||
if (!Validate::isFileName($except))
|
if (!Validate::isFileName($except))
|
||||||
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
||||||
|
|
||||||
@@ -172,11 +172,11 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$hook = new Hook($id_hook);
|
$hook = new Hook($id_hook);
|
||||||
if (!Validate::isLoadedObject($module))
|
if (!Validate::isLoadedObject($module))
|
||||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||||
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
|
elseif (!$id_hook || !Validate::isLoadedObject($hook))
|
||||||
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!$module->unregisterHook($id_hook, Context::getContext()->shop->getListOfID()) OR !$module->unregisterExceptions($id_hook, Context::getContext()->shop->getListOfID()))
|
if (!$module->unregisterHook($id_hook, Context::getContext()->shop->getListOfID()) || !$module->unregisterExceptions($id_hook, Context::getContext()->shop->getListOfID()))
|
||||||
$this->errors[] = Tools::displayError('An error occurred while deleting module from hook.');
|
$this->errors[] = Tools::displayError('An error occurred while deleting module from hook.');
|
||||||
else
|
else
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
||||||
@@ -187,7 +187,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
elseif (Tools::isSubmit('unhookform'))
|
elseif (Tools::isSubmit('unhookform'))
|
||||||
{
|
{
|
||||||
if (!($unhooks = Tools::getValue('unhooks')) OR !is_array($unhooks))
|
if (!($unhooks = Tools::getValue('unhooks')) || !is_array($unhooks))
|
||||||
$this->errors[] = Tools::displayError('Select a module to unhook.');
|
$this->errors[] = Tools::displayError('Select a module to unhook.');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -200,15 +200,15 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$hook = new Hook((int)($id_hook));
|
$hook = new Hook((int)($id_hook));
|
||||||
if (!Validate::isLoadedObject($module))
|
if (!Validate::isLoadedObject($module))
|
||||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||||
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
|
elseif (!$id_hook || !Validate::isLoadedObject($hook))
|
||||||
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!$module->unregisterHook((int)($id_hook)) OR !$module->unregisterExceptions((int)($id_hook)))
|
if (!$module->unregisterHook((int)($id_hook)) || !$module->unregisterExceptions((int)($id_hook)))
|
||||||
$this->errors[] = Tools::displayError('An error occurred while deleting module from hook.');
|
$this->errors[] = Tools::displayError('An error occurred while deleting module from hook.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!sizeof($this->errors))
|
if (!count($this->errors))
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
|
|
||||||
public function initContent()
|
public function initContent()
|
||||||
{
|
{
|
||||||
if (array_key_exists('addToHook', $_GET) OR array_key_exists('editGraft', $_GET) OR (Tools::isSubmit('submitAddToHook') AND $this->errors))
|
if (array_key_exists('addToHook', $_GET) || array_key_exists('editGraft', $_GET) || (Tools::isSubmit('submitAddToHook') && $this->errors))
|
||||||
{
|
{
|
||||||
$this->display = 'edit';
|
$this->display = 'edit';
|
||||||
$this->content .= $this->renderForm();
|
$this->content .= $this->renderForm();
|
||||||
@@ -260,7 +260,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$hooks[$key]['modules'][$module_key]['instance'] = $module_instances[$assoc_modules_id[$module['id_module']]];
|
$hooks[$key]['modules'][$module_key]['instance'] = $module_instances[$assoc_modules_id[$module['id_module']]];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addJqueryPlugin("tablednd");
|
$this->addJqueryPlugin('tablednd');
|
||||||
|
|
||||||
$this->toolbar_btn['save'] = array(
|
$this->toolbar_btn['save'] = array(
|
||||||
'href' => self::$currentIndex.'&addToHook'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token,
|
'href' => self::$currentIndex.'&addToHook'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token,
|
||||||
@@ -333,7 +333,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$modules = Module::getModulesInstalled(0);
|
$modules = Module::getModulesInstalled(0);
|
||||||
|
|
||||||
$instances = array();
|
$instances = array();
|
||||||
foreach ($modules AS $module)
|
foreach ($modules as $module)
|
||||||
if ($tmpInstance = Module::getInstanceById($module['id_module']))
|
if ($tmpInstance = Module::getInstanceById($module['id_module']))
|
||||||
$instances[$tmpInstance->displayName] = $tmpInstance;
|
$instances[$tmpInstance->displayName] = $tmpInstance;
|
||||||
ksort($instances);
|
ksort($instances);
|
||||||
@@ -380,9 +380,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
||||||
ksort($controllers);
|
ksort($controllers);
|
||||||
foreach ($controllers as $k => $v)
|
foreach ($controllers as $k => $v)
|
||||||
{
|
|
||||||
$content .= '<option value="'.$k.'">'.$k.'</option>';
|
$content .= '<option value="'.$k.'">'.$k.'</option>';
|
||||||
}
|
|
||||||
$content .= '</select> <input type="button" class="button" value="'.$this->l('Add').'" onclick="position_exception_add('.$shopID.')" />
|
$content .= '</select> <input type="button" class="button" value="'.$this->l('Add').'" onclick="position_exception_add('.$shopID.')" />
|
||||||
<input type="button" class="button" value="'.$this->l('Remove').'" onclick="position_exception_remove('.$shopID.')" /><br /><br />';
|
<input type="button" class="button" value="'.$this->l('Remove').'" onclick="position_exception_remove('.$shopID.')" /><br /><br />';
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$order = new Order($id_order);
|
$order = new Order($id_order);
|
||||||
$order_state = OrderHistory::getLastOrderState($id_order);
|
$order_state = OrderHistory::getLastOrderState($id_order);
|
||||||
if (!Validate::isLoadedObject($order_state) OR !Validate::isLoadedObject($order))
|
if (!Validate::isLoadedObject($order_state) || !Validate::isLoadedObject($order))
|
||||||
die(Tools::displayError('Invalid objects'));
|
die(Tools::displayError('Invalid objects'));
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
@@ -292,19 +292,19 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
/* Get message rules and and check fields validity */
|
/* Get message rules and and check fields validity */
|
||||||
// TODO review
|
// TODO review
|
||||||
$rules = call_user_func(array('Message', 'getValidationRules'), 'Message');
|
$rules = call_user_func(array('Message', 'getValidationRules'), 'Message');
|
||||||
foreach ($rules['required'] AS $field)
|
foreach ($rules['required'] as $field)
|
||||||
if (($value = Tools::getValue($field)) == false AND (string)$value != '0')
|
if (($value = Tools::getValue($field)) == false || (string)$value != '0')
|
||||||
if (!Tools::getValue('id_'.$this->table) OR $field != 'passwd')
|
if (!Tools::getValue('id_'.$this->table) || $field != 'passwd')
|
||||||
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is required.');
|
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is required.');
|
||||||
foreach ($rules['size'] AS $field => $maxLength)
|
foreach ($rules['size'] as $field => $maxLength)
|
||||||
if (Tools::getValue($field) AND Tools::strlen(Tools::getValue($field)) > $maxLength)
|
if (Tools::getValue($field) && Tools::strlen(Tools::getValue($field)) > $maxLength)
|
||||||
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is too long.').' ('.$maxLength.' '.Tools::displayError('chars max').')';
|
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is too long.').' ('.$maxLength.' '.Tools::displayError('chars max').')';
|
||||||
foreach ($rules['validate'] AS $field => $function)
|
foreach ($rules['validate'] as $field => $function)
|
||||||
if (Tools::getValue($field))
|
if (Tools::getValue($field))
|
||||||
if (!Validate::$function(htmlentities(Tools::getValue($field), ENT_COMPAT, 'UTF-8')))
|
if (!Validate::$function(htmlentities(Tools::getValue($field), ENT_COMPAT, 'UTF-8')))
|
||||||
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is invalid.');
|
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is invalid.');
|
||||||
|
|
||||||
if (!sizeof($this->errors))
|
if (!count($this->errors))
|
||||||
{
|
{
|
||||||
//check if a thread already exist
|
//check if a thread already exist
|
||||||
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($customer->email, $order->id);
|
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($customer->email, $order->id);
|
||||||
@@ -386,7 +386,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$this->errors[] = Tools::displayError('You have to write an amount if you want to do a partial credit slip');
|
$this->errors[] = Tools::displayError('You have to write an amount if you want to do a partial credit slip');
|
||||||
|
|
||||||
// Redirect if no errors
|
// Redirect if no errors
|
||||||
if (!sizeof($this->errors))
|
if (!count($this->errors))
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -413,14 +413,14 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$full_quantity_list[$id_order_detail] = $customizationQtyList[$key];
|
$full_quantity_list[$id_order_detail] = $customizationQtyList[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($productList OR $customizationList)
|
if ($productList || $customizationList)
|
||||||
{
|
{
|
||||||
if ($productList)
|
if ($productList)
|
||||||
{
|
{
|
||||||
$id_cart = Cart::getCartIdByOrderId($order->id);
|
$id_cart = Cart::getCartIdByOrderId($order->id);
|
||||||
$customization_quantities = Customization::countQuantityByCart($id_cart);
|
$customization_quantities = Customization::countQuantityByCart($id_cart);
|
||||||
|
|
||||||
foreach ($productList AS $key => $id_order_detail)
|
foreach ($productList as $key => $id_order_detail)
|
||||||
{
|
{
|
||||||
$qtyCancelProduct = abs($qtyList[$key]);
|
$qtyCancelProduct = abs($qtyList[$key]);
|
||||||
if (!$qtyCancelProduct)
|
if (!$qtyCancelProduct)
|
||||||
@@ -441,7 +441,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$customization_quantities = Customization::retrieveQuantitiesFromIds(array_keys($customizationList));
|
$customization_quantities = Customization::retrieveQuantitiesFromIds(array_keys($customizationList));
|
||||||
|
|
||||||
foreach ($customizationList AS $id_customization => $id_order_detail)
|
foreach ($customizationList as $id_customization => $id_order_detail)
|
||||||
{
|
{
|
||||||
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
|
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
|
||||||
$customization_quantity = $customization_quantities[$id_customization];
|
$customization_quantity = $customization_quantities[$id_customization];
|
||||||
@@ -454,14 +454,14 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sizeof($this->errors) AND $productList)
|
if (!count($this->errors) && $productList)
|
||||||
foreach ($productList AS $key => $id_order_detail)
|
foreach ($productList as $key => $id_order_detail)
|
||||||
{
|
{
|
||||||
$qty_cancel_product = abs($qtyList[$key]);
|
$qty_cancel_product = abs($qtyList[$key]);
|
||||||
$order_detail = new OrderDetail((int)($id_order_detail));
|
$order_detail = new OrderDetail((int)($id_order_detail));
|
||||||
|
|
||||||
// Reinject product
|
// Reinject product
|
||||||
if (!$order->hasBeenDelivered() OR ($order->hasBeenDelivered() AND Tools::isSubmit('reinjectQuantities')))
|
if (!$order->hasBeenDelivered() || ($order->hasBeenDelivered() && Tools::isSubmit('reinjectQuantities')))
|
||||||
{
|
{
|
||||||
$reinjectable_quantity = (int)$order_detail->product_quantity - (int)$order_detail->product_quantity_reinjected;
|
$reinjectable_quantity = (int)$order_detail->product_quantity - (int)$order_detail->product_quantity_reinjected;
|
||||||
$quantity_to_reinject = $qty_cancel_product > $reinjectable_quantity ? $reinjectable_quantity : $qty_cancel_product;
|
$quantity_to_reinject = $qty_cancel_product > $reinjectable_quantity ? $reinjectable_quantity : $qty_cancel_product;
|
||||||
@@ -473,8 +473,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||||
&& $product->advanced_stock_management
|
&& $product->advanced_stock_management
|
||||||
&& $order_detail->id_warehouse != 0
|
&& $order_detail->id_warehouse != 0)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$mvts = StockMvt::getNegativeStockMvts(
|
$mvts = StockMvt::getNegativeStockMvts(
|
||||||
$order_detail->id_order,
|
$order_detail->id_order,
|
||||||
@@ -516,8 +515,8 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$this->errors[] = Tools::displayError('An error occurred during deletion of the product.').' <span class="bold">'.$order_detail->product_name.'</span>';
|
$this->errors[] = Tools::displayError('An error occurred during deletion of the product.').' <span class="bold">'.$order_detail->product_name.'</span>';
|
||||||
Hook::exec('actionProductCancel', array('order' => $order, 'id_order_detail' => $id_order_detail));
|
Hook::exec('actionProductCancel', array('order' => $order, 'id_order_detail' => $id_order_detail));
|
||||||
}
|
}
|
||||||
if (!sizeof($this->errors) AND $customizationList)
|
if (!count($this->errors) && $customizationList)
|
||||||
foreach ($customizationList AS $id_customization => $id_order_detail)
|
foreach ($customizationList as $id_customization => $id_order_detail)
|
||||||
{
|
{
|
||||||
$order_detail = new OrderDetail((int)($id_order_detail));
|
$order_detail = new OrderDetail((int)($id_order_detail));
|
||||||
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
|
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
|
||||||
@@ -525,7 +524,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$this->errors[] = Tools::displayError('An error occurred during deletion of product customization.').' '.$id_customization;
|
$this->errors[] = Tools::displayError('An error occurred during deletion of product customization.').' '.$id_customization;
|
||||||
}
|
}
|
||||||
// E-mail params
|
// E-mail params
|
||||||
if ((isset($_POST['generateCreditSlip']) OR isset($_POST['generateDiscount'])) AND !sizeof($this->errors))
|
if ((isset($_POST['generateCreditSlip']) || isset($_POST['generateDiscount'])) && !count($this->errors))
|
||||||
{
|
{
|
||||||
$customer = new Customer((int)($order->id_customer));
|
$customer = new Customer((int)($order->id_customer));
|
||||||
$params['{lastname}'] = $customer->lastname;
|
$params['{lastname}'] = $customer->lastname;
|
||||||
@@ -534,21 +533,32 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate credit slip
|
// Generate credit slip
|
||||||
if (isset($_POST['generateCreditSlip']) AND !sizeof($this->errors))
|
if (isset($_POST['generateCreditSlip']) && !count($this->errors))
|
||||||
{
|
{
|
||||||
if (!OrderSlip::createOrderSlip($order, $full_product_list, $full_quantity_list, isset($_POST['shippingBack'])))
|
if (!OrderSlip::createOrderSlip($order, $full_product_list, $full_quantity_list, isset($_POST['shippingBack'])))
|
||||||
$this->errors[] = Tools::displayError('Cannot generate credit slip');
|
$this->errors[] = Tools::displayError('Cannot generate credit slip');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list));
|
Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list));
|
||||||
@Mail::Send((int)$order->id_lang, 'credit_slip', Mail::l('New credit slip regarding your order', $order->id_lang),
|
@Mail::Send(
|
||||||
$params, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, NULL, NULL,
|
(int)$order->id_lang,
|
||||||
_PS_MAIL_DIR_, true);
|
'credit_slip',
|
||||||
|
Mail::l('New credit slip regarding your order', $order->id_lang),
|
||||||
|
$params,
|
||||||
|
$customer->email,
|
||||||
|
$customer->firstname.' '.$customer->lastname,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
_PS_MAIL_DIR_,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate voucher
|
// Generate voucher
|
||||||
if (isset($_POST['generateDiscount']) AND !sizeof($this->errors))
|
if (isset($_POST['generateDiscount']) && !count($this->errors))
|
||||||
{
|
{
|
||||||
// @todo generate a voucher using cartrules
|
// @todo generate a voucher using cartrules
|
||||||
if (true || !$voucher = Discount::createOrderDiscount($order, $full_product_list, $full_quantity_list, $this->l('Credit Slip concerning the order #'), isset($_POST['shippingBack'])))
|
if (true || !$voucher = Discount::createOrderDiscount($order, $full_product_list, $full_quantity_list, $this->l('Credit Slip concerning the order #'), isset($_POST['shippingBack'])))
|
||||||
@@ -559,8 +569,8 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);
|
$params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);
|
||||||
$params['{voucher_num}'] = $voucher->name;
|
$params['{voucher_num}'] = $voucher->name;
|
||||||
@Mail::Send((int)$order->id_lang, 'voucher', Mail::l('New voucher regarding your order', (int)$order->id_lang),
|
@Mail::Send((int)$order->id_lang, 'voucher', Mail::l('New voucher regarding your order', (int)$order->id_lang),
|
||||||
$params, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, NULL,
|
$params, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null,
|
||||||
NULL, _PS_MAIL_DIR_, true);
|
null, _PS_MAIL_DIR_, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -568,7 +578,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$this->errors[] = Tools::displayError('No product or quantity selected.');
|
$this->errors[] = Tools::displayError('No product or quantity selected.');
|
||||||
|
|
||||||
// Redirect if no errors
|
// Redirect if no errors
|
||||||
if (!sizeof($this->errors))
|
if (!count($this->errors))
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -977,10 +987,10 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$carrier_module_call = call_user_func(array($module, 'displayInfoByCart'), $order->id_cart);
|
$carrier_module_call = call_user_func(array($module, 'displayInfoByCart'), $order->id_cart);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve addresses informations
|
// Retrieve addresses information
|
||||||
$addressInvoice = new Address($order->id_address_invoice, $this->context->language->id);
|
$addressInvoice = new Address($order->id_address_invoice, $this->context->language->id);
|
||||||
if (Validate::isLoadedObject($addressInvoice) AND $addressInvoice->id_state)
|
if (Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state)
|
||||||
$invoiceState = new State((int)($addressInvoice->id_state));
|
$invoiceState = new State((int)$addressInvoice->id_state);
|
||||||
|
|
||||||
if ($order->id_address_invoice == $order->id_address_delivery)
|
if ($order->id_address_invoice == $order->id_address_delivery)
|
||||||
{
|
{
|
||||||
@@ -991,7 +1001,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$addressDelivery = new Address($order->id_address_delivery, $this->context->language->id);
|
$addressDelivery = new Address($order->id_address_delivery, $this->context->language->id);
|
||||||
if (Validate::isLoadedObject($addressDelivery) AND $addressDelivery->id_state)
|
if (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state)
|
||||||
$deliveryState = new State((int)($addressDelivery->id_state));
|
$deliveryState = new State((int)($addressDelivery->id_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,8 +1016,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$product = new Product($order_detail['product_id']);
|
$product = new Product($order_detail['product_id']);
|
||||||
|
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||||
&& $product->advanced_stock_management
|
&& $product->advanced_stock_management)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
|
$warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
|
||||||
foreach ($warehouses as $warehouse)
|
foreach ($warehouses as $warehouse)
|
||||||
@@ -1082,10 +1091,10 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
public function ajaxProcessSearchProducts()
|
public function ajaxProcessSearchProducts()
|
||||||
{
|
{
|
||||||
$currency = new Currency((int)Tools::getValue('id_currency'));
|
$currency = new Currency(Tools::getValue('id_currency'));
|
||||||
if ($products = Product::searchByName((int)$this->context->language->id, pSQL(Tools::getValue('product_search'))))
|
if ($products = Product::searchByName((int)$this->context->language->id, pSQL(Tools::getValue('product_search'))))
|
||||||
{
|
{
|
||||||
foreach ($products AS &$product)
|
foreach ($products as &$product)
|
||||||
{
|
{
|
||||||
// Formatted price
|
// Formatted price
|
||||||
$product['formatted_price'] = Tools::displayPrice(Tools::convertPrice($product['price_tax_incl'], $currency), $currency);
|
$product['formatted_price'] = Tools::displayPrice(Tools::convertPrice($product['price_tax_incl'], $currency), $currency);
|
||||||
@@ -1102,7 +1111,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
$product['warehouse_list'] = array();
|
$product['warehouse_list'] = array();
|
||||||
|
|
||||||
foreach($attributes AS $attribute)
|
foreach ($attributes as $attribute)
|
||||||
{
|
{
|
||||||
if (!isset($combinations[$attribute['id_product_attribute']]['attributes']))
|
if (!isset($combinations[$attribute['id_product_attribute']]['attributes']))
|
||||||
$combinations[$attribute['id_product_attribute']]['attributes'] = '';
|
$combinations[$attribute['id_product_attribute']]['attributes'] = '';
|
||||||
@@ -1137,7 +1146,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$product['stock'][0] = Product::getRealQuantity($product['id_product'], 0, 0);
|
$product['stock'][0] = Product::getRealQuantity($product['id_product'], 0, 0);
|
||||||
|
|
||||||
|
|
||||||
foreach ($combinations AS &$combination)
|
foreach ($combinations as &$combination)
|
||||||
$combination['attributes'] = rtrim($combination['attributes'], ' - ');
|
$combination['attributes'] = rtrim($combination['attributes'], ' - ');
|
||||||
$product['combinations'] = $combinations;
|
$product['combinations'] = $combinations;
|
||||||
}
|
}
|
||||||
@@ -1156,7 +1165,6 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
if ($this->tabAccess['edit'] === '1')
|
if ($this->tabAccess['edit'] === '1')
|
||||||
{
|
{
|
||||||
$errors = array();
|
|
||||||
$cart = new Cart((int)Tools::getValue('id_cart'));
|
$cart = new Cart((int)Tools::getValue('id_cart'));
|
||||||
if (Validate::isLoadedObject($cart))
|
if (Validate::isLoadedObject($cart))
|
||||||
{
|
{
|
||||||
@@ -1168,7 +1176,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
'{firstname}' => $customer->firstname,
|
'{firstname}' => $customer->firstname,
|
||||||
'{lastname}' => $customer->lastname
|
'{lastname}' => $customer->lastname
|
||||||
);
|
);
|
||||||
if (Mail::Send((int)$cart->id_lang, 'backoffice_order', Mail::l('Process the payment of your order', (int)$cart->id_lang), $mailVars, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, NULL, NULL,_PS_MAIL_DIR_, true))
|
if (Mail::Send((int)$cart->id_lang, 'backoffice_order', Mail::l('Process the payment of your order', (int)$cart->id_lang), $mailVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true))
|
||||||
die(Tools::jsonEncode(array('errors' => false, 'result' => $this->l('The mail was sent to your customer.'))));
|
die(Tools::jsonEncode(array('errors' => false, 'result' => $this->l('The mail was sent to your customer.'))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,7 @@ class AdminOutstandingControllerCore extends AdminController
|
|||||||
|
|
||||||
$risks = array();
|
$risks = array();
|
||||||
foreach (Risk::getRisks() as $risk)
|
foreach (Risk::getRisks() as $risk)
|
||||||
{
|
|
||||||
$risks[$risk->id] = $risk->name;
|
$risks[$risk->id] = $risk->name;
|
||||||
}
|
|
||||||
|
|
||||||
$this->fieldsDisplay = array(
|
$this->fieldsDisplay = array(
|
||||||
'number' => array(
|
'number' => array(
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ class AdminPreferencesControllerCore extends AdminController
|
|||||||
$post_max_size = (int)str_replace('M', '', ini_get('post_max_size'));
|
$post_max_size = (int)str_replace('M', '', ini_get('post_max_size'));
|
||||||
$max_size = $upload_max_size < $post_max_size ? $upload_max_size : $post_max_size;
|
$max_size = $upload_max_size < $post_max_size ? $upload_max_size : $post_max_size;
|
||||||
|
|
||||||
if (Tools::getValue('PS_LIMIT_UPLOAD_FILE_VALUE') > $max_size or Tools::getValue('PS_LIMIT_UPLOAD_IMAGE_VALUE') > $max_size)
|
if (Tools::getValue('PS_LIMIT_UPLOAD_FILE_VALUE') > $max_size || Tools::getValue('PS_LIMIT_UPLOAD_IMAGE_VALUE') > $max_size)
|
||||||
{
|
{
|
||||||
$this->errors[] = Tools::displayError('The limit choosen is superior to the server\'s maximum upload file You need to improve the limit of your server.');
|
$this->errors[] = Tools::displayError('The limit choosen is superior to the server\'s maximum upload file You need to improve the limit of your server.');
|
||||||
return;
|
return;
|
||||||
@@ -445,10 +445,13 @@ class AdminPreferencesControllerCore extends AdminController
|
|||||||
$value = (int)$value;
|
$value = (int)$value;
|
||||||
|
|
||||||
$tabs_class_name = array('AdminOutstanding');
|
$tabs_class_name = array('AdminOutstanding');
|
||||||
if (!empty($tabs_class_name)) {
|
if (!empty($tabs_class_name))
|
||||||
foreach ($tabs_class_name as $tab_class_name) {
|
{
|
||||||
|
foreach ($tabs_class_name as $tab_class_name)
|
||||||
|
{
|
||||||
$tab = Tab::getInstanceFromClassName($tab_class_name);
|
$tab = Tab::getInstanceFromClassName($tab_class_name);
|
||||||
if (Validate::isLoadedObject($tab)) {
|
if (Validate::isLoadedObject($tab))
|
||||||
|
{
|
||||||
$tab->active = $value;
|
$tab->active = $value;
|
||||||
$tab->save();
|
$tab->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
/** @var integer Max image size for upload
|
/** @var integer Max image size for upload
|
||||||
* As of 1.5 it is recommended to not set a limit to max image size
|
* As of 1.5 it is recommended to not set a limit to max image size
|
||||||
**/
|
**/
|
||||||
protected $max_file_size = NULL;
|
protected $max_file_size = null;
|
||||||
protected $max_image_size = NULL;
|
protected $max_image_size = null;
|
||||||
|
|
||||||
private $_category;
|
private $_category;
|
||||||
/**
|
/**
|
||||||
@@ -1010,11 +1010,11 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
parent::postProcess();
|
parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo rename to processaddproductimage
|
/* @todo rename to processaddproductimage */
|
||||||
public function ajaxProcessAddImage()
|
public function ajaxProcessAddImage()
|
||||||
{
|
{
|
||||||
self::$currentIndex = 'index.php?tab=AdminProducts';
|
self::$currentIndex = 'index.php?tab=AdminProducts';
|
||||||
$allowedExtensions = array("jpeg", "gif", "png", "jpg");
|
$allowedExtensions = array('jpeg', 'jpg', 'png', 'jpg');
|
||||||
// max file size in bytes
|
// max file size in bytes
|
||||||
$uploader = new FileUploader($allowedExtensions, $this->max_image_size);
|
$uploader = new FileUploader($allowedExtensions, $this->max_image_size);
|
||||||
$result = $uploader->handleUpload();
|
$result = $uploader->handleUpload();
|
||||||
@@ -1272,7 +1272,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking customs feature
|
/* Checking customs feature */
|
||||||
protected function checkFeatures($languages, $feature_id)
|
protected function checkFeatures($languages, $feature_id)
|
||||||
{
|
{
|
||||||
$rules = call_user_func(array('FeatureValue', 'getValidationRules'), 'FeatureValue');
|
$rules = call_user_func(array('FeatureValue', 'getValidationRules'), 'FeatureValue');
|
||||||
@@ -1634,7 +1634,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$is_virtual_file = (int)Tools::getValue('is_virtual_file');
|
$is_virtual_file = (int)Tools::getValue('is_virtual_file');
|
||||||
|
|
||||||
/* add or update a virtual product */
|
// add or update a virtual product
|
||||||
if (Tools::getValue('is_virtual_good') == 'true')
|
if (Tools::getValue('is_virtual_good') == 'true')
|
||||||
{
|
{
|
||||||
if (!Tools::getValue('virtual_product_name') && !Tools::getValue('virtual_product_name_attribute') && !empty($is_virtual_file))
|
if (!Tools::getValue('virtual_product_name') && !Tools::getValue('virtual_product_name_attribute') && !empty($is_virtual_file))
|
||||||
@@ -1773,7 +1773,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteDownloadProduct($id_product_attribute = NULL)
|
public function deleteDownloadProduct($id_product_attribute = null)
|
||||||
{
|
{
|
||||||
if (!empty($id_product_attribute))
|
if (!empty($id_product_attribute))
|
||||||
{
|
{
|
||||||
@@ -1907,7 +1907,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$manufacturers = Manufacturer::getManufacturers();
|
$manufacturers = Manufacturer::getManufacturers();
|
||||||
$jsonArray = array();
|
$jsonArray = array();
|
||||||
if ($manufacturers)
|
if ($manufacturers)
|
||||||
foreach ($manufacturers AS $manufacturer)
|
foreach ($manufacturers as $manufacturer)
|
||||||
$jsonArray[] = '{"optionValue": "'.$manufacturer['id_manufacturer'].'", "optionDisplay": "'.htmlspecialchars(trim($manufacturer['name'])).'"}';
|
$jsonArray[] = '{"optionValue": "'.$manufacturer['id_manufacturer'].'", "optionDisplay": "'.htmlspecialchars(trim($manufacturer['name'])).'"}';
|
||||||
die('['.implode(',', $jsonArray).']');
|
die('['.implode(',', $jsonArray).']');
|
||||||
}
|
}
|
||||||
@@ -2137,12 +2137,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
Category::getLinkRewrite($product->id_category_default, $this->context->language->id), null, null, Context::getContext()->shop->getID());
|
Category::getLinkRewrite($product->id_category_default, $this->context->language->id), null, null, Context::getContext()->shop->getID());
|
||||||
if (!$product->active)
|
if (!$product->active)
|
||||||
{
|
{
|
||||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
$preview_url = $this->context->link->getProductLink($product, $this->getFieldValue($product, 'link_rewrite', $this->default_form_language), Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id));
|
||||||
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
|
|
||||||
$token = Tools::encrypt('PreviewProduct'.$product->id);
|
|
||||||
if (strpos($preview_url, '?') === false)
|
|
||||||
$preview_url .= '?';
|
|
||||||
$preview_url = ($this->context->link->getProductLink($product, $this->getFieldValue($product, 'link_rewrite', $this->default_form_language), Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id)));
|
|
||||||
if (!$product->active)
|
if (!$product->active)
|
||||||
{
|
{
|
||||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||||
@@ -2170,7 +2165,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
// Build tab with associated data
|
// Build tab with associated data
|
||||||
$tab = array();
|
$tab = array();
|
||||||
foreach ($zones as $zone)
|
foreach ($zones as $zone)
|
||||||
if (($num = Tools::getValue('zone_'.$zone['id_zone'])) !== NULL)
|
if (($num = Tools::getValue('zone_'.$zone['id_zone'])) !== null)
|
||||||
$tab[] = array(
|
$tab[] = array(
|
||||||
'id_zone' => $zone['id_zone'],
|
'id_zone' => $zone['id_zone'],
|
||||||
'id_product' => $product->id,
|
'id_product' => $product->id,
|
||||||
@@ -2661,9 +2656,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
if (!file_exists($exists_file)
|
if (!file_exists($exists_file)
|
||||||
&& !empty($product->productDownload->display_filename)
|
&& !empty($product->productDownload->display_filename)
|
||||||
&& !empty($product->cache_default_attribute))
|
&& !empty($product->cache_default_attribute))
|
||||||
{
|
|
||||||
$msg = sprintf(Tools::displayError('This file "%s" is missing'), $product->productDownload->display_filename);
|
$msg = sprintf(Tools::displayError('This file "%s" is missing'), $product->productDownload->display_filename);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
$msg = '';
|
$msg = '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user