// normalization / minor fix in php upgrader files

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12519 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2012-01-18 10:02:57 +00:00
parent f0ca064723
commit 8e32a164b2
39 changed files with 583 additions and 224 deletions
+17 -9
View File
@@ -27,6 +27,7 @@
function add_order_state($conf_name, $name, $invoice, $send_email, $color, $unremovable, $logable, $delivery, $template = null)
{
$res = true;
$name_lang = array();
$template_lang = array();
foreach (explode('|', $name) AS $item)
@@ -42,22 +43,29 @@ function add_order_state($conf_name, $name, $invoice, $send_email, $color, $unre
$template_lang[$temp[0]] = $temp[1];
}
Db::getInstance()->execute('
$res &= Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'order_state` (`invoice`, `send_email`, `color`, `unremovable`, `logable`, `delivery`)
VALUES ('.(int)$invoice.', '.(int)$send_email.', \''.pSQL($color).'\', '.(int)$unremovable.', '.(int)$logable.', '.(int)$delivery.')');
VALUES ('.(int)$invoice.', '.(int)$send_email.', "'.$color.'", '.(int)$unremovable.', '.(int)$logable.', '.(int)$delivery.')');
$id_order_state = Db::getInstance()->getValue('
SELECT MAX(`id_order_state`)
FROM `'._DB_PREFIX_.'order_state`
');
FROM `'._DB_PREFIX_.'order_state`');
foreach (Language::getLanguages() AS $lang)
$languages = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'lang`');
foreach ($languages AS $lang)
{
Db::getInstance()->execute('
$iso_code = $lang['iso_code'];
$iso_code_name = isset($name_lang[$iso_code])?$iso_code:'en';
$iso_code_template = isset($template_lang[$iso_code])?$iso_code:'en';
$name = isset($name_lang[$iso_code]) ? $name_lang[$iso_code] : $name_lang['en'];
$template = isset($template_lang[$iso_code]) ? $template_lang[$iso_code] : '';
$res &= Db::getInstance()->execute('
INSERT IGNORE INTO `'._DB_PREFIX_.'order_state_lang` (`id_lang`, `id_order_state`, `name`, `template`)
VALUES ('.(int)$lang['id_lang'].', '.(int)$id_order_state.', \''.pSQL(isset($name_lang[$lang['iso_code']]) ? $name_lang[$lang['iso_code']] : $name_lang['en']).'\', \''.pSQL(isset($template_lang[$lang['iso_code']]) ? $template_lang[$lang['iso_code']] : (isset($template_lang['en']) ? $template_lang['en'] : '')).'\')
VALUES ('.(int)$lang['id_lang'].', '.(int)$id_order_state.', "'. $name .'", "'. $template .'")
');
}
Configuration::updateValue($conf_name, $id_order_state);
}
$res &= Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration`
(name, value) VALUES ("'.$conf_name.'", "'.$id_order_state.'"');
}