// replace $_POST by Tools::getValue

This commit is contained in:
vChabot
2012-02-03 09:32:12 +00:00
parent ef0a90dc96
commit 4aef5a52d8
2 changed files with 10 additions and 5 deletions
+5 -2
View File
@@ -194,12 +194,15 @@ class CategoryCore extends ObjectModel
if ($this->getDuplicatePosition()) if ($this->getDuplicatePosition())
{ {
$assos = array(); $assos = array();
if (isset($_POST['checkBoxShopAsso_category'])) if (Tools::isSubmit('checkBoxShopAsso_category'))
foreach ($_POST['checkBoxShopAsso_category'] as $id_asso_object => $row) {
$check_box = Tools::getValue('checkBoxShopAsso_category');
foreach ($check_box as $id_asso_object => $row)
{ {
foreach ($row as $id_shop => $value) foreach ($row as $id_shop => $value)
$assos[] = array('id_object' => (int)$id_asso_object, 'id_shop' => (int)$id_shop); $assos[] = array('id_object' => (int)$id_asso_object, 'id_shop' => (int)$id_shop);
} }
}
foreach ($assos as $shop) foreach ($assos as $shop)
$this->addPosition(Category::getLastPosition((int)$this->id_parent, $shop['id_shop']), $shop['id_shop']); $this->addPosition(Category::getLastPosition((int)$this->id_parent, $shop['id_shop']), $shop['id_shop']);
} }
+5 -3
View File
@@ -2361,15 +2361,17 @@ class AdminControllerCore extends Controller
return; return;
$assos = array(); $assos = array();
if (isset($_POST['checkBox'.Tools::toCamelCase($type, true).'Asso_'.$table])) if (Tools::isSubmit('checkBox'.Tools::toCamelCase($type, true).'Asso_'.$table))
foreach ($_POST['checkBox'.Tools::toCamelCase($type, true).'Asso_'.$table] as $id_asso_object => $row) {
$check_box = Tools::getValue('checkBox'.Tools::toCamelCase($type, true).'Asso_'.$table);
foreach ($check_box as $id_asso_object => $row)
{ {
if (!(int)$id_asso_object) if (!(int)$id_asso_object)
$id_asso_object = $id_object; $id_asso_object = $id_object;
foreach ($row as $id_shop => $value) foreach ($row as $id_shop => $value)
$assos[] = array('id_object' => (int)$id_asso_object, 'id_'.$type => (int)$id_shop); $assos[] = array('id_object' => (int)$id_asso_object, 'id_'.$type => (int)$id_shop);
} }
}
return array($assos, $type); return array($assos, $type);
} }