";
}
$display .= "
".$title."
";
if($div_date) $display .= $div_date;
$display .="
";
ajax_http_send_response($display);
}
/*
* Enregistrement de la nouvelle action question/réponse
*/
function save_ask($id,$type){
global $dbh, $sujet, $detail, $date_rdv,$id_empr;
$date = date("Y-m-d",time());
if($type=='ask'){
$req = "insert into demandes_actions set
sujet_action = '".$sujet."',
detail_action = '".$detail."',
date_action = '".$date."',
deadline_action = '".$date."',
type_action=1,
statut_action=1,
num_demande = '".$id."',
actions_num_user ='".$id_empr."',
actions_type_user=1,
actions_read=1
";
} elseif($type=='info'){
$req = "insert into demandes_actions set
sujet_action = '".$sujet."',
detail_action = '".$detail."',
date_action = '".$date."',
deadline_action = '".$date."',
type_action=3,
statut_action=1,
num_demande = '".$id."',
actions_num_user ='".$id_empr."',
actions_type_user=1,
actions_read=1
";
} elseif($type=='rdv'){
$req = "insert into demandes_actions set
sujet_action = '".$sujet."',
detail_action = '".$detail."',
date_action = '".$date_rdv."',
deadline_action = '".$date_rdv."',
type_action=4,
statut_action=2,
num_demande = '".$id."',
actions_num_user ='".$id_empr."',
actions_type_user=1 ,
actions_read=1
";
}
mysql_query($req,$dbh);
$idaction = mysql_insert_id();
$dmde_act = new demandes_action($id,$idaction);
$display = $dmde_act->getContenuForm();
ajax_http_send_response($display);
}
/*
* Ajouter une note à une action
*/
function add_note(){
global $msg,$dbh, $id_action;
$req = "select type_action from demandes_actions where id_action='".$id_action."'";
$res = mysql_query($req,$dbh);
$action = mysql_fetch_object($res);
if($action->type_action == '1'){
$titre = $msg['demandes_notes_question_form'];
} else $titre = $msg['demandes_notes_form'];
$display .= "
".$titre."
";
ajax_http_send_response($display);
}
/*
* Enregistrer la note
*/
function save_note($idaction, $idnote=0, $id_demande=0){
global $contenu,$dbh, $charset, $id_empr;
global $demandes_email_demandes;
$date = date("Y-m-d",time());
$req = " insert into demandes_notes
set contenu='".$contenu."',
date_note='".$date."',";
if($idnote) $req .= "num_note_parent='".$idnote."',";
$req .= " num_action='".$idaction."',";
$req .= " notes_num_user='".$id_empr."', notes_type_user=1 ";
mysql_query($req,$dbh);
$req_up = "update demandes_actions set actions_read=1 where id_action='".$idaction."'";
mysql_query($req_up,$dbh);
$dmde_act = new demandes_action($id_demande,$idaction);
$display = $dmde_act->getContenuForm();
if ($demandes_email_demandes) $dmde_act->send_alert_by_mail($id_empr,$idnote);
ajax_http_send_response($display);
}
?>