From 0d8641a073596b3964e9e2e52ac391b63f840714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 12 May 2015 14:22:00 +0200 Subject: [PATCH 1/4] [Qual] Use jQuery property instead of attribute to test and set checked --- htdocs/adherents/card_subscriptions.php | 2 +- htdocs/admin/const.php | 2 +- htdocs/admin/tools/dolibarr_export.php | 2 +- htdocs/commande/orderstoinvoice.php | 4 ++-- htdocs/compta/facture.php | 10 +++++----- htdocs/compta/facture/mergepdftool.php | 8 ++++---- htdocs/compta/paiement/cheque/card.php | 4 ++-- htdocs/core/tpl/objectline_create.tpl.php | 8 ++++---- htdocs/fourn/commande/orderstoinvoice.php | 4 ++-- htdocs/install/fileconf.php | 4 ++-- htdocs/user/card.php | 12 ++++++------ htdocs/user/param_ihm.php | 6 +++--- 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 369027b1e14..3aedb6fe50c 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -873,7 +873,7 @@ if ($rowid) } }); '; - if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").attr("checked",true);'; + if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").prop("checked",true);'; print '});'; print ''."\n"; } diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 6b63ba74c6b..55434d4de2e 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -165,7 +165,7 @@ jQuery(document).ready(function() { var row_num = field_id.split("_"); jQuery("#updateconst").show(); jQuery("#action").val('update'); - jQuery("#check_" + row_num[1]).attr("checked",true); + jQuery("#check_" + row_num[1]).prop("checked",true); }); }); diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 842efb3a0ac..671a9bf9eba 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -96,7 +96,7 @@ jQuery(document).ready(function() { jQuery("#select_sql_compat").click(function() { if (jQuery("#select_sql_compat").val() == 'POSTGRESQL') { - jQuery("#checkbox_dump_disable-add-locks").attr('checked',true); + jQuery("#checkbox_dump_disable-add-locks").prop('checked',true); } }); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 39253325716..1203a987abf 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -512,10 +512,10 @@ if (($action != 'create' && $action != 'add') || !$error) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 1aaca07b57d..e3e753ab7eb 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2099,7 +2099,7 @@ if ($action == 'create') print ''; @@ -2154,7 +2154,7 @@ if ($action == 'create') print ''; @@ -2200,7 +2200,7 @@ if ($action == 'create') // Show credit note options only if we checked credit note print ' diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 6b218d52430..dba17a4798c 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -414,11 +414,11 @@ if ($action == 'new') { jQuery("#checkall_'.$bid.'").click(function() { - jQuery(".checkforremise_'.$bid.'").attr(\'checked\', true); + jQuery(".checkforremise_'.$bid.'").prop(\'checked\', true); }); jQuery("#checknone_'.$bid.'").click(function() { - jQuery(".checkforremise_'.$bid.'").attr(\'checked\', false); + jQuery(".checkforremise_'.$bid.'").prop(\'checked\', false); }); }); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 0d18cd9b8b5..9c6cfd2e1be 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -583,8 +583,8 @@ function setforfree() { jQuery("#idprod").val(''); jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product jQuery("#search_idprodfournprice").val(''); - jQuery("#prod_entry_mode_free").attr('checked',true); - jQuery("#prod_entry_mode_predef").attr('checked',false); + jQuery("#prod_entry_mode_free").prop('checked',true); + jQuery("#prod_entry_mode_predef").prop('checked',false); jQuery("#price_ht").show(); jQuery("#price_ttc").show(); // May no exists jQuery("#tva_tx").show(); @@ -601,8 +601,8 @@ function setforfree() { } function setforpredef() { jQuery("#select_type").val(-1); - jQuery("#prod_entry_mode_free").attr('checked',false); - jQuery("#prod_entry_mode_predef").attr('checked',true); + jQuery("#prod_entry_mode_free").prop('checked',false); + jQuery("#prod_entry_mode_predef").prop('checked',true); jQuery("#price_ht").hide(); jQuery("#title_up_ht").hide(); jQuery("#price_ttc").hide(); // May no exists diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index d35d318d4a2..a18031de4d4 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -386,10 +386,10 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 1256c5b215a..7df38b46d61 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -487,8 +487,8 @@ jQuery(document).ready(function() { function init_needroot() { - /*alert(jQuery("#db_create_database").attr("checked")); */ - if (jQuery("#db_create_database").attr("checked") || jQuery("#db_create_user").attr("checked")) + /*alert(jQuery("#db_create_database").prop("checked")); */ + if (jQuery("#db_create_database").prop("checked") || jQuery("#db_create_user").prop("checked")) { jQuery(".hideroot").show(); jQuery(".needroot").removeAttr('disabled'); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0320f44916e..77352b630f1 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -822,7 +822,7 @@ if (($action == 'create') || ($action == 'adduserldap')) if ( $(this).val() == 0 ) { $("input[name=superadmin]") .attr("disabled", true) - .attr("checked", false); + .prop("checked", false); $("select[name=entity]") .attr("disabled", false); } else { @@ -831,7 +831,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } }); $("input[name=superadmin]").change(function() { - if ( $(this).attr("checked") == "checked" ) { + if ( $(this).prop("checked", true) ) { $("select[name=entity]") .attr("disabled", true); } else { @@ -1823,9 +1823,9 @@ else if (admin == 0) { $("input[name=superadmin]") .attr("disabled", true) - .attr("checked", false); + .prop("checked", false); } - if ($("input[name=superadmin]").attr("checked") == "checked") { + if ($("input[name=superadmin]").prop("checked", true)) { $("select[name=entity]") .attr("disabled", true); } @@ -1833,7 +1833,7 @@ else if ( $(this).val() == 0 ) { $("input[name=superadmin]") .attr("disabled", true) - .attr("checked", false); + .prop("checked", false); $("select[name=entity]") .attr("disabled", false); } else { @@ -1842,7 +1842,7 @@ else } }); $("input[name=superadmin]").change(function() { - if ( $(this).attr("checked") == "checked" ) { + if ( $(this).prop("checked", true)) { $("select[name=entity]") .attr("disabled", true); } else { diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 4f8259bc007..77e03728af6 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -155,11 +155,11 @@ if ($action == 'edit') print ''; From e149d49fb87685265cd8a2ae25529829b881709c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 12 May 2015 14:47:33 +0200 Subject: [PATCH 2/4] [Qual] Use jQuery property instead of attribute to test and set disabled --- htdocs/admin/mails.php | 12 ++++---- htdocs/admin/menus/edit.php | 4 +-- htdocs/barcode/printsheet.php | 28 ++++++++--------- htdocs/comm/action/card.php | 18 +++++------ htdocs/core/class/html.formactions.class.php | 6 ++-- htdocs/core/lib/ajax.lib.php | 6 ++-- htdocs/core/tpl/admin_extrafields_add.tpl.php | 30 +++++++++---------- .../core/tpl/admin_extrafields_edit.tpl.php | 12 ++++---- htdocs/install/fileconf.php | 2 +- .../product/stock/tpl/stockcorrection.tpl.php | 6 ++-- htdocs/user/card.php | 24 +++++++-------- 11 files changed, 74 insertions(+), 74 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 159c03589b1..2b50008d58a 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -271,12 +271,12 @@ if ($action == 'edit') { jQuery(".drag").hide(); jQuery("#MAIN_MAIL_EMAIL_TLS").val(0); - jQuery("#MAIN_MAIL_EMAIL_TLS").attr(\'disabled\', \'disabled\'); + jQuery("#MAIN_MAIL_EMAIL_TLS").prop("disabled", true); '; if ($linuxlike) { - print ' jQuery("#MAIN_MAIL_SMTP_SERVER").attr(\'disabled\', \'disabled\');'; - print ' jQuery("#MAIN_MAIL_SMTP_PORT").attr(\'disabled\', \'disabled\');'; + print ' jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);'; + print ' jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);'; } print ' } @@ -284,9 +284,9 @@ if ($action == 'edit') { jQuery(".drag").show(); jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.'); - jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr(\'disabled\'); - jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr(\'disabled\'); - jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr(\'disabled\'); + jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled"); + jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr("disabled"); + jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr("disabled"); } } initfields(); diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9ded9ae1f34..4ab41c7991e 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -255,12 +255,12 @@ if ($action == 'create') { if (jQuery("#topleft").val() == \'top\') { - jQuery("#menuId").attr(\'disabled\',\'disabled\'); + jQuery("#menuId").prop("disabled", true); jQuery("#menuId").val(\'\'); } else { - jQuery("#menuId").removeAttr(\'disabled\'); + jQuery("#menuId").removeAttr("disabled"); } } init_topleft(); diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 1a518b1859c..36d9117eefe 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -313,28 +313,28 @@ jQuery(document).ready(function() { { if (jQuery("#fillmanually:checked").val() == "fillmanually") { - jQuery("#submitproduct").attr(\'disabled\',\'disabled\'); - jQuery("#submitthirdparty").attr(\'disabled\',\'disabled\'); - jQuery("#search_productid").attr(\'disabled\',\'disabled\'); - jQuery("#socid").attr(\'disabled\',\'disabled\'); + jQuery("#submitproduct").prop("disabled", true); + jQuery("#submitthirdparty").prop("disabled", true); + jQuery("#search_productid").prop("disabled", true); + jQuery("#socid").prop("disabled", true); jQuery(".showforproductselector").hide(); jQuery(".showforthirdpartyselector").hide(); } if (jQuery("#fillfromproduct:checked").val() == "fillfromproduct") { - jQuery("#submitproduct").removeAttr(\'disabled\'); - jQuery("#submitthirdparty").attr(\'disabled\',\'disabled\'); - jQuery("#search_productid").removeAttr(\'disabled\'); - jQuery("#socid").attr(\'disabled\',\'disabled\'); + jQuery("#submitproduct").removeAttr("disabled"); + jQuery("#submitthirdparty").prop("disabled", true); + jQuery("#search_productid").removeAttr("disabled"); + jQuery("#socid").prop("disabled", true); jQuery(".showforproductselector").show(); jQuery(".showforthirdpartyselector").hide(); } if (jQuery("#fillfromthirdparty:checked").val() == "fillfromthirdparty") { - jQuery("#submitproduct").attr(\'disabled\',\'disabled\'); - jQuery("#submitthirdparty").removeAttr(\'disabled\'); - jQuery("#search_productid").attr(\'disabled\',\'disabled\'); - jQuery("#socid").removeAttr(\'disabled\'); + jQuery("#submitproduct").prop("disabled", true); + jQuery("#submitthirdparty").removeAttr("disabled"); + jQuery("#search_productid").prop("disabled", true); + jQuery("#socid").removeAttr("disabled"); jQuery(".showforproductselector").hide(); jQuery(".showforthirdpartyselector").show(); } @@ -348,11 +348,11 @@ jQuery(document).ready(function() { { if (jQuery("#select_fk_barcode_type").val() > 0 && jQuery("#forbarcode").val()) { - jQuery("#submitformbarcodegen").removeAttr(\'disabled\'); + jQuery("#submitformbarcodegen").removeAttr("disabled"); } else { - jQuery("#submitformbarcodegen").attr(\'disabled\',\'disabled\'); + jQuery("#submitformbarcodegen").prop("disabled", true); } } init_gendoc_button(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 7e842ae3678..07f154c8ef7 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -570,11 +570,11 @@ if ($action == 'create') $(".fulldayendmin").removeAttr("disabled"); $("#p2").removeAttr("disabled"); } else { - $(".fulldaystarthour").attr("disabled","disabled").val("00"); - $(".fulldaystartmin").attr("disabled","disabled").val("00"); - $(".fulldayendhour").attr("disabled","disabled").val("23"); - $(".fulldayendmin").attr("disabled","disabled").val("59"); - $("#p2").removeAttr("disabled"); + $(".fulldaystarthour").prop("disabled", true).val("00"); + $(".fulldaystartmin").prop("disabled", true).val("00"); + $(".fulldayendhour").prop("disabled", true).val("23"); + $(".fulldayendmin").prop("disabled", true).val("59"); + $("#p2").removeAttr("disabled"); } } setdatefields(); @@ -841,10 +841,10 @@ if ($id > 0) $(".fulldayendhour").removeAttr("disabled"); $(".fulldayendmin").removeAttr("disabled"); } else { - $(".fulldaystarthour").attr("disabled","disabled").val("00"); - $(".fulldaystartmin").attr("disabled","disabled").val("00"); - $(".fulldayendhour").attr("disabled","disabled").val("23"); - $(".fulldayendmin").attr("disabled","disabled").val("59"); + $(".fulldaystarthour").prop("disabled", true).val("00"); + $(".fulldaystartmin").prop("disabled", true).val("00"); + $(".fulldayendhour").prop("disabled", true).val("23"); + $(".fulldayendmin").prop("disabled", true).val("59"); } } setdatefields(); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index c656cb0432d..9322680a682 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -95,17 +95,17 @@ class FormActions percentage.val(value); if (defaultvalue == -1) { - percentage.attr('disabled', 'disabled'); + percentage.prop('disabled', true); $('.hideifna').hide(); } else if (defaultvalue == 0) { percentage.val(0); - percentage.attr('disabled', 'disabled'); + percentage.prop('disabled', true); $('.hideifna').show(); } else if (defaultvalue == 100) { percentage.val(100); - percentage.attr('disabled', 'disabled'); + percentage.prop('disabled', true); $('.hideifna').show(); } else { diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 8d6bc704e21..0b119ada66a 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -132,7 +132,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt // Disable an element if (options.option_disabled) { if (ui.item.disabled) { - $("#" + options.option_disabled).attr("disabled", "disabled"); + $("#" + options.option_disabled).prop("disabled", true); if (options.error) { $.jnotify(options.error, "error", true); // Output with jnotify the error message } @@ -145,7 +145,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt } if (options.disabled) { $.each(options.disabled, function(key, value) { - $("#" + value).attr("disabled", "disabled"); + $("#" + value).prop("disabled", true); }); } if (options.show) { @@ -524,7 +524,7 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=a // Disable another element if (input.disabled && input.disabled.length > 0) { $.each(input.disabled, function(key,value) { - $("#" + value).attr("disabled", true); + $("#" + value).prop("disabled", true); if ($("#" + value).hasClass("butAction") == true) { $("#" + value).removeClass("butAction"); $("#" + value).addClass("butActionRefused"); diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 293a363edfd..44de526942f 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -42,27 +42,27 @@ if (GETPOST('type') == "separate") { - print "jQuery('#size, #unique, #required, #default_value').val('').attr('disabled','disabled');"; + print "jQuery('#size, #unique, #required, #default_value').val('').prop('disabled', true);"; print 'jQuery("#value_choice").hide();'; } ?> - if (type == 'date') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'datetime') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} - else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} - else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'link') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} - else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'chkbxlst') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} - else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else size.val('').attr('disabled','disabled'); + else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'select') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'link') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} + else if (type == 'sellist') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'radio') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} + else if (type == 'separate') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else size.val('').prop('disabled', true); } init_typeoffields(''); jQuery("#type").change(function() { diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 91b861381ae..9c283b83867 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -25,15 +25,15 @@ var size = jQuery("#size"); var unique = jQuery("#unique"); var required = jQuery("#required"); - if (type == 'date') { size.attr('disabled','disabled'); } - else if (type == 'datetime') { size.attr('disabled','disabled'); } + if (type == 'date') { size.prop('disabled', true); } + else if (type == 'datetime') { size.prop('disabled', true); } else if (type == 'double') { size.removeAttr('disabled'); } else if (type == 'int') { size.removeAttr('disabled'); } - else if (type == 'text') { size.removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); } + else if (type == 'text') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); } else if (type == 'varchar') { size.removeAttr('disabled'); } - else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');} - else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');} - else size.val('').attr('disabled','disabled'); + else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true);} + else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true);} + else size.val('').prop('disabled', true); } init_typeoffields(jQuery("#type").val()); }); diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 7df38b46d61..48599d51323 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -496,7 +496,7 @@ jQuery(document).ready(function() { else { jQuery(".hideroot").hide(); - jQuery(".needroot").attr('disabled','disabled'); + jQuery(".needroot").prop('disabled', true); } } diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 8f656045ee3..501272983cd 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -29,8 +29,8 @@ $langs->load("productbatch"); jQuery(document).ready(function() { function init_price() { - if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr(\'disabled\'); - else jQuery("#unitprice").attr(\'disabled\',\'disabled\'); + if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled"); + else jQuery("#unitprice").prop("disabled", true); } init_price(); jQuery("#mouvement").change(function() { @@ -116,4 +116,4 @@ $langs->load("productbatch"); print ''; ?> - \ No newline at end of file + diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 77352b630f1..8211adbb4bc 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -821,22 +821,22 @@ if (($action == 'create') || ($action == 'adduserldap')) $("select[name=admin]").change(function() { if ( $(this).val() == 0 ) { $("input[name=superadmin]") - .attr("disabled", true) + .prop("disabled", true) .prop("checked", false); $("select[name=entity]") - .attr("disabled", false); + .prop("disabled", false); } else { $("input[name=superadmin]") - .attr("disabled", false); + .prop("disabled", false); } }); $("input[name=superadmin]").change(function() { if ( $(this).prop("checked", true) ) { $("select[name=entity]") - .attr("disabled", true); + .prop("disabled", true); } else { $("select[name=entity]") - .attr("disabled", false); + .prop("disabled", false); } }); }); @@ -1822,32 +1822,32 @@ else var admin = $("select[name=admin]").val(); if (admin == 0) { $("input[name=superadmin]") - .attr("disabled", true) + .prop("disabled", true) .prop("checked", false); } if ($("input[name=superadmin]").prop("checked", true)) { $("select[name=entity]") - .attr("disabled", true); + .prop("disabled", true); } $("select[name=admin]").change(function() { if ( $(this).val() == 0 ) { $("input[name=superadmin]") - .attr("disabled", true) + .prop("disabled", true) .prop("checked", false); $("select[name=entity]") - .attr("disabled", false); + .prop("disabled", false); } else { $("input[name=superadmin]") - .attr("disabled", false); + .prop("disabled", false); } }); $("input[name=superadmin]").change(function() { if ( $(this).prop("checked", true)) { $("select[name=entity]") - .attr("disabled", true); + .prop("disabled", true); } else { $("select[name=entity]") - .attr("disabled", false); + .prop("disabled", false); } }); }); From d5565fffc1e5a2091c32b714b1e115b6102ccb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 12 May 2015 15:01:13 +0200 Subject: [PATCH 3/4] [Qual] Fixed HTML input form disabled attribute --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 150ca48e477..3a42879961b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4356,7 +4356,7 @@ class Form '; } - $out.=''; if ($show_empty) { From 932e23ac09713a2b84284d7e66580d9e83dc9d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 12 May 2015 16:21:21 +0200 Subject: [PATCH 4/4] [Qual] Use jQuery 'is' instead of 'prop' in conditions --- htdocs/compta/facture.php | 2 +- htdocs/install/fileconf.php | 2 +- htdocs/user/card.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e3e753ab7eb..f7efaff7b50 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2200,7 +2200,7 @@ if ($action == 'create') // Show credit note options only if we checked credit note print '