noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
card.js
Go to the documentation of this file.
00001 /*
00002  *   This file is part of NOALYSS.
00003  *
00004  *   NOALYSS is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation; either version 2 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   NOALYSS is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with NOALYSS; if not, write to the Free Software
00016  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 /* $Revision$ */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*! \file
00023  * \brief javascript for searching a card
00024  */
00025 
00026 var card_layer=1;
00027 /**
00028  *@brief search a card an display the result into a inner box
00029  */
00030 function boxsearch_card(p_dossier)
00031 {
00032         try
00033         {
00034         waiting_box();
00035         removeDiv('boxsearch_card_div');
00036         var queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+$(card_search).value;
00037         var action = new Ajax.Request(
00038                                   "ajax_misc.php" ,
00039                                   {
00040                                       method:'get', parameters:queryString,
00041                                       onFailure:ajax_misc_failure,
00042                                       onSuccess:function(req){
00043                                                 remove_waiting_box();
00044                                                 var y=posY+15;
00045                                                 var div_style="left:10%;width:80%;"+";top:"+y+"px";
00046                                                 add_div({id:'boxsearch_card_div',cssclass:'inner_box',html:loading(),style:div_style,drag:true});
00047                                                 $('boxsearch_card_div').innerHTML=req.responseText;
00048                                                 sorttable.makeSortable($('tb_fiche'));
00049                                       }
00050                                   }
00051                                   );
00052         }catch( e)
00053         {
00054                 alert(e.getMessage);
00055         }
00056 }
00057 /**
00058  *@brief show the ipopup with the form to search a card
00059  * the properties
00060  *  - jrn for the ledger
00061  *  - fs for the action
00062  *  - price for the price of the card (field to update)
00063  *  - tvaid for the tvaid of the card (field to update)
00064  *  - inp input text to update with the quickcode
00065  *  - label field to update with the name
00066  *  - ctl the id to fill with the HTML answer (ending with _content)
00067  */
00068 function search_card(obj)
00069 {
00070     try
00071     {
00072         var gDossier=$('gDossier').value;
00073         var inp=obj.inp;
00074         var string_to_search=$(inp).value;
00075         var label=obj.label;
00076         var typecard=obj.typecard;
00077         var price=obj.price;
00078         var tvaid=obj.tvaid;
00079         var jrn=obj.jrn;
00080         if ( jrn==undefined)
00081         {
00082             if ( g('p_jrn'))   {
00083                 jrn=$('p_jrn').value;
00084             }
00085             else            {
00086                 jrn=-1;
00087             }
00088         }
00089         var query=encodeJSON({'gDossier':gDossier,
00090                       'inp':inp,'label':label,'price':price,'tvaid':tvaid,
00091                       'ctl':'search_card','op':'fs','jrn':jrn,
00092                       'typecard':typecard,'query':string_to_search
00093                              });
00094         if (  $('search_card') ) {
00095             removeDiv('search_card');
00096         }
00097         
00098         
00099         waiting_box();
00100         
00101 
00102         var action=new Ajax.Request ( 'ajax_card.php',
00103                                       {
00104                                   method:'get',
00105                                   parameters:query,
00106                                   onFailure:errorFid,
00107                                   onSuccess:result_card_search
00108                                       }
00109                                     );
00110     }
00111     catch(e)
00112     {
00113         alert('search_card failed'+e.message);
00114     }
00115 }
00116 /**
00117  *@brief Display form for select card to add to action : other_concerned
00118  *action_add_concerned_card
00119  */
00120 function action_add_concerned_card(obj)
00121 {
00122     try
00123     {
00124         var dossier = 0;
00125         var inp="";
00126         var ag_id=0;
00127         
00128         if (obj.dossier) {
00129             dossier = obj.dossier; /* From the button */
00130         } 
00131         if (obj.ag_id) {
00132             ag_id=obj.ag_id;
00133         }
00134         /* from the form */
00135         if (obj.elements) {
00136             if (obj.elements['gDossier']) 
00137             {
00138                 dossier = obj.elements['gDossier'].value;
00139             }
00140 
00141             if (obj.elements['query']) {
00142                 inp = obj.elements['query'].value;
00143             }
00144 
00145             if (obj.elements['ag_id']) {
00146                 ag_id = obj.elements['ag_id'].value;
00147             }
00148         }
00149         if (dossier == 0) {
00150             throw "obj.dossier not found";
00151         }
00152         if (ag_id == 0) {
00153             throw "obj.ag_id not found";
00154         }
00155         var query = encodeJSON({
00156             'gDossier': dossier,
00157             'op': 'action_add_concerned_card',
00158             'query' : inp,
00159             'ctl' : 'unused',
00160             'ag_id' : ag_id
00161         });
00162 
00163         waiting_box();
00164 
00165 
00166         var action = new Ajax.Request('ajax_card.php',
00167                 {
00168                     method: 'get',
00169                     parameters: query,
00170                     onFailure: errorFid,
00171                     onSuccess: function (req, txt)
00172                     {
00173                         try {
00174                         remove_waiting_box();
00175                         var answer = req.responseXML;
00176                         var a = answer.getElementsByTagName('ctl');
00177                         if (a.length == 0)
00178                         {
00179                             var rec = req.responseText;
00180                             alert('erreur :' + rec);
00181                         }
00182                         var html = answer.getElementsByTagName('code');
00183                         var namectl = a[0].firstChild.nodeValue;
00184                         var nodeXml = html[0];
00185                         var code_html = getNodeText(nodeXml);
00186                         code_html = unescape_xml(code_html);
00187 
00188                         var sx = 0;
00189                         if (window.scrollY)
00190                         {
00191                             sx = window.scrollY + 40;
00192                         }
00193                         else
00194                         {
00195                             sx = document.body.scrollTop + 60;
00196                         }
00197                         var div_style = "top:" + sx + "px;height:80%";
00198                         if ( ! $('search_card')) { add_div({id: 'search_card', cssclass: 'inner_box', html: "", style: div_style, drag: true}); }
00199                         $('search_card').innerHTML = code_html;
00200                         $('query').focus();
00201                         }catch (e) {
00202                             alert(e.message);
00203                         }
00204                     }
00205                 }
00206         );
00207     }
00208     catch (e)
00209     {
00210         alert('search_card failed' + e.message);
00211         return false;
00212     }
00213     return false;
00214 }
00215 
00216 /**
00217  *@brief when you submit the form for searching a card
00218  *@param obj form
00219  *@note the same as search_card, except it answer to a FORM and not
00220  * to a click event
00221  */
00222 function search_get_card(obj)
00223 {
00224     var dossier=$('gDossier').value;
00225 
00226     var queryString="gDossier="+dossier;
00227     queryString+="&op=fs";
00228 
00229     if ( obj.elements['inp'] )
00230     {
00231         queryString+="&inp="+$F('inp');
00232     }
00233     if ( obj.elements['typecard'] )
00234     {
00235         queryString+="&typecard="+$F('typecard');
00236     }
00237     if ( obj.elements['jrn'] )
00238     {
00239         queryString+="&jrn="+$F('jrn');
00240     }
00241     if ( obj.elements['label'])
00242     {
00243         queryString+="&label="+$F('label');
00244     }
00245     if ( obj.elements['price'])
00246     {
00247         queryString+="&price="+$F('price');
00248     }
00249     if ( obj.elements['tvaid'])
00250     {
00251         queryString+="&tvaid="+$F('tvaid');
00252     }
00253     if( obj.elements['query'])
00254     {
00255         queryString+="&query="+$F('query');
00256     }
00257     if (obj.ctl )
00258     {
00259         queryString+="&ctl="+obj.ctl;
00260     }
00261     $('asearch').innerHTML=loading();
00262     var action=new Ajax.Request ( 'ajax_card.php',
00263                                   {
00264                                   method:'get',
00265                                   parameters:queryString,
00266                                   onFailure:errorFid,
00267                                   onSuccess:result_card_search
00268                                   }
00269                                 );
00270 }
00271 /**
00272  *@brief show the answer of ajax request
00273  *@param  answer in XML
00274  */
00275 function result_card_search(req)
00276 {
00277     try
00278     {
00279         
00280         remove_waiting_box();
00281         var answer=req.responseXML;
00282         var a=answer.getElementsByTagName('ctl');
00283         if ( a.length == 0 )
00284         {
00285             var rec=req.responseText;
00286             alert ('erreur :'+rec);
00287         }
00288         var html=answer.getElementsByTagName('code');
00289 
00290         var name_ctl=a[0].firstChild.nodeValue;
00291         var nodeXml=html[0];
00292         var code_html=getNodeText(nodeXml);
00293         code_html=unescape_xml(code_html);
00294         
00295         var sx=0;
00296         if ( window.scrollY)
00297         {
00298             sx=window.scrollY+40;
00299         }
00300         else
00301         {
00302             sx=document.body.scrollTop+60;
00303         }
00304 
00305         var div_style="top:"+sx+"px;height:80%";
00306         add_div({id:'search_card',cssclass:'inner_box',html:"",style:div_style,drag:true,effect:'blinddown'});
00307         $('search_card').innerHTML=code_html;
00308         $('query').focus();
00309     }
00310     catch (e)
00311     {
00312         alert(e.message);
00313     }
00314     try
00315     {
00316         code_html.evalScripts();
00317     }
00318     catch(e)
00319     {
00320         alert("Impossible executer script de la reponse\n"+e.message);
00321     }
00322 
00323 }
00324 
00325 
00326 
00327 /*!\brief Set the value of 2 input fields
00328 *
00329 * Set the quick code in the first ctrl and the label of the quickcode in the second one. This function is a variant of SetData for
00330 * some specific need.  This function is called if the caller is searchcardCtrl
00331 *
00332 *\param p_ctrl the input with the name of the quick code
00333 *\param  p_quickcode the found quick_code
00334 *\param p_ctrlname the name of the input field with the label
00335 *\param p_label the label of the quickcode
00336 */
00337 function setCtrl(p_ctrl,p_quickcode,p_ctrlname,p_label)
00338 {
00339     var ctrl=g(p_ctrl);
00340     if ( ctrl )
00341     {
00342         ctrl.value=p_quickcode;
00343     }
00344     var ctrl_name=g(p_ctrlname);
00345     if ( ctrl_name )
00346     {
00347         ctrl_name.value=p_label;
00348     }
00349 }
00350 
00351 
00352 
00353 /*!\brief clean the row (the label, price and vat)
00354  * \param p_ctl the calling ctrl
00355  */
00356 function clean_Fid(p_ctl)
00357 {
00358     nSell=p_ctl+"_price";
00359     nBuy=p_ctl+"_price";
00360     nTva_id=p_ctl+"_tva_id";
00361     if ( $(nSell) )
00362     {
00363         $(nSell).value="";
00364     }
00365     if ( $(nBuy) )
00366     {
00367         $(nBuy).value="";
00368     }
00369     if ( $(nTva_id) )
00370     {
00371         $(nTva_id).value="-1";
00372     }
00373 
00374 }
00375 function errorFid(request,json)
00376 {
00377     alert('erreur : ajax fiche');
00378 }
00379 function update_value(text,li)
00380 {
00381            ajaxFid(text);
00382 }
00383 /**
00384  *@brief is called when something change in ICard
00385  *@param the input field
00386  *@see ICard
00387  */
00388 function fill_data_onchange(ctl)
00389 {
00390     ajaxFid(ctl);
00391 
00392 }
00393 /**
00394  *@brief is called when something change in ICard
00395  *@param the input field
00396  *@see ICard
00397  */
00398 function fill_data(text,li)
00399 {
00400     ajaxFid(text);
00401 
00402 }
00403 /**
00404  *@brief is called when something change in ICard
00405  *@param the input field
00406  *@see ICard
00407  */
00408 function fill_fin_data_onchange(ctl)
00409 {
00410     ajaxFid(ctl);
00411     ajax_saldo(ctl.id);
00412 }
00413 /**
00414  *@brief is called when something change in ICard
00415  *@param the input field
00416  *@see ICard
00417  */
00418 function fill_fin_data(text,li)
00419 {
00420     ajaxFid(text);
00421     ajax_saldo($(text.id));
00422 }
00423 /**
00424  *@brief show the ipopup window and display the details of a card,
00425  * to work some attribute must be set
00426  *@parameter obj.qcode is the qcode, obj.nohistory if you don't want to  display
00427  * the history button, obj.ro is the popin is readonly
00428  *@note you must the gDossier as hidden in the calling page
00429  *
00430  *@see ajax_card.php
00431  */
00432 function fill_ipopcard(obj)
00433 {
00434 
00435     card_layer++;
00436 
00437     var content='card_'+card_layer;
00438     var nTop=posY-40;
00439     //var nLeft=posX-20;
00440         var nLeft="20%";
00441     var str_style="top:"+nTop+"px;left:"+nLeft+"px;width:45em;height:auto";
00442 
00443     var popup={'id':  content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true};
00444 
00445     add_div(popup);
00446     var dossier=$('gDossier').value;
00447     var qcode='';
00448     if ( $(obj).qcode != undefined )
00449     {
00450         qcode=obj.qcode;
00451     }
00452     else
00453     {
00454         qcode=$(obj).value;
00455     }
00456     //    ctl=$(obj).id;
00457 
00458     var queryString='gDossier='+dossier;
00459     queryString+='&qcode='+qcode;
00460     queryString+='&ctl='+content;
00461     queryString+='&op=dc';      // dc for detail card
00462     if ( obj.readonly != undefined) {
00463      queryString+='&ro';
00464     }
00465 
00466     if ( obj.nohistory != undefined) {
00467      queryString+='&nohistory';
00468     }
00469 
00470     var action=new Ajax.Request ( 'ajax_card.php',
00471                                   {
00472                                   method:'get',
00473                                   parameters:queryString,
00474                                   onFailure:errorFid,
00475                                   onSuccess:fill_box
00476                                   }
00477                                 );
00478 }
00479 /**
00480  *@brief
00481  * \param request : object request
00482  * \param json : json answer
00483 \code
00484 \endcode
00485 */
00486 function  successFill_ipopcard(req,json)
00487 {
00488     try
00489     {
00490         var answer=req.responseXML;
00491         var a=answer.getElementsByTagName('ctl');
00492         var html=answer.getElementsByTagName('code');
00493 
00494         if ( a.length == 0 )
00495         {
00496             var rec=req.responseText;
00497             alert ('erreur :'+rec);
00498         }
00499         var name_ctl=a[0].firstChild.nodeValue;
00500         var code_html=getNodeText(html[0]);
00501         code_html=unescape_xml(code_html);
00502 
00503         $(name_ctl).innerHTML=code_html;
00504     }
00505     catch (e)
00506     {
00507         alert(e.message);
00508     }
00509     try
00510     {
00511         code_html.evalScripts();
00512     }
00513     catch(e)
00514     {
00515         alert("Impossible executer script de la reponse\n"+e.message);
00516     }
00517 }
00518 /**
00519  *@brief show the ipopup for selecting a card type, it is a needed step before adding
00520  * a card
00521  *@param input field (obj) it must have the attribute ipopup
00522  *       possible attribute :
00523  *        - filter is the filter but with a  fd_id list, -1 means there  is no filter
00524  *        - ref if we want to refresh the window after adding a card
00525  *        - type type of card (supplier, customer...)
00526  *@see ajax_card.php
00527  */
00528 function select_card_type(obj)
00529 {
00530 
00531     var dossier=$('gDossier').value;
00532 
00533     // give a filter, -1 if not
00534     var filter=$(obj).filter;
00535     if ( filter==undefined)
00536     {
00537         filter=-1;
00538     }
00539     var content="select_card_div";
00540     if ( $(content)){removeDiv(content);}
00541     var sx=0;
00542     if ( window.scrollY)
00543     {
00544             sx=window.scrollY+160;
00545     }
00546     else
00547     {
00548         sx=document.body.scrollTop+160;
00549     }
00550 
00551     var str_style="top:"+sx+"px;height:auto";
00552     waiting_box();
00553     var popup={'id':  content,'cssclass':'inner_box','style':str_style,'html':"",'drag':true};
00554 
00555     add_div(popup);
00556 
00557     var queryString='gDossier='+dossier;
00558     queryString+='&ctl='+content;
00559     queryString+='&op=st';      // st for selecting type
00560     if ( $(obj).win_refresh!=undefined)
00561     {
00562         queryString+='&ref';
00563     }
00564     queryString+='&fil='+filter;
00565     // filter on the ledger, -1 if not
00566     var oledger=$(obj).jrn;
00567     if (oledger==undefined)
00568     {
00569         ledger=-1;
00570     }
00571     else
00572     {
00573         ledger=$(obj).jrn;
00574     }
00575 
00576     queryString+='&ledger='+ledger;
00577 
00578     if ( obj.type_cat)
00579     {
00580         queryString+='&cat='+obj.type_cat;
00581     }
00582 
00583     var action=new Ajax.Request ( 'ajax_card.php',
00584                                   {
00585                                   method:'get',
00586                                   parameters:queryString,
00587                                   onFailure:errorFid,
00588                                   onSuccess:function(req) { 
00589                                    
00590                                       fill_box(req);
00591                                        $('lk_cat_card_table').focus();
00592                                     }
00593                                   }
00594                                 );
00595 }
00596 /**
00597  *@brief Show a blank card
00598  *@param Form object (obj)
00599  *       possible attribute :
00600  *        - filter is the filter but with a  fd_id list, -1 means there  is no filter
00601  *        - ref : reload the window after adding card
00602  *        - content : name of the div
00603  *@example dis_blank_card({gDossier:15,fd_id:12,ref:1});
00604  *@see ajax_card.php
00605  */
00606 function dis_blank_card(obj)
00607 {
00608     // first we have to take the form elt we need
00609     if ( obj.fd_id.value != undefined )
00610                 { var fd_id=$F('fd_id'); }
00611         else {fd_id=obj.fd_id;}
00612 
00613     var ref="";
00614     if ( obj.elements &&  obj.elements['ref'] )
00615     {
00616         ref='&ref';
00617     }
00618     var content='div_new_card';
00619     var nTop=calcy(150);
00620     var nLeft=posX;
00621     var str_style="top:"+nTop+"px;right:"+nLeft+"px;height:auto";
00622 
00623     var popup={'id':  content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true};
00624     if ( $(content)) {removeDiv(content);}
00625     add_div(popup);
00626 
00627         if ( obj.gDossier.value != undefined ) {
00628     var dossier=$('gDossier').value;} else {
00629         var dossier=obj.gDossier;
00630         }
00631 
00632     var queryString='gDossier='+dossier;
00633     queryString+='&ctl='+content;
00634     queryString+='&fd_id='+fd_id;
00635     queryString+=ref;
00636     queryString+='&op=bc';      // bc for blank card
00637 
00638     var action=new Ajax.Request ( 'ajax_card.php',
00639                                   {
00640                                   method:'get',
00641                                   parameters:queryString,
00642                                   onFailure:errorFid,
00643                                   onSuccess:successFill_ipopcard
00644                                   }
00645                                 );
00646 }
00647 function form_blank_card(obj)
00648 {
00649     // first we have to take the form elt we need
00650     var fd_id=obj.fd_id;
00651     var content='div_new_card';
00652     var nTop=posY-40;
00653     var nLeft=posX-20;
00654     var str_style="top:"+nTop+"px;left:"+nLeft+"px;width:60em;height:auto";
00655 
00656     var popup={'id':  content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true};
00657     if ( $(content)) {removeDiv(content);}
00658     add_div(popup);
00659 
00660 
00661     var dossier=$('gDossier').value;
00662 
00663     var queryString='gDossier='+dossier;
00664     queryString+='&ctl='+content;
00665     queryString+='&fd_id='+fd_id;
00666     queryString+='&op=bc';      // bc for blank card
00667 
00668     var action=new Ajax.Request ( 'ajax_card.php',
00669                                   {
00670                                   method:'get',
00671                                   parameters:queryString,
00672                                   onFailure:errorFid,
00673                                   onSuccess:successFill_ipopcard
00674                                   }
00675                                 );
00676 }
00677 
00678 /**
00679  *@brief save the data contained into the form 'save_card'
00680  *@param input field (obj) it must have the attribute ipopup
00681  *       possible attribute :
00682  *@see ajax_card.php
00683  */
00684 function save_card(obj)
00685 {
00686     var content=$(obj).ipopup;
00687     // Data must be taken here
00688     data=$('save_card').serialize(false);
00689     $(content).innerHTML=loading();
00690 
00691     var dossier=$('gDossier').value;
00692     var queryString='gDossier='+dossier;
00693     queryString+='&ctl='+content;
00694     queryString+=data;
00695     queryString+='&op=sc';      // sc for save card
00696 
00697     var action=new Ajax.Request ( 'ajax_card.php',
00698                                   {
00699                                   method:'post',
00700                                   parameters:queryString,
00701                                   onFailure:errorFid,
00702                                   onSuccess:fill_box
00703                                   }
00704                                 );
00705 }
00706 /**
00707  *@brief add a category of card,
00708  *@param obj with the attribute
00709  * - ipopup the ipopup to show
00710  * - type_cat the category of card we want to add
00711  */
00712 function add_category(obj)
00713 {
00714     var sx=0;
00715         if ( window.scrollY)
00716         {
00717             sx=window.scrollY+120;
00718         }
00719         else
00720         {
00721             sx=document.body.scrollTop+120;
00722         }
00723 
00724         var div_style="top:"+sx+"px;width:60%;height:80%";
00725     // show ipopup
00726         var div={id:obj.ipopup,
00727                         cssclass:"inner_box",drag:1,style:div_style};
00728         if ( $(div) ) {
00729                 removeDiv(div);
00730         }
00731         add_div(div);
00732         waiting_box();
00733     var dossier=$('gDossier').value;
00734     var queryString='gDossier='+dossier;
00735     queryString+='&op=ac';
00736     queryString+='&ctl='+obj.ipopup;
00737     if ( obj.type_cat)
00738     {
00739         queryString+='&cat='+obj.type_cat;
00740     }
00741     var action=new Ajax.Request ( 'ajax_card.php',
00742                                   {
00743                                   method:'get',
00744                                   parameters:queryString,
00745                                   onFailure:errorFid,
00746                                   onSuccess:fill_box
00747                                   }
00748                                 );
00749 
00750 }
00751 /**
00752  * @brief save the form and add a new category of card
00753  * @param obj if the form object
00754  */
00755 function save_card_category(obj)
00756 {
00757     if ( ! $(obj).ipopup)
00758     {
00759         alert('Erreur pas d\' attribut ipopup '+obj.id);
00760         return;
00761     };
00762         try {
00763                 // Data must be taken here
00764 
00765     data=$('newcat').serialize(false);
00766     var dossier=$('gDossier').value;
00767     queryString='ctl='+obj.ipopup+'&';
00768     queryString+=data;
00769     queryString+='&op=scc';     // sc for save card
00770 
00771     var action=new Ajax.Request ( 'ajax_card.php',
00772                                   {
00773                                   method:'get',
00774                                   parameters:queryString,
00775                                   onFailure:errorFid,
00776                                   onSuccess:fill_box
00777                                   }
00778                                 );
00779         } catch(e)
00780         {
00781                 alert(e.message);
00782                 return false;
00783         }
00784         return false;
00785 }
00786 /**
00787  *@brief Remove a definition of an  attribut
00788  *@param attr_def.ad_id
00789  *@param gDossier
00790  *@param table_id to rm the row
00791  *@param special this pointer of the row
00792  */
00793 
00794 function removeCardAttribut(ad_id,gDossier,table_id,row)
00795 {
00796     var queryString='gDossier='+gDossier;
00797     queryString+='&op=rmfa';
00798     queryString+='&ctl=debug';  // debug id
00799     queryString+='&ad_id='+ad_id;
00800     var action=new Ajax.Request ( 'ajax_card.php',
00801                                   {
00802                                   method:'get',
00803                                   parameters:queryString,
00804                                   onFailure:null,
00805                                   onSuccess:null
00806                                   }
00807                                 );
00808     deleteRowRec(table_id,row);
00809 
00810 
00811 }
00812 /**
00813 * update a card in ajax
00814 */
00815 function update_card(obj)
00816 {
00817 try {
00818     var name=obj.id;
00819     var qs=Form.serialize(name)+'&op=upc';
00820     var action=new Ajax.Request ( 'ajax_card.php',
00821                                   {
00822                                       method:'get',
00823                                       parameters:qs,
00824                                       onFailure:errorFid,
00825                                       onSuccess:successFill_ipopcard
00826                                   }
00827                                 );
00828     } catch (e) {
00829         alert(e.message);
00830         return false;
00831     }
00832 }
00833 /***
00834  * In Follow-up, update, it is possible to add several card as concerned person or company
00835  * this function save it into the database, display the result and remove the search_card div
00836  * @param {type} p_dossier dossier
00837  * @param {type} p_fiche_id fiche.f_id
00838  * @param {type} p_action_id action_gestion.ag_id
00839  * @returns {undefined} nothing
00840  */
00841 function action_save_concerned(p_dossier, p_fiche_id, p_action_id) {
00842     var query = encodeJSON({'gDossier': p_dossier, 'f_id': p_fiche_id, 'ag_id': p_action_id,'op':'action_save_concerned','ctl':'unused'});
00843     var a=new Ajax.Request('ajax_card.php',
00844             {
00845                 method: 'get',
00846                 parameters: query,
00847                 onFailure: errorFid,
00848                 onSuccess: function (req, txt)
00849                 {
00850                     try {
00851                         remove_waiting_box();
00852                         var answer = req.responseXML;
00853                         var a = answer.getElementsByTagName('ctl');
00854                         if (a.length == 0)
00855                         {
00856                             var rec = req.responseText;
00857                             alert('erreur :' + rec);
00858                         }
00859                         var html = answer.getElementsByTagName('code');
00860                         var namectl = a[0].firstChild.nodeValue;
00861                         var nodeXml=html[0];
00862                         var code_html = getNodeText(nodeXml);
00863                         code_html = unescape_xml(code_html);
00864                         removeDiv('search_card');
00865                         $('concerned_card_td').innerHTML = code_html;
00866                     } catch (e) {
00867                        
00868                     }
00869                 }
00870             }
00871     );
00872     }
00873 function action_remove_concerned(p_dossier,p_fiche_id,p_action_id)
00874 {
00875  var query = encodeJSON({'gDossier': p_dossier, 'f_id': p_fiche_id, 'ag_id': p_action_id,'op':'action_remove_concerned','ctl':'unused'});
00876     var a=new Ajax.Request('ajax_card.php',
00877             {
00878                 method: 'get',
00879                 parameters: query,
00880                 onFailure: errorFid,
00881                 onSuccess: function (req, txt)
00882                 {
00883                     try {
00884                         remove_waiting_box();
00885                         var answer = req.responseXML;
00886                         var a = answer.getElementsByTagName('ctl');
00887                         if (a.length == 0)
00888                         {
00889                             var rec = req.responseText;
00890                             alert('erreur :' + rec);
00891                         }
00892                         var html = answer.getElementsByTagName('code');
00893                         var namectl = a[0].firstChild.nodeValue;
00894                         var nodeXml=html[0];
00895                         var code_html = getNodeText(nodeXml);
00896                         code_html = unescape_xml(code_html);
00897                         removeDiv('search_card');
00898                         $('concerned_card_td').innerHTML = code_html;
00899                     } catch (e) {
00900                         if ( console) { console.log('Erreur ') + e.message;}
00901                     }
00902                 }
00903             }
00904     );
00905     }
00906     
 All Data Structures Namespaces Files Functions Variables Enumerations