예제 #1
0
        $idFournisseur = htmlentities($_POST['idFournisseur']);
        $idProjet = htmlentities($_POST['idProjet']);
        $dateCommande = htmlentities($_POST['dateCommande']);
        $numeroCommande = htmlentities($_POST['numeroCommande']);
        $designation = htmlentities($_POST['designation']);
        $status = 0;
        $codeLivraison = uniqid() . date('YmdHis');
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //these next data are used to know the month and the year of a supply demand
        $mois = date('m', strtotime($dateCommande));
        $annee = date('Y', strtotime($dateCommande));
        //create object
        $commande = new Commande(array('idFournisseur' => $idFournisseur, 'idProjet' => $idProjet, 'dateCommande' => $dateCommande, 'numeroCommande' => $numeroCommande, 'designation' => $designation, 'status' => $status, 'codeLivraison' => $codeLivraison, 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $commandeManager->add($commande);
        $actionMessage = "Opération Valide : Commande Ajouté(e) avec succès.";
        $typeMessage = "success";
        $redirectLink = "Location:../commande-details-iaaza.php?codeCommande=" . $codeLivraison . "&mois=" . $mois . "&annee=" . $annee;
    } else {
        if (isset($_POST['source']) and $_POST['source'] == "commande-group-iaaza") {
            $redirectLink = "Location:../commande-group-iaaza.php";
        }
        $actionMessage = "Erreur Ajout commande : Vous devez remplir le champ 'Numéro Commande'.";
        $typeMessage = "error";
    }
} else {
    if ($action == "update") {
        $idCommande = htmlentities($_POST['idCommande']);
        $codeCommande = htmlentities($_POST['codeCommande']);
        $mois = $_POST['mois'];