[*] BO : you can now affect a zone to multiple countries and to multiple states

This commit is contained in:
vChabot
2011-12-02 15:41:05 +00:00
parent 1e1eec8f8d
commit 375ca90e6e
10 changed files with 303 additions and 9 deletions
+14
View File
@@ -200,5 +200,19 @@ class StateCore extends ObjectModel
FROM `'._DB_PREFIX_.'state`
WHERE `id_state` = '.(int)($id_state));
}
/**
* @param $ids_states
* @param $id_zone
* @return bool
*/
public function affectZoneToSelection($ids_states, $id_zone)
{
// cast every array values to int (security)
$ids_states = array_map('intval', $ids_states);
return Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'state` SET `id_zone` = '.(int)$id_zone.' WHERE `id_state` IN ('.implode(',', $ids_states).')
');
}
}