echo "</form>";
    Follow_Up::show_action_list($cn, $base);
}
//--------------------------------------------------------------------------------
// Save Follow_Up
// Stage 2 : Save a NEW action + Files and generate eventually a document
//--------------------------------------------------------------------------------
if ($sub_action == "save_action_st2") {
    $act = new Follow_Up($cn);
    $act->fromArray($_POST);
    try {
        $act->d_id = 0;
        $act->md_id = isset($_POST['gen_doc']) ? $_POST['gen_doc'] : 0;
        $act->verify();
        // insert into action_gestion
        echo $act->save();
        $url = "?{$base}&sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get();
        echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Evènement Sauvée') . '  : ' . $act->ag_ref) . '</a></p>';
        Follow_Up::show_action_list($cn, $base);
        $url = "?{$base}&sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get();
        echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Evènement Sauvée') . '  : ' . $act->ag_ref) . '</a></p>';
    } catch (Exception $e) {
        echo '<span class="notice">';
        echo _("Erreur") . " " . $e->getMessage();
        echo '</span>';
        $sub_action = "add_action";
        $error_id = $e->getCode();
    }
}
//--------------------------------------------------------------------------------
// Add an action