// +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: notes_ajax.inc.php,v 1.5 2015-05-20 14:39:30 dgoron Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once "{$class_path}/demandes_actions.class.php"; require_once "{$class_path}/demandes_notes.class.php"; require_once "{$class_path}/demandes.class.php"; require_once "{$include_path}/templates/demandes_notes.tpl.php"; switch ($quoifaire) { 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", true)); break; case 'change_read_note': $tab = json_decode(stripslashes($tab), true); $note = new demandes_notes($tab["id_note"], false); demandes_notes::change_read($note, "_gestion"); ajax_http_send_response(demandes_notes::note_majParent($tab["id_note"], $tab["id_action"], $tab["id_demande"], "_gestion")); break; case 'final_response': $tab = json_decode(stripslashes($tab), true); $note = new demandes_notes($tab["id_note"], false); $f_message = addslashes($note->contenu); $demande = new demandes($tab["id_demande"]); $demande->save_repfinale($tab["id_note"]); ajax_http_send_response(demandes_notes::note_majParent($tab["id_note"], $tab["id_action"], $tab["id_demande"], "_gestion")); break; }
demandes_notes::save($notes); demandes_notes::note_majParent($notes->id_note, $notes->num_action, $actions->num_demande, "_gestion"); demandes_notes::note_majParent($notes->id_note, $notes->num_action, $actions->num_demande, "_opac"); $actions->fetch_data($notes->num_action, false); if ($redirectto == "demandes-show_consult_form") { $demande = new demandes($actions->num_demande); $demande->show_consult_form($notes->num_action); } else { $actions->show_consultation_form(); } break; case 'reponse': $notes->show_modif_form(true); break; case 'save_note': demandes_notes::get_values_from_form($notes); demandes_notes::save($notes); demandes_notes::note_majParent($notes->id_note, $notes->num_action, $actions->num_demande, "_gestion"); demandes_notes::note_majParent($notes->id_note, $notes->num_action, $actions->num_demande, "_opac"); $actions->fetch_data($idaction, false); $actions->show_consultation_form(); break; case 'modif_note': $notes->show_modif_form(); break; case 'suppr_note': demandes_notes::delete($notes); $actions->fetch_data($idaction, false); $actions->show_consultation_form(); break; }
static function save(&$note) { global $dbh; global $demandes_email_demandes, $pmb_type_audit, $PMBuserid; if ($note->id_note) { //MODIFICATION $query = "UPDATE demandes_notes SET \n\t\t\tcontenu='" . $note->contenu . "',\n\t\t\tdate_note='" . $note->date_note . "',\n\t\t\tprive='" . $note->prive . "',\n\t\t\trapport='" . $note->rapport . "',\n\t\t\tnum_action='" . $note->num_action . "',\n\t\t\tnotes_num_user='******',\n\t\t\tnotes_type_user='******',\n\t\t\tnum_note_parent='" . $note->num_note_parent . "',\n\t\t\tnotes_read_gestion='" . $note->notes_read_gestion . "',\n\t\t\tnotes_read_opac='1' \n\t\t\tWHERE id_note='" . $note->id_note . "'"; pmb_mysql_query($query, $dbh); if ($pmb_type_audit) { audit::insert_modif(AUDIT_NOTE, $note->id_note); } } else { //CREATION $query = "INSERT INTO demandes_notes SET\n\t\t\tcontenu='" . $note->contenu . "',\n\t\t\tdate_note='" . $note->date_note . "',\n\t\t\tprive='" . $note->prive . "',\n\t\t\trapport='" . $note->rapport . "',\n\t\t\tnum_action='" . $note->num_action . "',\n\t\t\tnotes_num_user='******',\n\t\t\tnotes_type_user='******',\n\t\t\tnum_note_parent='" . $note->num_note_parent . "', \n\t\t\tnotes_read_gestion='" . $note->notes_read_gestion . "',\n\t\t\tnotes_read_opac='1'"; pmb_mysql_query($query, $dbh); $note->id_note = pmb_mysql_insert_id($dbh); if ($pmb_type_audit) { audit::insert_creation(AUDIT_NOTE, $note->id_note); } if (!$note->prive) { if ($demandes_email_demandes) { $note->fetch_data($note->id_note, $note->num_action); $note->send_alert_by_mail($note->notes_num_user, $note); } } } // Générer la réponse finale de la demande avec cette note if ($note->demande_end) { global $f_message; $f_message = $note->contenu; $demande = new demandes($note->num_demande); $demande->save_repfinale($note->id_note); demandes_notes::note_majParent($note->id_note, $note->num_action, $note->num_demande, "_gestion"); } }
$demandes->fetch_data($demandes->id_demande, false); $demandes->show_consult_form(); break; case 'add_demande': $demandes->show_modif_form(); break; case 'add_action': $demandes_action->type_action = $type_action; $demandes_action->num_demande = $iddemande; $demandes_action->show_modif_form(); break; case 'add_note': demandes_notes::get_values_from_form($demande_note); demandes_notes::save($demande_note); demandes_notes::note_majParent($demande_note->id_note, $demande_note->num_action, $demandes_action->num_demande, "_gestion"); demandes_notes::note_majParent($demande_note->id_note, $demande_note->num_action, $demandes_action->num_demande, "_opac"); $demandes_action->fetch_data($demande_note->num_action, false); $demandes->show_consult_form($demande_note->num_action); break; case 'open_action': $demandes_action->fetch_data($demandes_action->id_action, false); $demandes_action->show_consultation_form(); break; case 'open_demande': $demandes->fetch_data($demandes->id_demande, false); $demandes->show_consult_form($last_modified); break; case 'see_demandes': default: $demandes->show_list_form(); break;