actions,$id_demande,0,false)); break; case 'show_dialog': $action=new demandes_actions($id_action,false); ajax_http_send_response(demandes_notes::show_dialog($action->notes, $action->id_action,$action->num_demande,"demandes-show_consult_form")); break; } /* * Affiche le formulaire d'ajout d'un action */ function show_form($id,$type){ global $dbh, $msg; if($type == 'ask'){ $title = $msg['demandes_question_form']; $btn = $msg['demandes_save_question']; } elseif($type == 'info'){ $title = $msg['demandes_info_form']; $btn = $msg['demandes_save_info']; } elseif($type == 'rdv'){ $title = $msg['demandes_rdv_form']; $btn = $msg['demandes_save_rdv']; $date = date('Ymd',time()); $div_date= "
"; } $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, $pmb_type_audit; $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, actions_read_gestion=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, actions_read_gestion=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, actions_read_gestion=1 "; } pmb_mysql_query($req,$dbh); $idaction = pmb_mysql_insert_id(); if($pmb_type_audit) audit::insert_creation(AUDIT_ACTION,$idaction); $dmde_act = new demandes_action($id,$idaction); $display = $dmde_act->getContenuForm(); $update_dmde = "update demandes set dmde_read_gestion='1' where id_demande=".$id; pmb_mysql_query($update_dmde,$dbh); 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 = pmb_mysql_query($req,$dbh); $action = pmb_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, $pmb_type_audit; $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, "; $req .= " notes_read_gestion=1"; pmb_mysql_query($req,$dbh); $req_up = "update demandes_actions set actions_read=1 where id_action='".$idaction."'"; pmb_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); if($pmb_type_audit && $idnote) { audit::insert_modif(AUDIT_NOTE,$idnote); } elseif ($pmb_type_audit && !$idnote){ $idnote = pmb_mysql_insert_id($dbh); audit::insert_creation(AUDIT_NOTE,$idnote); } // création d'une nouvelle note => alerte sur l'action + la demande $req_up1 = "update demandes_actions set actions_read_gestion='1' where id_action='".$idaction."';"; $req_up2= "update demandes inner join demandes_actions on demandes_actions.num_demande = demandes.id_demande set demandes.dmde_read_gestion='1' where demandes_actions.id_action='".$idaction."'"; pmb_mysql_query($req_up1,$dbh); pmb_mysql_query($req_up2,$dbh); ajax_http_send_response($display); } ?>