From cf1a4851b1c2b7682079e2c404257ff4c2068e83 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 27 Sep 2013 17:07:31 +0000 Subject: [PATCH] Action - gestion : enleve tag, ajoute tag, imprime plusieurs action --- include/action.common.inc.php | 30 ++++++++++++-- include/action.inc.php | 2 +- include/ajax_search_add_tag.php | 4 +- include/ajax_search_clear_tag.php | 2 +- include/ajax_search_display_tag.php | 2 +- include/category_followup.inc.php | 2 +- include/class_follow_up.php | 48 ++++++++++++---------- include/class_icheckbox.php | 5 +++ include/class_iradio.php | 2 +- include/class_tag.php | 18 ++++----- include/constant.php | 11 ++--- include/template/action_button.php | 6 +-- include/template/action_other_action.php | 51 ++++++++++++++++++++++++ include/template/action_search.php | 16 ++++---- include/template/tag_search_select.php | 6 +-- 15 files changed, 143 insertions(+), 62 deletions(-) create mode 100644 include/template/action_other_action.php diff --git a/include/action.common.inc.php b/include/action.common.inc.php index e870fe74e..a1542c6a8 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -38,7 +38,29 @@ if (isset($_REQUEST['f_id'])) if (isset($_REQUEST['sb'])) $supl_hidden.=HtmlInput::hidden('sb', $_REQUEST['sb']); $supl_hidden.=HtmlInput::hidden('ac', $_REQUEST['ac']); - +/*-----------------------------------------------------------------------------*/ +/* For other action +/*-----------------------------------------------------------------------------*/ +if ( isset ($_GET['other_action_bt'])) { + var_dump($_GET); + /** + * 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']) { + case 'IMP': + //Impression + case 'ST': + // Etat + case 'ETIREM': + //tag + case 'ETIADD': + } + } +} /* --------------------------------------------------------------------------- */ /* We ask to generate the document */ @@ -188,14 +210,14 @@ if ($sub_action == 'delete') // Show a list of the action if ($sub_action == "list") { - Follow_Up::show_action_list($cn, $base); // Add a button to export to Csv - echo '
'; + echo ''; 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", - "tdoc", "query","date_start","date_end","tag")); + "tdoc", "query","date_start","date_end","hsstate","searchtag")); echo HtmlInput::hidden("act", "CSV:ActionGestion"); echo HtmlInput::submit("follow_up_csv", "Export CSV"); echo "
"; + Follow_Up::show_action_list($cn, $base); } //-------------------------------------------------------------------------------- // Add an action diff --git a/include/action.inc.php b/include/action.inc.php index 2eb535a9d..ab7f68a61 100644 --- a/include/action.inc.php +++ b/include/action.inc.php @@ -25,7 +25,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); require_once('class_ipopup.php'); global $g_user; $retour=HtmlInput::button_anchor(_('Retour liste'), - HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate","tag"))); + HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate","searchtag"))); //----------------------------------------------------- // Follow_Up //----------------------------------------------------- diff --git a/include/ajax_search_add_tag.php b/include/ajax_search_add_tag.php index e69b2aa8c..ae536927f 100644 --- a/include/ajax_search_add_tag.php +++ b/include/ajax_search_add_tag.php @@ -24,10 +24,10 @@ require_once 'class_tag.php'; ob_start(); if ($_GET['clear']==1) { /* Add a clear button */ - echo Tag::add_clear_button(); + echo Tag::add_clear_button($_GET['pref']); } $tag=new Tag($cn,$_GET['id']); -$tag->update_search_cell(); +$tag->update_search_cell($_GET['pref']); $response= ob_get_clean(); ob_end_clean(); diff --git a/include/ajax_search_clear_tag.php b/include/ajax_search_clear_tag.php index 7d9640699..2edfa7be6 100644 --- a/include/ajax_search_clear_tag.php +++ b/include/ajax_search_clear_tag.php @@ -22,7 +22,7 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); require_once 'class_tag.php'; ob_start(); -echo Tag::button_search(); +echo Tag::button_search($_GET['pref']); $response= ob_get_clean(); ob_end_clean(); $html=escape_xml($response); diff --git a/include/ajax_search_display_tag.php b/include/ajax_search_display_tag.php index f211114c2..f4ce0cf9a 100644 --- a/include/ajax_search_display_tag.php +++ b/include/ajax_search_display_tag.php @@ -23,7 +23,7 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); require_once 'class_tag.php'; ob_start(); $tag=new Tag($cn); -$tag->select_search(); +$tag->select_search($_GET['pref']); $response= ob_get_clean(); ob_end_clean(); diff --git a/include/category_followup.inc.php b/include/category_followup.inc.php index fc2a51793..7e17893e9 100644 --- a/include/category_followup.inc.php +++ b/include/category_followup.inc.php @@ -40,7 +40,7 @@ $ag_id=(isset($_REQUEST['ag_id']))?$_REQUEST['ag_id']:0; if (! isset($_GET['submit_query'])) {$_REQUEST['closed_action']=1;$_GET['closed_action']=1;} $p_action=$_REQUEST['ac']; -$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","hsstate","tag","sb","sc"),""); +$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","hsstate","searchtag","sb","sc"),""); $retour=HtmlInput::button_anchor('Retour','?'.dossier::get().'&'.$base); $fiche=new Fiche($cn,$_REQUEST['f_id']); diff --git a/include/class_follow_up.php b/include/class_follow_up.php index 04a6d4ec2..43272035a 100644 --- a/include/class_follow_up.php +++ b/include/class_follow_up.php @@ -504,7 +504,7 @@ class Follow_Up /* add the number of item */ $Hid = new IHidden(); $r.=$Hid->input("nb_item", MAX_ARTICLE); - $r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate","tag")); + $r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate","searchtag")); $a_tag=$this->tag_get(); /* get template */ ob_start(); @@ -663,18 +663,19 @@ class Follow_Up $this->insert_action(); } - /** myList($p_filter="") - * \brief Show list of action by default if sorted on date - * \param $p_base base url with ac... - * \param $p_filter filters on the document_type - * \param $p_search must a valid sql command ( ex 'and ag_title like upper('%hjkh%')) - * \return string containing html code + /** + * myList($p_base, $p_filter = "", $p_search = "") + * Show list of action by default if sorted on date + * @param $p_base base url with ac... + * @param $p_filter filters on the document_type + * @param $p_search must a valid sql command ( ex 'and ag_title like upper('%hjkh%')) + * @return string containing html code */ function myList($p_base, $p_filter = "", $p_search = "") { // for the sort - $url = HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate","tag")) . '&' . $p_base; + $url = HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate","searchtag")) . '&' . $p_base; $table = new Sort_Table(); $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd'); @@ -725,6 +726,7 @@ class Follow_Up $r.=$bar; $r.=''; $r.=""; + $r.=''; $r.=''; $r.=''; $r.=''; @@ -747,10 +749,11 @@ class Follow_Up } $today = date('d.m.Y'); $i = 0; + $checkbox=new ICheckBox("mag_id[]"); //show the sub_action foreach ($a_row as $row) { - $href = ''; + $href = ''; $i++; $tr = ($i % 2 == 0) ? 'even' : 'odd'; if ($row['ag_priority'] < 2) @@ -765,6 +768,8 @@ class Follow_Up if ($date_remind != "" && $date_remind < $date_today && $row['ag_state']!=1 && $row['ag_state']!=3) $st = ' style="font-weight:bold;background:#FF0000"'; $r.=""; + $checkbox->value=$row['ag_id']; + $r.=''; $r.=""; $r.=""; $r.=""; @@ -1189,7 +1194,7 @@ class Follow_Up require_once 'template/action_search.php'; } /** - *@brief show a list of actions + *@brief show a list of documents * @param $cn database connextion * @param $p_base base URL */ @@ -1203,11 +1208,12 @@ class Follow_Up * \note The field 'recherche' is about a part of the title or a ref. number */ $query = Follow_Up::create_query($cn); - - - - $r = $act->myList($p_base, "", $query); - echo $r; + + 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); + echo ''; } /** * Create a subquery to filter thanks the selected tag @@ -1222,10 +1228,10 @@ class Follow_Up extract($p_array); $query = ""; - if ( count($tag) == 0 )return ""; - for ($i=0;$i"doc id","type"=>"string"), array("title"=>"date","type"=>"date"), array("title"=>"rappel","type"=>"date"), - array("title"=>"dernier comm.","type"=>"date"), + array("title"=>"date dernier commentaire","type"=>"date"), array("title"=>"tags","type"=>"string"), array("title"=>"nom","type"=>"string"), array("title"=>"titre","type"=>"string"), diff --git a/include/class_icheckbox.php b/include/class_icheckbox.php index ecc54ec84..8a6d5b8ea 100644 --- a/include/class_icheckbox.php +++ b/include/class_icheckbox.php @@ -64,6 +64,11 @@ class ICheckBox extends HtmlInput { if ($this->value==$p_value)$this->selected=true; } + static function toggle_checkbox($p_name,$p_form) { + $a=new ICheckBox($p_name); + $a->javascript='onclick="toggle_checkbox(\''.$p_form.'\')"'; + return $a->input(); + } static public function test_me() { } diff --git a/include/class_iradio.php b/include/class_iradio.php index f94f72bd6..8ac06d956 100644 --- a/include/class_iradio.php +++ b/include/class_iradio.php @@ -69,5 +69,5 @@ class IRadio extends HtmlInput { } - + } diff --git a/include/class_tag.php b/include/class_tag.php index 55bbeeb96..7f3f45564 100644 --- a/include/class_tag.php +++ b/include/class_tag.php @@ -79,16 +79,16 @@ class Tag * Show a button to select tag for Search * @return HTML */ - static function button_search() + static function button_search($p_prefix) { $r=""; - $r.=HtmlInput::button("choose_tag", "Etiquette", 'onclick="search_display_tag('.Dossier::id().')"', "smallbutton"); + $r.=HtmlInput::button("choose_tag", "Etiquette", 'onclick="search_display_tag('.Dossier::id().',\''.$p_prefix.'\')"', "smallbutton"); return $r; } /** * let select a tag to add to the search */ - function select_search() + function select_search($p_prefix) { $ret=$this->data->seek(' order by t_tag'); require_once 'template/tag_search_select.php'; @@ -96,11 +96,11 @@ class Tag /** * In the screen search add this data to the cell */ - function update_search_cell() { - echo ''; + function update_search_cell($p_prefix) { + echo ''; echo h($this->data->t_tag); - echo HtmlInput::hidden('tag[]', $this->data->t_id); - $js=sprintf("$('sp_".$this->data->t_id."').remove()='';"); + echo HtmlInput::hidden($p_prefix.'tag[]', $this->data->t_id); + $js=sprintf("$('sp_".$p_prefix.$this->data->t_id."').remove();"); echo ''; echo HtmlInput::anchor('X', "javascript:void(0)", "onclick=\"$js\""); echo ''; @@ -109,8 +109,8 @@ class Tag /** * clear the search cell */ - static function add_clear_button() { - $clear=HtmlInput::button('clear', 'X', 'onclick="search_clear_tag('.Dossier::id().');"', 'smallbutton'); + static function add_clear_button($p_prefix) { + $clear=HtmlInput::button('clear', 'X', 'onclick="search_clear_tag('.Dossier::id().',\''.$p_prefix.'\');"', 'smallbutton'); return $clear; } } diff --git a/include/constant.php b/include/constant.php index 5359ff8e2..6f733f259 100644 --- a/include/constant.php +++ b/include/constant.php @@ -60,21 +60,18 @@ $g_captcha=false; $g_failed=""; $g_succeed=""; /* uncomment for development */ -define ('SVNINFO',5900); -define ("DEBUG",true); + define ('SVNINFO',5900); + define ("DEBUG",true); +//define ("DEBUG",false); $version_phpcompta=SVNINFO; -/* define ('SVNINFO',5015); - * $version_phpcompta=SVNINFO; - * define ("DEBUG",true); -*/ // If you don't want to be notified of the update // define ("SITE_UPDATE",''); define ("SITE_UPDATE",'http://www.phpcompta.eu/last_version.txt'); define ("SITE_UPDATE_PLUGIN",'http://www.phpcompta.eu/plugin_last_version.txt'); -define ("DBVERSION",107); +define ("DBVERSION",108); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",14); define ('NOTFOUND','--not found--'); diff --git a/include/template/action_button.php b/include/template/action_button.php index 167b27a46..0dfb0ba4d 100644 --- a/include/template/action_button.php +++ b/include/template/action_button.php @@ -27,9 +27,9 @@ * */ ?> -
-
-
+
+
+ "> diff --git a/include/template/action_other_action.php b/include/template/action_other_action.php new file mode 100644 index 000000000..f26e6c69b --- /dev/null +++ b/include/template/action_other_action.php @@ -0,0 +1,51 @@ + + + + diff --git a/include/template/action_search.php b/include/template/action_search.php index e45c33441..0c7c9921e 100644 --- a/include/template/action_search.php +++ b/include/template/action_search.php @@ -31,7 +31,7 @@ -
+
@@ -65,14 +65,14 @@
-
'. ICheckBox::toggle_checkbox('ag','list_ag_frm').'' . $table->get_header(0) . '' . $table->get_header(1) . '' . $table->get_header(2) . '
'.$checkbox->input().'" . $href . smaller_date($row['my_date']) . '' . "" . $href . $row['last_comment'] . '' . "" . $href . smaller_date($row['my_remind']) . '' . "
- + + update_search_cell(); + if ( isset($_GET['searchtag'])) { + echo Tag::add_clear_button('search'); + for ($i=0;$iupdate_search_cell('search'); } } ?> diff --git a/include/template/tag_search_select.php b/include/template/tag_search_select.php index de270531b..8711f1a14 100644 --- a/include/template/tag_search_select.php +++ b/include/template/tag_search_select.php @@ -1,12 +1,12 @@ cn->count($ret); if ( $max == 0 ) { echo h2("Aucune étiquette disponible",' class="notice"'); return; } ?> -Filtrer = +Filtrer =
@@ -24,7 +24,7 @@ $gDossier=Dossier::id();