コード例 #1
0
 //if the client exists in the database, and we get its information from the clients-add.php file
 //we just are going to send its informations to the next url : contrats-add.php
 if (!empty($_POST['idClient'])) {
     $idClient = htmlentities($_POST['idClient']);
     $client = $clientManager->getClientById($idClient);
     $codeClient = $client->code();
     $actionMessage = "<strong>Opération Valide : </strong>Client Récuperé avec succès.";
     $typeMessage = "info";
     $redirectLink = 'Location:../contrats-add.php?idProjet=' . $idProjet . '&codeClient=' . $codeClient;
 } else {
     if (empty($_POST['idClient'])) {
         //Case 1 :  if we tray to force the creation of an existing customer
         //we get an error message indicating that we do have a customer with that name
         if (!empty($_POST['cin'])) {
             $cin = htmlentities($_POST['cin']);
             if ($clientManager->existsCIN($cin)) {
                 $actionMessage = "<strong>Erreur Création Client : </strong>Un client existe déjà avec ce CIN : <strong>" . $cin . "</strong>.";
                 $typeMessage = "error";
                 $redirectLink = 'Location:../clients-add.php?idProjet=' . $idProjet;
             } else {
                 //input posts processing
                 $nom = htmlentities($_POST['nom']);
                 $nomArabe = htmlentities($_POST['nomArabe']);
                 $adresse = htmlentities($_POST['adresse']);
                 $adresseArabe = htmlentities($_POST['adresseArabe']);
                 $telephone1 = htmlentities($_POST['telephone1']);
                 $telephone2 = htmlentities($_POST['telephone2']);
                 $email = htmlentities($_POST['email']);
                 $codeClient = uniqid() . date('YmdHis');
                 $created = date('Y-m-d h:i:s');
                 $createdBy = $_SESSION['userMerlaTrav']->login();