'; // Verifier si on a un rapport $rapports = Doctrine_Query::create() ->from('Report') ->where('identifier = ?', $identifier) ->execute(); if ($rapports != false && count($rapports) > 0) { // Nouvelle commande $commande = new Commandes(); $commande->prix = Doctrine_Query::create() ->select('p.immediate') ->from('Price p') ->leftJoin('p.Country c') ->where('c.graydon_country = ?', $pays) ->fetchOne(); $commande->servicespeed = 'Immediate'; $commande->orderstate = 'Delivered'; $commande->dateordered = date('Y-m-d'); $commande->datecompleted = $commande->dateordered; $commande->datedue = $commande->dateordered; $commande->companyproductidentifier = $pidentifier; list($dummy, $session_id, $transaction_identifier) = explode(':', $commande->companyproductidentifier); $commande->sessionid = $session_id; $commande->transactionidentifier = $transaction_identifier; $commande->user = $login; $commande->mode = $mode; $commande->Country = Doctrine_Query::create() ->from('Country') ->where('graydon_country = ?', $pays) ->fetchOne(); $commande->save(); // Detail de la commande $commandesDetail = new CommandesDetail(); $commandesDetail->eName = $name; $commandesDetail->eIdentifiers = $identifier; $commandesDetail->ePays = $pays; $commandesDetail->commandes_id = $commande->id; $commandesDetail->eCreditOpinionCurrency = 'EUR'; $commandesDetail->save(); // Copie des rapports $i = count($rapports); $f = array(); while ($i > 0) { --$i; // Copie du rapport pour la nouvelle commande if (isset($f[$rapports[$i]->format]) == true) { continue; } $rapport = new Report(); $rapport->identifier = $rapports[$i]->identifier; $rapport->name = $rapports[$i]->name; $rapport->content = $rapports[$i]->content; $rapport->format = $rapports[$i]->format; $rapport->order_id = $commande->id; $rapport->save(); $f[$rapports[$i]->format] = true; } $commande_id = $commande->id; } else { $commande_id = getIdentite($identifier, $pidentifier); } if ($commande_id > 0) { header('Location: ?page=international_commandes&id='.$commande_id); print 'Veuillez suivre ce lien'; } print ''; ?>