$req->execute();
    $data = $req->fetch();
    $req = $bdd->prepare("INSERT INTO historique_contrat (histo_contrat, histo_titre, histo_desc, histo_demandeur, histo_prestataire, histo_date_deb, histo_date_fin, histo_theme, histo_montant, histo_competences)\n                              VALUES (:cid, :titre, :desc, :demandeur, :prestataire, :datedeb, :datefin, :theme, :montant, :competences)");
    $req->bindParam(":cid", $data['contrat_id']);
    $req->bindParam(":titre", $data['contrat_titre']);
    $req->bindParam(":desc", $data['contrat_description']);
    $req->bindParam(":demandeur", $data['contrat_auteur']);
    $req->bindParam(":prestataire", $data['prop_user']);
    $req->bindParam(":datedeb", $data['contrat_debut_reel']);
    $req->bindParam(":datefin", $data['contrat_fin_reelle']);
    $req->bindParam(":theme", $data['contrat_theme']);
    $req->bindParam(":montant", $data['contrat_montant']);
    $req->bindParam(":competences", $data['contrat_competences']);
    $req->execute();
    // On archive aussi la conversation de ce contrat
    archiverConversation($_GET['c']);
    $req = $bdd->prepare("DELETE FROM contrat WHERE contrat_id = :cid AND contrat_etat = 2");
    $req->bindParam(":cid", $data['contrat_id']);
    $req->execute();
    header("location:index.php");
} else {
    header("location:index.php");
}
function archiverConversation($cid)
{
    require_once "inc/bd/bdd.php";
    $bdd = bdd();
    // On récupère les messages de la conversation
    $req = $bdd->prepare("SELECT * FROM messagerie WHERE message_contrat = :contrat");
    $req->bindParam(":contrat", $cid);
    $req->execute();
Exemple #2
0
				case 'getConversations' : 
					$data["conversations"] = listerConversations();
				break;

				case 'activer' :
				if ($idConv = valider("idConv"))
				{	
					reactiverConversation($idConv);
					// msg par défaut
				}
				break;

				case 'archiver' :
				if ($idConv = valider("idConv"))
				{	
					archiverConversation($idConv);
					// msg par défaut
				}
				break;

				case 'setConversation' :
				if ($theme = valider("theme"))
				{	
					$data["idConv"] = creerConversation($theme);	
					// msg par défaut
				}
				break;

				case 'delConversation' :
				if ($idConv = valider("idConv"))
				{