From bf13768b517c45d02425ce02e94dd40f36e65f03 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Thu, 31 May 2012 02:51:49 +0000 Subject: [PATCH] Add : Multi comment related operation related action --- html/js/card.js | 2 +- html/js/gestion.js | 216 +- html/js/scripts.js | 76 +- html/show_document.php | 14 + include/ajax_search_action.php | 11 +- include/class_follow_up.php | 2218 +++++++++++---------- include/class_html_input.php | 2 +- include/class_irelated_action.php | 71 + include/template/action_button.php | 44 + include/template/action_search.php | 107 + include/template/action_search_result.php | 84 + include/template/detail-action.php | 38 +- sql/upgrade.sql | 57 +- 13 files changed, 1733 insertions(+), 1207 deletions(-) create mode 100644 include/class_irelated_action.php create mode 100644 include/template/action_button.php create mode 100644 include/template/action_search.php create mode 100644 include/template/action_search_result.php diff --git a/html/js/card.js b/html/js/card.js index 367da0641..f07ffd539 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -240,7 +240,7 @@ function errorFid(request,json) } function update_value(text,li) { - ajaxFid(ctl); + ajaxFid(text); } /** *@brief is called when something change in ICard diff --git a/html/js/gestion.js b/html/js/gestion.js index 3ebda3096..eb6f42cb1 100644 --- a/html/js/gestion.js +++ b/html/js/gestion.js @@ -33,17 +33,17 @@ */ function remove_document(p_dossier,p_id) { - queryString="gDossier="+p_dossier+"&a=rm&d_id="+p_id; - var action=new Ajax.Request ( - "show_document.php", - { - method:'get', - parameters:queryString, - onFailure:errorRemoveDoc, - onSuccess:successRemoveDoc - } + queryString="gDossier="+p_dossier+"&a=rm&d_id="+p_id; + var action=new Ajax.Request ( + "show_document.php", + { + method:'get', + parameters:queryString, + onFailure:errorRemoveDoc, + onSuccess:successRemoveDoc + } - ); + ); } /** @@ -53,30 +53,62 @@ function remove_document(p_dossier,p_id) */ function remove_operation(p_dossier,p_id) { - queryString="gDossier="+p_dossier+"&a=rmop&id="+p_id; - var action=new Ajax.Request ( - "show_document.php", - { - method:'get', - parameters:queryString, - onFailure:errorRemoveDoc, - onSuccess:successRemoveOp - } + queryString="gDossier="+p_dossier+"&a=rmop&id="+p_id; + var action=new Ajax.Request ( + "show_document.php", + { + method:'get', + parameters:queryString, + onFailure:errorRemoveDoc, + onSuccess:successRemoveOp + } - ); + ); } function successRemoveOp(request,json) { try{ - var answer=request.responseText.evalJSON(true); - var action="acop"+answer.ago_id; - $(action).innerHTML=""; - var doc="op"+answer.ago_id; - $(doc).style.color="red"; - $(doc).href="javascript:alert('Commentaire Effacé')"; - $(doc).style.textDecoration="line-through"; - }catch(e){alert(e.message);} + var answer=request.responseText.evalJSON(true); + var action="acop"+answer.ago_id; + $(action).innerHTML=""; + var doc="op"+answer.ago_id; + $(doc).style.color="red"; + $(doc).href="javascript:alert('Commentaire Effacé')"; + $(doc).style.textDecoration="line-through"; + }catch(e){ + alert(e.message); + } +} +/** + *@brief remove the concerned operation of an action + *@param dossier + *@param p_id id pk action_comment_operation +*/ +function remove_action(p_dossier,p_id,ag_id) +{ + queryString="gDossier="+p_dossier+"&a=rmaction&id="+p_id+"&ag_id="+ag_id; + var action=new Ajax.Request ( + "show_document.php", + { + method:'get', + parameters:queryString, + onFailure:ajax_misc_failure, + onSuccess:function(request,json) { + try{ + var answer=request.responseText.evalJSON(true); + var action="acact"+answer.act_id; + $(action).innerHTML=""; + var doc="act"+answer.act_id; + $(doc).style.color="red"; + $(doc).href="javascript:alert('Action Effacée')"; + $(doc).style.textDecoration="line-through"; + } catch (e){ alert(e.message);} + } + } + + ); + } /** *@brief remove comment of an action @@ -85,28 +117,28 @@ function successRemoveOp(request,json) */ function remove_comment(p_dossier,p_id) { - queryString="gDossier="+p_dossier+"&a=rmcomment&id="+p_id; - var action=new Ajax.Request ( - "show_document.php", - { - method:'get', - parameters:queryString, - onFailure:errorRemoveDoc, - onSuccess:successRemoveComment - } + queryString="gDossier="+p_dossier+"&a=rmcomment&id="+p_id; + var action=new Ajax.Request ( + "show_document.php", + { + method:'get', + parameters:queryString, + onFailure:errorRemoveDoc, + onSuccess:successRemoveComment + } - ); + ); } function successRemoveComment(request,json) { - var answer=request.responseText.evalJSON(true); - var action="accom"+answer.agc_id; - $(action).innerHTML=""; - var doc="com"+answer.agc_id; - $(doc).style.color="red"; - $(doc).href="javascript:alert('Commentaire Effacé')"; - $(doc).style.textDecoration="line-through"; + var answer=request.responseText.evalJSON(true); + var action="accom"+answer.agc_id; + $(action).innerHTML=""; + var doc="com"+answer.agc_id; + $(doc).style.color="red"; + $(doc).href="javascript:alert('Commentaire Effacé')"; + $(doc).style.textDecoration="line-through"; } /** @@ -114,20 +146,20 @@ function successRemoveComment(request,json) */ function errorRemoveDoc() { - alert('Impossible d\'effacer ce document'); + alert('Impossible d\'effacer ce document'); } /** *@brief success when removing a document */ function successRemoveDoc(request,json) { - var answer=request.responseText.evalJSON(true); - var action="ac"+answer.d_id; - $(action).innerHTML=""; - var doc="doc"+answer.d_id; - $(doc).style.color="red"; - $(doc).href="javascript:alert('Document Effacé')"; - $(doc).style.textDecoration="line-through"; + var answer=request.responseText.evalJSON(true); + var action="ac"+answer.d_id; + $(action).innerHTML=""; + var doc="doc"+answer.d_id; + $(doc).style.color="red"; + $(doc).href="javascript:alert('Document Effacé')"; + $(doc).style.textDecoration="line-through"; } /** @@ -136,17 +168,17 @@ function successRemoveDoc(request,json) */ function check_hour(p_ctl) { - try - { - var h=document.getElementById(p_ctl); - var re = /^\d{1,2}:\d{2}$/; - if ( trim(h.value) !='' && ! h.value.match(re)) - alert("Format de l'heure est HH:MM ") - } - catch (erreur) - { - alert('fct : check_hour '+erreur); - } + try + { + var h=document.getElementById(p_ctl); + var re = /^\d{1,2}:\d{2}$/; + if ( trim(h.value) !='' && ! h.value.match(re)) + alert("Format de l'heure est HH:MM ") + } + catch (erreur) + { + alert('fct : check_hour '+erreur); + } } /** @@ -157,21 +189,21 @@ function check_hour(p_ctl) function removeStock(s_id,p_dossier) { - if ( ! confirm("Confirmez-vous l'effacement de cette entrée dans le stock?") ) - { - return; - } - queryString="gDossier="+p_dossier+"&op=rm_stock&s_id="+s_id; - var action=new Ajax.Request ( - "ajax_misc.php", - { - method:'get', - parameters:queryString, - onFailure:errorRemoveStock, - onSuccess:successRemoveStock - } + if ( ! confirm("Confirmez-vous l'effacement de cette entrée dans le stock?") ) + { + return; + } + queryString="gDossier="+p_dossier+"&op=rm_stock&s_id="+s_id; + var action=new Ajax.Request ( + "ajax_misc.php", + { + method:'get', + parameters:queryString, + onFailure:errorRemoveStock, + onSuccess:successRemoveStock + } - ); + ); } /** @@ -179,25 +211,25 @@ function removeStock(s_id,p_dossier) */ function errorRemoveStock() { - alert('Impossible d\'effacer '); + alert('Impossible d\'effacer '); } /** *@brief success when removing a document */ function successRemoveStock(request,json) { - try - { - var answer=request.responseText.evalJSON(true); - var doc="stock"+answer.d_id; - var href="href"+answer.d_id; - $(href).innerHTML=''; + try + { + var answer=request.responseText.evalJSON(true); + var doc="stock"+answer.d_id; + var href="href"+answer.d_id; + $(href).innerHTML=''; - $(doc).style.color="red"; - // $(doc).href="javascript:alert('Stock Effacé')"; - $(doc).style.textDecoration="line-through"; - } catch (e) - { - alert("success_box"+e.message); - } + $(doc).style.color="red"; + // $(doc).href="javascript:alert('Stock Effacé')"; + $(doc).style.textDecoration="line-through"; + } catch (e) +{ + alert("success_box"+e.message); + } } diff --git a/html/js/scripts.js b/html/js/scripts.js index 550355781..fe1d90709 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -1175,7 +1175,7 @@ function fixed_position(p_sx,p_sy) var sx=p_sx; var sy=calcy(p_sy); - var str_style="top:"+sy+";left:"+sx+"position:absolute"; + var str_style="top:"+sy+";left:"+sx+";position:absolute"; return str_style; } @@ -1384,8 +1384,10 @@ function rapport_add_row(p_dossier) */ function search_action(dossier,ctl_concern) { + try + { var dossier=g('gDossier').value; - + var target="search_action_div"; removeDiv(target); var str_style=fixed_position(77, 99); @@ -1408,10 +1410,76 @@ function search_action(dossier,ctl_concern) parameters:qs, onFailure:null, onSuccess:function (req){ + try { remove_waiting_box(); - $('search_action').innerHTML=req.responseText; + $('search_action_div').innerHTML=req.responseText; req.responseText.evalScripts(); + }catch( e){alert(e.message);} } } ); -} \ No newline at end of file + }catch( e){alert(e.message);} +} + +function result_search_action(obj) +{ + try + { + var queryString=$(obj).serialize()+"&op=search_action"; + alert (queryString); + var action = new Ajax.Request( + "ajax_misc.php" , + {method:'get', + parameters:queryString, + onFailure:ajax_misc_failure, + onSuccess:function (req){ + try { + remove_waiting_box(); + $('search_action_div').innerHTML=req.responseText; + req.responseText.evalScripts(); + }catch( e){alert(e.message);} + } + } + ) + + } + catch (e) + { + alert("display_periode "+e.message); + } + + return false; +} + +function set_action_related(p_obj) + { + + try + { + var obj=$(p_obj); + var ctlc=obj.elements['ctlc']; + + for (var e=0;echeck_action(RMDOC)==1) + { + $cn->exec_sql("delete from action_gestion_related where aga_least=$1 and aga_greatest=$2", + array($_REQUEST['id'],$_REQUEST['ag_id'])); + $cn->exec_sql("delete from action_gestion_related where aga_least=$2 and aga_greatest=$1", + array($_REQUEST['id'],$_REQUEST['ag_id'])); + $json=sprintf('{"act_id":"%s"}',$_REQUEST['id']); + header("Content-type: text/html; charset: utf8",true); + print $json; + } +} diff --git a/include/ajax_search_action.php b/include/ajax_search_action.php index 2eaf324eb..1a5a70a69 100755 --- a/include/ajax_search_action.php +++ b/include/ajax_search_action.php @@ -23,10 +23,13 @@ */ require_once('class_dossier.php'); include_once("ac_common.php"); -require_once('class_action.php'); -$ac=$_REQUEST['ac']; -$base='ac='.$ac; +require_once('class_follow_up.php'); +$_REQUEST['ac']='FOLLOW'; -Action::ShowActionList($cn,""); +echo Follow_Up::display_search($cn,true); +$sql= "true ".Follow_Up::create_query($cn); +var_dump($_GET); +echo $sql; +echo Follow_Up::short_list($cn, $sql); ?> diff --git a/include/class_follow_up.php b/include/class_follow_up.php index 46060fee7..1f5203db8 100644 --- a/include/class_follow_up.php +++ b/include/class_follow_up.php @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with PhpCompta; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + */ /* $Revision$ */ // Copyright Author Dany De Bontridder ddebontridder@yahoo.f require_once('class_itextarea.php'); @@ -35,8 +35,9 @@ require_once("user_common.php"); require_once('class_follow_up_detail.php'); require_once('class_inum.php'); require_once 'class_sort_table.php'; +require_once 'class_irelated_action.php'; -/*!\file +/* !\file * \brief class_action for manipulating actions * action can be : * + * * The table document_type are the possible actions */ -/*! +/* ! * \brief class_action for manipulating actions * action can be : *