replace if(id$) by document.getElementById

This commit is contained in:
Dany wm 2024-10-18 18:53:56 +02:00 committed by sparkyx
parent d021d1b061
commit be606f4c1a
8 changed files with 81 additions and 81 deletions

View file

@ -104,9 +104,9 @@ function CurrencyCompute(p_rate,p_update)
{
var tvac=1;
if (id$('tvac')) {
if (document.getElementById('tvac')) {
tvac=id$('tvac').innerHTML;
} else if (id$("htva")) {
} else if (document.getElementById("htva")) {
tvac=id$('htva').innerHTML;
}
@ -166,7 +166,7 @@ function CurrencyComputeMisc(p_rate,p_update)
function LedgerCurrencyUpdate(p_dossier,p_code,p_update,p_rate,p_eur_amount)
{
// Hide or show the row of the table with the amount in EUR
if (id$(p_code).value != 0) {
if (document.getElementById(p_code).value != 0) {
id$('row_currency').show();
}else {
id$('row_currency').hide();
@ -189,7 +189,7 @@ function LedgerCurrencyUpdate(p_dossier,p_code,p_update,p_rate,p_eur_amount)
function LedgerCurrencyUpdateMisc(p_dossier,p_code,p_update,p_rate,p_eur_amount)
{
// Hide or show the row of the table with the amount in EUR (= default currency)
if (id$(p_code).value != -1) {
if (document.getElementById(p_code).value != -1) {
id$('row_currency').show();
}else {
id$('row_currency').hide();

View file

@ -488,7 +488,7 @@ function ledger_add_row() {
id$("e_march" + nb.value + "_price").value = '0';
id$("e_march" + nb.value).value = "";
id$("e_quant" + nb.value).value = "1";
if (id$("e_march" + nb.value + "_tva_amount"))
if (document.getElementById("e_march" + nb.value + "_tva_amount"))
id$("e_march" + nb.value + "_tva_amount").value = 0;
nb.value++;
@ -526,7 +526,7 @@ function compute_ledger(p_ctl_nb) {
* if tva_id is empty send a value of -1
*/
var tva_id = -1;
if (id$('e_march' + p_ctl_nb + '_tva_id')) {
if (document.getElementById('e_march' + p_ctl_nb + '_tva_id')) {
tva_id = id$('e_march' + p_ctl_nb + '_tva_id').value;
if (trim(tva_id) == '') {
tva_id = -1;
@ -571,11 +571,11 @@ function refresh_ledger() {
nb_item = id$("nb_item").value;
for (var i = 0; i < nb_item; i++) {
if (id$('tva_march' + i))
if (document.getElementById('tva_march' + i))
tva += id$('tva_march' + i).value * 1;
if (id$('htva_march' + i))
if (document.getElementById('htva_march' + i))
htva += id$('htva_march' + i).value * 1;
if (id$('tvac_march' + i))
if (document.getElementById('tvac_march' + i))
tvac += id$('tvac_march' + i).value * 1;
}
id_tva = id$("tva");
@ -625,7 +625,8 @@ function success_compute_ledger(request, json) {
id$('sum').show();
if (id$('e_march' + ctl + '_tva_amount').value == "" || id$('e_march' + ctl + '_tva_amount').value == 0) {
if (document.getElementById('e_march' + ctl + '_tva_amount').value == "" ||
document.getElementById('e_march' + ctl + '_tva_amount').value == 0) {
id$('tva_march' + ctl).value = rtva;
id$('e_march' + ctl + '_tva_amount').value = rtva;
} else {
@ -658,52 +659,51 @@ function compute_all_ledger() {
var tvac = 0;
for (var i = 0; i < nb_item; i++) {
if (id$('tva_march'))
if (document.getElementById('tva_march'))
tva += id$('tva_march' + i).value * 1;
if (id$('htva_march' + i))
if (document.getElementById('htva_march' + i))
htva += id$('htva_march' + i).value * 1;
if (id$('tvac_march' + i))
if (document.getElementById('tvac_march' + i))
tvac += id$('tvac_march' + i).value * 1;
}
id_other_tax = id$("other_tax_amount");
if (id$('tva'))
id$('tva').innerHTML = Math.round(tva * 100) / 100;
if (id$('htva'))
if (document.getElementById('tva')) id$('tva').innerHTML = Math.round(tva * 100) / 100;
if (document.getElementById ('htva'))
id$('htva').innerHTML = Math.round(htva * 100) / 100;
if (id_other_tax) {
tvac += id_other_tax.value;
}
if (id$('tvac'))
if (document.getElementById('tvac'))
id$('tvac').innerHTML = Math.round(tvac * 100) / 100;
}
function clean_tva(p_ctl) {
if (id$('e_march' + p_ctl + '_tva_amount'))
if (document.getElementById('e_march' + p_ctl + '_tva_amount'))
id$('e_march' + p_ctl + '_tva_amount').value = 0;
}
function clean_ledger(p_ctl_nb) {
if (id$("e_march" + p_ctl_nb)) {
if (document.getElementById("e_march" + p_ctl_nb)) {
id$("e_march" + p_ctl_nb).value = trim(id$("e_march" + p_ctl_nb).value);
}
if (id$('e_march' + p_ctl_nb + '_price')) {
if (document.getElementById('e_march' + p_ctl_nb + '_price')) {
id$('e_march' + p_ctl_nb + '_price').value = '';
}
if (id$('e_quant' + p_ctl_nb)) {
if (document.getElementById('e_quant' + p_ctl_nb)) {
id$('e_quant' + p_ctl_nb).value = '1';
}
if (id$('tva_march' + p_ctl_nb + '_show')) {
if (document.getElementById('tva_march' + p_ctl_nb + '_show')) {
id$('tva_march' + p_ctl_nb + '_show').value = '0';
}
if (id$('tva_march' + p_ctl_nb)) {
if (document.getElementById('tva_march' + p_ctl_nb)) {
id$('tva_march' + p_ctl_nb).value = 0;
}
if (id$('htva_march' + p_ctl_nb)) {
if (document.getElementById('htva_march' + p_ctl_nb)) {
id$('htva_march' + p_ctl_nb).value = 0;
}
if (id$('tvac_march' + p_ctl_nb)) {
if (document.getElementById('tvac_march' + p_ctl_nb)) {
id$('tvac_march' + p_ctl_nb).value = 0;
}
@ -1283,7 +1283,7 @@ function op_save(obj) {
/*
* Operation detail is in a new window
*/
if (id$('inpopup')) {
if (document.getElementById('inpopup')) {
var action = new Ajax.Request('ajax_misc.php',
{
method: 'post',
@ -1348,7 +1348,7 @@ function op_save(obj) {
}
function get_history_account(ctl, dossier) {
if (id$(ctl).value != '') {
if (document.getElementById(ctl).value != '') {
view_history_account(id$(ctl).value, dossier);
}
}
@ -1427,7 +1427,7 @@ function gestion_add_row() {
id$("e_march" + nb.value).value = "";
id$("e_quant" + nb.value).value = "1";
id$('tvac_march' + nb.value).value = "0";
if (id$("e_march" + nb.value + "_tva_amount"))
if (document.getElementById("e_march" + nb.value + "_tva_amount"))
id$("e_march" + nb.value + "_tva_amount").value = 0;
nb.value++;
@ -1653,10 +1653,10 @@ function reset_filter(p_div) {
var idx = elt[i];
id$(p_div + idx).value = "";
}
if (id$(p_div + "date_start_hidden")) {
if (document.getElementById(p_div + "date_start_hidden")) {
id$(p_div + "date_start").value = id$(p_div + "date_start_hidden").value;
}
if (id$(p_div + "date_end_hidden")) {
if (document.getElementById(p_div + "date_end_hidden")) {
id$(p_div + "date_end").value = id$(p_div + "date_end_hidden").value;
}
// clean all the selected ledger

View file

@ -61,7 +61,7 @@ function search_accounting(obj)
{
queryString+="&j="+obj.jrn;
}else {
if (id$("p_jrn")) {
if (document.getElementById("p_jrn")) {
queryString+="&j="+id$("p_jrn").value;
}
}
@ -97,7 +97,7 @@ function search_accounting(obj)
}
else
{
if (id$(obj).account)
if (document.getElementById(obj).account)
{
var e=id$(obj).account;
var str_account=id$(e).value;

View file

@ -33,7 +33,7 @@ function folder_display(p_user)
*
*/
var p_filter = "";
if (id$('database_filter_input')) {
if (document.getElementById('database_filter_input')) {
p_filter = id$('database_filter_input').value;
}
/*
@ -46,7 +46,7 @@ function folder_display(p_user)
// table id = database_list
var folder = {};
var create = false;
if (!id$('folder_list_div')) {
if (!document.getElementById('folder_list_div')) {
folder = create_div({'id': 'folder_list_div', 'cssclass': "inner_box", 'style': 'width:90%,right:5%;top:100px'});
create = true;
}
@ -157,7 +157,7 @@ function display_admin_answer(p_dossier,p_action)
var folder;
var create = false;
if (!id$(div_display)) {
if (!document.getElementById(div_display)) {
folder = create_div({'id': div_display, 'cssclass': "inner_box", style: 'width:90%;right:5%;top:100px'});
create = true;
}

View file

@ -35,19 +35,19 @@ function clean_Fid(p_ctl)
nTvaAmount=p_ctl+"_tva_amount";
nBuy=p_ctl+"_price";
nTva_id=p_ctl+"_tva_id";
if ( id$(nSell) )
if ( document.getElementById(nSell) )
{
id$(nSell).value="";
}
if ( id$(nBuy) )
if ( document.getElementById(nBuy) )
{
id$(nBuy).value="";
}
if ( id$(nTva_id) )
if ( document.getElementById(nTva_id) )
{
id$(nTva_id).value="-1";
}
if ( id$(nTvaAmount))
if ( document.getElementById(nTvaAmount))
{
id$(nTvaAmount).value=0;
}
@ -75,7 +75,7 @@ function ajaxFid(p_ctl)
id$(p_ctl).value=id$(p_ctl).value.toUpperCase();
if ( jrn == undefined )
{
if (id$('p_jrn')!=undefined)
if (document.getElementById('p_jrn')!=undefined)
{
jrn=id$('p_jrn').value;
}
@ -84,10 +84,10 @@ function ajaxFid(p_ctl)
{
jrn=-1;
}
if ( trim(id$(p_ctl).value)=="" )
if ( trim(document.getElementById(p_ctl).value)=="" )
{
nLabel=id$(p_ctl).label;
if (id$(nLabel) )
if (document.getElementById(nLabel) )
{
id$(nLabel).value="";
id$(nLabel).innerHTML="&nbsp;";
@ -96,23 +96,23 @@ function ajaxFid(p_ctl)
}
}
var queryString="FID="+trim(id$(p_ctl).value);
if ( id$(p_ctl).label)
if ( document.getElementById(p_ctl).label)
{
queryString+='&l='+id$(p_ctl).label;
}
if ( id$(p_ctl).tvaid)
if ( document.getElementById(p_ctl).tvaid)
{
queryString+='&t='+id$(p_ctl).tvaid;
}
if ( id$(p_ctl).price)
if ( document.getElementById(p_ctl).price)
{
queryString+='&p='+id$(p_ctl).price;
}
if ( id$(p_ctl).purchase)
if ( document.getElementById(p_ctl).purchase)
{
queryString+='&b='+id$(p_ctl).purchase;
}
if ( id$(p_ctl).typecard)
if ( document.getElementById(p_ctl).typecard)
{
queryString+='&d='+id$(p_ctl).typecard;
}

View file

@ -152,7 +152,7 @@ function verify_ca(div)
while (idx < 50)
{
var table = div + 't' + idx;
if (id$(table))
if (document.getElementById(table))
{
var total_amount = 0;
// table is found compute the different val[]

View file

@ -93,7 +93,7 @@ function search_card(obj)
}
if ( jrn==undefined)
{
if ( id$('p_jrn')) {
if ( document.getElementById('p_jrn')) {
jrn=id$('p_jrn').value;
}
else {
@ -114,7 +114,7 @@ function search_card(obj)
'amount_from_type':amount_from_type,
'inactive_card':inactive_card
});
if ( id$('search_card') ) {
if ( document.getElementById('search_card') ) {
removeDiv('search_card');
}
@ -336,7 +336,7 @@ function action_concerned_search_card(obj)
sx = document.body.scrollTop + 60;
}
var div_style = "top:" + sx + "px;height:52rem";
if ( ! id$('search_card')) { add_div({id: 'search_card', cssclass: 'inner_box', html: "", style: div_style, drag: true}); }
if ( ! document.getElementById('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');
@ -470,7 +470,7 @@ function result_card_search(req)
id$('search_card').innerHTML=code_html;
if (id$('query')) { id$('query').focus();}
if (document.getElementById('query')) { id$('query').focus();}
}
catch (e)
{
@ -525,15 +525,15 @@ function clean_Fid(p_ctl)
nSell=p_ctl+"_price";
nBuy=p_ctl+"_price";
nTva_id=p_ctl+"_tva_id";
if ( id$(nSell) )
if ( document.getElementById(nSell) )
{
id$(nSell).value="";
}
if ( id$(nBuy) )
if ( document.getElementById(nBuy) )
{
id$(nBuy).value="";
}
if ( id$(nTva_id) )
if ( document.getElementById(nTva_id) )
{
id$(nTva_id).value="-1";
}
@ -709,7 +709,7 @@ function select_card_type(obj)
filter=-1;
}
var content="select_card_div";
if ( id$(content)){removeDiv(content);}
if ( document.getElementById(content)){removeDiv(content);}
var sx=0;
sx=calcy(160);
@ -723,12 +723,12 @@ function select_card_type(obj)
queryString+='&ctl='+content;
queryString+='&op2=st'; // st for selecting type
queryString+='&op=card'; // st for selecting type
if ( id$(obj).win_refresh!=undefined)
if ( document.getElementById(obj).win_refresh!=undefined)
{
queryString+='&ref';
}
/* if an element id must be updated after creating a new card */
if ( id$(obj).elementId) {
if ( document.getElementById(obj).elementId) {
var elementId=id$(obj).elementId;
queryString+="&eltid="+elementId;
}
@ -850,7 +850,7 @@ 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 ( id$(content)) {removeDiv(content);}
if ( document.getElementById(content)) {removeDiv(content);}
add_div(popup);
@ -986,7 +986,7 @@ function add_category(obj)
// show ipopup
var div={id:obj.ipopup,
cssclass:"inner_box",drag:1,style:div_style};
if ( id$(div) ) {
if ( document.getElementById(div) ) {
removeDiv(div);
}
add_div(div);
@ -1016,7 +1016,7 @@ function add_category(obj)
*/
function save_card_category(obj)
{
if ( ! id$(obj).ipopup)
if ( ! document.getElementById(obj).ipopup)
{
alert_box('Erreur pas d\' attribut ipopup '+obj.id);
return;

View file

@ -152,7 +152,7 @@ function get_next_layer(){
* enable the type of periode
*/
function enable_type_periode() {
if (id$("type_periode").options[id$("type_periode").selectedIndex].value == 0) {
if (document.getElementById("type_periode").options[id$("type_periode").selectedIndex].value == 0) {
id$('from_periode').enable();
id$('to_periode').enable();
id$('from_date').disable();
@ -242,7 +242,7 @@ 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_value(p_ctl, p_value, p_add) {
if (id$(p_ctl)) {
if (document.getElementById(p_ctl)) {
var g_ctrl = id$(p_ctl);
if (p_add != undefined && p_add === 1) {
if (g_ctrl.value) {
@ -583,7 +583,7 @@ function cat_doc_change(p_dt_id, p_dossier) {
*/
function popup_select_tva(obj, p_function_callback) {
try {
if (id$('tva_select')) {
if (document.getElementById('tva_select')) {
removeDiv('tva_select');
}
@ -710,7 +710,7 @@ function create_div(obj) {
try {
var top = document;
var elt = null;
if (!id$(obj.id)) {
if (!document.getElementById(obj.id)) {
elt = top.createElement('div');
} else {
elt = id$(obj.id);
@ -809,7 +809,7 @@ function waiting_box() {
};
var y = fixed_position(10, 250)
obj.style = y + ";width:20%;margin-left:40%;";
if (id$('wait_box')) {
if (document.getElementById('wait_box')) {
removeDiv('wait_box');
}
waiting_node();
@ -969,7 +969,7 @@ function hide_ledger_choice(p_frm_search) {
try {
var nb = id$(p_frm_search).nb_jrn.value;
var div = "";
if (id$(p_frm_search).div) {
if (document.getElementById(p_frm_search).div) {
div = id$(p_frm_search).div.value;
}
var i = 0;
@ -980,7 +980,7 @@ function hide_ledger_choice(p_frm_search) {
for (i = 0; i < nb; i++) {
n_name = div + "r_jrn[" + sel + "]";
name = div + "r_jrn" + i;
if (id$(name).checked) {
if (document.getElementById(name).checked) {
str += '<input type="hidden" id="' + n_name + '" name="' + n_name + '" value="' + id$(name).value + '">';
sel++;
}
@ -1109,7 +1109,7 @@ function unselect_checkbox(form_id) {
* show the calculator
*/
function show_calc() {
if (id$('calc1')) {
if (document.getElementById('calc1')) {
this.document.getElementById('inp').value = "";
this.document.getElementById('inp').focus();
return;
@ -1142,7 +1142,7 @@ function display_periode(p_dossier, p_id) {
'style': 'width:30em',
'drag': true
};
if (!id$('mod_periode')) {
if (!document.getElementById('mod_periode')) {
add_div(popup);
}
var action = new Ajax.Request(
@ -1313,7 +1313,7 @@ function save_predf_op(obj) {
function search_reconcile(dossier, ctl_concern, amount_id, ledger, p_id_target, p_tiers) {
if (amount_id === undefined) {
amount_id = 0;
} else if (id$(amount_id)) {
} else if (document.getElementById(amount_id)) {
if (id$(amount_id).value) {
amount_id = id$(amount_id).value;
} else if
@ -1376,7 +1376,7 @@ function search_operation(obj) {
var dossier = id$('gDossier').value;
waiting_box();
var target = "search" + layer;
if (id$(obj)["target"]) {
if (document.getElementById(obj)["target"]) {
target = id$(obj)["target"].value;
}
var qs = Form.serialize('search_form_ajx') + "&op=search_op";
@ -1466,7 +1466,7 @@ function remove_waiting_node() {
}
function remove_waiting_box() {
if (id$('wait_box')) {
if (document.getElementById('wait_box')) {
Effect.Fade('wait_box', {duration: 0.6});
}
@ -2003,7 +2003,7 @@ function show_fin_chdate(obj_id) {
}
var nb = id$('nb_item').value;
for (i = 0; i < nb; i++) {
if (id$('tdchdate' + i)) {
if (document.getElementById('tdchdate' + i)) {
if (ch == 2) {
id$('tdchdate' + i).show();
}
@ -2216,11 +2216,11 @@ function filter_table(phrase, _id, colnr, start_row) {
id$('info_div').innerHTML = "";
}
if (tot_found == 0) {
if (id$('info_' + _id)) {
if (document.getElementById('info_' + _id)) {
id$('info_' + _id).innerHTML = content[69];
}
} else {
if (id$('info_' + _id)) {
if (document.getElementById('info_' + _id)) {
id$('info_' + _id).innerHTML = " ";
}
}
@ -2268,11 +2268,11 @@ function filter_list(phrase, _id) {
}
if (tot_found == 0) {
if (id$('info_' + _id)) {
if (document.getElementById('info_' + _id)) {
id$('info_' + _id).innerHTML = content[69];
}
} else {
if (id$('info_' + _id)) {
if (document.getElementById('info_' + _id)) {
id$('info_' + _id).innerHTML = " ";
}
}
@ -2309,11 +2309,11 @@ function filter_multiselect(phrase, _id) {
id$('info_div').innerHTML = "";
}
if (tot_found == 0) {
if (id$('info_' + _id)) {
if (document.getElementById('info_' + _id)) {
id$('info_' + _id).innerHTML = content[69];
}
} else {
if (id$('info_' + _id)) {
if (document.getElementById('info_' + _id)) {
id$('info_' + _id).innerHTML = " ";
}
}
@ -4603,7 +4603,7 @@ Widget.prototype.add=function (widget_code) {
{
here=this;
var param = {};
if (id$(widget_code+"_param")) {
if (document.getElementById(widget_code+"_param")) {
param=id$(widget_code+"_param").serialize()
}
query = {