/**
  * @name majTotalReservation($pIdDetailCommande)
  * @param integer
  * @desc Met à jour le montant du détails des opérations et des opérations de réservation en fonction des valeurs du lot
  */
 public static function majTotalReservation($pIdDetailCommande)
 {
     // Initialisation du Logger
     $lLogger =& Log::singleton('file', CHEMIN_FICHIER_LOGS);
     $lLogger->setMask(Log::MAX(LOG_LEVEL));
     $lRequete1 = "UPDATE " . DetailOperationManager::TABLE_DETAILOPERATION . " a\n\t\t\tSET " . DetailOperationManager::CHAMP_DETAILOPERATION_MONTANT . " = ( SELECT round(" . StockManager::CHAMP_STOCK_QUANTITE . " * " . DetailCommandeManager::CHAMP_DETAILCOMMANDE_PRIX . " / " . DetailCommandeManager::CHAMP_DETAILCOMMANDE_TAILLE . ", 2)\n\t\t\tFROM " . DetailCommandeManager::TABLE_DETAILCOMMANDE . "\n\t\t\tJOIN " . StockManager::TABLE_STOCK . "\n\t\t\t\tON " . StockManager::CHAMP_STOCK_TYPE . " = 0 \n\t\t\t\tAND " . StockManager::CHAMP_STOCK_ID_DETAIL_COMMANDE . " = " . DetailCommandeManager::CHAMP_DETAILCOMMANDE_ID . "\n\t\t\tWHERE " . DetailCommandeManager::CHAMP_DETAILCOMMANDE_ID . " = '" . StringUtils::securiser($pIdDetailCommande) . "'\n\t\t\t\tAND a." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_DETAIL_COMMANDE . " = " . DetailCommandeManager::CHAMP_DETAILCOMMANDE_ID . "\n\t\t\t\tAND a." . DetailOperationManager::CHAMP_DETAILOPERATION_TYPE_PAIEMENT . " = 0\n\t\t\t\tAND a." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_OPERATION . " = " . StockManager::CHAMP_STOCK_ID_OPERATION . ")\n\t\t\t\n\t\t\tWHERE exists (\n\t\t\t    SELECT 1\n\t\t\tFROM " . DetailCommandeManager::TABLE_DETAILCOMMANDE . "\n\t\t\tJOIN " . StockManager::TABLE_STOCK . "\n\t\t\t\tON " . StockManager::CHAMP_STOCK_TYPE . " = 0 \n\t\t\t\tAND " . StockManager::CHAMP_STOCK_ID_DETAIL_COMMANDE . " = " . DetailCommandeManager::CHAMP_DETAILCOMMANDE_ID . "\n\t\t\tWHERE " . DetailCommandeManager::CHAMP_DETAILCOMMANDE_ID . " = '" . StringUtils::securiser($pIdDetailCommande) . "'\n\t\t\tAND a." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_DETAIL_COMMANDE . " = " . DetailCommandeManager::CHAMP_DETAILCOMMANDE_ID . "\n\t\t\tAND a." . DetailOperationManager::CHAMP_DETAILOPERATION_TYPE_PAIEMENT . " = 0\n\t\t\tAND a." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_OPERATION . " = " . StockManager::CHAMP_STOCK_ID_OPERATION . ");";
     $lRequete2 = "\r\n\t\t\tCREATE TEMPORARY table TMP_1\r\n\t\t\t\tSELECT b." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_OPERATION . ", sum(b." . DetailOperationManager::CHAMP_DETAILOPERATION_MONTANT . ") as " . DetailOperationManager::CHAMP_DETAILOPERATION_MONTANT . "\n\t\t\t\tFROM " . DetailOperationManager::TABLE_DETAILOPERATION . " a\r\n\t\t\t\tJOIN " . DetailOperationManager::TABLE_DETAILOPERATION . " b \n\t\t\t\t\tON a." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_OPERATION . " = b." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_OPERATION . "\r\n\t\t\t\tAND b." . DetailOperationManager::CHAMP_DETAILOPERATION_TYPE_PAIEMENT . " = 0\r\n\t\t\t\twhere a." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_DETAIL_COMMANDE . " = '" . StringUtils::securiser($pIdDetailCommande) . "'\r\n\t\t\t\tAND a." . DetailOperationManager::CHAMP_DETAILOPERATION_TYPE_PAIEMENT . " = 0\r\n\t\t\t\tgroup by b." . DetailOperationManager::CHAMP_DETAILOPERATION_ID_OPERATION . ";";
     $lRequete3 = "\r\n\t\t\tCREATE TEMPORARY table TMP_2\r\n\t\t\tSELECT * FROM TMP_1;";
     $lRequete4 = "\r\n\t\t\tUPDATE " . OperationManager::TABLE_OPERATION . " a\r\n\t\t\tSET " . OperationManager::CHAMP_OPERATION_MONTANT . " = ( SELECT " . DetailOperationManager::CHAMP_DETAILOPERATION_MONTANT . " FROM TMP_1 WHERE a." . OperationManager::CHAMP_OPERATION_ID . " = " . DetailOperationManager::CHAMP_DETAILOPERATION_ID_OPERATION . " )\r\n\t\t\tWHERE exists (SELECT 1 FROM TMP_2 WHERE a." . OperationManager::CHAMP_OPERATION_ID . " = " . DetailOperationManager::CHAMP_DETAILOPERATION_ID_OPERATION . " );";
     $lLogger->log("Execution de la requete : " . $lRequete1 . " " . $lRequete2 . " " . $lRequete3 . " " . $lRequete4, PEAR_LOG_DEBUG);
     // Maj des logs
     return Dbutils::executerRequetesMultiples(array($lRequete1, $lRequete2, $lRequete3, $lRequete4));
 }