From dc4c4dffc02a2af5ec96ba26f0fafbd594ca91c5 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Tue, 5 Dec 2017 17:55:53 +0100 Subject: [PATCH] Redirect & confirmation --- modules/fraud/fraud.php | 60 ++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/modules/fraud/fraud.php b/modules/fraud/fraud.php index 193e5fe2..0633c4ae 100755 --- a/modules/fraud/fraud.php +++ b/modules/fraud/fraud.php @@ -68,16 +68,20 @@ class Fraud extends Module { global $currentIndex; - // @todo : Must be exec in postProcess before display if (Tools::getIsset('validFraud')) { + $token = Tools::getValue('token'); $id_order = Tools::getValue('id_order'); if (!FraudCore::validOrder($id_order)) { echo '

'.$this->l('Update impossible').'

'; } else { - echo '

'.$this->l('Valid order with success').'

'; + Tools::redirectAdmin($currentIndex.'&id_order='.$id_order.'&vieworder&hookconf=1&token='.$token); } } + if (Tools::getIsset('hookconf')) { + echo '

'.$this->l('Valid order with success').'

'; + } + $reputation = FraudCore::getReputationOrder((int) $params['id_order']); if ($reputation) { if ($reputation['score'] >= 100) { @@ -118,28 +122,36 @@ class Fraud extends Module
'; - if (Tools::getIsset('validFraud')) { - $id_order = Tools::getValue('id_order'); - if (!FraudCore::validOrder($id_order)) { - $data .= '

'.$this->l('Update impossible').'

'; - } else { - $data .= '

'.$this->l('Valid order with success').'

'; - } - } - if ($reputation['score'] >= 100) { - $info = json_decode($reputation['report']); - $data .= ' - - '.$this->l('Score : ').' '.$reputation['score'].' - -
-

'.$this->l('Details : ').'

-

'.implode('
', $info).'

-
'; - if ($reputation['pass'] == 0) { - $data .= ''.$this->l('Valid Order').''; - } - } + + if (Tools::getIsset('validFraud')) { + $token = Tools::getValue('token'); + $id_order = Tools::getValue('id_order'); + if (!FraudCore::validOrder($id_order)) { + $data .= '

'.$this->l('Update impossible').'

'; + } else { + Tools::redirectAdmin($currentIndex.'&id_order='.$id_order.'&vieworder&hookconf=1&token='.$token); + } + } + + if (Tools::getIsset('hookconf')) { + $data .= '

'.$this->l('Valid order with success').'

'; + } + + if ($reputation['score'] >= 100) { + $info = json_decode($reputation['report']); + $data .= ' + + '.$this->l('Score : ').' '.$reputation['score'].' + +
+

'.$this->l('Details : ').'

+

'.implode('
', $info).'

+
'; + if ($reputation['pass'] == 0) { + $data .= ''.$this->l('Valid Order').''; + } + } + $data .= '
';