From 687627ba969d5672bca485bb1dac4ed0345dd321 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 27 Sep 2013 19:51:08 +0000 Subject: [PATCH] Page break when printing multiple Add clean tag, remove document, ... --- html/style-print.css | 3 +- html/style.css | 2 +- include/action.common.inc.php | 22 +++++- include/class_follow_up.php | 93 ++++++++++++++++++++++-- include/template/action_other_action.php | 15 ++++ 5 files changed, 124 insertions(+), 11 deletions(-) diff --git a/html/style-print.css b/html/style-print.css index 6d3abaa86..136054b91 100644 --- a/html/style-print.css +++ b/html/style-print.css @@ -289,4 +289,5 @@ div.myfieldset } #info_div { display:none; -} \ No newline at end of file +} +p#breakhere {page-break-before: always} \ No newline at end of file diff --git a/html/style.css b/html/style.css index ec0ddb6cd..be56d8179 100644 --- a/html/style.css +++ b/html/style.css @@ -1348,4 +1348,4 @@ div#error_content_div { color:error; font-weight: bold; text-align: center; -} \ No newline at end of file +} diff --git a/include/action.common.inc.php b/include/action.common.inc.php index a1542c6a8..54117920f 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -41,23 +41,37 @@ $supl_hidden.=HtmlInput::hidden('ac', $_REQUEST['ac']); /*-----------------------------------------------------------------------------*/ /* For other action /*-----------------------------------------------------------------------------*/ -if ( isset ($_GET['other_action_bt'])) { - var_dump($_GET); +if ( isset ($_POST['other_action_bt'])) { /** * The action id are in the array mag_id * the tag to remove are vin the array remtag * the tag to add are in the array addtag * the state in ag_state */ - if ( isset ($_GET['ag_id'])) { - switch ($_GET['othact']) { + if ( isset ($_POST['mag_id'])) { + switch ($_POST['othact']) { case 'IMP': //Impression + Follow_Up::action_print($cn,$_POST); + exit(0); + break; case 'ST': // Etat + Follow_Up::action_set_state($cn, $_POST); + break; case 'ETIREM': //tag + Follow_Up::action_tag_remove($cn, $_POST); + break; case 'ETIADD': + Follow_Up::action_tag_add($cn, $_POST); + break; + case 'ETICLEAR': + Follow_Up::action_tag_clear($cn,$_POST); + break; + case 'DOCREM': + Follow_Up::action_remove($cn, $_POST); + break; } } } diff --git a/include/class_follow_up.php b/include/class_follow_up.php index 43272035a..6c8635663 100644 --- a/include/class_follow_up.php +++ b/include/class_follow_up.php @@ -87,10 +87,10 @@ class Follow_Up * \param p_cn database connection */ - function __construct($p_cn) + function __construct($p_cn,$p_id=0) { $this->db = $p_cn; - $this->ag_id=0; + $this->ag_id=$p_id; $this->f_id = 0; } static function sql_security_filter($cn,$p_mode) @@ -117,7 +117,7 @@ class Follow_Up * \note If ag_id is not equal to zero then it is an update otherwise * it is a new document * - * \param $p_view if set to true the form will be in readonly mode (value: true or false) + * \param $p_view form will be in readonly mode (value: READ, UPD or NEW ) * \param $p_gen true we show the tag for generating a doc (value : true or false) and adding files * \param $p_base is the ac parameter * \param $retour is the html code for the return button @@ -508,7 +508,7 @@ class Follow_Up $a_tag=$this->tag_get(); /* get template */ ob_start(); - require_once 'template/detail-action.php'; + require 'template/detail-action.php'; $content = ob_get_contents(); ob_end_clean(); $r.=$content; @@ -1209,7 +1209,7 @@ class Follow_Up */ $query = Follow_Up::create_query($cn); - echo '
'; + echo ''; echo HtmlInput::request_to_hidden(array("gDossier","ac","sb","sc","f_id")); require_once 'template/action_other_action.php'; echo $act->myList($p_base, "", $query); @@ -1502,4 +1502,87 @@ class Follow_Up echo HtmlInput::button('tag_bt', 'Ajout tag',$js, 'smallbutton'); } + static function action_tag_remove($cn,$p_array) + { + global $g_user; + $mag_id=$p_array['mag_id']; + $remtag=$p_array['remtag']; + for ($i=0;$i< count($mag_id);$i++) + { + if ($g_user->can_write_action($mag_id[$i]) == false) continue; + for ($e=0;$etag_remove($remtag[$e]); + } + } + + } + static function action_tag_add($cn,$p_array) + { + global $g_user; + $mag_id=$p_array['mag_id']; + $addtag=$p_array['addtag']; + for ($i=0;$i< count($mag_id);$i++) + { + if ($g_user->can_write_action($mag_id[$i]) == false) continue; + for ($e=0;$etag_add($addtag[$e]); + } + } + } + static function action_tag_clear($cn,$p_array) + { + global $g_user; + $mag_id=$p_array['mag_id']; + for ($i=0;$i< count($mag_id);$i++) + { + if ($g_user->can_write_action($mag_id[$i]) == false) continue; + $a=new Follow_Up($cn,$mag_id[$i]); + $a->tag_clear(); + } + } + static function action_print($cn,$p_array) + { + global $g_user; + $mag_id=$p_array['mag_id']; + for ($i=0;$i< count($mag_id);$i++) + { + if ($g_user->can_read_action($mag_id[$i]) == false) continue; + $a=new Follow_Up($cn,$mag_id[$i]); + $a->get(); + echo $a->Display("READ", false, ""); + echo '

- -

'; + } + } + function tag_clear() { + $this->db->exec_sql('delete from action_tags where ag_id=$1',array($this->ag_id)); + } + static function action_set_state($cn,$p_array) + { + + global $g_user; + $mag_id=$p_array['mag_id']; + $state=$p_array['ag_state']; + for ($i=0;$i< count($mag_id);$i++) + { + if ($g_user->can_write_action($mag_id[$i]) == false) continue; + $cn->exec_sql('update action_gestion set ag_state=$1 where ag_id=$2', + array($state,$mag_id[$i])); + } + } + static function action_remove($cn,$p_array) + { + global $g_user; + + $mag_id=$p_array['mag_id']; + for ($i=0;$i< count($mag_id);$i++) + { + if ($g_user->can_write_action($mag_id[$i]) == false) continue; + $cn->exec_sql('delete from action_gestion where ag_id=$1', + array($mag_id[$i])); + } + } } diff --git a/include/template/action_other_action.php b/include/template/action_other_action.php index f26e6c69b..28db92945 100644 --- a/include/template/action_other_action.php +++ b/include/template/action_other_action.php @@ -43,9 +43,24 @@ echo HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remin +
  • + value="ETICLEAR";echo $radio->input(); ?> + Enlever toutes les étiquettes des documents choisis +
  • +
  • + value="DOCREM";echo $radio->input(); ?> + Effacer les documents choisis +
  • +