Debug v14 with nojs
This commit is contained in:
parent
2091120d77
commit
e7b3280c17
@ -99,14 +99,16 @@ print "<br>\n";
|
|||||||
/**
|
/**
|
||||||
* Edit parameters
|
* Edit parameters
|
||||||
*/
|
*/
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
print '$(document).ready(function () {
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
|
print '$(document).ready(function () {
|
||||||
$("#selectcountry_id").change(function() {
|
$("#selectcountry_id").change(function() {
|
||||||
document.form_index.action.value="updateedit";
|
document.form_index.action.value="updateedit";
|
||||||
document.form_index.submit();
|
document.form_index.submit();
|
||||||
});
|
});
|
||||||
});';
|
});';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
|||||||
@ -384,14 +384,16 @@ print "<br>\n";
|
|||||||
/**
|
/**
|
||||||
* Edit parameters
|
* Edit parameters
|
||||||
*/
|
*/
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
print '$(document).ready(function () {
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
|
print '$(document).ready(function () {
|
||||||
$("#selectcountry_id").change(function() {
|
$("#selectcountry_id").change(function() {
|
||||||
document.form_index.action.value="updateedit";
|
document.form_index.action.value="updateedit";
|
||||||
document.form_index.submit();
|
document.form_index.submit();
|
||||||
});
|
});
|
||||||
});';
|
});';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
|
print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
|||||||
@ -2006,30 +2006,32 @@ class ExtraFields
|
|||||||
$collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true));
|
$collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true));
|
||||||
$extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key].(!empty($object->id)?'_'.$object->id:'');
|
$extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key].(!empty($object->id)?'_'.$object->id:'');
|
||||||
|
|
||||||
$out .= '<!-- Add js script to manage the collapse/uncollapse of extrafields separators '.$key.' -->'."\n";
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
$out .= '<script type="text/javascript">'."\n";
|
$out .= '<!-- Add js script to manage the collapse/uncollapse of extrafields separators '.$key.' -->'."\n";
|
||||||
$out .= 'jQuery(document).ready(function(){'."\n";
|
$out .= '<script type="text/javascript">'."\n";
|
||||||
if ($collapse_display === false) {
|
$out .= 'jQuery(document).ready(function(){'."\n";
|
||||||
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-plus-square\"></span> ");'."\n";
|
if ($collapse_display === false) {
|
||||||
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n";
|
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-plus-square\"></span> ");'."\n";
|
||||||
} else {
|
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n";
|
||||||
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-minus-square\"></span> ");'."\n";
|
} else {
|
||||||
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-minus-square\"></span> ");'."\n";
|
||||||
|
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
||||||
|
}
|
||||||
|
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'").click(function(){'."\n";
|
||||||
|
$out .= ' console.log("We click on collapse/uncollapse .trextrafields_collapse'.$extrafields_collapse_num.'");'."\n";
|
||||||
|
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").toggle(300, function(){'."\n";
|
||||||
|
$out .= ' if (jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").is(":hidden")) {'."\n";
|
||||||
|
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n";
|
||||||
|
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=0; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
||||||
|
$out .= ' } else {'."\n";
|
||||||
|
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-minus-square").removeClass("fa-plus-square");'."\n";
|
||||||
|
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
||||||
|
$out .= ' }'."\n";
|
||||||
|
$out .= ' });'."\n";
|
||||||
|
$out .= ' });'."\n";
|
||||||
|
$out .= '});'."\n";
|
||||||
|
$out .= '</script>'."\n";
|
||||||
}
|
}
|
||||||
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'").click(function(){'."\n";
|
|
||||||
$out .= ' console.log("We click on collapse/uncollapse .trextrafields_collapse'.$extrafields_collapse_num.'");'."\n";
|
|
||||||
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").toggle(300, function(){'."\n";
|
|
||||||
$out .= ' if (jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").is(":hidden")) {'."\n";
|
|
||||||
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n";
|
|
||||||
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=0; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
|
||||||
$out .= ' } else {'."\n";
|
|
||||||
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-minus-square").removeClass("fa-plus-square");'."\n";
|
|
||||||
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
|
||||||
$out .= ' }'."\n";
|
|
||||||
$out .= ' });'."\n";
|
|
||||||
$out .= ' });'."\n";
|
|
||||||
$out .= '});'."\n";
|
|
||||||
$out .= '</script>'."\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7067,7 +7067,7 @@ class Form
|
|||||||
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
|
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
global $delayedhtmlcontent;
|
global $delayedhtmlcontent; // Will be used later outside of this function
|
||||||
|
|
||||||
// TODO Use an internal dolibarr component instead of select2
|
// TODO Use an internal dolibarr component instead of select2
|
||||||
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
|
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
|
||||||
@ -7076,68 +7076,71 @@ class Form
|
|||||||
|
|
||||||
$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
|
$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
|
||||||
|
|
||||||
$tmpplugin = 'select2';
|
$outdelayed = '';
|
||||||
$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
<script>
|
$tmpplugin = 'select2';
|
||||||
$(document).ready(function () {
|
$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
'.($callurlonselect ? 'var saveRemoteData = [];' : '').'
|
'.($callurlonselect ? 'var saveRemoteData = [];' : '').'
|
||||||
|
|
||||||
$(".'.$htmlname.'").select2({
|
$(".'.$htmlname.'").select2({
|
||||||
ajax: {
|
ajax: {
|
||||||
dir: "ltr",
|
dir: "ltr",
|
||||||
url: "'.$url.'",
|
url: "'.$url.'",
|
||||||
dataType: \'json\',
|
dataType: \'json\',
|
||||||
delay: 250,
|
delay: 250,
|
||||||
data: function (params) {
|
data: function (params) {
|
||||||
return {
|
return {
|
||||||
q: params.term, // search term
|
q: params.term, // search term
|
||||||
page: params.page
|
page: params.page
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
processResults: function (data) {
|
processResults: function (data) {
|
||||||
// parse the results into the format expected by Select2.
|
// parse the results into the format expected by Select2.
|
||||||
// since we are using custom formatting functions we do not need to alter the remote JSON data
|
// since we are using custom formatting functions we do not need to alter the remote JSON data
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
saveRemoteData = data;
|
saveRemoteData = data;
|
||||||
/* format json result for select2 */
|
/* format json result for select2 */
|
||||||
result = []
|
result = []
|
||||||
$.each( data, function( key, value ) {
|
$.each( data, function( key, value ) {
|
||||||
result.push({id: key, text: value.text});
|
result.push({id: key, text: value.text});
|
||||||
});
|
});
|
||||||
//return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false}
|
//return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false}
|
||||||
//console.log(result);
|
//console.log(result);
|
||||||
return {results: result, more: false}
|
return {results: result, more: false}
|
||||||
},
|
},
|
||||||
cache: true
|
cache: true
|
||||||
},
|
},
|
||||||
language: select2arrayoflanguage,
|
language: select2arrayoflanguage,
|
||||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||||
placeholder: "'.dol_escape_js($placeholder).'",
|
placeholder: "'.dol_escape_js($placeholder).'",
|
||||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||||
minimumInputLength: '.$minimumInputLength.',
|
minimumInputLength: '.$minimumInputLength.',
|
||||||
formatResult: function(result, container, query, escapeMarkup) {
|
formatResult: function(result, container, query, escapeMarkup) {
|
||||||
return escapeMarkup(result.text);
|
return escapeMarkup(result.text);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
'.($callurlonselect ? '
|
'.($callurlonselect ? '
|
||||||
/* Code to execute a GET when we select a value */
|
/* Code to execute a GET when we select a value */
|
||||||
$(".'.$htmlname.'").change(function() {
|
$(".'.$htmlname.'").change(function() {
|
||||||
var selected = $(".'.$htmlname.'").val();
|
var selected = $(".'.$htmlname.'").val();
|
||||||
console.log("We select in selectArrayAjax the entry "+selected)
|
console.log("We select in selectArrayAjax the entry "+selected)
|
||||||
$(".'.$htmlname.'").val(""); /* reset visible combo value */
|
$(".'.$htmlname.'").val(""); /* reset visible combo value */
|
||||||
$.each( saveRemoteData, function( key, value ) {
|
$.each( saveRemoteData, function( key, value ) {
|
||||||
if (key == selected)
|
if (key == selected)
|
||||||
{
|
{
|
||||||
console.log("selectArrayAjax - Do a redirect to "+value.url)
|
console.log("selectArrayAjax - Do a redirect to "+value.url)
|
||||||
location.assign(value.url);
|
location.assign(value.url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});' : '').'
|
});' : '').'
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($acceptdelayedhtml) {
|
if ($acceptdelayedhtml) {
|
||||||
$delayedhtmlcontent .= $outdelayed;
|
$delayedhtmlcontent .= $outdelayed;
|
||||||
@ -7168,7 +7171,7 @@ class Form
|
|||||||
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
|
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
global $delayedhtmlcontent;
|
global $delayedhtmlcontent; // Will be used later outside of this function
|
||||||
|
|
||||||
// TODO Use an internal dolibarr component instead of select2
|
// TODO Use an internal dolibarr component instead of select2
|
||||||
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
|
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
|
||||||
@ -7187,74 +7190,77 @@ class Form
|
|||||||
$formattedarrayresult[] = $o;
|
$formattedarrayresult[] = $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpplugin = 'select2';
|
$outdelayed = '';
|
||||||
$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
<script>
|
$tmpplugin = 'select2';
|
||||||
$(document).ready(function () {
|
$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||||
var data = '.json_encode($formattedarrayresult).';
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
var data = '.json_encode($formattedarrayresult).';
|
||||||
|
|
||||||
'.($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
|
'.($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
|
||||||
|
|
||||||
$(".'.$htmlname.'").select2({
|
$(".'.$htmlname.'").select2({
|
||||||
data: data,
|
data: data,
|
||||||
language: select2arrayoflanguage,
|
language: select2arrayoflanguage,
|
||||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||||
placeholder: "'.dol_escape_js($placeholder).'",
|
placeholder: "'.dol_escape_js($placeholder).'",
|
||||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||||
minimumInputLength: '.$minimumInputLength.',
|
minimumInputLength: '.$minimumInputLength.',
|
||||||
formatResult: function(result, container, query, escapeMarkup) {
|
formatResult: function(result, container, query, escapeMarkup) {
|
||||||
return escapeMarkup(result.text);
|
return escapeMarkup(result.text);
|
||||||
},
|
},
|
||||||
matcher: function (params, data) {
|
matcher: function (params, data) {
|
||||||
|
|
||||||
if(! data.id) return null;';
|
if(! data.id) return null;';
|
||||||
|
|
||||||
|
if ($callurlonselect) {
|
||||||
|
$outdelayed .= '
|
||||||
|
|
||||||
|
var urlBase = data.url;
|
||||||
|
var separ = urlBase.indexOf("?") >= 0 ? "&" : "?";
|
||||||
|
/* console.log("params.term="+params.term); */
|
||||||
|
/* console.log("params.term encoded="+encodeURIComponent(params.term)); */
|
||||||
|
saveRemoteData[data.id].url = urlBase + separ + "sall=" + encodeURIComponent(params.term.replace(/\"/g, ""));';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$disableFiltering) {
|
||||||
|
$outdelayed .= '
|
||||||
|
|
||||||
|
if(data.text.match(new RegExp(params.term))) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;';
|
||||||
|
} else {
|
||||||
|
$outdelayed .= '
|
||||||
|
|
||||||
|
return data;';
|
||||||
|
}
|
||||||
|
|
||||||
if ($callurlonselect) {
|
|
||||||
$outdelayed .= '
|
$outdelayed .= '
|
||||||
|
|
||||||
var urlBase = data.url;
|
|
||||||
var separ = urlBase.indexOf("?") >= 0 ? "&" : "?";
|
|
||||||
/* console.log("params.term="+params.term); */
|
|
||||||
/* console.log("params.term encoded="+encodeURIComponent(params.term)); */
|
|
||||||
saveRemoteData[data.id].url = urlBase + separ + "sall=" + encodeURIComponent(params.term.replace(/\"/g, ""));';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$disableFiltering) {
|
|
||||||
$outdelayed .= '
|
|
||||||
|
|
||||||
if(data.text.match(new RegExp(params.term))) {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;';
|
|
||||||
} else {
|
|
||||||
$outdelayed .= '
|
|
||||||
|
|
||||||
return data;';
|
|
||||||
}
|
|
||||||
|
|
||||||
$outdelayed .= '
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
'.($callurlonselect ? '
|
|
||||||
/* Code to execute a GET when we select a value */
|
|
||||||
$(".'.$htmlname.'").change(function() {
|
|
||||||
var selected = $(".'.$htmlname.'").val();
|
|
||||||
console.log("We select "+selected)
|
|
||||||
|
|
||||||
$(".'.$htmlname.'").val(""); /* reset visible combo value */
|
|
||||||
$.each( saveRemoteData, function( key, value ) {
|
|
||||||
if (key == selected)
|
|
||||||
{
|
|
||||||
console.log("selectArrayFilter - Do a redirect to "+value.url)
|
|
||||||
location.assign(value.url);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});' : '').'
|
|
||||||
|
|
||||||
});
|
'.($callurlonselect ? '
|
||||||
</script>';
|
/* Code to execute a GET when we select a value */
|
||||||
|
$(".'.$htmlname.'").change(function() {
|
||||||
|
var selected = $(".'.$htmlname.'").val();
|
||||||
|
console.log("We select "+selected)
|
||||||
|
|
||||||
|
$(".'.$htmlname.'").val(""); /* reset visible combo value */
|
||||||
|
$.each( saveRemoteData, function( key, value ) {
|
||||||
|
if (key == selected)
|
||||||
|
{
|
||||||
|
console.log("selectArrayFilter - Do a redirect to "+value.url)
|
||||||
|
location.assign(value.url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});' : '').'
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($acceptdelayedhtml) {
|
if ($acceptdelayedhtml) {
|
||||||
$delayedhtmlcontent .= $outdelayed;
|
$delayedhtmlcontent .= $outdelayed;
|
||||||
@ -7297,7 +7303,7 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add code for jquery to use multiselect
|
// Add code for jquery to use multiselect
|
||||||
if (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
|
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
|
||||||
$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
|
$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
|
||||||
$out .= "\n".'<script>'."\n";
|
$out .= "\n".'<script>'."\n";
|
||||||
if ($addjscombo == 1) {
|
if ($addjscombo == 1) {
|
||||||
|
|||||||
@ -258,7 +258,6 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add code to manage list depending on others
|
// Add code to manage list depending on others
|
||||||
// TODO Test/enhance this with a more generic solution
|
// TODO Test/enhance this with a more generic solution
|
||||||
if (!empty($conf->use_javascript_ajax)) {
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
|||||||
@ -1016,14 +1016,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
//WYSIWYG Editor
|
//WYSIWYG Editor
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
|
||||||
print '<script type="text/javascript">';
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
print '$(document).ready(function () {
|
print '<script type="text/javascript">';
|
||||||
|
print '$(document).ready(function () {
|
||||||
$("#selectcountry_id").change(function() {
|
$("#selectcountry_id").change(function() {
|
||||||
document.formprod.action.value="create";
|
document.formprod.action.value="create";
|
||||||
document.formprod.submit();
|
document.formprod.submit();
|
||||||
});
|
});
|
||||||
});';
|
});';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Load object modCodeProduct
|
// Load object modCodeProduct
|
||||||
$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard');
|
$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard');
|
||||||
@ -1551,14 +1553,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
//WYSIWYG Editor
|
//WYSIWYG Editor
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
|
||||||
print '<script type="text/javascript">';
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print '<script type="text/javascript">';
|
||||||
print '$(document).ready(function () {
|
print '$(document).ready(function () {
|
||||||
$("#selectcountry_id").change(function () {
|
$("#selectcountry_id").change(function () {
|
||||||
document.formprod.action.value="edit";
|
document.formprod.action.value="edit";
|
||||||
document.formprod.submit();
|
document.formprod.submit();
|
||||||
});
|
});
|
||||||
});';
|
});';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
// We set country_id, country_code and country for the selected country
|
// We set country_id, country_code and country for the selected country
|
||||||
$object->country_id = GETPOST('country_id') ? GETPOST('country_id') : $object->country_id;
|
$object->country_id = GETPOST('country_id') ? GETPOST('country_id') : $object->country_id;
|
||||||
@ -1646,46 +1650,48 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
$inherited_mask_sn = getDolGlobalString('SN_ADVANCED_MASK');
|
$inherited_mask_sn = getDolGlobalString('SN_ADVANCED_MASK');
|
||||||
print '<td id="field_mask">';
|
print '<td id="field_mask">';
|
||||||
print $form->textwithpicto('<input type="text" class="flat minwidth175" name="batch_mask" id="batch_mask_input" value="'.$mask.'">', $tooltip, 1, 1);
|
print $form->textwithpicto('<input type="text" class="flat minwidth175" name="batch_mask" id="batch_mask_input" value="'.$mask.'">', $tooltip, 1, 1);
|
||||||
|
// Add javascript to sho/hide field for custom mask
|
||||||
print '<script type="text/javascript">
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
$(document).ready(function() {
|
print '<script type="text/javascript">
|
||||||
$("#field_mask").parent().addClass("hideobject");
|
$(document).ready(function() {
|
||||||
var preselect = document.getElementById("status_batch");';
|
|
||||||
if (getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS')) {
|
|
||||||
print 'if (preselect.value == "2") {
|
|
||||||
$("#field_mask").parent().removeClass("hideobject");
|
|
||||||
}';
|
|
||||||
}
|
|
||||||
if (getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS')) {
|
|
||||||
print 'if (preselect.value == "1") {
|
|
||||||
$("#field_mask").parent().removeClass("hideobject");
|
|
||||||
}';
|
|
||||||
}
|
|
||||||
print '$("#status_batch").on("change", function () {
|
|
||||||
var optionSelected = $("option:selected", this);
|
|
||||||
var valueSelected = this.value;
|
|
||||||
$("#field_mask").parent().addClass("hideobject");
|
$("#field_mask").parent().addClass("hideobject");
|
||||||
';
|
var preselect = document.getElementById("status_batch");';
|
||||||
if (getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') {
|
if (getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS')) {
|
||||||
print '
|
print 'if (preselect.value == "2") {
|
||||||
if (this.value == 1) {
|
$("#field_mask").parent().removeClass("hideobject");
|
||||||
$("#field_mask").parent().removeClass("hideobject");
|
}';
|
||||||
$("#batch_mask_input").val("'.$inherited_mask_lot.'");
|
}
|
||||||
}
|
if (getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS')) {
|
||||||
|
print 'if (preselect.value == "1") {
|
||||||
|
$("#field_mask").parent().removeClass("hideobject");
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
print '$("#status_batch").on("change", function () {
|
||||||
|
var optionSelected = $("option:selected", this);
|
||||||
|
var valueSelected = this.value;
|
||||||
|
$("#field_mask").parent().addClass("hideobject");
|
||||||
';
|
';
|
||||||
}
|
if (getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') {
|
||||||
if (getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced') {
|
print '
|
||||||
|
if (this.value == 1) {
|
||||||
|
$("#field_mask").parent().removeClass("hideobject");
|
||||||
|
$("#batch_mask_input").val("'.$inherited_mask_lot.'");
|
||||||
|
}
|
||||||
|
';
|
||||||
|
}
|
||||||
|
if (getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced') {
|
||||||
|
print '
|
||||||
|
if (this.value == 2) {
|
||||||
|
$("#field_mask").parent().removeClass("hideobject");
|
||||||
|
$("#batch_mask_input").val("'.$inherited_mask_sn.'");
|
||||||
|
}
|
||||||
|
';
|
||||||
|
}
|
||||||
print '
|
print '
|
||||||
if (this.value == 2) {
|
})
|
||||||
$("#field_mask").parent().removeClass("hideobject");
|
|
||||||
$("#batch_mask_input").val("'.$inherited_mask_sn.'");
|
|
||||||
}
|
|
||||||
';
|
|
||||||
}
|
|
||||||
print '
|
|
||||||
})
|
})
|
||||||
})
|
</script>';
|
||||||
</script>';
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1859,7 +1859,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
$sub2 = 1;
|
$sub2 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax) {
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
print "\n".'<script type="text/javascript">';
|
print "\n".'<script type="text/javascript">';
|
||||||
print '$(document).ready(function () {
|
print '$(document).ready(function () {
|
||||||
var val='.$sub.';
|
var val='.$sub.';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user