Merge branch 'fix-updateStateWhenOrderManuallyValidation' into develop

This commit is contained in:
Marion Muszynski 2016-12-02 10:46:10 +01:00
commit 9194612e04
2 changed files with 52 additions and 38 deletions

View File

@ -30,7 +30,7 @@ function getCategories()
$id_sale = (int)Tools::getValue('sale', false);
if (!$id_sale) {
http_response_code(500);
http_response_code(404);
return Tools::displayError('Catégorie invalide');
}
@ -49,12 +49,12 @@ function getProductId()
$ean = (float)Tools::getValue('ean', false);
if (!$ean) {
http_response_code(500);
http_response_code(404);
return Tools::displayError('Code EAN invalide');
}
if (!is_float($ean)) {
http_response_code(500);
http_response_code(404);
return Tools::displayError('Code EAN invalide');
}
@ -146,7 +146,7 @@ function getProductId()
}
return $result;
} else {
http_response_code(500);
http_response_code(404);
return Tools::displayError('Aucun produit trouvé');
}
}
@ -155,31 +155,31 @@ function addToSellout()
{
$parent_category = (int)Tools::getValue('parent_category', false);
if (!$parent_category || !is_int($parent_category)) {
http_response_code(500);
http_response_code(404);
return Tools::displayError('La catégorie principale n\'est pas valide');
}
$category = (int)Tools::getValue('category', false);
if (!$category || !is_int($category)) {
http_response_code(500);
http_response_code(404);
return Tools::displayError('La catégorie n\'est pas valide');
}
$product_id = (int)Tools::getValue('product', false);
if (!$product_id || !is_int($product_id)) {
http_response_code(500);
http_response_code(404);
return Tools::displayError('Le produit n\'est pas valide');
}
$quantity = (int)Tools::getValue('quantity', false);
if (!$quantity || !is_int($quantity)) {
http_response_code(500);
http_response_code(404);
return Tools::displayError('La quantitée n\'est pas valide');
}
$storage = Tools::getValue('storage');
if (empty($storage)) {
http_response_code(500);
http_response_code(404);
return Tools::displayError('L\'emplacement n\'est pas valide');
}

View File

@ -313,6 +313,20 @@ class FraudCore {
WHERE `id_order` = '. (int)$id_order
.' AND `id_order_state` = 18'
);
$id_order_state = $order->getCurrentState();
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'order_state_current`
VALUES (
'.(int) $id_order.',
'.(int) $id_order_state.',
NOW()
)
ON DUPLICATE KEY UPDATE
`id_order_state` = '.(int) $id_order_state.',
`date_upd` = NOW()
');
return TRUE;
} else {
return FALSE;