mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 09:38:23 +01:00
Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0
This commit is contained in:
@@ -1578,14 +1578,20 @@ jQuery(document).ready(function() {
|
||||
|
||||
// Code to manage the js for combo list with dependencies (called by extrafields_view.tpl.php)
|
||||
function showOptions(child_list, parent_list) {
|
||||
var val = $("select[name="+parent_list+"]").val();
|
||||
var parentVal = parent_list + ":" + val;
|
||||
if(val > 0) {
|
||||
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
||||
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show();
|
||||
var parentInput = $("select[name="+parent_list+"]");
|
||||
if (parentInput.length === 0) { // when parent extra-field is in view mode and the child is edited directly on card (on line edit)
|
||||
parentInput = $("input[name="+parent_list+"]");
|
||||
}
|
||||
if (parentInput.length > 0) {
|
||||
var val = parentInput.val();
|
||||
var parentVal = parent_list + ":" + val;
|
||||
if (val > 0) {
|
||||
$("select[name=\""+child_list+"\"] option[parent]").prop("disabled", true).hide(); // hide not work with select2 element so disabled it
|
||||
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").prop('disabled', false).show(); // show not work with select2 element so enabled it
|
||||
} else {
|
||||
$("select[name=\""+child_list+"\"] option").show();
|
||||
$("select[name=\""+child_list+"\"] option").prop("disabled", false).show(); // show not work with select2 element so enabled it
|
||||
}
|
||||
}
|
||||
}
|
||||
function setListDependencies() {
|
||||
console.log("setListDependencies");
|
||||
|
||||
Reference in New Issue
Block a user