/** * gets all reevaluations for the shop specified and updates orders in Certissim table * * @param mixed $id_shop, id_shop of the shop concerned, or null if no shop concerned particularly (PS 1.4 or multishop not available) */ private function getReevaluations($id_shop = null) { //initializes Certissim for the shop specified (id or null) $sac = new CertissimSac($id_shop); //gets all the reevaulations $stack = $sac->getAlert('new'); $reevals = new CertissimResultResponse($stack->getXML()); CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, $reevals->returnCount() . " réévaluations trouvées."); //log //for each reevaluation found foreach ($reevals->getTransactions() as $transaction) { //update of the order in Certissim table $sql = "UPDATE `" . _DB_PREFIX_ . Fianetfraud::CERTISSIM_ORDER_TABLE_NAME . "`\n\t\t\t\tSET `avancement`='" . pSQL($transaction->returnAvancement()) . "', `date`='" . pSQL($transaction->getEvalDate()) . "', `score`='" . pSQL($transaction->getEval()) . "', `detail`='" . pSQL($transaction->getDetail()) . "', `profil`='" . pSQL($transaction->getEvalInfo()) . "'\n\t\t\t\tWHERE `id_order`=" . $transaction->returnRefid(); $update = Db::getInstance()->execute($sql); fianetfraud::switchOrderToState($transaction->returnRefid(), 'scored'); //log insert result if (!$update) { CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, 'Erreur de mise à jour de la commande ' . $transaction->returnRefid() . ' : ' . Db::getInstance()->getMsgError()); } else { CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, 'Commande ' . $transaction->returnRefid() . ' réévaluée.'); } } }