Debug v14 with nojs
This commit is contained in:
parent
2091120d77
commit
e7b3280c17
@ -99,14 +99,16 @@ print "<br>\n";
|
||||
/**
|
||||
* Edit parameters
|
||||
*/
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print '$(document).ready(function () {
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#selectcountry_id").change(function() {
|
||||
document.form_index.action.value="updateedit";
|
||||
document.form_index.submit();
|
||||
});
|
||||
});';
|
||||
print '</script>'."\n";
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
@ -384,14 +384,16 @@ print "<br>\n";
|
||||
/**
|
||||
* Edit parameters
|
||||
*/
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print '$(document).ready(function () {
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#selectcountry_id").change(function() {
|
||||
document.form_index.action.value="updateedit";
|
||||
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 '<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));
|
||||
$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";
|
||||
$out .= '<script type="text/javascript">'."\n";
|
||||
$out .= 'jQuery(document).ready(function(){'."\n";
|
||||
if ($collapse_display === false) {
|
||||
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-plus-square\"></span> ");'."\n";
|
||||
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n";
|
||||
} else {
|
||||
$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";
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
$out .= '<!-- Add js script to manage the collapse/uncollapse of extrafields separators '.$key.' -->'."\n";
|
||||
$out .= '<script type="text/javascript">'."\n";
|
||||
$out .= 'jQuery(document).ready(function(){'."\n";
|
||||
if ($collapse_display === false) {
|
||||
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-plus-square\"></span> ");'."\n";
|
||||
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n";
|
||||
} else {
|
||||
$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)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $delayedhtmlcontent;
|
||||
global $delayedhtmlcontent; // Will be used later outside of this function
|
||||
|
||||
// TODO Use an internal dolibarr component instead of select2
|
||||
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>';
|
||||
|
||||
$tmpplugin = 'select2';
|
||||
$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$outdelayed = '';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
$tmpplugin = 'select2';
|
||||
$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
'.($callurlonselect ? 'var saveRemoteData = [];' : '').'
|
||||
'.($callurlonselect ? 'var saveRemoteData = [];' : '').'
|
||||
|
||||
$(".'.$htmlname.'").select2({
|
||||
ajax: {
|
||||
dir: "ltr",
|
||||
url: "'.$url.'",
|
||||
dataType: \'json\',
|
||||
delay: 250,
|
||||
data: function (params) {
|
||||
return {
|
||||
q: params.term, // search term
|
||||
page: params.page
|
||||
};
|
||||
},
|
||||
processResults: function (data) {
|
||||
// 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
|
||||
//console.log(data);
|
||||
saveRemoteData = data;
|
||||
/* format json result for select2 */
|
||||
result = []
|
||||
$.each( data, function( key, value ) {
|
||||
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}
|
||||
//console.log(result);
|
||||
return {results: result, more: false}
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
language: select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
placeholder: "'.dol_escape_js($placeholder).'",
|
||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||
minimumInputLength: '.$minimumInputLength.',
|
||||
formatResult: function(result, container, query, escapeMarkup) {
|
||||
return escapeMarkup(result.text);
|
||||
},
|
||||
});
|
||||
$(".'.$htmlname.'").select2({
|
||||
ajax: {
|
||||
dir: "ltr",
|
||||
url: "'.$url.'",
|
||||
dataType: \'json\',
|
||||
delay: 250,
|
||||
data: function (params) {
|
||||
return {
|
||||
q: params.term, // search term
|
||||
page: params.page
|
||||
};
|
||||
},
|
||||
processResults: function (data) {
|
||||
// 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
|
||||
//console.log(data);
|
||||
saveRemoteData = data;
|
||||
/* format json result for select2 */
|
||||
result = []
|
||||
$.each( data, function( key, value ) {
|
||||
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}
|
||||
//console.log(result);
|
||||
return {results: result, more: false}
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
language: select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
placeholder: "'.dol_escape_js($placeholder).'",
|
||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||
minimumInputLength: '.$minimumInputLength.',
|
||||
formatResult: function(result, container, query, escapeMarkup) {
|
||||
return escapeMarkup(result.text);
|
||||
},
|
||||
});
|
||||
|
||||
'.($callurlonselect ? '
|
||||
/* Code to execute a GET when we select a value */
|
||||
$(".'.$htmlname.'").change(function() {
|
||||
var selected = $(".'.$htmlname.'").val();
|
||||
console.log("We select in selectArrayAjax the entry "+selected)
|
||||
$(".'.$htmlname.'").val(""); /* reset visible combo value */
|
||||
$.each( saveRemoteData, function( key, value ) {
|
||||
if (key == selected)
|
||||
{
|
||||
console.log("selectArrayAjax - Do a redirect to "+value.url)
|
||||
location.assign(value.url);
|
||||
}
|
||||
});
|
||||
});' : '').'
|
||||
'.($callurlonselect ? '
|
||||
/* Code to execute a GET when we select a value */
|
||||
$(".'.$htmlname.'").change(function() {
|
||||
var selected = $(".'.$htmlname.'").val();
|
||||
console.log("We select in selectArrayAjax the entry "+selected)
|
||||
$(".'.$htmlname.'").val(""); /* reset visible combo value */
|
||||
$.each( saveRemoteData, function( key, value ) {
|
||||
if (key == selected)
|
||||
{
|
||||
console.log("selectArrayAjax - Do a redirect to "+value.url)
|
||||
location.assign(value.url);
|
||||
}
|
||||
});
|
||||
});' : '').'
|
||||
|
||||
});
|
||||
</script>';
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
if ($acceptdelayedhtml) {
|
||||
$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)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $delayedhtmlcontent;
|
||||
global $delayedhtmlcontent; // Will be used later outside of this function
|
||||
|
||||
// TODO Use an internal dolibarr component instead of select2
|
||||
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
|
||||
@ -7187,74 +7190,77 @@ class Form
|
||||
$formattedarrayresult[] = $o;
|
||||
}
|
||||
|
||||
$tmpplugin = 'select2';
|
||||
$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var data = '.json_encode($formattedarrayresult).';
|
||||
$outdelayed = '';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
$tmpplugin = 'select2';
|
||||
$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var data = '.json_encode($formattedarrayresult).';
|
||||
|
||||
'.($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
|
||||
'.($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
|
||||
|
||||
$(".'.$htmlname.'").select2({
|
||||
data: data,
|
||||
language: select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
placeholder: "'.dol_escape_js($placeholder).'",
|
||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||
minimumInputLength: '.$minimumInputLength.',
|
||||
formatResult: function(result, container, query, escapeMarkup) {
|
||||
return escapeMarkup(result.text);
|
||||
},
|
||||
matcher: function (params, data) {
|
||||
$(".'.$htmlname.'").select2({
|
||||
data: data,
|
||||
language: select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
placeholder: "'.dol_escape_js($placeholder).'",
|
||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||
minimumInputLength: '.$minimumInputLength.',
|
||||
formatResult: function(result, container, query, escapeMarkup) {
|
||||
return escapeMarkup(result.text);
|
||||
},
|
||||
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 .= '
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
});' : '').'
|
||||
|
||||
});
|
||||
</script>';
|
||||
'.($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);
|
||||
}
|
||||
});
|
||||
});' : '').'
|
||||
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
if ($acceptdelayedhtml) {
|
||||
$delayedhtmlcontent .= $outdelayed;
|
||||
@ -7297,7 +7303,7 @@ class Form
|
||||
}
|
||||
|
||||
// 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".'<script>'."\n";
|
||||
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
|
||||
// TODO Test/enhance this with a more generic solution
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
|
||||
@ -1016,14 +1016,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
print '<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#selectcountry_id").change(function() {
|
||||
document.formprod.action.value="create";
|
||||
document.formprod.submit();
|
||||
});
|
||||
});';
|
||||
print '</script>'."\n";
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
// Load object modCodeProduct
|
||||
$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
|
||||
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 () {
|
||||
$("#selectcountry_id").change(function () {
|
||||
document.formprod.action.value="edit";
|
||||
document.formprod.submit();
|
||||
});
|
||||
});';
|
||||
});';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
// We set country_id, country_code and country for the selected country
|
||||
$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');
|
||||
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 '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#field_mask").parent().addClass("hideobject");
|
||||
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;
|
||||
// Add javascript to sho/hide field for custom mask
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#field_mask").parent().addClass("hideobject");
|
||||
';
|
||||
if (getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') {
|
||||
print '
|
||||
if (this.value == 1) {
|
||||
$("#field_mask").parent().removeClass("hideobject");
|
||||
$("#batch_mask_input").val("'.$inherited_mask_lot.'");
|
||||
}
|
||||
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");
|
||||
';
|
||||
}
|
||||
if (getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced') {
|
||||
if (getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_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 '
|
||||
if (this.value == 2) {
|
||||
$("#field_mask").parent().removeClass("hideobject");
|
||||
$("#batch_mask_input").val("'.$inherited_mask_sn.'");
|
||||
}
|
||||
';
|
||||
}
|
||||
print '
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>';
|
||||
</script>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1859,7 +1859,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$sub2 = 1;
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
var val='.$sub.';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user