// errors translations + some improvements

This commit is contained in:
vChabot
2012-01-10 17:20:00 +00:00
parent 2560f50da8
commit 9db2d67140
4 changed files with 71 additions and 69 deletions
+12 -1
View File
@@ -341,7 +341,10 @@ class CategoryCore extends ObjectModel
foreach ($categories as $id_category)
{
$category = new Category($id_category);
$return &= $category->delete();
if ($category->isRootCategoryForAShop())
return false;
else
$return &= $category->delete();
}
return $return;
}
@@ -1298,5 +1301,13 @@ class CategoryCore extends ObjectModel
WHERE `id_parent` = 0
');
}
public function isRootCategoryForAShop()
{
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_shop`
FROM `'._DB_PREFIX_.'shop`
WHERE `id_category` = '.(int)$this->id);
}
}
+57 -63
View File
@@ -416,40 +416,59 @@ class AdminCategoriesControllerCore extends AdminController
return parent::renderForm();
}
public function postProcess()
public function processAdd($token)
{
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
if (Tools::isSubmit('submitAdd'.$this->table))
$id_category = (int)Tools::getValue('id_category');
$id_parent = (int)Tools::getValue('id_parent');
// if true, we are in a root category creation
if (!$id_parent && !Tools::isSubmit('is_root_category'))
{
$id_category = (int)Tools::getValue('id_category');
$id_parent = (int)Tools::getValue('id_parent');
// if true, we are in a root category creation
if (!$id_parent && !Tools::isSubmit('is_root_category'))
$_POST['id_parent'] = $id_parent = 0;
$_POST['is_root_category'] = 1;
}
if ($id_category)
{
if ($id_category != $id_parent)
{
$_POST['id_parent'] = $id_parent = 0;
$_POST['is_root_category'] = 1;
if (!Category::checkBeforeMove($id_category, $id_parent))
$this->_errors[] = Tools::displayError($this->l('Category cannot be moved here'));
}
if ($id_category)
else
$this->_errors[] = Tools::displayError($this->l('Category cannot be parent of herself.'));
}
parent::processAdd($token);
}
public function processDelete($token)
{
if ($this->tabAccess['delete'] === '1')
{
if (Tools::isSubmit($this->table.'Box'))
{
if ($id_category != $id_parent)
if (isset($_POST[$this->table.'Box']))
{
if (!Category::checkBeforeMove($id_category, $id_parent))
$this->_errors[] = Tools::displayError($this->l('Category cannot be moved here'));
$category = new Category();
$result = true;
$result = $category->deleteSelection(Tools::getValue($this->table.'Box'));
if ($result)
{
$category->cleanPositions((int)Tools::getValue('id_category'));
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCategories').'&id_category='.(int)Tools::getValue('id_category'));
}
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
}
else
$this->_errors[] = Tools::displayError($this->l('Category cannot be parent of herself.'));
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
}
}
/* Delete object */
else if (isset($_GET['delete'.$this->table]))
{
if ($this->tabAccess['delete'] === '1')
else
{
if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings))
{
// check if request at least one object with noZeroObject
if (isset($object->noZeroObject) &&
if ($object->isRootCategoryForAShop())
{
$this->_errors[] = Tools::displayError('You cannot remove this category because a shop uses this category as a root category.');
}// check if request at least one object with noZeroObject
elseif (isset($object->noZeroObject) &&
count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.
$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
@@ -471,50 +490,25 @@ class AdminCategoriesControllerCore extends AdminController
$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 (isset($_GET['position']))
{
if ($this->tabAccess['edit'] !== '1')
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
else if (!Validate::isLoadedObject($object = new Category((int)Tools::getValue($this->identifier, Tools::getValue('id_category_to_move', 1)))))
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.
$this->table.'</b> '.Tools::displayError('(cannot load object)');
if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
$this->_errors[] = Tools::displayError('Failed to update the position.');
else
{
$object->regenerateEntireNtree();
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCategories'));
}
}
/* Delete multiple objects */
else if (Tools::getValue('submitDel'.$this->table))
{
if ($this->tabAccess['delete'] === '1')
{
if (isset($_POST[$this->table.'Box']))
{
$category = new Category();
$result = true;
$result = $category->deleteSelection(Tools::getValue($this->table.'Box'));
if ($result)
{
$category->cleanPositions((int)Tools::getValue('id_category'));
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCategories').'&id_category='.(int)Tools::getValue('id_category'));
}
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
else
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
}
else
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
}
else
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
return;
public function processPosition($token)
{
if ($this->tabAccess['edit'] !== '1')
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
else if (!Validate::isLoadedObject($object = new Category((int)Tools::getValue($this->identifier, Tools::getValue('id_category_to_move', 1)))))
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.
$this->table.'</b> '.Tools::displayError('(cannot load object)');
if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
$this->_errors[] = Tools::displayError('Failed to update the position.');
else
{
$object->regenerateEntireNtree();
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCategories'));
}
parent::postProcess();
}
protected function postImage($id)
@@ -227,6 +227,7 @@ class AdminShopControllerCore extends AdminController
public function afterUpdate($new_shop)
{
$new_shop->updateCategories(Tools::getValue('categoryBox'));
if (Tools::getValue('useImportData') && ($import_data = Tools::getValue('importData')) && is_array($import_data))
$new_shop->copyShopData((int)Tools::getValue('importFromShop'), $import_data);
}
+1 -5
View File
@@ -54,7 +54,6 @@ $_ERRORS['1b073c8ca6b9aabf07935221e17b7c42'] = 'obtenir la liste des paramètres
$_ERRORS['6262d9cbf1b6649b8a9433a0fa2db8e0'] = 'Le dossier de backup n\'existe pas';
$_ERRORS['4e0ac45de6bd848503ffa98ff6247f2f'] = 'Suppression d\'erreur';
$_ERRORS['c1c8a564c10a0efe07bb4e4b20d88cc9'] = 'Identifiant non valide';
$_ERRORS['721b2acc2e54e77e36654bbc42a0747a'] = 'Le système de backup ne gère actuellement que les bases de données MySQL';
$_ERRORS['4eb9ec8ac71ad17fdc99b5371ace9f6e'] = 'Impossible de créer une sauvegarde';
$_ERRORS['58f270b8b462558c757ca28a8094f08f'] = 'Impossible d\'obtenir la description de la table';
$_ERRORS['9b3261577a34cd7c48ad83d80295ff09'] = 'Erreur fatale : pas de transporteur par défaut';
@@ -86,7 +85,6 @@ $_ERRORS['e96841b0cb2396574006c1e17a45abec'] = 'Une erreur est survenue lors de
$_ERRORS['4df3709ec0ff3ceb57341890ccf57641'] = 'Une erreur est survenue pendant la copie de l\'image :';
$_ERRORS['efccf3b0fd1b65f88bd6dfa2821060c8'] = 'uen erreur est survenue pendant la mise à jour du statut';
$_ERRORS['9d35e3b5d28c6a068a6c6856e359b87b'] = 'Thème actuel indisponible. Merci de vérifier le répertoire de votre thème ou ses permissions.';
$_ERRORS['4fc963e213bba362778f5c175eb4d5ff'] = 'AIDE';
$_ERRORS['10f237be40b3205ba97da9b89d290c30'] = 'Impossible de sélectionner la base de données.';
$_ERRORS['f1cdcf26d9787f078f7fc0e0645858d7'] = 'Erreur fatale : Format utf-8 non supporté. Merci de vérifier la configuration de votre serveur.';
$_ERRORS['49bd922182bd3518641589e3077eacd3'] = 'Impossible de se connecter à la base de données.';
@@ -285,6 +283,7 @@ $_ERRORS['996a45aa702d041706f6388d54c53b12'] = 'Commande invalide';
$_ERRORS['31fe542f8c37c61360c21d904e59bf41'] = 'La commande ne peut être renouvelée';
$_ERRORS['3deb828738895a2717cf306362abeca8'] = 'Bon de réduction invalide';
$_ERRORS['47ae969a0bf53f947536844087b17dde'] = 'Impossible d\'ajouter le bon de réduction';
$_ERRORS['df57550d5051bd670c8de245c15a0ad7'] = 'Vous ne pouvez pas supprimer cette catégorie parce qu\'une boutique utilise cette catégorie comme catégorie racine.';
$_ERRORS['2d4aab5065e4f7b78be97f9a6de62a1d'] = 'La categorie CMS ne peut être déplacée ici';
$_ERRORS['1b7e32fd6ed56569d8557947ccf095a6'] = 'Cet état n\'est pas dans ce pays';
$_ERRORS['1839a3d62a613779417d8720d8d7d84a'] = 'Email invalide.';
@@ -397,11 +396,8 @@ $_ERRORS['42c7641733e2026a7baf5d94327fd340'] = 'une erreur est survenue pendant
$_ERRORS['087193a0e83ba92c73396e2e6082ee89'] = 'Selectionnez au moins un module à décrocher';
$_ERRORS['dc4b45d6ded64ffc6cfcec146a2b0bf5'] = 'Contrôlleur introuvable';
$_ERRORS['5421db7177e5dc293af3f2565811888a'] = 'Objets non valides';
$_ERRORS['28b52d39a4166aa0c9b644106d2d405a'] = 'Une erreur s\'est produite lors de la mise à jour de la commande';
$_ERRORS['63db5c2b8986159ee1069488711ccdb0'] = 'Numéro de suivi incorrect';
$_ERRORS['e1e95b3cea70730a922b35808ca3dce3'] = 'Statut de commande invalide';
$_ERRORS['ae831e16712dd5e3b49c1f10c1d4f3c0'] = 'une erreur est survenue lors du changement de statut et/ou de l\'envoi de l\'e-mail au client';
$_ERRORS['d8f4f69d48a199f1c406d3e821b7828a'] = 'une erreur est survenue avant d\'envoyer le message';
$_ERRORS['70f4b635847038d056e33959821a7a66'] = 'caractères max';
$_ERRORS['ddccb08d56c9ba148a1e395c2a0901df'] = 'une erreur est survenue lors de l\'envoi de l\'e-mail au client';
$_ERRORS['ec995e6aa93ad0264c5593d9d76edbe3'] = 'Impossible de générer un remboursement partiel';