replace g and $( by id$

This commit is contained in:
Dany wm 2024-10-12 17:43:03 +02:00 committed by sparkyx
parent fde1c4104c
commit 305d8d4f1f
10 changed files with 718 additions and 717 deletions

View file

@ -34,7 +34,7 @@ function boxsearch_card(p_dossier)
{
waiting_box();
removeDiv('boxsearch_card_div');
var queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+encodeURI($("card_search").value);
var queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+encodeURI(id$("card_search").value);
var action = new Ajax.Request(
"ajax_misc.php" ,
{
@ -49,8 +49,8 @@ function boxsearch_card(p_dossier)
var y=calcy(15);
var div_style="position:absolute;"+";top:"+y+"px";
add_div({id:'boxsearch_card_div',cssclass:'inner_box',html:loading(),style:div_style,drag:true});
$('boxsearch_card_div').innerHTML=req.responseText;
sorttable.makeSortable($('tb_fiche'));
id$('boxsearch_card_div').innerHTML=req.responseText;
sorttable.makeSortable(id$('tb_fiche'));
}
}
);
@ -76,9 +76,9 @@ function search_card(obj)
{
try
{
var gDossier=$('gDossier').value;
var gDossier=id$('gDossier').value;
var inp=obj.inp;
var string_to_search=$(inp).value;
var string_to_search=id$(inp).value;
var label=obj.label;
var typecard=obj.typecard;
var price=obj.price;
@ -93,8 +93,8 @@ function search_card(obj)
}
if ( jrn==undefined)
{
if ( g('p_jrn')) {
jrn=$('p_jrn').value;
if ( id$('p_jrn')) {
jrn=id$('p_jrn').value;
}
else {
jrn=-1;
@ -114,7 +114,7 @@ function search_card(obj)
'amount_from_type':amount_from_type,
'inactive_card':inactive_card
});
if ( $('search_card') ) {
if ( id$('search_card') ) {
removeDiv('search_card');
}
@ -164,7 +164,7 @@ function action_concerned_save_card(obj)
var nodeXml = html[0];
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
$(namectl).update(code_html);
id$(namectl).update(code_html);
removeDiv('search_card');
/* if dialog box exist with list other card, then refresh it */
if ( document.getElementById("action_concerned_list_dv") ) {
@ -222,7 +222,7 @@ function action_concerned_list(p_obj) {
code_html = unescape_xml(code_html);
$('action_concerned_list_dv').innerHTML = code_html;
id$('action_concerned_list_dv').innerHTML = code_html;
} catch (e) {
alert_box(e.message);
}
@ -336,9 +336,9 @@ function action_concerned_search_card(obj)
sx = document.body.scrollTop + 60;
}
var div_style = "top:" + sx + "px;height:52rem";
if ( ! $('search_card')) { add_div({id: 'search_card', cssclass: 'inner_box', html: "", style: div_style, drag: true}); }
$('search_card').innerHTML = code_html;
$('query').focus();
if ( ! id$('search_card')) { add_div({id: 'search_card', cssclass: 'inner_box', html: "", style: div_style, drag: true}); }
id$('search_card').innerHTML = code_html;
id$('query').focus();
activate_checkbox_range('select_card_ck');
}catch (e) {
alert_box(e.message);
@ -363,7 +363,7 @@ function action_concerned_search_card(obj)
*/
function search_get_card(obj)
{
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString="gDossier="+dossier;
queryString+="&op2=fs&op=card";
@ -417,7 +417,7 @@ function search_get_card(obj)
}
queryString=encodeURI(queryString);
$('asearch').innerHTML=loading();
id$('asearch').innerHTML=loading();
var action=new Ajax.Request ( 'ajax_misc.php',
{
@ -466,9 +466,9 @@ function result_card_search(req)
var div_style="top:"+sx+"px;min-height:80%;height:auto";
add_div({id:'search_card',cssclass:'inner_box',html:"",style:div_style,drag:false,effect:'blinddown'});
$('search_card').innerHTML=code_html;
id$('search_card').innerHTML=code_html;
if ($('query')) { $('query').focus();}
if (id$('query')) { id$('query').focus();}
}
catch (e)
{
@ -500,12 +500,12 @@ function result_card_search(req)
*/
function setCtrl(p_ctrl,p_quickcode,p_ctrlname,p_label)
{
var ctrl=g(p_ctrl);
var ctrl=id$(p_ctrl);
if ( ctrl )
{
ctrl.value=p_quickcode;
}
var ctrl_name=g(p_ctrlname);
var ctrl_name=id$(p_ctrlname);
if ( ctrl_name )
{
ctrl_name.value=p_label;
@ -523,17 +523,17 @@ function clean_Fid(p_ctl)
nSell=p_ctl+"_price";
nBuy=p_ctl+"_price";
nTva_id=p_ctl+"_tva_id";
if ( $(nSell) )
if ( id$(nSell) )
{
$(nSell).value="";
id$(nSell).value="";
}
if ( $(nBuy) )
if ( id$(nBuy) )
{
$(nBuy).value="";
id$(nBuy).value="";
}
if ( $(nTva_id) )
if ( id$(nTva_id) )
{
$(nTva_id).value="-1";
id$(nTva_id).value="-1";
}
}
@ -583,7 +583,7 @@ function fill_fin_data_onchange(ctl)
function fill_fin_data(text,li)
{
ajaxFid(text);
ajax_saldo($(text.id));
ajax_saldo(id$(text.id));
}
/**
* show the ipopup window and display the details of a card,
@ -611,17 +611,17 @@ function fill_ipopcard(obj)
var popup={'id': content,'cssclass':'inner_box2','style':str_style,'html':"",'drag':false};
add_div(popup);
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var qcode='';
if ( $(obj).qcode != undefined )
if ( id$(obj).qcode != undefined )
{
qcode=obj.qcode;
}
else
{
qcode=$(obj).value;
qcode=id$(obj).value;
}
// ctl=$(obj).id;
// ctl=id$(obj).id;
var queryString='gDossier='+dossier;
queryString+='&qcode='+qcode;
@ -671,7 +671,7 @@ function successFill_ipopcard(req,json)
var code_html=getNodeText(html[0]);
code_html=unescape_xml(code_html);
$(name_ctl).innerHTML=code_html;
id$(name_ctl).innerHTML=code_html;
}
catch (e)
{
@ -698,16 +698,16 @@ function successFill_ipopcard(req,json)
*/
function select_card_type(obj)
{
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var elementId="";
// give a filter, -1 if not
var filter=$(obj).filter;
var filter=id$(obj).filter;
if ( filter==undefined)
{
filter=-1;
}
var content="select_card_div";
if ( $(content)){removeDiv(content);}
if ( id$(content)){removeDiv(content);}
var sx=0;
sx=calcy(160);
@ -721,25 +721,25 @@ function select_card_type(obj)
queryString+='&ctl='+content;
queryString+='&op2=st'; // st for selecting type
queryString+='&op=card'; // st for selecting type
if ( $(obj).win_refresh!=undefined)
if ( id$(obj).win_refresh!=undefined)
{
queryString+='&ref';
}
/* if an element id must be updated after creating a new card */
if ( $(obj).elementId) {
var elementId=$(obj).elementId;
if ( id$(obj).elementId) {
var elementId=id$(obj).elementId;
queryString+="&eltid="+elementId;
}
queryString+='&fil='+filter;
// filter on the ledger, -1 if not
var oledger=$(obj).jrn;
var oledger=id$(obj).jrn;
if (oledger==undefined)
{
ledger=-1;
}
else
{
ledger=$(obj).jrn;
ledger=id$(obj).jrn;
}
queryString+='&ledger='+ledger;
@ -773,7 +773,7 @@ function select_card_type(obj)
return;
}
fill_box(req);
$('lk_cat_card_table').focus();
id$('lk_cat_card_table').focus();
}
}
);
@ -810,7 +810,7 @@ function dis_blank_card(obj)
add_div(popup);
if ( obj.gDossier.value != undefined ) {
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
} else {
var dossier=obj.gDossier;
}
@ -848,11 +848,11 @@ function form_blank_card(obj)
var str_style="top:"+nTop+"px;left:"+nLeft+"px;width:60em;height:auto";
var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true};
if ( $(content)) {removeDiv(content);}
if ( id$(content)) {removeDiv(content);}
add_div(popup);
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString='gDossier='+dossier;
queryString+='&ctl='+content;
@ -878,8 +878,8 @@ function form_blank_card(obj)
*/
function save_card(obj)
{
var content=$(obj).ipopup;
var accounting= $(obj)['av_text5'];
var content=id$(obj).ipopup;
var accounting= id$(obj)['av_text5'];
if ( accounting && accounting.value.length > 40 ) {
smoke.alert('Poste comptable trop grand');
return false;
@ -887,9 +887,9 @@ function save_card(obj)
// Data must be taken here
var data=$('save_card').serialize(false);
var data=id$('save_card').serialize(false);
waiting_box();
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString='gDossier='+dossier;
queryString+='&ctl='+content;
queryString+=data;
@ -922,7 +922,7 @@ function save_card(obj)
// if status == OK and after_save == 1
// then add a row to the table
if ( status_value == 'OK' && after_save == 1) {
var table_card=$('fiche_tb_id');
var table_card=id$('fiche_tb_id');
f_id=getNodeText(req.responseXML.getElementsByTagName("f_id")[0]);
var row=new Element('tr');
row.id="row_card"+f_id;
@ -943,9 +943,9 @@ function save_card(obj)
var eltid=getNodeText(elt[0]);
if ( eltid !="") {
var eltvalue=req.responseXML.getElementsByTagName("elt_value");
$(eltid).value=getNodeText(eltvalue[0]);
id$(eltid).value=getNodeText(eltvalue[0]);
fill_data_onchange(eltid);
$(eltid).focus();
id$(eltid).focus();
}
}
if (status_value == "OK") {
@ -984,12 +984,12 @@ function add_category(obj)
// show ipopup
var div={id:obj.ipopup,
cssclass:"inner_box",drag:1,style:div_style};
if ( $(div) ) {
if ( id$(div) ) {
removeDiv(div);
}
add_div(div);
waiting_box();
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString='gDossier='+dossier;
queryString+='&op2=ac';
queryString+='&op=card';
@ -1014,15 +1014,15 @@ function add_category(obj)
*/
function save_card_category(obj)
{
if ( ! $(obj).ipopup)
if ( ! id$(obj).ipopup)
{
alert_box('Erreur pas d\' attribut ipopup '+obj.id);
return;
};
try {
// Data must be taken here
data=$('newcat').serialize(false);
var dossier=$('gDossier').value;
data=id$('newcat').serialize(false);
var dossier=id$('gDossier').value;
var queryString='ctl='+obj.ipopup+'&';
queryString+=data;
queryString+='&op2=scc'; // sc for save card
@ -1124,7 +1124,7 @@ function action_save_concerned(p_form_id) {
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
removeDiv('search_card');
$('concerned_card_td').innerHTML = code_html;
id$('concerned_card_td').innerHTML = code_html;
} catch (e) {
}
@ -1156,10 +1156,10 @@ function action_remove_concerned(p_dossier,p_fiche_id,p_action_id)
var nodeXml=html[0];
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
$('concerned_card_td').innerHTML = code_html;
id$('concerned_card_td').innerHTML = code_html;
removeDiv('search_card');
$(namectl).remove();
id$(namectl).remove();
} catch (e) {
if ( console) { console.log('Erreur ') + e.message;}
@ -1234,7 +1234,7 @@ function modify_card(p_fiche_id)
console.error("card_gdossier error");
throw ("card_gdossier not set");
}
var dossier = $('card_gdossier').value;
var dossier = id$('card_gdossier').value;
var action = new Ajax.Request('ajax_misc.php',
@ -1262,8 +1262,8 @@ function delete_card_id(p_fiche_id)
console.error("card_gdossier error");
throw ("card_gdossier not set");
}
$(row).addClassName("background-selected");
var dossier = $('card_gdossier').value;
id$(row).addClassName("background-selected");
var dossier = id$('card_gdossier').value;
smoke.confirm(content[47], function (e) {
if (e) {
waiting_box();
@ -1272,7 +1272,7 @@ function delete_card_id(p_fiche_id)
parameters: {'gDossier':dossier,"op":'card',"op2":"rm_card","f_id":p_fiche_id,'ctl':row} ,
onSuccess: function (req) {
remove_waiting_box();
var table_card=$('fiche_tb_id');
var table_card=id$('fiche_tb_id');
var answer = req.responseXML;
var a = answer.getElementsByTagName('ctl');
if (a.length == 0)
@ -1288,7 +1288,7 @@ function delete_card_id(p_fiche_id)
if ((code_html) == "OK") {
Effect.Fade(row, {duration: 0.1});
table_card.tBodies[0].removeChild($(row));
table_card.tBodies[0].removeChild(id$(row));
alternate_row_color("fiche_tb_id");
} else {
smoke.alert(code_html);
@ -1298,7 +1298,7 @@ function delete_card_id(p_fiche_id)
});
} else{
$(row).removeClassName("background-selected");
id$(row).removeClassName("background-selected");
}
});
@ -1338,11 +1338,11 @@ function card_update_row(obj)
if ( document.getElementById(name_ctl)) {
// update the row
$(name_ctl).innerHTML = code_html;
id$(name_ctl).innerHTML = code_html;
new Effect.Highlight(name_ctl ,{startcolor: '#FAD4D4',endcolor: '#F78082' });
}
$(a[0].firstChild.nodeValue).remove();
id$(a[0].firstChild.nodeValue).remove();
} catch (e) {
@ -1391,7 +1391,7 @@ function linked_card_option(p_action_person_id,p_dossier) {
onSuccess:function(req) {
remove_waiting_box();
add_div({ "id":"d_linked_card_option",cssclass:"inner_box",style:"position:fixed;top:30%;min-width:20rem;width:auto;",drag:0});
$("d_linked_card_option").update(req.responseText);
id$("d_linked_card_option").update(req.responseText);
}
});
@ -1414,7 +1414,7 @@ function save_linked_card_option(obj)
onSuccess:function(req) {
remove_waiting_box();
removeDiv("d_linked_card_option");
$("other_"+obj.action_person_id.value).update(req.responseText);
id$("other_"+obj.action_person_id.value).update(req.responseText);
new Effect.Highlight("other_"+obj.action_person_id.value,{startcolor: '#FAD4D4',endcolor: '#F78082' });
}
});
@ -1503,10 +1503,10 @@ CategoryCardDefinition.prototype.add_attribut = function (attribut_id) {
// if successfull add id on existing_list and remove from available_list
// remove from available_list
$('avail_attr_' + attribut_id).remove();
id$('avail_attr_' + attribut_id).remove();
var parser = new DOMParser();
var element = parser.parseFromString(req.responseText, 'text/html');
$(here.existing_list).appendChild(element.body.firstChild);
id$(here.existing_list).appendChild(element.body.firstChild);
new Effect.Highlight('existing_attr_' + attribut_id, {
startcolor: '#FAD4D4',
endcolor: '#F78082'
@ -1551,10 +1551,10 @@ CategoryCardDefinition.prototype.remove_attribut = function (attribut_id) {
// if successfull add id on existing_list and remove from available_list
// remove from available_list
$('existing_attr_' + attribut_id).remove();
id$('existing_attr_' + attribut_id).remove();
var parser = new DOMParser();
var element = parser.parseFromString(req.responseText, 'text/html');
$(here.available_list).appendChild(element.body.firstChild);
id$(here.available_list).appendChild(element.body.firstChild);
alternate_row_color_list(here.available_list);
Sortable.create('attribut_card', {tag: 'li', hoverclass: inner_box});