32if ( ! defined (
'ALLOWED') ) die(
'Appel direct ne sont pas permis');
48if ( empty (
$g_user->get_readable_profile() ) ) {
49 echo
'<span class="warning">'. _(
"Aucun profil disponible").
'</span>';
59if ( isset (
$_POST[
'other_action_bt'])) {
66 if ( isset (
$_POST[
'mag_id'])) {
67 switch (
$_POST[
'othact']) {
97if (isset(
$_POST[
'generate']))
101 if (
$act->ag_id == 0)
110 $doc_mod=
$http->post(
'doc_mod',
"number");
123 $ag_comment = urldecode(
$_POST[
'ag_comment']);
135 if (isset(
$_POST[
'save']))
139 if (
$g_user->can_write_action($act2->ag_id) == FALSE )
141 echo
'<div class="redcontent">';
142 echo
'<h2 class="error">'._(
'Cette action ne vous est pas autorisée Contactez votre responsable').
'</h2>';
147 put_global(array(array(
'key' =>
"sa",
"value" =>
"detail")));
154 echo
'<span class="notice">';
155 echo _(
"Erreur").
" ".
$e->getMessage();
169 if (isset(
$_GET[
'add_action_here']))
173 if (
$g_user->can_write_action(
$act->ag_id) == FALSE )
175 echo
'<div class="redcontent">';
176 echo
'<h2 class="error">'._(
'Cette action ne vous est pas autorisée Contactez votre responsable').
'</h2>';
185 $act->ag_timestamp=date(
'd.m.Y');
189 $act->ag_remind_date=
"";
190 $act->dt_id =
$http->request(
"action_type",
"number");
192 $act->ag_comment =
"";
195 $act->qcode_dest =
$http->request (
'qcode');
198 $act->qcode_dest=
$cn->get_value(
"select ad_value from action_gestion ag join fiche_detail fd
199 on (fd.f_id=ag.f_id_dest) where ag_id=$1 and ad_id=$2",
206 echo
'<form enctype="multipart/form-data" style="display:inline" action="do.php" method="post"">';
212 echo
'<input type="hidden" name="ac" value="' .
$http->request(
'ac') .
'">';
213 echo
'<input type="hidden" name="sa" value="save_action_st2">';
214 echo
'<input type="submit" class="button" name="save_action_st2" value="' . _(
'Enregistrer') .
'">';
226 echo
'<div class="content" style="padding:1rem">';
238 printf(
'<form enctype="multipart/form-data" id="action_common_frm" class="print" action="do.php"
239method="post" style="display:inline" onsubmit="return check_file_size(this,%s)">',MAX_FILE_SIZE);
242 echo dossier::hidden();
244 echo
'<input type="hidden" name="sa" value="update">';
245 echo
'<input type="hidden" id="delete" name="delete" value="0">';
255 ' onclick="$(\'delete\').value=1;return confirm_box(\'action_common_frm\',\''. _(
"Vous confirmez l\'effacement") .
'\')
" ');
259 // Create select box for new Action
260 Follow_Up::show_action_add(["sa
"=>"update
","add_action_here
"=>1,"ag_id"=>$ag_id]);
262 else if ($g_user->can_read_action($ag_id) == true || $act->ag_dest == -1)
264 echo $act->Display('READ', false, $base, $retour);
268 echo h2info(_("Ce document
n'est pas accessible"));
275//-------------------------------------------------------------------------------
277//-------------------------------------------------------------------------------
278if ($sub_action == 'delete')
282 $act = new Follow_Up($cn);
283 $act->ag_id =$http->request("ag_id","number") ;
285 if ($g_user->can_delete_action($act->ag_id)==true) $act->remove();
286 $sub_action = "list";
288 Follow_Up::show_action_list($cn, $base);
289 if (isset($act->ag_ref))
290 echo hb(_('Action
') . $act->ag_ref . _(' effacée
'));
294//--------------------------------------------------------------------------------
295// Show a list of the action
296//--------------------------------------------------------------------------------
297if ($sub_action == "list")
299 // Add a button to export to Csv
300 echo '<form method=
"GET" style=
"display:inline;" ACTION=
"export.php">
';
301 echo HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref", "remind_date","only_internal", "state", "gDossier", "qcode", "start_date", "end_date", "ag_id", "ag_dest_query",
302 "tdoc", "action_query","date_start","date_end","hsstate","searchtag"));
303 echo HtmlInput::hidden("act", "CSV:ActionGestion");
304 echo HtmlInput::hidden("export_type", "simple");
305 echo HtmlInput::submit("follow_up_csv", _("Export CSV"),'','smallbutton
');
307 // Add a button to export complete to Csv
308 echo '<form method=
"GET" style=
"display:inline;" ACTION=
"export.php">
';
309 echo HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref", "remind_date","only_internal", "state", "gDossier", "qcode", "start_date", "end_date", "ag_id", "ag_dest_query",
310 "tdoc", "action_query","date_start","date_end","hsstate","searchtag"));
311 echo HtmlInput::hidden("act", "CSV:ActionGestion");
312 echo HtmlInput::hidden("export_type", "detail");
313 echo HtmlInput::submit("follow_up_csv", _("Export CSV détaillé"),'','smallbutton
');
315 //if filter_name exists then we save the $_GET into the DB as a JSON object
316 $filter_name=$http->get("filter_name","string",null);
317 if ( noalyss_trim($filter_name) != "" ) {
319 // $follow_up_filter=new Follow_Up_Filter($cn);
320 $a_content=json_encode($_GET);
321 $action_gestion_filter=new Follow_Up_Filter($filter_name,$a_content);
322 $action_gestion_filter->save();
324 // si filtered on charge la DB
325 Follow_Up::show_action_list($cn, $base);
327//--------------------------------------------------------------------------------
329// Stage 2 : Save a NEW action + Files and generate a document
330//--------------------------------------------------------------------------------
331if ($sub_action == "save_action_st2")
333 $act = new Follow_Up($cn);
334 $act->fromArray($_POST);
337 $act->ag_id = $http->request("ag_id", "number");
338 $act->md_id = $http->post('gen_doc
', 'number
', 0);
341 $sup_parameter = HtmlInput::array_to_string(["sc", "sb", "f_id", "qcode"], $_REQUEST, "&");
342 // insert into action_gestion
345 $url = "?sa=detail&ag_id=" . $act->ag_id . '&
' . dossier::get() . "&ac=" . $http->request("ac") .
347 echo '<
p><a
class=
"mtitle" href=
"' . $url . '">
' . hb(_('Action Sauvée
') . ' :
' . $act->ag_ref) . '</a></
p>
';
349 Follow_Up::show_action_list($cn, $base);
350 $url = "?sa=detail&ag_id=" . $act->ag_id . '&
' . dossier::get() . "&ac=" . $http->request("ac") .
352 echo '<
p><a
class=
"mtitle" href=
"' . $url . '">
' . hb(_('Action Sauvée
') . ' :
' . $act->ag_ref) . '</a></
p>
';
353 } catch (Exception $e) {
354 echo '<
span class=
"notice">
';
355 echo _("Erreur") . " " . $e->getMessage();
357 $sub_action = "add_action";
358 $error_id = $e->getCode();
362//--------------------------------------------------------------------------------
364if ($sub_action == "add_action" && ! empty($g_user->get_writable_profile() ) )
366 $act = new Follow_Up($cn);
367 $act->fromArray($_POST);
368 $act->dt_id = $http->request("action_type","number");
370 $f_id_dest=$http->request("f_id","number",null);
371 if ( $f_id_dest != NULL ) {
372 $act->qcode_dest=$cn->get_value("select ad_value from fiche_detail where ad_id=$1 and f_id=$2",
373 [ATTR_DEF_QUICKCODE,$f_id_dest]);
377 echo '<div
class=
"content">
';
379 echo '<form method=
"post" action=
"do.php" name=
"form_add" id=
"form_add" enctype=
"multipart/form-data" >
';
381 echo dossier::hidden();
384 $act->ag_comment =Decode($http->post("ag_comment","string",""));
385 if (isset($_REQUEST['qcode
']))
386 $act->qcode_dest = $http->request('qcode
');
387 echo $act->Display('NEW
', false, $base, $retour);
389 echo '<input
type=
"hidden" name=
"ac" value=
"' . $http->request("ac
") . '">
';
390 echo '<input
type=
"hidden" name=
"sa" value=
"save_action_st2">
';
391 echo '<input
type=
"hidden" name=
"save_action_st2" value=
"save_action_st2">
';
392 echo '<input
type=
"submit" class=
"button" name=
"save_action_st2" value=
"' . _('Enregistrer') . '">
';
398if ( $error_id != 0 ){
400 $error[20]='ag_timestamp
';
401 $error[30]='ag_remind_date
';
402 $div=$error[$error_id];
404 <script>$('$div').style.borderColor="red";
405 $('info_div
').innerHTML='erreur
';
put_global($array)
Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter)
span($p_string, $p_extra='')
record_log($p_message)
Record an error message into the log file of the server.
if(empty($g_user->get_readable_profile())) $correction
global $g_user
if no group available , then stop
$sub_action
Show the list of action, this code should be common to several webpage. But for the moment we keep li...
static action_tag_remove($cn, $p_array)
static action_remove($cn, $p_array)
static action_set_state($cn, $p_array)
static action_tag_clear($cn, $p_array)
static action_print($cn, $p_array)
static action_tag_add($cn, $p_array)
static echo_file($msg, $print=true)
display the file