Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
+1
-1
@@ -111,7 +111,7 @@ class SearchCore
|
|||||||
$string = preg_replace('/[^\s]-+/', '', $string);
|
$string = preg_replace('/[^\s]-+/', '', $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
$blacklist = Configuration::get('PS_SEARCH_BLACKLIST', $id_lang);
|
$blacklist = Tools::strtolower(Configuration::get('PS_SEARCH_BLACKLIST', $id_lang));
|
||||||
if (!empty($blacklist))
|
if (!empty($blacklist))
|
||||||
{
|
{
|
||||||
$string = preg_replace('/(?<=\s)('.$blacklist.')(?=\s)/Su', '', $string);
|
$string = preg_replace('/(?<=\s)('.$blacklist.')(?=\s)/Su', '', $string);
|
||||||
|
|||||||
@@ -277,127 +277,128 @@ class AdminLanguagesControllerCore extends AdminController
|
|||||||
return parent::renderForm();
|
return parent::renderForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postProcess()
|
public function processDelete()
|
||||||
{
|
{
|
||||||
if (isset($_GET['delete'.$this->table]))
|
$object = $this->loadObject();
|
||||||
{
|
if (!$this->checkDeletion($object))
|
||||||
if ($this->tabAccess['delete'] === '1')
|
return false;
|
||||||
{
|
if (!$this->deleteNoPictureImages((int)$object->id))
|
||||||
if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings))
|
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> ';
|
||||||
{
|
|
||||||
if ($object->id == Configuration::get('PS_LANG_DEFAULT'))
|
|
||||||
$this->errors[] = $this->l('You cannot delete the default language.');
|
|
||||||
else if ($object->id == $this->context->language->id)
|
|
||||||
$this->errors[] = $this->l('You cannot delete the language currently in use. Please change languages before deleting.');
|
|
||||||
else if ($this->deleteNoPictureImages((int)Tools::getValue('id_lang')) && $object->delete())
|
|
||||||
{
|
|
||||||
$this->checkEmployeeIdLang($object->id);
|
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
return parent::processDelete();
|
||||||
else
|
}
|
||||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.
|
|
||||||
Tools::displayError('(cannot load object)');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
|
||||||
}
|
|
||||||
else if (Tools::getValue('submitDel'.$this->table) && isset($_POST[$this->table.'Box']))
|
|
||||||
{
|
|
||||||
if ($this->tabAccess['delete'] === '1')
|
|
||||||
{
|
|
||||||
if (in_array(Configuration::get('PS_LANG_DEFAULT'), $_POST[$this->table.'Box']))
|
|
||||||
$this->errors[] = $this->l('You cannot delete the default language.');
|
|
||||||
else if (in_array($this->context->language->id, $_POST[$this->table.'Box']))
|
|
||||||
$this->errors[] = $this->l('You cannot delete the language currently in use. Please change languages before deleting.');
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach ($_POST[$this->table.'Box'] as $language)
|
|
||||||
$this->deleteNoPictureImages($language);
|
|
||||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
|
||||||
$this->checkEmployeeIdLang($object->id);
|
|
||||||
parent::postProcess();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
|
||||||
}
|
|
||||||
else if (Tools::isSubmit('submitAddlang'))
|
|
||||||
{
|
|
||||||
/* New language */
|
|
||||||
if ((int)Tools::getValue('id_'.$this->table) == 0)
|
|
||||||
{
|
|
||||||
if ($this->tabAccess['add'] === '1')
|
|
||||||
{
|
|
||||||
if (isset($_POST['iso_code']) && !empty($_POST['iso_code']) && Validate::isLanguageIsoCode(Tools::getValue('iso_code')) && Language::getIdByIso($_POST['iso_code']))
|
|
||||||
$this->errors[] = Tools::displayError('This ISO code is already linked to another language.');
|
|
||||||
if ((!empty($_FILES['no-picture']['tmp_name']) || !empty($_FILES['flag']['tmp_name'])) && Validate::isLanguageIsoCode(Tools::getValue('iso_code')))
|
|
||||||
{
|
|
||||||
if ($_FILES['no-picture']['error'] == UPLOAD_ERR_OK)
|
|
||||||
$this->copyNoPictureImage(strtolower(Tools::getValue('iso_code')));
|
|
||||||
// class AdminTab deal with every $_FILES content, don't do that for no-picture
|
|
||||||
unset($_FILES['no-picture']);
|
|
||||||
parent::postProcess();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->validateRules();
|
|
||||||
$this->errors[] = Tools::displayError('Flag and "No picture" image fields are required.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
|
||||||
}
|
|
||||||
/* Language edition */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($this->tabAccess['edit'] === '1')
|
|
||||||
{
|
|
||||||
if (( isset($_FILES['no-picture']) && !$_FILES['no-picture']['error'] || isset($_FILES['flag']) && !$_FILES['flag']['error'])
|
|
||||||
&& Validate::isLanguageIsoCode(Tools::getValue('iso_code')))
|
|
||||||
{
|
|
||||||
if ($_FILES['no-picture']['error'] == UPLOAD_ERR_OK)
|
|
||||||
$this->copyNoPictureImage(strtolower(Tools::getValue('iso_code')));
|
|
||||||
// class AdminTab deal with every $_FILES content, don't do that for no-picture
|
|
||||||
unset($_FILES['no-picture']);
|
|
||||||
parent::postProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Validate::isLoadedObject($object = $this->loadObject()))
|
protected function processBulkDelete()
|
||||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
{
|
||||||
if ((int)$object->id == (int)Configuration::get('PS_LANG_DEFAULT') && (int)$_POST['active'] != (int)$object->active)
|
$can_bulk = true;
|
||||||
$this->errors[] = Tools::displayError('You cannot change the status of the default language.');
|
if (is_array($this->boxes) && !empty($this->boxes))
|
||||||
else
|
{
|
||||||
parent::postProcess();
|
foreach ($this->boxes as $id_lang)
|
||||||
|
{
|
||||||
$this->validateRules();
|
$object = new Language((int)$id_lang);
|
||||||
|
if (!$this->checkDeletion($object))
|
||||||
|
return false;
|
||||||
|
if (!$this->deleteNoPictureImages((int)$object->id))
|
||||||
|
{
|
||||||
|
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> ';
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isset($_GET['status'.$this->table]) && isset($_GET['id_lang']))
|
return parent::processBulkDelete();
|
||||||
{
|
}
|
||||||
if ($this->tabAccess['edit'] === '1')
|
|
||||||
{
|
|
||||||
if (!Validate::isLoadedObject($object = $this->loadObject()))
|
|
||||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
|
||||||
if ((int)$object->id == (int)Configuration::get('PS_LANG_DEFAULT'))
|
|
||||||
$this->errors[] = Tools::displayError('You cannot change the status of the default language.');
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Validate::isLoadedObject($object))
|
|
||||||
$this->checkEmployeeIdLang($object->id);
|
|
||||||
return parent::postProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
protected function checkDeletion($object)
|
||||||
|
{
|
||||||
|
if (Validate::isLoadedObject($object))
|
||||||
|
{
|
||||||
|
if ($object->id == Configuration::get('PS_LANG_DEFAULT'))
|
||||||
|
$this->errors[] = $this->l('You cannot delete the default language.');
|
||||||
|
elseif ($object->id == $this->context->language->id)
|
||||||
|
$this->errors[] = $this->l('You cannot delete the language currently in use. Please change languages before deleting.');
|
||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return parent::postProcess();
|
$this->errors[] = Tools::displayError('(cannot load object)');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkDisableStatus($object)
|
||||||
|
{
|
||||||
|
if (!Validate::isLoadedObject($object))
|
||||||
|
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($object->id == (int)Configuration::get('PS_LANG_DEFAULT'))
|
||||||
|
$this->errors[] = Tools::displayError('You cannot change the status of the default language.');
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processStatus()
|
||||||
|
{
|
||||||
|
$object = $this->loadObject();
|
||||||
|
if ($this->checkDisableStatus($object))
|
||||||
|
{
|
||||||
|
$this->checkEmployeeIdLang($object->id);
|
||||||
|
return parent::processStatus();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function processBulkDisableSelection()
|
||||||
|
{
|
||||||
|
if (is_array($this->boxes) && !empty($this->boxes))
|
||||||
|
{
|
||||||
|
foreach ($this->boxes as $id_lang)
|
||||||
|
{
|
||||||
|
$object = new Language((int)$id_lang);
|
||||||
|
if (!$this->checkDisableStatus($object))
|
||||||
|
return false;
|
||||||
|
$this->checkEmployeeIdLang($object->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parent::processBulkDisableSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processAdd()
|
||||||
|
{
|
||||||
|
if (isset($_POST['iso_code']) && !empty($_POST['iso_code']) && Validate::isLanguageIsoCode(Tools::getValue('iso_code')) && Language::getIdByIso($_POST['iso_code']))
|
||||||
|
$this->errors[] = Tools::displayError('This ISO code is already linked to another language.');
|
||||||
|
if ((!empty($_FILES['no-picture']['tmp_name']) || !empty($_FILES['flag']['tmp_name'])) && Validate::isLanguageIsoCode(Tools::getValue('iso_code')))
|
||||||
|
{
|
||||||
|
if ($_FILES['no-picture']['error'] == UPLOAD_ERR_OK)
|
||||||
|
$this->copyNoPictureImage(strtolower(Tools::getValue('iso_code')));
|
||||||
|
unset($_FILES['no-picture']);
|
||||||
|
return parent::processAdd();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->errors[] = Tools::displayError('Flag and "No picture" image fields are required.');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processUpdate()
|
||||||
|
{
|
||||||
|
if (( isset($_FILES['no-picture']) && !$_FILES['no-picture']['error'] || isset($_FILES['flag']) && !$_FILES['flag']['error'])
|
||||||
|
&& Validate::isLanguageIsoCode(Tools::getValue('iso_code')))
|
||||||
|
{
|
||||||
|
if ($_FILES['no-picture']['error'] == UPLOAD_ERR_OK)
|
||||||
|
$this->copyNoPictureImage(strtolower(Tools::getValue('iso_code')));
|
||||||
|
// class AdminTab deal with every $_FILES content, don't do that for no-picture
|
||||||
|
unset($_FILES['no-picture']);
|
||||||
|
}
|
||||||
|
$object = $this->loadObject();
|
||||||
|
if (Tools::getValue('active') != (int)$object->active)
|
||||||
|
if (!$this->checkDisableStatus($object))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$this->checkEmployeeIdLang($object->id);
|
||||||
|
return parent::processUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -515,21 +516,4 @@ class AdminLanguagesControllerCore extends AdminController
|
|||||||
//update employee lang if current id lang is disabled
|
//update employee lang if current id lang is disabled
|
||||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'employee` set `id_lang`='.(int)Configuration::get('PS_LANG_DEFAULT').' WHERE `id_lang`='.(int)$current_id_lang);
|
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'employee` set `id_lang`='.(int)Configuration::get('PS_LANG_DEFAULT').' WHERE `id_lang`='.(int)$current_id_lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processBulkStatusSelection($status)
|
|
||||||
{
|
|
||||||
if (!$status)//only check if status == 0 (disable)
|
|
||||||
{
|
|
||||||
if (is_array($this->boxes) && !empty($this->boxes))
|
|
||||||
foreach ($this->boxes as $id)
|
|
||||||
if (Configuration::get('PS_LANG_DEFAULT') == $id)
|
|
||||||
$this->errors[] = $this->l('You cannot change the status of the default language.');
|
|
||||||
if (!count($this->errors))
|
|
||||||
parent::processBulkStatusSelection($status);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
parent::processBulkStatusSelection($status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
Context::getContext()->language = new Language(Configuration::get('PS_LANG_DEFAULT'));
|
Context::getContext()->language = new Language(Configuration::get('PS_LANG_DEFAULT'));
|
||||||
Context::getContext()->country = new Country('PS_COUNTRY_DEFAULT');
|
Context::getContext()->country = new Country('PS_COUNTRY_DEFAULT');
|
||||||
Context::getContext()->cart = new Cart();
|
Context::getContext()->cart = new Cart();
|
||||||
|
Context::getContext()->employee = new Employee(1);
|
||||||
define('_PS_SMARTY_FAST_LOAD_', true);
|
define('_PS_SMARTY_FAST_LOAD_', true);
|
||||||
require_once _PS_ROOT_DIR_.'/config/smarty.config.inc.php';
|
require_once _PS_ROOT_DIR_.'/config/smarty.config.inc.php';
|
||||||
|
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ $(document).ready(function() {
|
|||||||
<h3>{l s='Tax identification'}</h3>
|
<h3>{l s='Tax identification'}</h3>
|
||||||
<p class="required text">
|
<p class="required text">
|
||||||
<label for="dni">{l s='Identification number'}</label>
|
<label for="dni">{l s='Identification number'}</label>
|
||||||
<input type="text" class="text" name="dni" id="dni" value="{if isset($smarty.post.dni)}{$smarty.post.dni}{/if} "/>
|
<input type="text" class="text" name="dni" id="dni" value="{if isset($smarty.post.dni)}{$smarty.post.dni}{/if}" />
|
||||||
<span class="form_info">{l s='DNI / NIF / NIE'}</span>
|
<span class="form_info">{l s='DNI / NIF / NIE'}</span>
|
||||||
</p>
|
</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -345,7 +345,7 @@ $(document).ready(function() {
|
|||||||
<p class="cart_navigation required submit">
|
<p class="cart_navigation required submit">
|
||||||
<span><sup>*</sup>{l s='Required field'}</span>
|
<span><sup>*</sup>{l s='Required field'}</span>
|
||||||
<input type="hidden" name="display_guest_checkout" value="1" />
|
<input type="hidden" name="display_guest_checkout" value="1" />
|
||||||
<input type="submit" class="exclusive" name="submitGuestAccount" id="submitGuestAccount" value="{l s='Continue'} "/>
|
<input type="submit" class="exclusive" name="submitGuestAccount" id="submitGuestAccount" value="{l s='Continue'}" />
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user