diff --git a/html/admin/setup.php b/html/admin/setup.php index d5ff348b3..fe0c8d5aa 100644 --- a/html/admin/setup.php +++ b/html/admin/setup.php @@ -6,8 +6,8 @@ - - + +

@@ -43,7 +43,7 @@ ?>

- + get_array('select jrn_def_name,jrn_def_description from jrn_def where jrn_def_id=$1',array($l)); + if ( count($ajrn)==1) + { + + echo '

'.$ajrn[0]['jrn_def_name'].'

'; + if ( trim($ajrn[0]['jrn_def_description']) != "") { + echo '

'.$ajrn[0]['jrn_def_description'].'

'; + } + } + exit(); + break; default: var_dump($_GET); } diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index 1e9f24702..3600a6353 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -92,7 +92,21 @@ function update_pay_method() */ function update_name() { - $('jrn_name').innerHTML=$('p_jrn').options[$('p_jrn').selectedIndex].innerHTML; + var jrn_id=$('p_jrn').value; + var dossier=g("gDossier").value; + var querystring='gDossier='+dossier+'&l='+jrn_id+"&op=ledger_description"; + var action=new Ajax.Request( + "ajax_misc.php", + { + method:'get', + parameters:querystring, + onFailure:error_get_pj, + onSuccess:function (req){ + $('jrn_name_div').innerHTML=req.responseText; + } + } + ); + } /** * @brief update the field predef diff --git a/html/js/gestion.js b/html/js/gestion.js index e24e91376..1da485f71 100644 --- a/html/js/gestion.js +++ b/html/js/gestion.js @@ -33,7 +33,7 @@ */ function remove_document(p_dossier,p_id) { - queryString="gDossier="+p_dossier+"&a=rm&d_id="+p_id; + var queryString="gDossier="+p_dossier+"&a=rm&d_id="+p_id; var action=new Ajax.Request ( "show_document.php", { @@ -46,6 +46,32 @@ function remove_document(p_dossier,p_id) ); } +/** + *@brief update the description of an attached document of an action + *@param dossier + *@param dt_id id of the document (pk document:d_id) +*/ +function update_document(p_dossier,p_id) +{ + var queryString="gDossier="+p_dossier+"&a=upd_doc&d_id="+p_id; + queryString+="&value="+$('input_desc_txt'+p_id).value; + var action=new Ajax.Request ( + "show_document.php", + { + method:'get', + parameters:queryString, + onFailure:errorRemoveDoc, + onSuccess:function(req){ + $('input_desc'+p_id).hide(); + $('print_desc'+p_id).innerHTML=$('input_desc_txt'+p_id).value+'Modifier'; + $('print_desc'+p_id).show(); + } + } + + ); + return false; +} + /** *@brief remove the concerned operation of an action *@param dossier diff --git a/html/js/scripts.js b/html/js/scripts.js index 71a153532..f2cf81331 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -14,7 +14,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.fr @@ -23,65 +23,65 @@ * \brief javascript script, always added to every page * */ -var ask_reload=0; -var tag_choose=''; +var ask_reload = 0; +var tag_choose = ''; /** -* callback function when we just need to update a hidden div with an info -* message -*/ -function infodiv(req,json) + * callback function when we just need to update a hidden div with an info + * message + */ +function infodiv(req, json) { try { remove_waiting_box(); - var answer=req.responseXML; - var a=answer.getElementsByTagName('ctl'); - var html=answer.getElementsByTagName('code'); - if ( a.length == 0 ) + var answer = req.responseXML; + var a = answer.getElementsByTagName('ctl'); + var html = answer.getElementsByTagName('code'); + if (a.length == 0) { - var rec=req.responseText; - alert ('erreur :'+rec); + var rec = req.responseText; + alert('erreur :' + rec); } - var name_ctl=a[0].firstChild.nodeValue; - var code_html=getNodeText(html[0]); + var name_ctl = a[0].firstChild.nodeValue; + var code_html = getNodeText(html[0]); - code_html=unescape_xml(code_html); - g(name_ctl+"info").innerHTML=code_html; + code_html = unescape_xml(code_html); + g(name_ctl + "info").innerHTML = code_html; } catch (e) { - alert("success_box"+e.message); + alert("success_box" + e.message); } try { code_html.evalScripts(); } - catch(e) + catch (e) { - alert("answer_box Impossible executer script de la reponse\n"+e.message); + alert("answer_box Impossible executer script de la reponse\n" + e.message); } } /** -*@brief delete a row from a table (tb) the input button send the this -as second parameter -*/ -function deleteRow(tb,obj) + *@brief delete a row from a table (tb) the input button send the this + as second parameter + */ +function deleteRow(tb, obj) { if (confirm('Confirmez effacement')) { - var td=obj.parentNode; - var tr=td.parentNode; - var lidx=tr.rowIndex; + var td = obj.parentNode; + var tr = td.parentNode; + var lidx = tr.rowIndex; g(tb).deleteRow(lidx); } } -function deleteRowRec(tb,obj) +function deleteRowRec(tb, obj) { - var td=obj.parentNode; - var tr=td.parentNode; - var lidx=tr.rowIndex; + var td = obj.parentNode; + var tr = td.parentNode; + var lidx = tr.rowIndex; g(tb).deleteRow(lidx); } /*!\brief remove trailing and heading space @@ -104,7 +104,7 @@ function g(ID) { return this.document.getElementById(ID); } - else if (document.all) + else if (document.all) { return document.all[ID]; } @@ -118,21 +118,21 @@ function g(ID) */ function enable_type_periode() { - if ( g('type_periode').value == 1 ) + if (g('type_periode').value == 1) { - g('from_periode').disabled=true; - g('to_periode').disabled=true; - g('from_date').disabled=false; - g('to_date').disabled=false; - g('p_step').disabled=true; + g('from_periode').disabled = true; + g('to_periode').disabled = true; + g('from_date').disabled = false; + g('to_date').disabled = false; + g('p_step').disabled = true; } else { - g('from_periode').disabled=false; - g('to_periode').disabled=false; - g('from_date').disabled=true; - g('to_date').disabled=true; - g('p_step').disabled=false; + g('from_periode').disabled = false; + g('to_periode').disabled = false; + g('from_date').disabled = true; + g('to_date').disabled = true; + g('p_step').disabled = false; } } @@ -158,35 +158,35 @@ function encodeJSON(obj) } try { - var str=''; - var e=0; + var str = ''; + var e = 0; for (i in obj) { - if (e != 0 ) + if (e != 0) { - str+='&'; + str += '&'; } else { - e=1; + e = 1; } - str+=i; - str+='='+encodeURI(obj[i]); + str += i; + str += '=' + encodeURI(obj[i]); } return str; } - catch(e) + catch (e) { - alert('encodeParameter '+e.message); + alert('encodeParameter ' + e.message); } } function hide(p_param) { - g(p_param).style.display='none'; + g(p_param).style.display = 'none'; } function show(p_param) { - g(p_param).style.display='block'; + g(p_param).style.display = 'block'; } /** @@ -194,7 +194,7 @@ function show(p_param) *@param Field id of the control *@param selectIt : the value selected in case of Field is a object select, numeric */ -function SetFocus(Field,SelectIt) +function SetFocus(Field, SelectIt) { var elem = g(Field); if (elem) @@ -204,95 +204,95 @@ function SetFocus(Field,SelectIt) return true; } /** -* @brief set a DOM id with a value in the parent window (the caller), + * @brief set a DOM id with a value in the parent window (the caller), @param p_ctl is the name of the control @param p_value is the value to set in -@param p_add if we don't replace the current value but we add something -*/ -function set_inparent(p_ctl,p_value,p_add) + @param p_add if we don't replace the current value but we add something + */ +function set_inparent(p_ctl, p_value, p_add) { - self.opener.set_value(p_ctl,p_value,p_add); + self.opener.set_value(p_ctl, p_value, p_add); } /** -* @brief set a DOM id with a value, it will consider if it the attribute - value or innerHTML has be used + * @brief set a DOM id with a value, it will consider if it the attribute + value or innerHTML has be used @param p_ctl is the name of the control @param p_value is the value to set in -@param p_add if we don't replace the current value but we add something -*/ -function set_value(p_ctl,p_value,p_add) + @param p_add if we don't replace the current value but we add something + */ +function set_value(p_ctl, p_value, p_add) { - if ( g(p_ctl)) + if (g(p_ctl)) { - var g_ctrl=g(p_ctl); - if ( p_add != undefined && p_add==1 ) + var g_ctrl = g(p_ctl); + if (p_add != undefined && p_add == 1) { - if ( g_ctrl.value ) + if (g_ctrl.value) { - p_value=g_ctrl.value+','+p_value; + p_value = g_ctrl.value + ',' + p_value; } } - if ( g_ctrl.tagName=='INPUT' ) + if (g_ctrl.tagName == 'INPUT') { - g(p_ctl).value=p_value; + g(p_ctl).value = p_value; } - if ( g_ctrl.tagName=='SPAN' ) + if (g_ctrl.tagName == 'SPAN') { - g(p_ctl).innerHTML=p_value; + g(p_ctl).innerHTML = p_value; } - if ( g_ctrl.tagName=='SELECT' ) + if (g_ctrl.tagName == 'SELECT') { - g(p_ctl).value=p_value; + g(p_ctl).value = p_value; } } } /** -*@brief format the number change comma to point -*@param HTML obj -*/ -function format_number(obj,p_prec) + *@brief format the number change comma to point + *@param HTML obj + */ +function format_number(obj, p_prec) { - var precision=2; - if ( p_prec == undefined) - { - precision=2; - } else { - precision=p_prec; - } - var value=obj.value; - value=value.replace(/,/,'.'); - value=parseFloat(value); - if ( isNaN(value) ) + var precision = 2; + if (p_prec == undefined) { - value=0; + precision = 2; + } else { + precision = p_prec; } - var arrondi=Math.pow(10,precision); + var value = obj.value; + value = value.replace(/,/, '.'); + value = parseFloat(value); + if (isNaN(value)) + { + value = 0; + } + var arrondi = Math.pow(10, precision); - value=Math.round(value*arrondi)/arrondi; + value = Math.round(value * arrondi) / arrondi; - $(obj).value=value; + $(obj).value = value; } /** *@brief check if the object is hidden or show and perform the opposite, * show the hidden obj or hide the shown one *@param name of the object -*/ -function toggleHideShow(p_obj,p_button) + */ +function toggleHideShow(p_obj, p_button) { - var stat=g(p_obj).style.display; - var str=g(p_button).value; - if ( stat == 'none' ) + var stat = g(p_obj).style.display; + var str = g(p_button).value; + if (stat == 'none') { show(p_obj); - str=str.replace(/Afficher/,'Cacher'); - g(p_button).value=str; + str = str.replace(/Afficher/, 'Cacher'); + g(p_button).value = str; } else { hide(p_obj); - str=str.replace(/Cacher/,'Afficher'); - g(p_button).value=str; + str = str.replace(/Cacher/, 'Afficher'); + g(p_button).value = str; } } /** @@ -302,7 +302,7 @@ function toggleHideShow(p_obj,p_button) */ function popup_recherche(p_dossier) { - var w=window.open("recherche.php?gDossier="+p_dossier+"&ac=SEARCH",'','statusbar=no,scrollbars=yes,toolbar=no'); + var w = window.open("recherche.php?gDossier=" + p_dossier + "&ac=SEARCH", '', 'statusbar=no,scrollbars=yes,toolbar=no'); w.focus(); } /** @@ -311,11 +311,11 @@ function popup_recherche(p_dossier) */ function unescape_xml(code_html) { - code_html=code_html.replace(/\</,'<'); - code_html=code_html.replace(/\>/,'>'); - code_html=code_html.replace(/\"/,'"'); - code_html=code_html.replace(/\'/,"'"); - code_html=code_html.replace(/\&/,'&'); + code_html = code_html.replace(/\</, '<'); + code_html = code_html.replace(/\>/, '>'); + code_html = code_html.replace(/\"/, '"'); + code_html = code_html.replace(/\'/, "'"); + code_html = code_html.replace(/\&/, '&'); return code_html; } /** @@ -323,15 +323,17 @@ function unescape_xml(code_html) * to get the different parts thanks textContent *@param xmlNode a node (result of var data = =answer.getElementsByTagName('code')) *@return all the content of the XML node -*/ + */ function getNodeText(xmlNode) { - if(!xmlNode) return ''; - if(typeof(xmlNode.textContent) != "undefined") + if (!xmlNode) + return ''; + if (typeof (xmlNode.textContent) != "undefined") { return xmlNode.textContent; } - if ( xmlNode.firstChild && xmlNode.firstChild.nodeValue ) return xmlNode.firstChild.nodeValue; + if (xmlNode.firstChild && xmlNode.firstChild.nodeValue) + return xmlNode.firstChild.nodeValue; return ""; } /** @@ -340,36 +342,36 @@ function getNodeText(xmlNode) */ function change_month(obj) { - var queryString="gDossier="+obj.gDossier+"&op=cal"+"&per="+obj.value; + var queryString = "gDossier=" + obj.gDossier + "&op=cal" + "&per=" + obj.value; var action = new Ajax.Request( - "ajax_misc.php" , {method:'get', parameters:queryString,onFailure:ajax_misc_failure,onSuccess:success_misc} - ); + "ajax_misc.php", {method: 'get', parameters: queryString, onFailure: ajax_misc_failure, onSuccess: success_misc} + ); } /** -*@brief basic answer to ajax on success, it will fill the DOMID code with -* the code. In that case, you need to create the object before the Ajax.Request -*The difference with success box is that -*@see add_div removeDiv success_box is that the width and height are not changed ajax_misc.php -*@parameter code is the ID of the object containing the html (div, button...) -*@parameter value is the html code, with it you fill the ctl element -*/ + *@brief basic answer to ajax on success, it will fill the DOMID code with + * the code. In that case, you need to create the object before the Ajax.Request + *The difference with success box is that + *@see add_div removeDiv success_box is that the width and height are not changed ajax_misc.php + *@parameter code is the ID of the object containing the html (div, button...) + *@parameter value is the html code, with it you fill the ctl element + */ function success_misc(req) { try { - var answer=req.responseXML; - var html=answer.getElementsByTagName('code'); - if ( html.length == 0 ) + var answer = req.responseXML; + var html = answer.getElementsByTagName('code'); + if (html.length == 0) { - var rec=req.responseText; - alert ('erreur :'+rec); + var rec = req.responseText; + alert('erreur :' + rec); } - var nodeXml=html[0]; - var code_html=getNodeText(nodeXml); - code_html=unescape_xml(code_html); - $("user_cal").innerHTML=code_html; + var nodeXml = html[0]; + var code_html = getNodeText(nodeXml); + code_html = unescape_xml(code_html); + $("user_cal").innerHTML = code_html; } catch (e) { @@ -379,9 +381,9 @@ function success_misc(req) { code_html.evalScripts(); } - catch(e) + catch (e) { - alert("Impossible executer script de la reponse\n"+e.message); + alert("Impossible executer script de la reponse\n" + e.message); } @@ -400,60 +402,60 @@ function ajax_misc_failure() /** *@brief remove a document_modele */ -function cat_doc_remove(p_dt_id,p_dossier) +function cat_doc_remove(p_dt_id, p_dossier) { - var queryString="gDossier="+p_dossier+"&op=rem_cat_doc"+"&dt_id="+p_dt_id; + var queryString = "gDossier=" + p_dossier + "&op=rem_cat_doc" + "&dt_id=" + p_dt_id; var action = new Ajax.Request( - "ajax_misc.php" , {method:'get', parameters:queryString,onFailure:ajax_misc_failure,onSuccess:success_cat_doc_remove} - ); + "ajax_misc.php", {method: 'get', parameters: queryString, onFailure: ajax_misc_failure, onSuccess: success_cat_doc_remove} + ); } /** *@brief change a document_modele */ -function cat_doc_change(p_dt_id,p_dossier) +function cat_doc_change(p_dt_id, p_dossier) { - var queryString="gDossier="+p_dossier+"&op=mod_cat_doc"+"&dt_id="+p_dt_id; - var nTop=calcy(posY); - var nLeft="200px"; - var str_style="top:"+nTop+"px;left:"+nLeft+";width:50em;height:auto"; + var queryString = "gDossier=" + p_dossier + "&op=mod_cat_doc" + "&dt_id=" + p_dt_id; + var nTop = calcy(posY); + var nLeft = "200px"; + var str_style = "top:" + nTop + "px;left:" + nLeft + ";width:50em;height:auto"; removeDiv('change_doc_div'); waiting_box(); var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req){ - remove_waiting_box(); - add_div({id:'change_doc_div',style:str_style,cssclass:'inner_box',drag:"1"}); - $('change_doc_div').innerHTML=req.responseText; + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req) { + remove_waiting_box(); + add_div({id: 'change_doc_div', style: str_style, cssclass: 'inner_box', drag: "1"}); + $('change_doc_div').innerHTML = req.responseText; - } - } - ); + } + } + ); } function success_cat_doc_remove(req) { try { - var answer=req.responseXML; - var html=answer.getElementsByTagName('dtid'); - if ( html.length == 0 ) + var answer = req.responseXML; + var html = answer.getElementsByTagName('dtid'); + if (html.length == 0) { - var rec=req.responseText; - alert ('erreur :'+rec); + var rec = req.responseText; + alert('erreur :' + rec); } - nodeXML=html[0]; - row_id=getNodeText(nodeXML); - if ( row_id == 'nok') + nodeXML = html[0]; + row_id = getNodeText(nodeXML); + if (row_id == 'nok') { alert('Error'); return; } - $('row'+row_id).style.textDecoration="line-through"; - $('X'+row_id).style.display='none'; + $('row' + row_id).style.textDecoration = "line-through"; + $('X' + row_id).style.display = 'none'; } catch (e) { @@ -468,34 +470,34 @@ function popup_select_tva(obj) { try { - if ( $('tva_select')) { - removeDiv('tva_select'); - } + if ($('tva_select')) { + removeDiv('tva_select'); + } - var nTop=posY-50; - var nLeft="35%"; - var str_style="top:"+nTop+";left:"+nLeft+";width:55em;height:auto"; + var nTop = posY - 50; + var nLeft = "35%"; + var str_style = "top:" + nTop + ";left:" + nLeft + ";width:55em;height:auto"; - var popup={'id': 'tva_select','cssclass':'inner_box','style':str_style,'html':loading(),'drag':true}; - add_div(popup); - var queryString="gDossier="+obj.gDossier+"&op=dsp_tva"+"&ctl="+obj.ctl+'&popup='+'tva_select'; - if ( obj.jcode ) - queryString+='&code='+obj.jcode; + var popup = {'id': 'tva_select', 'cssclass': 'inner_box', 'style': str_style, 'html': loading(), 'drag': true}; + add_div(popup); + var queryString = "gDossier=" + obj.gDossier + "&op=dsp_tva" + "&ctl=" + obj.ctl + '&popup=' + 'tva_select'; + if (obj.jcode) + queryString += '&code=' + obj.jcode; if (obj.compute) - queryString+='&compute='+obj.compute; + queryString += '&compute=' + obj.compute; var action = new Ajax.Request( - "ajax_misc.php" , - {method:'get', - parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:success_popup_select_tva - } + "ajax_misc.php", + {method: 'get', + parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: success_popup_select_tva + } ); } catch (e) { - alert("popup_select_tva "+e.message); + alert("popup_select_tva " + e.message); } } /** @@ -505,24 +507,24 @@ function success_popup_select_tva(req) { try { - var answer=req.responseXML; - var popup=answer.getElementsByTagName('popup'); - if ( popup.length == 0 ) + var answer = req.responseXML; + var popup = answer.getElementsByTagName('popup'); + if (popup.length == 0) { - var rec=req.responseText; - alert ('erreur :'+rec); + var rec = req.responseText; + alert('erreur :' + rec); } - var html=answer.getElementsByTagName('code'); + var html = answer.getElementsByTagName('code'); - var name_ctl=popup[0].firstChild.nodeValue; - var nodeXml=html[0]; - var code_html=getNodeText(nodeXml); - code_html=unescape_xml(code_html); - $(name_ctl).innerHTML=code_html; + var name_ctl = popup[0].firstChild.nodeValue; + var nodeXml = html[0]; + var code_html = getNodeText(nodeXml); + code_html = unescape_xml(code_html); + $(name_ctl).innerHTML = code_html; } catch (e) { - alert("success_popup_select_tva "+e.message); + alert("success_popup_select_tva " + e.message); } } @@ -535,21 +537,21 @@ function set_tva_label(obj) { try { - var queryString="gDossier="+obj.gDossier+"&op=label_tva"+"&id="+obj.value; - if ( obj.jcode ) - queryString+='&code='+obj.jcode; + var queryString = "gDossier=" + obj.gDossier + "&op=label_tva" + "&id=" + obj.value; + if (obj.jcode) + queryString += '&code=' + obj.jcode; var action = new Ajax.Request( - "ajax_misc.php" , - {method:'get', - parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:success_set_tva_label - } - ); + "ajax_misc.php", + {method: 'get', + parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: success_set_tva_label + } + ); } catch (e) { - alert("set_tva_label "+e.message); + alert("set_tva_label " + e.message); } } /** @@ -559,23 +561,23 @@ function success_set_tva_label(req) { try { - var answer=req.responseXML; - var code=answer.getElementsByTagName('code'); - var value=answer.getElementsByTagName('value'); + var answer = req.responseXML; + var code = answer.getElementsByTagName('code'); + var value = answer.getElementsByTagName('value'); - if ( code.length == 0 ) + if (code.length == 0) { - var rec=req.responseText; - alert ('erreur :'+rec); + var rec = req.responseText; + alert('erreur :' + rec); } - var label_code=code[0].firstChild.nodeValue; - var label_value=value[0].firstChild.nodeValue; - set_value(label_code,label_value); + var label_code = code[0].firstChild.nodeValue; + var label_value = value[0].firstChild.nodeValue; + set_value(label_code, label_value); } catch (e) { - alert("success_set_tva_label "+e.message); + alert("success_set_tva_label " + e.message); } } @@ -586,8 +588,8 @@ function success_set_tva_label(req) */ function set_wait(name) { - var content=name+"_content"; - $(content).innerHTML= 'Un instant...Chargement...'; + var content = name + "_content"; + $(content).innerHTML = 'Un instant...Chargement...'; } /** *@brief add dynamically a object for AJAX @@ -603,51 +605,53 @@ function add_div(obj) { try { - var top=document; - - if ( ! $(obj.id) ) { var elt=top.createElement('div');} - else { - var elt=$(obj.id); + var top = document; + + if (!$(obj.id)) { + var elt = top.createElement('div'); } - if (obj.id ) + else { + var elt = $(obj.id); + } + if (obj.id) { - elt.setAttribute('id',obj.id); + elt.setAttribute('id', obj.id); } if (obj.style) { if (elt.style.setAttribute) { /* IE7 bug */ - elt.style.setAttribute('cssText',obj.style); + elt.style.setAttribute('cssText', obj.style); } else { /* good Browser */ - elt.setAttribute('style',obj.style); + elt.setAttribute('style', obj.style); } } - if (obj.cssclass ) + if (obj.cssclass) { - elt.setAttribute('class',obj.cssclass);/* FF */ - elt.setAttribute('className',obj.cssclass); /* IE */ + elt.setAttribute('class', obj.cssclass);/* FF */ + elt.setAttribute('className', obj.cssclass); /* IE */ } if (obj.html) { - elt.innerHTML=obj.html; + elt.innerHTML = obj.html; } - var bottom_div=document.body; + var bottom_div = document.body; bottom_div.appendChild(elt); - if ( obj.drag ) + if (obj.drag) { -new Draggable(obj.id,{starteffect:function() - { - new Effect.Highlight(obj.id,{scroll:window,queue:'end'}); - }} - ); + new Draggable(obj.id, {starteffect: function() + { + new Effect.Highlight(obj.id, {scroll: window, queue: 'end'}); + }} + ); } } catch (e) { - alert("add_div "+e.message); + alert("add_div " + e.message); } } /** @@ -656,17 +660,17 @@ new Draggable(obj.id,{starteffect:function() */ function removeDiv(elt) { - if (g(elt) ) + if (g(elt)) { document.body.removeChild(g(elt)); } - // if reloaded if asked the window will be reloaded when - // the box is closed - if ( ask_reload == 1) - { - // avoid POST window.location = window.location.href; - window.location.reload(); - } + // if reloaded if asked the window will be reloaded when + // the box is closed + if (ask_reload == 1) + { + // avoid POST window.location = window.location.href; + window.location.reload(); + } } /** *show a box while loading @@ -675,46 +679,46 @@ function removeDiv(elt) */ function waiting_box() { - obj={ - id:'wait_box',html:loading() - }; - var y=calcy(posY); - obj.style=fixed_position(posX,y)+";width:200px"; - if ($('wait_box')){ - removeDiv('wait_box'); - } - add_div(obj); - $('info_div').innerHTML="Un instant"; - $('info_div').style.display="block"; + obj = { + id: 'wait_box', html: loading() + }; + var y = calcy(posY); + obj.style = fixed_position(posX, y) + ";width:200px"; + if ($('wait_box')) { + removeDiv('wait_box'); + } + add_div(obj); + $('info_div').innerHTML = "Un instant"; + $('info_div').style.display = "block"; } /** -*@brief call add_div to add a DIV and after call the ajax -* the queryString, the callback for function for success and error management -* the method is always GET -*@param obj, the mandatory attributes are -* - obj.qs querystring -* - obj.js_success callback function in javascript for handling the xml answer -* - obj.js_error callback function for error -* - obj.callback the php file to call -* - obj.fixed optional let you determine the position, otherwise works like IPopup -*@see add_div IBox -*/ + *@brief call add_div to add a DIV and after call the ajax + * the queryString, the callback for function for success and error management + * the method is always GET + *@param obj, the mandatory attributes are + * - obj.qs querystring + * - obj.js_success callback function in javascript for handling the xml answer + * - obj.js_error callback function for error + * - obj.callback the php file to call + * - obj.fixed optional let you determine the position, otherwise works like IPopup + *@see add_div IBox + */ function show_box(obj) { - add_div(obj) ; - if ( ! obj.fixed ) + add_div(obj); + if (!obj.fixed) { - var sx=0; - if ( window.scrollY) + var sx = 0; + if (window.scrollY) { - sx=window.scrollY+40; + sx = window.scrollY + 40; } else { - sx=document.body.scrollTop+40; + sx = document.body.scrollTop + 40; } - g(obj.id).style.top=sx; + g(obj.id).style.top = sx; show(obj.id); } else @@ -722,14 +726,14 @@ function show_box(obj) show(obj.id); } - var action=new Ajax.Request ( - obj.callback, - { - method:'GET', - parameters:obj.qs, - onFailure:eval(obj.js_error), - onSuccess:eval(obj.js_success) - }); + var action = new Ajax.Request( + obj.callback, + { + method: 'GET', + parameters: obj.qs, + onFailure: eval(obj.js_error), + onSuccess: eval(obj.js_success) + }); } /** *@brief receive answer from ajax and just display it into the IBox @@ -737,109 +741,192 @@ function show_box(obj) * code is the HTML to put in it *@see fill_box */ -function success_box(req,json) +function success_box(req, json) { try { - var answer=req.responseXML; - var a=answer.getElementsByTagName('ctl'); - var html=answer.getElementsByTagName('code'); - if ( a.length == 0 ) + var answer = req.responseXML; + var a = answer.getElementsByTagName('ctl'); + var html = answer.getElementsByTagName('code'); + if (a.length == 0) { - var rec=req.responseText; - alert ('erreur :'+rec); + var rec = req.responseText; + alert('erreur :' + rec); } - var name_ctl=a[0].firstChild.nodeValue; - var code_html=getNodeText(html[0]); + var name_ctl = a[0].firstChild.nodeValue; + var code_html = getNodeText(html[0]); - code_html=unescape_xml(code_html); - g(name_ctl).innerHTML=code_html; - g(name_ctl).style.height='auto'; + code_html = unescape_xml(code_html); + g(name_ctl).innerHTML = code_html; + g(name_ctl).style.height = 'auto'; - if(name_ctl != 'popup') - g(name_ctl).style.width='60%'; + if (name_ctl != 'popup') + g(name_ctl).style.width = '60%'; else - g(name_ctl).style.width='auto'; + g(name_ctl).style.width = 'auto'; } catch (e) { - alert("success_box"+e.message); + alert("success_box" + e.message); } try { code_html.evalScripts(); } - catch(e) + catch (e) { - alert("answer_box Impossible executer script de la reponse\n"+e.message); + alert("answer_box Impossible executer script de la reponse\n" + e.message); } } -function error_box () +function error_box() { alert('IBOX : error_box ajax not implemented'); } /** -* show the ledger choice -*/ -function show_ledger_choice() + * show the ledger choice + */ +function show_ledger_choice(json_obj) { - if ($('div_jrn')) g('div_jrn').style.visibility='visible'; - if ($('div_jrnsearch_op')) $('div_jrnsearch_op').style.display='block'; + try + { + waiting_box(); + var i = 0; + var query = "gDossier=" + json_obj.dossier + '&type=' + json_obj.type + '&div=' + json_obj.div + '&op=ledger_show'; + query = query + '&nbjrn=' + $( json_obj.div+'nb_jrn').value; + query = query + '&all_type=' + json_obj.all_type; + for (i = 0; i < $( json_obj.div+'nb_jrn').value; i++) { + query = query + "&r_jrn[]=" + $( json_obj.div+'r_jrn[' + i + ']').value; + } + var action = new Ajax.Request( + "ajax_misc.php", + {method: 'get', + parameters: query, + onFailure: ajax_misc_failure, + onSuccess: function(req, json) { + try { + var obj = { + id: json_obj.div + 'jrn_search', + cssclass: 'inner_box', + style: ';position:absolute;width:60%;z-index:20;margin-left:20%', + drag: 1 + }; + var y=calcy(posY); + if (json_obj.div != '')obj.cssclass=""; + obj.style="top:"+y+obj.style; + add_div(obj); + + + var answer = req.responseXML; + var a = answer.getElementsByTagName('ctl'); + var html = answer.getElementsByTagName('code'); + if (a.length == 0) { + var rec = req.responseText; + alert('erreur :' + rec); + } + var name_ctl = a[0].firstChild.nodeValue; + var code_html = getNodeText(html[0]); + + code_html = unescape_xml(code_html); + remove_waiting_box(); + g(obj.id).innerHTML = code_html; + + } + catch (e) { + alert("show_ledger_callback" + e.message); + } + try { + code_html.evalScripts(); + } + catch (e) { + alert("answer_box Impossible executer script de la reponse\n" + e.message); + } + + } + + } + ); + } catch (e) { + alert('show_ledger_choice'+e.message); + } } /** -* hide the ledger choice -*/ -function hide_ledger_choice() + * hide the ledger choice + */ +function hide_ledger_choice(p_frm_search) { - if ($('div_jrn')) g('div_jrn').style.visibility='hidden'; - if ($('div_jrnsearch_op')) $('div_jrnsearch_op').style.display='none'; + try + { + var nb = $(p_frm_search).nb_jrn.value; + var div = $(p_frm_search).div.value; + var i = 0; + var str = ""; + var name = ""; + var n_name = ""; + var sel=0; + for (i = 0; i < nb; i++) { + n_name = div + "r_jrn[" + sel+"]"; + name = div + "r_jrn" + i; + if ($(name).checked) { + str += ''; + sel++; + } + } + str += ''; + $('ledger_id'+div).innerHTML = str; + removeDiv(div+'jrn_search'); + return false; + } catch (e) { + alert('hide_ledger_choice'+e.message); + return false; + } + } /** -* show the cat of ledger choice -*/ + * show the cat of ledger choice + */ function show_cat_choice() { - g('div_cat').style.visibility='visible'; + g('div_cat').style.visibility = 'visible'; } /** -* hide the cat of ledger choice -*/ + * hide the cat of ledger choice + */ function hide_cat_choice() { - g('div_cat').style.visibility='hidden'; + g('div_cat').style.visibility = 'hidden'; } /** -* add a row for the forecast item -*/ + * add a row for the forecast item + */ function for_add_row(tableid) { - style='class="input_text"'; - var mytable=g(tableid).tBodies[0]; - var nNumberRow=mytable.rows.length; - var oRow=mytable.insertRow(nNumberRow); - var rowToCopy=mytable.rows[1]; - var nNumberCell=rowToCopy.cells.length; - var nb=g("nbrow"); + style = 'class="input_text"'; + var mytable = g(tableid).tBodies[0]; + var nNumberRow = mytable.rows.length; + var oRow = mytable.insertRow(nNumberRow); + var rowToCopy = mytable.rows[1]; + var nNumberCell = rowToCopy.cells.length; + var nb = g("nbrow"); var oNewRow = mytable.insertRow(nNumberRow); - for ( var e=0;e < nNumberCell;e++) + for (var e = 0; e < nNumberCell; e++) { - var newCell=oRow.insertCell(e); - var tt=rowToCopy.cells[e].innerHTML; - new_tt=tt.replace(/an_cat0/g,"an_cat"+nb.value); - new_tt=new_tt.replace(/an_cat_acc0/g,"an_cat_acc"+nb.value); - new_tt=new_tt.replace(/an_qc0/g,"an_qc"+nb.value); - new_tt=new_tt.replace(/an_label0/g,"an_label"+nb.value); - new_tt=new_tt.replace(/month0/g,"month"+nb.value); - new_tt=new_tt.replace(/an_cat_amount0/g,"an_cat_amount"+nb.value); - new_tt=new_tt.replace(/an_deb0/g,"an_deb"+nb.value); - newCell.innerHTML=new_tt; + var newCell = oRow.insertCell(e); + var tt = rowToCopy.cells[e].innerHTML; + new_tt = tt.replace(/an_cat0/g, "an_cat" + nb.value); + new_tt = new_tt.replace(/an_cat_acc0/g, "an_cat_acc" + nb.value); + new_tt = new_tt.replace(/an_qc0/g, "an_qc" + nb.value); + new_tt = new_tt.replace(/an_label0/g, "an_label" + nb.value); + new_tt = new_tt.replace(/month0/g, "month" + nb.value); + new_tt = new_tt.replace(/an_cat_amount0/g, "an_cat_amount" + nb.value); + new_tt = new_tt.replace(/an_deb0/g, "an_deb" + nb.value); + newCell.innerHTML = new_tt; new_tt.evalScripts(); } - $("an_cat_acc"+nb.value).value=""; - $("an_qc"+nb.value).value=""; - $("an_label"+nb.value).value=""; - $("an_cat_amount"+nb.value).value="0"; + $("an_cat_acc" + nb.value).value = ""; + $("an_qc" + nb.value).value = ""; + $("an_label" + nb.value).value = ""; + $("an_cat_amount" + nb.value).value = "0"; nb.value++; } /** @@ -848,19 +935,19 @@ function for_add_row(tableid) */ function toggle_checkbox(form_id) { - var form=g(form_id); - for (var i=0;iFermer'; - shtml+='

Calculatrice

'; - shtml+='
Calculatrice simplifiée: écrivez simplement les opérations que vous voulez puis la touche retour. exemple : 1+2+3*(1/5) '; - shtml+='

Taper une formule (ex 20*5.1) puis enter
'; + var sid = 'calc1'; + var shtml = ''; + shtml += '
Fermer
'; + shtml += '

Calculatrice

'; + shtml += '
Calculatrice simplifiée: écrivez simplement les opérations que vous voulez puis la touche retour. exemple : 1+2+3*(1/5) '; + shtml += '

Taper une formule (ex 20*5.1) puis enter
'; -var obj={id:sid,html:shtml, - drag:true,style:'' - }; + var obj = {id: sid, html: shtml, + drag: true, style: '' + }; add_div(obj); this.document.getElementById('inp').focus(); } -function display_periode(p_dossier,p_id) +function display_periode(p_dossier, p_id) { - try + try { - var queryString="gDossier="+p_dossier+"&op=input_per"+"&p_id="+p_id; - var popup={'id': 'mod_periode','cssclass':'inner_box','html':loading(),'style':'width:30em','drag':true}; - if ( ! $('mod_periode') ) { - add_div(popup); - } + var queryString = "gDossier=" + p_dossier + "&op=input_per" + "&p_id=" + p_id; + var popup = {'id': 'mod_periode', 'cssclass': 'inner_box', 'html': loading(), 'style': 'width:30em', 'drag': true}; + if (!$('mod_periode')) { + add_div(popup); + } var action = new Ajax.Request( - "ajax_misc.php" , - {method:'get', - parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:success_display_periode - } + "ajax_misc.php", + {method: 'get', + parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: success_display_periode + } ); - $('mod_periode').style.top=posY-70; - $('mod_periode').style.left=posX-70; - } + $('mod_periode').style.top = posY - 70; + $('mod_periode').style.left = posX - 70; + } catch (e) { - alert("display_periode "+e.message); + alert("display_periode " + e.message); } } function success_display_periode(req) -{try +{ + try { - var answer=req.responseXML; - var html=answer.getElementsByTagName('data'); + var answer = req.responseXML; + var html = answer.getElementsByTagName('data'); - if ( html.length == 0 ) + if (html.length == 0) { - var rec=req.responseText; - alert ('erreur :'+rec); + var rec = req.responseText; + alert('erreur :' + rec); } - var code_html=getNodeText(html[0]); - code_html=unescape_xml(code_html); + var code_html = getNodeText(html[0]); + code_html = unescape_xml(code_html); - $('mod_periode').innerHTML=code_html; + $('mod_periode').innerHTML = code_html; } catch (e) { @@ -974,110 +1062,116 @@ function success_display_periode(req) { code_html.evalScripts(); } - catch(e) + catch (e) { - alert("success_display_periode Impossible executer script de la reponse\n"+e.message); + alert("success_display_periode Impossible executer script de la reponse\n" + e.message); } } function save_periode(obj) { - try + try { - var queryString=$(obj).serialize()+"&op=save_per"; + var queryString = $(obj).serialize() + "&op=save_per"; var action = new Ajax.Request( - "ajax_misc.php" , - {method:'post', - parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:success_display_periode - } + "ajax_misc.php", + {method: 'post', + parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: success_display_periode + } ); } catch (e) { - alert("display_periode "+e.message); + alert("display_periode " + e.message); } return false; } /** -*@brief basic answer to ajax on success, it will fill the ctl with -* the code. In that case, you need to create the object before the Ajax.Request -*The difference with success box is that -*@see add_div removeDiv success_box is that the width and height are not changed -*@parameter ctl is the ID of the object containing the html (div, button...) -*@parameter code is the html code, with it you fill the ctl element -*/ + *@brief basic answer to ajax on success, it will fill the ctl with + * the code. In that case, you need to create the object before the Ajax.Request + *The difference with success box is that + *@see add_div removeDiv success_box is that the width and height are not changed + *@parameter ctl is the ID of the object containing the html (div, button...) + *@parameter code is the html code, with it you fill the ctl element + */ function fill_box(req) { - try{ + try { - remove_waiting_box(); + remove_waiting_box(); - var answer=req.responseXML; - var a=answer.getElementsByTagName('ctl'); - var html=answer.getElementsByTagName('code'); - if ( a.length == 0 ) {var rec=req.responseText;alert ('erreur :'+rec);} - var name_ctl=a[0].firstChild.nodeValue; - var code_html=getNodeText(html[0]); // Firefox ne prend que les 4096 car. - code_html=unescape_xml(code_html); - $(name_ctl).innerHTML=code_html; + var answer = req.responseXML; + var a = answer.getElementsByTagName('ctl'); + var html = answer.getElementsByTagName('code'); + if (a.length == 0) { + var rec = req.responseText; + alert('erreur :' + rec); + } + var name_ctl = a[0].firstChild.nodeValue; + var code_html = getNodeText(html[0]); // Firefox ne prend que les 4096 car. + code_html = unescape_xml(code_html); + $(name_ctl).innerHTML = code_html; } catch (e) { - alert(e.message);} - try{ - code_html.evalScripts();} - catch(e){ - alert("Impossible executer script de la reponse\n"+e.message);} + alert(e.message); + } + try { + code_html.evalScripts(); + } + catch (e) { + alert("Impossible executer script de la reponse\n" + e.message); + } } /** -*display a popin to let you modified a predefined operation -*@param dossier_id -*@param od_id from table op_predef -*/ -function mod_predf_op(dossier_id,od_id) + *display a popin to let you modified a predefined operation + *@param dossier_id + *@param od_id from table op_predef + */ +function mod_predf_op(dossier_id, od_id) { - var target="mod_predf_op"; - removeDiv(target); - var sx='20%'; - var sy='20%'; - var str_style="top:"+sx+";left:"+sy+'width:60%;'; + var target = "mod_predf_op"; + removeDiv(target); + var sx = '20%'; + var sy = '20%'; + var str_style = "top:" + sx + ";left:" + sy + 'width:60%;'; - var div={id:target, cssclass:'inner_box',style:str_style,html:loading(),drag:1}; + var div = {id: target, cssclass: 'inner_box', style: str_style, html: loading(), drag: 1}; add_div(div); - var qs="gDossier="+dossier_id+'&op=mod_predf&id='+od_id; + var qs = "gDossier=" + dossier_id + '&op=mod_predf&id=' + od_id; - var action=new Ajax.Request ( 'ajax_misc.php', - { - method:'get', - parameters:qs, - onFailure:null, - onSuccess:fill_box - } - ); + var action = new Ajax.Request('ajax_misc.php', + { + method: 'get', + parameters: qs, + onFailure: null, + onSuccess: fill_box + } + ); } function save_predf_op(obj) { waiting_box(); - var querystring=$(obj).serialize()+'&op=save_predf'; + var querystring = $(obj).serialize() + '&op=save_predf'; // Create a ajax request to get all the person - var action = new Ajax.Request ('ajax_misc.php', - { - method: 'post', - parameters: querystring, - onFailure: null, - onSuccess: refresh_window - } - ); + var action = new Ajax.Request('ajax_misc.php', + { + method: 'post', + parameters: querystring, + onFailure: null, + onSuccess: refresh_window + } + ); return false; } @@ -1085,72 +1179,78 @@ function save_predf_op(obj) *ctl_concern is the widget to update *amount_id is either a html obj. or an amount */ -function search_reconcile(dossier,ctl_concern,amount_id,ledger) +function search_reconcile(dossier, ctl_concern, amount_id, ledger) { - var dossier=g('gDossier').value; - if ( amount_id == undefined ) - {amount_id=0;} - else if ($(amount_id)) - { - if ($(amount_id).value) - {amount_id=$(amount_id).value;} - else if - ($(amount_id).innerHTML) {amount_id=$(amount_id).innerHTML;} - } + var dossier = g('gDossier').value; + if (amount_id == undefined) + { + amount_id = 0; + } + else if ($(amount_id)) + { + if ($(amount_id).value) + { + amount_id = $(amount_id).value; + } + else if + ($(amount_id).innerHTML) { + amount_id = $(amount_id).innerHTML; + } + } - var target="search_op"; - removeDiv(target); - var str_style=fixed_position(77, 99); - str_style+=";width:92%;overflow:auto;"; + var target = "search_op"; + removeDiv(target); + var str_style = fixed_position(77, 99); + str_style += ";width:92%;overflow:auto;"; - var div={id:target, cssclass:'inner_box',style:str_style,html:loading(),drag:1}; + var div = {id: target, cssclass: 'inner_box', style: str_style, html: loading(), drag: 1}; add_div(div); - var target={gDossier:dossier, - ctlc:ctl_concern, - op:'search_op', - ctl:target, - ac:'JSSEARCH', - amount_id:amount_id, - ledger:ledger}; + var target = {gDossier: dossier, + ctlc: ctl_concern, + op: 'search_op', + ctl: target, + ac: 'JSSEARCH', + amount_id: amount_id, + ledger: ledger}; - var qs=encodeJSON(target); + var qs = encodeJSON(target); - var action=new Ajax.Request ( 'ajax_misc.php', - { - method:'get', - parameters:qs, - onFailure:null, - onSuccess:function (req){ - remove_waiting_box(); - $('search_op').innerHTML=req.responseText; - req.responseText.evalScripts(); - } - } - ); + var action = new Ajax.Request('ajax_misc.php', + { + method: 'get', + parameters: qs, + onFailure: null, + onSuccess: function(req) { + remove_waiting_box(); + $('search_op').innerHTML = req.responseText; + req.responseText.evalScripts(); + } + } + ); } /** * search in a popin obj if the object form */ function search_operation(obj) { - try{ - var dossier=g('gDossier').value; - waiting_box(); - var target="search_op"; - var qs=Form.serialize('search_form_ajx')+"&op=search_op&ctl=search_op"; - var action=new Ajax.Request ( 'ajax_misc.php', - { - method:'get', - parameters:qs, - onFailure:null, - onSuccess:function (req){ - remove_waiting_box(); - $('search_op').innerHTML=req.responseText; - req.responseText.evalScripts(); - } - } - ); + try { + var dossier = g('gDossier').value; + waiting_box(); + var target = "search_op"; + var qs = Form.serialize('search_form_ajx') + "&op=search_op&ctl=search_op"; + var action = new Ajax.Request('ajax_misc.php', + { + method: 'get', + parameters: qs, + onFailure: null, + onSuccess: function(req) { + remove_waiting_box(); + $('search_op').innerHTML = req.responseText; + req.responseText.evalScripts(); + } + } + ); } catch (e) { remove_waiting_box(); @@ -1159,75 +1259,78 @@ function search_operation(obj) } function set_reconcile(obj) - { +{ - try - { - var ctlc=obj.elements['ctlc']; + try + { + var ctlc = obj.elements['ctlc']; - for (var e=0;e'; + cellPos.innerHTML = ''; // right cell var cellName = row.insertCell(1); - cellName.innerHTML=''; + cellName.innerHTML = ''; // button + formula var cellbutton = row.insertCell(2); - var but_html=table.rows[1].cells[2].innerHTML; - but_html=but_html.replace(/form0/g,"form"+line); - cellbutton.innerHTML=but_html; + var but_html = table.rows[1].cells[2].innerHTML; + but_html = but_html.replace(/form0/g, "form" + line); + cellbutton.innerHTML = but_html; but_html.evalScripts(); - g('form'+line).value=''; + g('form' + line).value = ''; } /** * Search an action in an inner box */ -function search_action(dossier,ctl_concern) +function search_action(dossier, ctl_concern) { - try - { - var dossier=g('gDossier').value; + try + { + var dossier = g('gDossier').value; - var target="search_action_div"; - removeDiv(target); - var str_style=fixed_position(77, 99); - str_style+=";width:80%"; + var target = "search_action_div"; + removeDiv(target); + var str_style = fixed_position(77, 99); + str_style += ";width:80%"; - var div={id:target, cssclass:'inner_box',style:str_style,html:loading(),drag:1}; + var div = {id: target, cssclass: 'inner_box', style: str_style, html: loading(), drag: 1}; - add_div(div); - var target={gDossier:dossier, - ctlc:ctl_concern, - op:'search_action', - ctl:target - }; + add_div(div); + var target = {gDossier: dossier, + ctlc: ctl_concern, + op: 'search_action', + ctl: target + }; - var qs=encodeJSON(target); + var qs = encodeJSON(target); - var action=new Ajax.Request ( 'ajax_misc.php', - { - method:'get', - parameters:qs, - onFailure:null, - onSuccess:function (req){ - try { - remove_waiting_box(); - $('search_action_div').innerHTML=req.responseText; - req.responseText.evalScripts(); - }catch( e){alert(e.message);} - } - } - ); - }catch( e){alert(e.message);} + var action = new Ajax.Request('ajax_misc.php', + { + method: 'get', + parameters: qs, + onFailure: null, + onSuccess: function(req) { + try { + remove_waiting_box(); + $('search_action_div').innerHTML = req.responseText; + req.responseText.evalScripts(); + } catch (e) { + alert(e.message); + } + } + } + ); + } catch (e) { + alert(e.message); + } } function result_search_action(obj) { - try + try { - var queryString=$(obj).serialize()+"&op=search_action"; + var queryString = $(obj).serialize() + "&op=search_action"; 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);} - } - } + "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); + alert("display_periode " + e.message); } return false; } function set_action_related(p_obj) - { +{ - try - { - var obj=$(p_obj); - var ctlc=obj.elements['ctlc']; + try + { + var obj = $(p_obj); + var ctlc = obj.elements['ctlc']; - for (var e=0;e= 0) { - aCol = colnr.split(','); - } else { - aCol[0] = colnr; - } - var ele; + // if colnr contains a comma then check several columns + var aCol = new Array(); + if (colnr.indexOf(',') >= 0) { + aCol = colnr.split(','); + } else { + aCol[0] = colnr; + } + var ele; - for (var r = start_row; r < table.rows.length; r++) { - var found=0; - for (var col =0;col < aCol.length;col++) - { - var idx=aCol[col]; - if (table.rows[r].cells[idx]) - { - ele = table.rows[r].cells[idx].innerHTML.replace(/<[^>]+>/g, ""); - //var displayStyle = 'none'; - if (ele.toLowerCase().indexOf(words) >= 0){ found=1; } - } + for (var r = start_row; r < table.rows.length; r++) { + var found = 0; + for (var col = 0; col < aCol.length; col++) + { + var idx = aCol[col]; + if (table.rows[r].cells[idx]) + { + ele = table.rows[r].cells[idx].innerHTML.replace(/<[^>]+>/g, ""); + //var displayStyle = 'none'; + if (ele.toLowerCase().indexOf(words) >= 0) { + found = 1; + } + } - } - if (found == 1 ){ - table.rows[r].style.display = ''; - } else { - table.rows[r].style.display = 'none'; - } - $('info_div').style.display="none"; - $('info_div').innerHTML=""; - } + } + if (found == 1) { + table.rows[r].style.display = ''; + } else { + table.rows[r].style.display = 'none'; + } + $('info_div').style.display = "none"; + $('info_div').innerHTML = ""; + } } /** * @brief @@ -1785,31 +1908,31 @@ function filter_table(phrase, _id, colnr,start_row) { */ function display_task(p_id) { - new Draggable(p_id,{starteffect:function() - { - new Effect.Highlight(obj.id,{scroll:window,queue:'end'}); - }} - ); - $(p_id).style.top=posY; - $(p_id).style.left=posX; - $(p_id).style.display='block'; + new Draggable(p_id, {starteffect: function() + { + new Effect.Highlight(obj.id, {scroll: window, queue: 'end'}); + }} + ); + $(p_id).style.top = posY; + $(p_id).style.left = posX; + $(p_id).style.display = 'block'; } /** * @brief * Set a message in the info */ -function info_message (p_message) +function info_message(p_message) { - $('info_div').innerHTML=p_message; - $('info_div').style.display="block"; + $('info_div').innerHTML = p_message; + $('info_div').style.display = "block"; } /** * @brief hide the info box */ function info_hide() { - $('info_div').style.display="none"; + $('info_div').style.display = "none"; } /** * Show the navigator in a internal window @@ -1819,33 +1942,33 @@ function ask_navigator(p_dossier) { try { waiting_box(); removeDiv('navi_div') - var queryString="gDossier="+p_dossier+"&op=navigator"; - var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req){ - remove_waiting_box(); - add_div({id:'navi_div',style:'top:2em;left:2em;width:90%',cssclass:'inner_box'}); - $('navi_div').innerHTML=req.responseText; - try - { - req.responseText.evalScripts(); - sorttable.makeSortable($("navi_tb")); - } - catch(e) - { - alert("answer_box Impossible executer script de la reponse\n"+e.message); - } + var queryString = "gDossier=" + p_dossier + "&op=navigator"; + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req) { + remove_waiting_box(); + add_div({id: 'navi_div', style: 'top:2em;left:2em;width:90%', cssclass: 'inner_box'}); + $('navi_div').innerHTML = req.responseText; + try + { + req.responseText.evalScripts(); + sorttable.makeSortable($("navi_tb")); + } + catch (e) + { + alert("answer_box Impossible executer script de la reponse\n" + e.message); + } - } - } - ); + } + } + ); } catch (e) { info_message(e.getMessage); } - + } /** * @brief Display an internal windows to set the user's preference @@ -1855,32 +1978,32 @@ function set_preference(p_dossier) { try { waiting_box(); removeDiv('preference_div') - var queryString="gDossier="+p_dossier+"&op=preference"; - var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req){ - remove_waiting_box(); - add_div({id:'preference_div',drag:1}); - $('preference_div').innerHTML=req.responseText; - try - { - req.responseText.evalScripts(); - } - catch(e) - { - alert("answer_box Impossible executer script de la reponse\n"+e.message); - } + var queryString = "gDossier=" + p_dossier + "&op=preference"; + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req) { + remove_waiting_box(); + add_div({id: 'preference_div', drag: 1}); + $('preference_div').innerHTML = req.responseText; + try + { + req.responseText.evalScripts(); + } + catch (e) + { + alert("answer_box Impossible executer script de la reponse\n" + e.message); + } - } - } - ); + } + } + ); } catch (e) { info_message(e.getMessage); } - + } /** * @brief Display user's bookmark @@ -1890,34 +2013,34 @@ function show_bookmark(p_dossier) { try { waiting_box(); removeDiv('bookmark_div'); - var param=window.location.search; - param=param.gsub('?',''); - var queryString="gDossier="+p_dossier+"&op=bookmark&"+param; - var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req){ - remove_waiting_box(); - add_div({id:'bookmark_div',cssclass:'inner_box',drag:1}); - $('bookmark_div').innerHTML=req.responseText; - try - { - req.responseText.evalScripts(); - } - catch(e) - { - alert("answer_box Impossible executer script de la reponse\n"+e.message); - } + var param = window.location.search; + param = param.gsub('?', ''); + var queryString = "gDossier=" + p_dossier + "&op=bookmark&" + param; + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req) { + remove_waiting_box(); + add_div({id: 'bookmark_div', cssclass: 'inner_box', drag: 1}); + $('bookmark_div').innerHTML = req.responseText; + try + { + req.responseText.evalScripts(); + } + catch (e) + { + alert("answer_box Impossible executer script de la reponse\n" + e.message); + } - } - } - ); + } + } + ); } catch (e) { info_message(e.getMessage); } - + } /** * @brief save the bookmark @@ -1925,33 +2048,33 @@ function show_bookmark(p_dossier) { function save_bookmark() { try { waiting_box(); - var queryString="op=bookmark&"+$("bookmark_frm").serialize(); - var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req){ - remove_waiting_box(); - // removeDiv('bookmark_div'); - // - $('bookmark_div').innerHTML=req.responseText; - try - { - req.responseText.evalScripts(); - } - catch(e) - { - alert("answer_box Impossible executer script de la reponse\n"+e.message); - } + var queryString = "op=bookmark&" + $("bookmark_frm").serialize(); + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req) { + remove_waiting_box(); + // removeDiv('bookmark_div'); + // + $('bookmark_div').innerHTML = req.responseText; + try + { + req.responseText.evalScripts(); + } + catch (e) + { + alert("answer_box Impossible executer script de la reponse\n" + e.message); + } - } - } - ); + } + } + ); } catch (e) { info_message(e.getMessage); } - + } /** * @brief remove selected bookmark @@ -1959,31 +2082,31 @@ function save_bookmark() { function remove_bookmark() { try { waiting_box(); - var queryString="op=bookmark&"+$("bookmark_del_frm").serialize(); - var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req){ - remove_waiting_box(); - $('bookmark_div').innerHTML=req.responseText; - try - { - req.responseText.evalScripts(); - } - catch(e) - { - alert("answer_box Impossible executer script de la reponse\n"+e.message); - } + var queryString = "op=bookmark&" + $("bookmark_del_frm").serialize(); + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req) { + remove_waiting_box(); + $('bookmark_div').innerHTML = req.responseText; + try + { + req.responseText.evalScripts(); + } + catch (e) + { + alert("answer_box Impossible executer script de la reponse\n" + e.message); + } - } - } - ); + } + } + ); } catch (e) { error_message(e.getMessage); } - + } /** *@brief display the error message into the div error_content_div (included into error_div) @@ -1992,47 +2115,47 @@ function remove_bookmark() { */ function error_message(message) { - $('error_content_div').innerHTML=message; - $('error_div').style.visibility='visible'; + $('error_content_div').innerHTML = message; + $('error_div').style.visibility = 'visible'; } /** * @brief show the detail of a tag and propose to save it */ -function show_tag(p_dossier,p_ac,p_tag_id,p_post) +function show_tag(p_dossier, p_ac, p_tag_id, p_post) { try { waiting_box(); - var queryString="op=tag_detail&tag="+p_tag_id+"&gDossier="+p_dossier+"&ac="+p_ac+'&form='+p_post; - var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req){ - var answer=req.responseXML; - var html=answer.getElementsByTagName('code'); - if ( html.length == 0 ) - { - var rec=req.responseText; - alert ('erreur :'+rec); - } - var code_html=getNodeText(html[0]); - code_html=unescape_xml(code_html); - remove_waiting_box(); - add_div({id:'tag_div',cssclass:'inner_box',drag:1}); - $('tag_div').innerHTML=code_html; - try - { - code_html.evalScripts(); - } - catch(e) - { - alert("answer_box Impossible executer script de la reponse\n"+e.message); - } + var queryString = "op=tag_detail&tag=" + p_tag_id + "&gDossier=" + p_dossier + "&ac=" + p_ac + '&form=' + p_post; + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req) { + var answer = req.responseXML; + var html = answer.getElementsByTagName('code'); + if (html.length == 0) + { + var rec = req.responseText; + alert('erreur :' + rec); + } + var code_html = getNodeText(html[0]); + code_html = unescape_xml(code_html); + remove_waiting_box(); + add_div({id: 'tag_div', cssclass: 'inner_box', drag: 1}); + $('tag_div').innerHTML = code_html; + try + { + code_html.evalScripts(); + } + catch (e) + { + alert("answer_box Impossible executer script de la reponse\n" + e.message); + } - } - } - ); + } + } + ); } catch (e) { error_message(e.getMessage); } @@ -2045,25 +2168,25 @@ function save_tag() { try { waiting_box(); - var queryString="op=tag_save&"+$("tag_detail_frm").serialize(); - var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', - parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req,j){ - remove_waiting_box(); - removeDiv('tag_div'); - } - } - ); + var queryString = "op=tag_save&" + $("tag_detail_frm").serialize(); + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', + parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req, j) { + remove_waiting_box(); + removeDiv('tag_div'); + } + } + ); } catch (e) { error_message(e.getMessage); return false; } - return false; - + return false; + } /** * Show a list of tag which can be added to the current followup document @@ -2071,34 +2194,34 @@ function save_tag() * @param {type} ag_id * @returns {undefined} */ -function action_tag_select(p_dossier,ag_id) +function action_tag_select(p_dossier, ag_id) { try { waiting_box(); - var queryString="ag_id="+ag_id+"&op=tag_list&gDossier="+p_dossier; + var queryString = "ag_id=" + ag_id + "&op=tag_list&gDossier=" + p_dossier; var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req,j){ - var answer=req.responseXML; - var html=answer.getElementsByTagName('code'); - if ( html.length == 0 ) - { - var rec=unescape_xml(req.responseText); - error_message ('erreur :'+rec); - } - var code_html=getNodeText(html[0]); - code_html=unescape_xml(code_html); - add_div({id:'tag_div',style:'width:40%;',cssclass:'inner_box',drag:1}); - $('tag_div').style.top=posY-70; - $('tag_div').style.left=posX-70; - remove_waiting_box(); - $('tag_div').innerHTML=code_html; - } - } - ); + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req, j) { + var answer = req.responseXML; + var html = answer.getElementsByTagName('code'); + if (html.length == 0) + { + var rec = unescape_xml(req.responseText); + error_message('erreur :' + rec); + } + var code_html = getNodeText(html[0]); + code_html = unescape_xml(code_html); + add_div({id: 'tag_div', style: 'width:40%;', cssclass: 'inner_box', drag: 1}); + $('tag_div').style.top = posY - 70; + $('tag_div').style.left = posX - 70; + remove_waiting_box(); + $('tag_div').innerHTML = code_html; + } + } + ); } catch (e) { error_message(e.getMessage); } @@ -2109,32 +2232,32 @@ function action_tag_select(p_dossier,ag_id) * @param {type} ag_id * @returns {undefined} */ -function action_tag_add(p_dossier,ag_id,t_id) +function action_tag_add(p_dossier, ag_id, t_id) { try { waiting_box(); - var queryString="t_id="+t_id+"&ag_id="+ag_id+"&op=tag_add&gDossier="+p_dossier; + var queryString = "t_id=" + t_id + "&ag_id=" + ag_id + "&op=tag_add&gDossier=" + p_dossier; var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req,j){ - var answer=req.responseXML; - var html=answer.getElementsByTagName('code'); - if ( html.length == 0 ) - { - var rec=unescape_xml(req.responseText); - error_message ('erreur :'+rec); - } - var code_html=getNodeText(html[0]); - code_html=unescape_xml(code_html); - remove_waiting_box(); - $('action_tag_td').innerHTML=code_html; - removeDiv('tag_div'); - } - } - ); + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req, j) { + var answer = req.responseXML; + var html = answer.getElementsByTagName('code'); + if (html.length == 0) + { + var rec = unescape_xml(req.responseText); + error_message('erreur :' + rec); + } + var code_html = getNodeText(html[0]); + code_html = unescape_xml(code_html); + remove_waiting_box(); + $('action_tag_td').innerHTML = code_html; + removeDiv('tag_div'); + } + } + ); } catch (e) { error_message(e.getMessage); } @@ -2145,33 +2268,34 @@ function action_tag_add(p_dossier,ag_id,t_id) * @param {type} ag_id * @returns {undefined} */ -function action_tag_remove(p_dossier,ag_id,t_id) +function action_tag_remove(p_dossier, ag_id, t_id) { - if ( confirm ('Enlevez ce tags ?')== false ) return; + if (confirm('Enlevez ce tags ?') == false) + return; try { waiting_box(); - var queryString="t_id="+t_id+"&ag_id="+ag_id+"&op=tag_remove&gDossier="+p_dossier; + var queryString = "t_id=" + t_id + "&ag_id=" + ag_id + "&op=tag_remove&gDossier=" + p_dossier; var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req,j){ - var answer=req.responseXML; - var html=answer.getElementsByTagName('code'); - if ( html.length == 0 ) - { - var rec=unescape_xml(req.responseText); - error_message ('erreur :'+rec); - } - var code_html=getNodeText(html[0]); - code_html=unescape_xml(code_html); - remove_waiting_box(); - $('action_tag_td').innerHTML=code_html; + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req, j) { + var answer = req.responseXML; + var html = answer.getElementsByTagName('code'); + if (html.length == 0) + { + var rec = unescape_xml(req.responseText); + error_message('erreur :' + rec); + } + var code_html = getNodeText(html[0]); + code_html = unescape_xml(code_html); + remove_waiting_box(); + $('action_tag_td').innerHTML = code_html; - } - } - ); + } + } + ); } catch (e) { error_message(e.getMessage); } @@ -2184,36 +2308,36 @@ function action_tag_remove(p_dossier,ag_id,t_id) * @param {type} p_dossier * @returns {undefined} */ -function search_display_tag(p_dossier,p_prefix) +function search_display_tag(p_dossier, p_prefix) { try { waiting_box(); - var queryString="op=search_display_tag&gDossier="+p_dossier+"&pref="+p_prefix; + var queryString = "op=search_display_tag&gDossier=" + p_dossier + "&pref=" + p_prefix; var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req,j){ - var answer=req.responseXML; - var html=answer.getElementsByTagName('code'); - if ( html.length == 0 ) - { - var rec=unescape_xml(req.responseText); - error_message ('erreur :'+rec); - } - var code_html=getNodeText(html[0]); - code_html=unescape_xml(code_html); - remove_waiting_box(); - add_div({id:p_prefix+'tag_div',style:'width:40%',cssclass:'inner_box',drag:1}); - $(p_prefix+'tag_div').style.top=posY-80; - $(p_prefix+'tag_div').style.left=posX-200; - remove_waiting_box(); - $(p_prefix+'tag_div').innerHTML=code_html; + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req, j) { + var answer = req.responseXML; + var html = answer.getElementsByTagName('code'); + if (html.length == 0) + { + var rec = unescape_xml(req.responseText); + error_message('erreur :' + rec); + } + var code_html = getNodeText(html[0]); + code_html = unescape_xml(code_html); + remove_waiting_box(); + add_div({id: p_prefix + 'tag_div', style: 'width:40%', cssclass: 'inner_box', drag: 1}); + $(p_prefix + 'tag_div').style.top = posY - 80; + $(p_prefix + 'tag_div').style.left = posX - 200; + remove_waiting_box(); + $(p_prefix + 'tag_div').innerHTML = code_html; - } - } - ); + } + } + ); } catch (e) { error_message(e.getMessage); } @@ -2224,81 +2348,83 @@ function search_display_tag(p_dossier,p_prefix) * @param {type} p_dossier * @param {type} p_tag_id */ -function search_add_tag(p_dossier,p_tag_id,p_prefix) +function search_add_tag(p_dossier, p_tag_id, p_prefix) { try { - var clear_button=0; - if ( tag_choose == '' && p_prefix=='search') { - tag_choose=$(p_prefix+'tag_choose_td').innerHTML ; - clear_button=1; + var clear_button = 0; + if (tag_choose == '' && p_prefix == 'search') { + tag_choose = $(p_prefix + 'tag_choose_td').innerHTML; + clear_button = 1; } waiting_box(); - var queryString="op=search_add_tag&gDossier="+p_dossier+"&id="+p_tag_id+"&clear="+clear_button+'&pref='+p_prefix; + var queryString = "op=search_add_tag&gDossier=" + p_dossier + "&id=" + p_tag_id + "&clear=" + clear_button + '&pref=' + p_prefix; var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req,j){ - var answer=req.responseXML; - var html=answer.getElementsByTagName('html'); - if ( html.length == 0 ) - { - var rec=unescape_xml(req.responseText); - error_message ('erreur :'+rec); - } - var code_html=getNodeText(html[0]); - code_html=unescape_xml(code_html); - remove_waiting_box(); - $(p_prefix+'tag_choose_td').innerHTML=$(p_prefix+'tag_choose_td').innerHTML+code_html; - removeDiv(p_prefix+'tag_div'); - } - } - ); - }catch (e) { - error_message(e.getMessage); + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req, j) { + var answer = req.responseXML; + var html = answer.getElementsByTagName('html'); + if (html.length == 0) + { + var rec = unescape_xml(req.responseText); + error_message('erreur :' + rec); + } + var code_html = getNodeText(html[0]); + code_html = unescape_xml(code_html); + remove_waiting_box(); + $(p_prefix + 'tag_choose_td').innerHTML = $(p_prefix + 'tag_choose_td').innerHTML + code_html; + removeDiv(p_prefix + 'tag_div'); + } + } + ); + } catch (e) { + error_message(e.getMessage); } } /** * Clear the tags in the cell tag_choose_td of the search screen * @returns {undefined} */ -function search_clear_tag(p_dossier,p_prefix) +function search_clear_tag(p_dossier, p_prefix) { - if ( p_prefix !='search') { - $(p_prefix+'tag_choose_td').innerHTML=""; + if (p_prefix != 'search') { + $(p_prefix + 'tag_choose_td').innerHTML = ""; return; } try { - var queryString="op=search_clear_tag&gDossier="+p_dossier+"&pref="+p_prefix; + var queryString = "op=search_clear_tag&gDossier=" + p_dossier + "&pref=" + p_prefix; var action = new Ajax.Request( - "ajax_misc.php" , - { - method:'get', parameters:queryString, - onFailure:ajax_misc_failure, - onSuccess:function(req,j){ - var answer=req.responseXML; - var html=answer.getElementsByTagName('html'); - if ( html.length == 0 ) - { - var rec=unescape_xml(req.responseText); - error_message ('erreur :'+rec); - } - var code_html=getNodeText(html[0]); - code_html=unescape_xml(code_html); - $(p_prefix+'tag_choose_td').innerHTML=code_html; - tag_choose=""; - } - } - ); - }catch (e) { - error_message(e.getMessage); + "ajax_misc.php", + { + method: 'get', parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function(req, j) { + var answer = req.responseXML; + var html = answer.getElementsByTagName('html'); + if (html.length == 0) + { + var rec = unescape_xml(req.responseText); + error_message('erreur :' + rec); + } + var code_html = getNodeText(html[0]); + code_html = unescape_xml(code_html); + $(p_prefix + 'tag_choose_td').innerHTML = code_html; + tag_choose = ""; + } + } + ); + } catch (e) { + error_message(e.getMessage); } } function action_show_checkbox() { - var a=document.getElementsByName('ag_id_td'); - for (var i=0;icheck_action(VIEWDOC) == 1) + { + $doc = new Document($cn, $_REQUEST['d_id']); + $doc->get(); + if ( $g_user->can_write_action($doc->ag_id)) + // retrieve the document + $doc->update_description(strip_tags ($_REQUEST['value'])); + } + +} /* remove the operation from action_gestion_operation */ if ($action == 'rmop') { diff --git a/html/style.css b/html/style.css index 284d225b5..75d64db95 100644 --- a/html/style.css +++ b/html/style.css @@ -959,16 +959,6 @@ div.op_detail_title { /* width:500;*/ -} -div#div_jrn{ - position:absolute; - border:1px solid black; - top:15%;left:100; - visibility:hidden; - z-index:2; - width:50em; - background-color:#EDF3FF; - } div#div_cat{ position:absolute; @@ -1017,7 +1007,6 @@ h2#jrn_name color:blue; font-size:2.74em; margin-right:30%; - float: right; } tr.footer{ font-size:0.87em; @@ -1034,7 +1023,7 @@ div#jrn_name_div { float: right; margin-right:150; - + width:50%; } #predef_form { @@ -1077,9 +1066,7 @@ div#wait_box text-align:center; } div#div_jrnsearch_op{ - border:1px solid black; - display:none; width:50em; background-color:#EDF3FF; position:absolute; diff --git a/include/ac_common.php b/include/ac_common.php index 1ab251bb4..73381c5d4 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -53,9 +53,9 @@ function hb($p_string) return '' . htmlspecialchars($p_string) . ''; } -function th($p_string, $p_extra='') +function th($p_string, $p_extra='',$raw='') { - return '' . htmlspecialchars($p_string) . ''; + return '' . htmlspecialchars($p_string).$raw . ''; } function h2info($p_string) diff --git a/include/ajax_ledger_show.php b/include/ajax_ledger_show.php new file mode 100644 index 000000000..baab43d27 --- /dev/null +++ b/include/ajax_ledger_show.php @@ -0,0 +1,32 @@ + + +$ctl +$html + +EOF; +exit(); +?> \ No newline at end of file diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index a3cac075e..db55f8bc5 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -2421,13 +2421,30 @@ class Acc_Ledger extends jrn_def_sql function search_form($p_type, $all_type_ledger = 1, $div = "") { - global $g_user; - $r = ''; - /* security : filter ledger on user */ - $filter_ledger = $g_user->get_ledger($p_type, 3); - - $selected = (isset($_REQUEST['r_jrn' . $div])) ? $_REQUEST['r_jrn' . $div] : null; - $f_ledger = HtmlInput::select_ledger($filter_ledger, $selected, $div); + global $g_user; + $r=""; + $bledger_param= json_encode(array( + 'dossier'=>$_REQUEST['gDossier'], + 'type'=>$p_type, + 'all_type'=>$all_type_ledger, + 'div'=>$div + )); + + $bledger_param= str_replace('"', "'", $bledger_param); + $bledger=new ISmallButton('l'); + $bledger->label="choix des journaux"; + $bledger->javascript=" show_ledger_choice($bledger_param)"; + $f_ledger=$bledger->input(); + $hid_jrn=""; + if ( isset ($_REQUEST[$div.'nb_jrn']) ){ + for ($i=0;$i < $_REQUEST[$div.'nb_jrn'];$i++) { + if ( isset ($_REQUEST[$div."r_jrn"][$i])) + $hid_jrn.=HtmlInput::hidden($div.'r_jrn['.$i.']',$_REQUEST[$div."r_jrn"][$i]); + } + $hid_jrn.=HtmlInput::hidden($div.'nb_jrn',$_REQUEST[$div.'nb_jrn']); + } else { + $hid_jrn=HtmlInput::hidden($div.'nb_jrn',0); + } /* Compute date for exercice */ $period = $g_user->get_periode(); $per = new Periode($this->db, $period); @@ -2618,7 +2635,13 @@ class Acc_Ledger extends jrn_def_sql if (!empty($p_array)) extract($p_array); - $r_jrn = (isset($r_jrn)) ? $r_jrn : -1; + if (isset($op) ) + $r_jrn = (isset(${$op."r_jrn"})) ? ${$op."r_jrn"} : -1; + else + { + $r_jrn = (isset($r_jrn)) ? $r_jrn : -1; + + } /* if no variable are set then give them a default * value */ @@ -2678,12 +2701,13 @@ class Acc_Ledger extends jrn_def_sql $aLedger = $g_user->get_ledger($p_action, 3); $fil_ledger = ''; $sp = ''; - for ($i = 0; $i < count($aLedger); $i++) + for ($i = 0; $i < count($r_jrn); $i++) { - if (isset($r_jrn[$i])) + if (isset($r_jrn[$i]) ) { - $fil_ledger.=$sp . $aLedger[$i]['jrn_def_id']; - $sp = ','; + $a=$r_jrn[$i]; + $fil_ledger.=$sp . $a; + $sp = ','; } } $fil_ledger = ' jrn_def_id in (' . $fil_ledger . ')'; @@ -3317,6 +3341,10 @@ class Acc_Ledger extends jrn_def_sql $min_row = new INum("min_row",$this->jrn_deb_max_line); $min_row->prec=0; + + $description=new ITextarea('p_description'); + $description->value=$this->jrn_def_description; + $str_description=$description->input(); /* Load the card */ $card = $this->get_fiche_def(); @@ -3413,6 +3441,7 @@ class Acc_Ledger extends jrn_def_sql $this->jrn_def_pj_pref = $jrn_def_pj_pref; $this->jrn_def_fiche_deb = (isset($FICHEDEB)) ? join($FICHEDEB, ',') : ""; $this->jrn_deb_max_line=($min_row<1)?1:$min_row; + $this->jrn_def_description=$p_description; switch ($this->jrn_def_type) { case 'ACH': @@ -3509,6 +3538,9 @@ class Acc_Ledger extends jrn_def_sql $pj_seq = ''; $last_seq = 0; $new = 1; + $description=new ITextarea('p_description'); + $description->value=""; + $str_description=$description->input(); /* bank card */ $qcode_bank = ''; /* Numbering (only FIN) */ @@ -3541,7 +3573,7 @@ class Acc_Ledger extends jrn_def_sql $this->jrn_def_fiche_deb = (isset($FICHEDEB)) ? join($FICHEDEB, ',') : ""; $this->jrn_deb_max_line=$min_row; $this->jrn_def_code = sprintf("%s%02d", trim(substr($this->jrn_def_type, 0, 1)), Acc_Ledger::next_number($this->db, $this->jrn_def_type)); - + $this->jrn_def_description=$p_description; switch ($this->jrn_def_type) { case 'ACH': diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index 89f9db0bc..38c9ed9cc 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -474,7 +474,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger // always save quantity but in withStock we can find // what card need a stock management if ( $g_parameter->MY_STOCK='Y'&& isset ($repo)) - Stock_Goods::insert_goods($this->db,array('j_id'=>$j_id,'goods'=>${'e_march'.$i},'quant'=>$nNeg*${'e_quant'.$i},'dir'=>'d','repo'=>$repo)) ; + { + $dir=(${'e_quant'.$i} < 0 ) ? 'c':'d'; + Stock_Goods::insert_goods($this->db,array('j_id'=>$j_id,'goods'=>${'e_march'.$i},'quant'=>$nNeg*${'e_quant'.$i},'dir'=>$dir,'repo'=>$repo)) ; + } if ( $g_parameter->MY_ANALYTIC != "nu" ) { diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index 5b3d602ac..724779b26 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -333,7 +333,10 @@ class Acc_Ledger_Sold extends Acc_Ledger { // always save quantity but in withStock we can find // what card need a stock management if ($g_parameter->MY_STOCK = 'Y' && isset($repo)) - Stock_Goods::insert_goods($this->db, array('j_id' => $j_id, 'goods' => ${'e_march' . $i}, 'quant' => $nNeg * ${'e_quant' . $i}, 'dir' => 'c', 'repo' => $repo)); + { + $dir=(${'e_quant'.$i} < 0 ) ? 'd':'c'; + Stock_Goods::insert_goods($this->db, array('j_id' => $j_id, 'goods' => ${'e_march' . $i}, 'quant' => $nNeg * ${'e_quant' . $i}, 'dir' => $dir, 'repo' => $repo)); + } if ($g_parameter->MY_ANALYTIC != "nu") { diff --git a/include/class_document.php b/include/class_document.php index 1f7c70324..08167128e 100644 --- a/include/class_document.php +++ b/include/class_document.php @@ -38,6 +38,7 @@ class Document var $d_mimetype; /*!< $d_mimetype */ var $d_filename; /*!< $d_filename */ var $d_lob; /*!< $d_lob the oid of the lob */ + var $d_description; /*!< Description of the file*/ var $d_number; /*!< $d_number number of the document */ var $md_id; /*!< $md_id document's template */ /* Constructor @@ -370,10 +371,10 @@ class Document $this->d_lob=$oid; $this->d_filename=$_FILES['file_upload']['name'][$i]; $this->d_mimetype=$_FILES['file_upload']['type'][$i]; - + $this->d_description= strip_tags($_POST['input_desc'][$i]); // insert into the table - $sql="insert into document (ag_id, d_lob,d_filename,d_mimetype,d_number) values ($1,$2,$3,$4,5)"; - $this->db->exec_sql($sql,array($p_ag_id,$this->d_lob,$this->d_filename,$this->d_mimetype)); + $sql="insert into document (ag_id, d_lob,d_filename,d_mimetype,d_number,d_description) values ($1,$2,$3,$4,$5,$6)"; + $this->db->exec_sql($sql,array($p_ag_id,$this->d_lob,$this->d_filename,$this->d_mimetype,1,$this->d_description)); } } /* end for */ $this->db->commit(); @@ -439,7 +440,7 @@ class Document function get_all($ag_id) { $res=$this->db->get_array('select d_id, ag_id, d_lob, d_number, d_filename,'. - ' d_mimetype from document where ag_id=$1',array($ag_id)); + ' d_mimetype,d_description from document where ag_id=$1',array($ag_id)); $a=array(); for ($i=0;$id_number=$res[$i]['d_number']; $doc->d_filename=$res[$i]['d_filename']; $doc->d_mimetype=$res[$i]['d_mimetype']; + $doc->d_description=$row['d_description']; $a[$i]=clone $doc; } return $a; @@ -469,6 +471,7 @@ class Document $this->d_filename=$row['d_filename']; $this->d_lob=$row['d_lob']; $this->d_number=$row['d_number']; + $this->d_description=$row['d_description']; } /*! @@ -1231,5 +1234,10 @@ class Document // if ad_id is not type select get value return $ad_value; } + function update_description ($p_desc) + { + $this->db->exec_sql('update document set d_description = $1 where d_id=$2', + array($p_desc,$this->d_id)); + } } diff --git a/include/class_fiche.php b/include/class_fiche.php index 3d32ebd4a..7c5f4f69e 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -73,7 +73,8 @@ class Fiche { global $g_user; $sql_ledger=$g_user->get_ledger_sql('FIN',3); - $avail=$this->cn->get_array("select jrn_def_id,jrn_def_bank from jrn_def where jrn_def_type='FIN' and $sql_ledger + $avail=$this->cn->get_array("select jrn_def_id,jrn_def_name," + . "jrn_def_bank,jrn_def_description from jrn_def where jrn_def_type='FIN' and $sql_ledger order by jrn_def_name"); if ( count($avail) == 0 ) @@ -82,6 +83,8 @@ class Fiche for ($i=0;$icn,$avail[$i]['jrn_def_bank']); + $t->ledger_name=$avail[$i]['jrn_def_name']; + $t->ledger_description=$avail[$i]['jrn_def_description']; $t->getAttribut(); $all[$i]=$t; diff --git a/include/class_follow_up.php b/include/class_follow_up.php index 028d958b1..866c4d11b 100644 --- a/include/class_follow_up.php +++ b/include/class_follow_up.php @@ -379,7 +379,7 @@ class Follow_Up $upload->name = "file_upload[]"; $upload->readOnly=$readonly; $upload->value = ""; - $aAttachedFile = $this->db->get_array('select d_id,d_filename,d_mimetype,' . + $aAttachedFile = $this->db->get_array('select d_id,d_filename,d_description,d_mimetype,' . '\'show_document.php?' . Dossier::get() . '&d_id=\'||d_id as link' . ' from document where ag_id=$1', array($this->ag_id)); diff --git a/include/class_html_input.php b/include/class_html_input.php index abb87a760..a375f826c 100755 --- a/include/class_html_input.php +++ b/include/class_html_input.php @@ -301,41 +301,54 @@ class HtmlInput * return the html code to create an hidden div and a button * to show this DIV. This contains all the available ledgers * for the user in READ or RW - *@param $p_array is an array obtains thanks User::get_ledger *@param $selected is an array of checkbox + *@param $div div suffix *@note the choosen ledger are stored in the array r_jrn (_GET) */ - static function select_ledger($p_array,$p_selected,$div='') + static function select_ledger($p_type,$p_selected,$div='') { + global $g_user; + $r = ''; + /* security : filter ledger on user */ + $p_array = $g_user->get_ledger($p_type, 3); + ob_start(); - $ledger=new ISmallButton('l'); - $ledger->label="choix des journaux"; - $ledger->javascript=" show_ledger_choice()"; - echo $ledger->input(); + /* create a hidden div for the ledger */ echo '
'; - echo '

Choix des journaux

'; - - echo '
    '; + echo HtmlInput::title_box("Journaux", $div."jrn_search"); + echo '
    '; + echo HtmlInput::hidden('nb_jrn', count($p_array)); + echo _('Filtre ').HtmlInput::filter_table($div.'tb_jrn', '0,1,2', 1); + echo ''; + echo ''; + echo th('Nom'); + echo th('Description'); + echo th('Type'); + echo ''; + for ($e=0;$eselected=true; } - echo '
  • '.$r->input().$row['jrn_def_name'].'('.$row['jrn_def_type'].')
  • '; + $class=($e%2==0)?' class="even" ':' class="odd" '; + echo '
    '; + echo ''; + echo ''; + echo ''; + echo ''; } - echo ''; - $hide=new IButton('l'); - $hide->label="Valider"; - $hide->javascript=" hide_ledger_choice() "; - echo $hide->input(); - + echo '
    '.$r->input().$row['jrn_def_name'].''.$row['jrn_def_description'].''.$row['jrn_def_type'].'
    '; + echo HtmlInput::hidden('div',$div); + echo HtmlInput::submit('save','Valider'); + echo '
    '; echo '
'; $ret=ob_get_contents(); ob_end_clean(); diff --git a/include/class_jrn_def_sql.php b/include/class_jrn_def_sql.php index 9e0352ab7..d7f9edeb9 100644 --- a/include/class_jrn_def_sql.php +++ b/include/class_jrn_def_sql.php @@ -36,6 +36,7 @@ class Jrn_Def_sql , "jrn_def_pj_pref" => "jrn_def_pj_pref" , "jrn_def_bank" => "jrn_def_bank" , "jrn_def_num_op" => "jrn_def_num_op" + , "jrn_def_description" => "jrn_def_description" ); function __construct(& $p_cn, $p_id=-1) @@ -193,6 +194,7 @@ class Jrn_Def_sql ,jrn_def_pj_pref ,jrn_def_bank ,jrn_def_num_op +,jrn_def_description ) values ($1 ,$2 ,$3 @@ -207,56 +209,6 @@ class Jrn_Def_sql ,$12 ,$13 ,$14 -) returning jrn_def_id"; - - $this->jrn_def_id = $this->db->get_value( - $sql, array($this->jrn_def_name - , $this->jrn_def_class_deb - , $this->jrn_def_class_cred - , $this->jrn_def_fiche_deb - , $this->jrn_def_fiche_cred - , $this->jrn_deb_max_line - , $this->jrn_cred_max_line - , $this->jrn_def_ech - , $this->jrn_def_ech_lib - , $this->jrn_def_type - , $this->jrn_def_code - , $this->jrn_def_pj_pref - , $this->jrn_def_bank - , $this->jrn_def_num_op - ) - ); - } - else - { - $sql = "insert into public.jrn_def(jrn_def_name -,jrn_def_class_deb -,jrn_def_class_cred -,jrn_def_fiche_deb -,jrn_def_fiche_cred -,jrn_deb_max_line -,jrn_cred_max_line -,jrn_def_ech -,jrn_def_ech_lib -,jrn_def_type -,jrn_def_code -,jrn_def_pj_pref -,jrn_def_bank -,jrn_def_num_op -,jrn_def_id) values ($1 -,$2 -,$3 -,$4 -,$5 -,$6 -,$7 -,$8 -,$9 -,$10 -,$11 -,$12 -,$13 -,$14 ,$15 ) returning jrn_def_id"; @@ -275,7 +227,62 @@ class Jrn_Def_sql , $this->jrn_def_pj_pref , $this->jrn_def_bank , $this->jrn_def_num_op - , $this->jrn_def_id) + , strip_tags($this->jrn_def_description) + ) + ); + } + else + { + $sql = "insert into public.jrn_def(jrn_def_name +,jrn_def_class_deb +,jrn_def_class_cred +,jrn_def_fiche_deb +,jrn_def_fiche_cred +,jrn_deb_max_line +,jrn_cred_max_line +,jrn_def_ech +,jrn_def_ech_lib +,jrn_def_type +,jrn_def_code +,jrn_def_pj_pref +,jrn_def_bank +,jrn_def_num_op +,jrn_def_id +,jrn_def_description) values ($1 +,$2 +,$3 +,$4 +,$5 +,$6 +,$7 +,$8 +,$9 +,$10 +,$11 +,$12 +,$13 +,$14 +,$15 +,$16 +) returning jrn_def_id"; + + $this->jrn_def_id = $this->db->get_value( + $sql, array($this->jrn_def_name + , $this->jrn_def_class_deb + , $this->jrn_def_class_cred + , $this->jrn_def_fiche_deb + , $this->jrn_def_fiche_cred + , $this->jrn_deb_max_line + , $this->jrn_cred_max_line + , $this->jrn_def_ech + , $this->jrn_def_ech_lib + , $this->jrn_def_type + , $this->jrn_def_code + , $this->jrn_def_pj_pref + , $this->jrn_def_bank + , $this->jrn_def_num_op + , $this->jrn_def_id + , strip_tags($this->jrn_def_description)) ); } } @@ -299,7 +306,8 @@ class Jrn_Def_sql ,jrn_def_pj_pref = $12 ,jrn_def_bank = $13 ,jrn_def_num_op = $14 - where jrn_def_id= $15"; +,jrn_def_description = $15 + where jrn_def_id= $16"; $res = $this->db->exec_sql( $sql, array($this->jrn_def_name , $this->jrn_def_class_deb @@ -315,6 +323,7 @@ class Jrn_Def_sql , $this->jrn_def_pj_pref , $this->jrn_def_bank , $this->jrn_def_num_op + , strip_tags($this->jrn_def_description) , $this->jrn_def_id) ); } @@ -340,6 +349,7 @@ class Jrn_Def_sql ,jrn_def_pj_pref ,jrn_def_bank ,jrn_def_num_op +,jrn_def_description from public.jrn_def where jrn_def_id=$1"; /* please adapt */ $res = $this->db->get_array( diff --git a/include/class_user.php b/include/class_user.php index fa91288d4..71f0f55eb 100644 --- a/include/class_user.php +++ b/include/class_user.php @@ -302,7 +302,7 @@ class User $sql = "select jrn_def_id,jrn_def_type, jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv, - jrn_deb_max_line,jrn_cred_max_line + jrn_deb_max_line,jrn_cred_max_line,jrn_def_description from jrn_def join jrn_type on jrn_def_type=jrn_type_id join user_sec_jrn on uj_jrn_id=jrn_def_id where @@ -314,7 +314,7 @@ class User { $sql_type = ($p_type == 'ALL') ? '' : "where jrn_def_type=upper('" . sql_string($p_type) . "')"; $sql = "select jrn_def_id,jrn_def_type,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line, - jrn_type_id,jrn_desc,'W' as uj_priv + jrn_type_id,jrn_desc,'W' as uj_priv,jrn_def_description from jrn_def join jrn_type on jrn_def_type=jrn_type_id $sql_type order by jrn_Def_name"; diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index d532a588b..aeab69192 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -227,7 +227,7 @@ echo ""; if (!isset($_POST['e_date']) && $g_parameter->MY_DATE_SUGGEST=='Y') echo create_script(" get_last_date()"); - +echo create_script(" update_name()"); echo ''; diff --git a/include/compta_fin.inc.php b/include/compta_fin.inc.php index bd93c603e..2f19d1e5e 100644 --- a/include/compta_fin.inc.php +++ b/include/compta_fin.inc.php @@ -150,5 +150,5 @@ if ( ! isset ($_POST['e_date'])&& $g_parameter->MY_DATE_SUGGEST=='Y') }else { echo create_script(" ajax_saldo('first_sold');"); } - +echo create_script(" update_name()"); exit(); \ No newline at end of file diff --git a/include/compta_fin_rec.inc.php b/include/compta_fin_rec.inc.php index 07897f951..2865d210e 100644 --- a/include/compta_fin_rec.inc.php +++ b/include/compta_fin_rec.inc.php @@ -151,7 +151,7 @@ for ($i = 0; $i < count($operation); $i++) $r.=td($row['jr_comment']); $r.=td($js); $amount=$cn->get_value('select qf_amount from quant_fin where jr_id=$1', array($row['jr_id'])); - $r.=''.nbm ($amount).''; + $r.=''.nbm ($amount).''; $diff=bcadd($diff,$amount); $tot_not_reconcilied+=$row['jr_montant']; diff --git a/include/compta_fin_saldo.inc.php b/include/compta_fin_saldo.inc.php index 29638e853..83cf0a3c8 100644 --- a/include/compta_fin_saldo.inc.php +++ b/include/compta_fin_saldo.inc.php @@ -36,16 +36,23 @@ require_once ('class_acc_parm_code.php'); echo '
'; echo dossier::hidden(); - echo ''; - echo tr(th('Quick Code').th('Compte en banque',' style="text-align:left"').th('solde opération',' style="text-align:right"') - .th('solde extrait/relevé',' style="text-align:right"') - .th('différence',' style="text-align:right"')); + echo _('Filtre :').HtmlInput::filter_table("fin_saldo_tb", '0,1,2,3', '1'); + echo '
'; + echo tr(th('Quick Code',' class=" sorttable_sorted_reverse"',HtmlInput::infobulle(17).' ▴') + .th('Compte en banque',' style="text-align:left"') + .th('Journal',' style="text-align:center"') + .th('Description',' style="text-align:center"') + .th('solde opération',' style="text-align:right" class="sorttable_numeric"') + .th('solde extrait/relevé',' style="text-align:right" class="sorttable_numeric"') + .th('différence',' style="text-align:right" class="sorttable_numeric"') + ); // Filter the saldo // on the current year $filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')"; // for highligting tje line $idx=0; bcscale(2); + $tot_extrait=0;$tot_diff=0;$tot_operation=0; // for each account for ( $i = 0; $i < count($array);$i++) { @@ -73,7 +80,7 @@ require_once ('class_acc_parm_code.php'); if ( $idx%2 != 0 ) $odd="odd"; else - $odd=""; + $odd="even"; $idx++; echo ""; @@ -86,18 +93,35 @@ require_once ('class_acc_parm_code.php'); echo "". - "". - "". - "". ""; + $tot_extrait=bcadd($tot_extrait,$solde); + $tot_operation=bcadd($tot_operation,$saldo_rec); + $tot_diff=bcadd($tot_diff,$diff); } }// for + echo ''; + echo ''; + echo td(''); + echo td(''); + echo td(''); + echo td(' TOTAUX ','style="font-weight:bold"'); + echo td(nbm($tot_extrait),'style="font-weight:bold" class="num"'); + echo td(nbm($tot_operation),' style="font-weight:bold" class="num"'); + echo td(nbm($tot_diff),' style="font-weight:bold" class="num"'); + echo ''; + + echo ''; echo "
". $array[$i]->strAttribut(ATTR_DEF_NAME). "". + td(h($array[$i]->ledger_name)). + td(h($array[$i]->ledger_description)). + ''. nbm($solde). "". + ''. nbm($saldo_rec). "". + ''. nbm($diff). "
"; echo "
"; exit(); diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index b0870aa4a..e09273968 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -236,6 +236,6 @@ echo '
'; { echo create_script(" get_last_date()"); } - +echo create_script(" update_name()"); exit(); ?> diff --git a/include/constant.php b/include/constant.php index f99b67681..f1b5cdb08 100644 --- a/include/constant.php +++ b/include/constant.php @@ -71,7 +71,7 @@ define ("SITE_UPDATE",'http://www.phpcompta.eu/last_version.txt'); define ("SITE_UPDATE_PLUGIN",'http://www.phpcompta.eu/plugin_last_version.txt'); -define ("DBVERSION",109); +define ("DBVERSION",110); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",14); define ('NOTFOUND','--not found--'); diff --git a/include/fiche.inc.php b/include/fiche.inc.php index 20a015ace..f4535f023 100644 --- a/include/fiche.inc.php +++ b/include/fiche.inc.php @@ -309,7 +309,9 @@ if ($_GET['histo'] == 4 || $_GET['histo'] == 5) continue; } echo '

' . $cn->get_value("select fd_label from fiche_def where fd_id=$1", array($afiche[$e]['fd_id'])) . '

'; - echo ''; + $id="table_".$afiche[$e]."_id"; + echo _('Filtre rapide:').HtmlInput::filter_table($id, '0,1,2', '1'); + echo '
'; echo tr( th('Quick Code') . th('Libellé') . @@ -341,15 +343,16 @@ if ($_GET['histo'] == 4 || $_GET['histo'] == 5) td(HtmlInput::history_card($oCard->id, $oCard->strAttribut(ATTR_DEF_QUICKCODE))) . td($oCard->strAttribut(ATTR_DEF_NAME)) . td($oCard->strAttribut(ATTR_DEF_ACCOUNT)). - td(nbm($solde['debit']), 'style="text-align:right"') . - td(nbm($solde['credit']), 'style="text-align:right"') . - td(nbm(abs($solde['solde'])), 'style="text-align:right"') . + td(nbm($solde['debit']), 'class="sorttable_numeric" sorttable_customkey="'.$solde['debit'].'" style="text-align:right"') . + td(nbm($solde['credit']), 'class="sorttable_numeric" sorttable_customkey="'.$solde['debit'].'" style="text-align:right"') . + td(nbm(abs($solde['solde'])), 'class="sorttable_numeric" sorttable_customkey="'.$solde['solde'].'" style="text-align:right"') . td((($solde['debit'] < $solde['credit']) ? 'CRED' : 'DEB'), 'style="text-align:right"'), $class ); } + echo ''; echo tr( td(''). td(_('Totaux')). @@ -358,6 +361,7 @@ if ($_GET['histo'] == 4 || $_GET['histo'] == 5) td(nbm($sum_cred), 'style="text-align:right"'). td(nbm(abs($sum_solde)), 'style="text-align:right"'). td((($sum_deb < $sum_cred) ? 'CRED' : 'DEB'), 'style="text-align:right"'),""); + echo ''; echo '
'; } if ( $allcard == 0 ) echo $str_add_card; diff --git a/include/function_javascript.php b/include/function_javascript.php index 1282eb5b0..49e520e3a 100644 --- a/include/function_javascript.php +++ b/include/function_javascript.php @@ -21,7 +21,7 @@ function js_include($p_string) if ( ! file_exists('js/'.$p_string)) alert("Erreur js/$p_string n existe pas"); - $script=''; + $script=''; // debug return $script; @@ -34,7 +34,7 @@ function js_include($p_string) */ function create_script($p_string) { - $script=''; + $script=''; return $script; } diff --git a/include/history_operation.inc.php b/include/history_operation.inc.php index 83def2523..c7d00c0bc 100644 --- a/include/history_operation.inc.php +++ b/include/history_operation.inc.php @@ -94,7 +94,7 @@ if (isset($_GET ['paid'])) $msg=""; -/* by default we should the default period */ +/* by default we should use the default period */ if (!isset($p_array['date_start'])) { $period = $g_user->get_periode(); @@ -102,11 +102,11 @@ if (!isset($p_array['date_start'])) list($date_start, $date_end) = $per->get_date_limit(); $p_array['date_start'] = $date_start; $p_array['date_end'] = $date_end; - $msg='

'."Periode ".$date_start." au ".$date_end.'

'; + $msg='

'."Période ".$date_start." au ".$date_end.'

'; } else { - $msg='

'."Periode ".$_GET['date_start']." au ".$_GET['date_end'].'

'; + $msg='

'."Période ".$_GET['date_start']." au ".$_GET['date_end'].'

'; } /* compute the sql stmt */ diff --git a/include/operation_ods_new.inc.php b/include/operation_ods_new.inc.php index 56af29718..b3cacc74d 100644 --- a/include/operation_ods_new.inc.php +++ b/include/operation_ods_new.inc.php @@ -107,6 +107,7 @@ echo '

'; echo ''; echo ""; +echo create_script(" update_name()"); if ($g_parameter->MY_DATE_SUGGEST=='Y') { diff --git a/include/search.inc.php b/include/search.inc.php index 43e6f93ac..4cd2f2dcc 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -126,9 +126,9 @@ if ( isset ($_GET['viewsearch']) ) echo HtmlInput::submit("upd_rec","Mettre à jour"); if (! $inside )echo $bar; - if (isset($_GET['r_jrn'])) { - foreach ($_GET['r_jrn'] as $k=>$v) - echo HtmlInput::hidden('r_jrn['.$k.']',$v); + if (isset($_GET[$op.'r_jrn'])) { + foreach ($_GET[$op.'r_jrn'] as $k=>$v) + echo HtmlInput::hidden($op.'r_jrn['.$k.']',$v); } echo ''; } diff --git a/include/template/dashboard.php b/include/template/dashboard.php index bde8a9bdb..3042b9ec8 100644 --- a/include/template/dashboard.php +++ b/include/template/dashboard.php @@ -318,7 +318,7 @@ endif;
-
diff --git a/include/template/detail-action.php b/include/template/detail-action.php index 2f094ea2c..7ebaf94b8 100644 --- a/include/template/detail-action.php +++ b/include/template/detail-action.php @@ -125,6 +125,7 @@ +ag_id > 0 ): ?> Dossier / tags @@ -136,6 +137,7 @@ ?> +
@@ -381,8 +383,31 @@ function toggleShowDetail() { for ($i=0;$i -
  • " href=""> - +
  • " href=""> + + + +
    + + + + + Modifier + + + + + + +
    '; + new_element.innerHTML='
    '; docAdded.appendChild(new_element); } catch(exception) { alert(''); alert(exception.message);} @@ -413,6 +438,9 @@ catch(exception) { alert('
  • input(); ?> +
    + +
  • diff --git a/include/template/ledger_search.php b/include/template/ledger_search.php index 33eaeedb3..f48ee80be 100644 --- a/include/template/ledger_search.php +++ b/include/template/ledger_search.php @@ -6,6 +6,11 @@ + + + diff --git a/include/template/module.php b/include/template/module.php index faf7b4694..c7819d1e0 100644 --- a/include/template/module.php +++ b/include/template/module.php @@ -36,7 +36,7 @@ if ( $cn->get_value("select count(*) from profile join profile_user using (p_id) ?> -