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 \n\t\tset contenu='" . $contenu . "',\n\t\tdate_note='" . $date . "',"; if ($idnote) { $req .= "num_note_parent='" . $idnote . "',"; } $req .= " num_action='" . $idaction . "',"; $req .= " notes_num_user='******', 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); }
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 \n\t\tset contenu='" . $contenu . "',\n\t\tdate_note='" . $date . "',"; if ($idnote) { $req .= "num_note_parent='" . $idnote . "',"; } $req .= " num_action='" . $idaction . "',"; $req .= " notes_num_user='******', 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); }