50function ajax_autocompleter($selected, $htmlname, $url, $urloption =
'', $minLength = 2, $autoselect = 0, $ajaxoptions = array(), $moreparams =
'')
52 if (empty($minLength)) {
56 $dataforrenderITem =
'ui-autocomplete';
57 $dataforitem =
'ui-autocomplete-item';
59 if (defined(
'JS_QUERY_AUTOCOMPLETE_RENDERITEM')) {
60 $dataforrenderITem = constant(
'JS_QUERY_AUTOCOMPLETE_RENDERITEM');
62 if (defined(
'JS_QUERY_AUTOCOMPLETE_ITEM')) {
63 $dataforitem = constant(
'JS_QUERY_AUTOCOMPLETE_ITEM');
66 $htmlnamejquery = str_replace(
'.',
'\\\\.', $htmlname);
70 $script =
'<input type="hidden" name="'.$htmlname.
'" id="'.$htmlname.
'" value="'.$selected.
'" '.($moreparams ? $moreparams :
'').
' />';
72 $script .=
'<!-- Javascript code for autocomplete of field '.$htmlname.
' -->'.
"\n";
73 $script .=
'<script>'.
"\n";
74 $script .=
'$(document).ready(function() {
75 var autoselect = '.((int) $autoselect).
';
76 var options = '.json_encode($ajaxoptions).
'; /* Option of actions to do after keyup, or after select */
78 /* Remove selected id as soon as we type or delete a char (it means old selection is wrong). Use keyup/down instead of change to avoid losing the product id. This is needed only for select of predefined product */
79 $("input#search_'.$htmlnamejquery.
'").keydown(function(e) {
80 if (e.keyCode != 9) /* If not "Tab" key */
82 if (e.keyCode == 13) { return false; } /* disable "ENTER" key useful for barcode readers */
83 console.log("Clear id previously selected for field '.$htmlname.
'");
84 $("#'.$htmlnamejquery.
'").val("");
88 // Check options for secondary actions when keyup
89 $("input#search_'.$htmlnamejquery.
'").keyup(function() {
90 if ($(this).val().length == 0)
92 $("#search_'.$htmlnamejquery.
'").val("");
93 $("#'.$htmlnamejquery.
'").val("").trigger("change");
94 if (options.option_disabled) {
95 $("#" + options.option_disabled).removeAttr("disabled");
97 if (options.disabled) {
98 $.each(options.disabled, function(key, value) {
99 $("#" + value).removeAttr("disabled");
102 if (options.update) {
103 $.each(options.update, function(key, value) {
104 $("#" + key).val("").trigger("change");
108 $.each(options.show, function(key, value) {
109 $("#" + value).hide().trigger("hide");
112 if (options.update_textarea) {
113 $.each(options.update_textarea, function(key, value) {
114 if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") {
115 CKEDITOR.instances[key].setData("");
117 $("#" + key).html("");
124 // Activate the autocomplete to execute the GET
125 $("input#search_'.$htmlnamejquery.
'").autocomplete({
126 source: function( request, response ) {
127 $.get("'.$url.($urloption ?
'?'.$urloption :
'').
'", { "'.str_replace(
'.',
'_', $htmlname).
'": request.term }, function(data){
130 response($.map( data, function(item) {
131 console.log("Received answer from ajax GET, we populate array to return to the jquery autocomplete");
132 if (autoselect == 1 && data.length == 1) {
133 $("#search_'.$htmlnamejquery.
'").val(item.value);
137 // When product has only one price by qty and 1 result, must set data attributes before triggering change
138 $("#'.$htmlname.
'").attr("data-pbq", item.pbq);
139 $("#'.$htmlname.
'").attr("data-pbqup", item.price_ht);
140 $("#'.$htmlname.
'").attr("data-pbqbase", item.pricebasetype);
141 $("#'.$htmlname.
'").attr("data-pbqqty", item.qty);
142 $("#'.$htmlname.
'").attr("data-pbqpercent", item.discount);
146 $("#'.$htmlnamejquery.
'").val(item.key).trigger("change");
149 if (item.labelhtml != null) {
150 label = item.labelhtml.toString();
151 } else if (item.label != null) {
152 label = item.label.toString();
155 if (options.update) {
156 $.each(options.update, function(key, value) {
157 update[key] = item[value];
161 if (options.update_textarea) {
162 $.each(options.update_textarea, function(key, value) {
163 textarea[key] = item[value];
167 return { label: label,
170 disabled: item.disabled,
176 discount: item.discount,
177 pricebasetype: item.pricebasetype,
178 price_ht: item.price_ht,
179 price_ttc: item.price_ttc,
180 price_unit_ht: item.price_unit_ht,
181 price_unit_ht_locale: item.price_unit_ht_locale,
182 multicurrency_code: item.multicurrency_code,
183 multicurrency_unitprice: item.multicurrency_unitprice,
184 description : item.description,
185 ref_customer: item.ref_customer,
187 default_vat_code: item.default_vat_code,
188 supplier_ref: item.supplier_ref
192 console.error("Error: Ajax url '.$url.($urloption ?
'?'.$urloption :
'').
' has returned an empty page. Should be an empty json array.");
197 minLength: '.((
int) $minLength).
',
198 select: function( event, ui ) { // Function ran once a new value has been selected into the javascript combo
199 console.log("We will trigger change on input '.$htmlname.
' because of the select definition of autocomplete code for input#search_'.$htmlname.
'");
200 console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
202 console.log("Before, we propagate some properties, retrieved by the ajax of the get, into the data-xxx properties of the component #'.$htmlnamejquery.
'");
203 //console.log(ui.item);
205 // For supplier price and customer when price by quantity is off
206 $("#'.$htmlnamejquery.
'").attr("data-up", ui.item.price_ht);
207 $("#'.$htmlnamejquery.
'").attr("data-up-locale", ui.item.price_unit_ht_locale);
208 $("#'.$htmlnamejquery.
'").attr("data-base", ui.item.pricebasetype);
209 $("#'.$htmlnamejquery.
'").attr("data-qty", ui.item.qty);
210 $("#'.$htmlnamejquery.
'").attr("data-discount", ui.item.discount);
211 $("#'.$htmlnamejquery.
'").attr("data-description", ui.item.description);
212 $("#'.$htmlnamejquery.
'").attr("data-ref-customer", ui.item.ref_customer);
213 $("#'.$htmlnamejquery.
'").attr("data-tvatx", ui.item.tva_tx);
214 $("#'.$htmlnamejquery.
'").attr("data-default-vat-code", ui.item.default_vat_code);
215 $("#'.$htmlnamejquery.
'").attr("data-supplier-ref", ui.item.supplier_ref); // supplier_ref of price
217 // For multi-currency values
218 $("#'.$htmlnamejquery.
'").attr("data-multicurrency-code", ui.item.multicurrency_code);
219 $("#'.$htmlnamejquery.
'").attr("data-multicurrency-unitprice", ui.item.multicurrency_unitprice);
223 // For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on
224 console.log("PRODUIT_CUSTOMER_PRICES_BY_QTY is on, so we propagate also prices by quantity into data-pbqxxx properties");
225 $("#'.$htmlnamejquery.
'").attr("data-pbq", ui.item.pbq);
226 $("#'.$htmlnamejquery.
'").attr("data-pbqup", ui.item.price_ht);
227 $("#'.$htmlnamejquery.
'").attr("data-pbqbase", ui.item.pricebasetype);
228 $("#'.$htmlnamejquery.
'").attr("data-pbqqty", ui.item.qty);
229 $("#'.$htmlnamejquery.
'").attr("data-pbqpercent", ui.item.discount);
233 // A new value has been selected, we trigger the handlers on #htmlnamejquery
234 console.log("Now, we trigger changes on #'.$htmlnamejquery.
'");
235 $("#'.$htmlnamejquery.
'").val(ui.item.id).trigger("change"); // Select new value
237 // Complementary actions
239 // Disable an element
240 if (options.option_disabled) {
241 console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)
242 if (ui.item.disabled) {
243 $("#" + options.option_disabled).prop("disabled", true);
245 $.jnotify(options.error, "error", true); // Output with jnotify the error message
247 if (options.warning) {
248 $.jnotify(options.warning, "warning", false); // Output with jnotify the warning message
251 $("#" + options.option_disabled).removeAttr("disabled");
255 if (options.disabled) {
256 console.log("Make action \'disabled\' on each "+options.option_disabled)
257 $.each(options.disabled, function(key, value) {
258 $("#" + value).prop("disabled", true);
262 console.log("Make action \'show\' on each "+options.show)
263 $.each(options.show, function(key, value) {
264 $("#" + value).show().trigger("show");
269 if (ui.item.update) {
270 console.log("Make action \'update\' on each ui.item.update (if there is)")
271 // loop on each "update" fields
272 $.each(ui.item.update, function(key, value) {
273 console.log("Set value "+value+" into #"+key);
274 $("#" + key).val(value).trigger("change");
277 if (ui.item.textarea) {
278 console.log("Make action \'textarea\' on each ui.item.textarea (if there is)")
279 $.each(ui.item.textarea, function(key, value) {
280 if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") {
281 CKEDITOR.instances[key].setData(value);
282 CKEDITOR.instances[key].focus();
284 $("#" + key).html(value);
285 $("#" + key).focus();
289 console.log("ajax_autocompleter new value selected, we trigger change also on original component so on field #search_'.$htmlname.
'");
291 $("#search_'.$htmlnamejquery.
'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
295 const widgetData = $("input#search_'.$htmlnamejquery.
'").data("'.$dataforrenderITem.
'");
297 widgetData._renderItem = function( ul, item ) {
299 .data( "'.$dataforitem.
'", item ) // jQuery UI > 1.10.0
300 .append( \'<a><span class="tag">\' + item.label + "</span></a>" )
306 $script .=
'</script>';
476function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete =
'resolve', $idforemptyvalue =
'-1', $morecss =
'')
481 if (!empty(
$conf->browser->layout) &&
$conf->browser->layout ==
'phone' &&
getDolGlobalString(
'MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE')) {
488 if (empty(
$conf->use_javascript_ajax)) {
491 if (!
getDolGlobalString(
'MAIN_USE_JQUERY_MULTISELECT') && !defined(
'REQUIRE_JQUERY_MULTISELECT')) {
498 if (empty($minLengthToAutocomplete)) {
499 $minLengthToAutocomplete = 0;
502 $moreselect2theme = ($morecss ?
dol_escape_js(
' '.$morecss) :
'');
503 $moreselect2theme = preg_replace(
'/widthcentpercentminus[^\s]*/',
'', $moreselect2theme);
505 $tmpplugin =
'select2';
507 $msg .=
'<!-- JS CODE TO ENABLE '.$tmpplugin.
' for id = '.$htmlname.
' -->'.
"\n";
508 $msg .=
"<script>\n";
509 $msg .=
'$(document).ready(function () {
510 $(\''.(dol_escape_js(preg_match(
'/^\./', $htmlname) ? $htmlname :
'#'.$htmlname)).
'\').
'.$tmpplugin.'({
';
511 if (preg_match('/onrightofpage/
', $morecss)) { // when $morecss contains 'onrightofpage
', the select2 component must also be inside a parent with class="parentonrightofpage"
512 $msg .= ' dropdownAutoWidth:
true, dropdownParent: $(\
'#'.$htmlname.
'\').parent(),
'."\n";
516 width: \''.dol_escape_js($widthTypeOfAutocomplete).
'\',
517 minimumInputLength:
'.((int) $minLengthToAutocomplete).',
518 language: (typeof select2arrayoflanguage === \
'undefined\') ? \'en\' : select2arrayoflanguage,
519 matcher: function (params, data) {
520 if ($.trim(params.term) === "") { return data; }';
523 var term = params.term.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase()
524 var searchText = data.element ? $(data.element).attr("data-search") : undefined;
525 var text = (searchText !== undefined ? searchText : (data.text || "")).normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase() || "";';
528 var term = params.term.toLowerCase();
529 var searchText = data.element ? $(data.element).attr("data-search") : undefined;
530 var text = (searchText !== undefined ? searchText : (data.text || "")).toLowerCase();';
533 var keywords = term.split(" ");
534 for (var i = 0; i < keywords.length; i++) {
535 if (text.indexOf(keywords[i]) === -1) {
541 theme: \'default'.dol_escape_js($moreselect2theme).
'\',
542 containerCssClass: \
':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
543 selectionCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
544 dropdownCssClass: \'ui-dialog\',
545 templateResult: function (data, container) { /* Format visible output into combo list */
546 /* Code to add class of origin OPTION propagated to the new select2 <li> tag */
547 if (data.element) { $(container).addClass($(data.element).attr("class")); }
548 /* console.log("data html is "+$(data.element).attr("data-html")); */
549 if (data.id == \''.(dol_escape_js($idforemptyvalue)).
'\' && $(data.element).attr(
"data-html") == undefined) {
552 if ($(data.element).attr("data-html") != undefined) {
553 /* If property html set, we decode html entities and use this. */
554 /* Note that HTML content must have been sanitized against js injection with dol_escape_htmltag(xxx, 0, 0, \'\', 0, 1) when building the select option. */
555 if (typeof htmlEntityDecodeJs === "function") {
556 return htmlEntityDecodeJs($(data.element).attr("data-html"));
561 templateSelection: function (selection) { /* Format visible output of selected value */
562 if (selection.id == \''.(dol_escape_js($idforemptyvalue)).
'\')
return \
'<span class="placeholder">\'+selection.text+\'</span>\';
563 if (selection.element && $(selection.element).attr("data-select-html") != undefined) {
564 if (typeof htmlEntityDecodeJs === "function") {
565 return htmlEntityDecodeJs($(selection.element).attr("data-select-html"));
568 return selection.text;
570 escapeMarkup: function(markup) {
575 $msg .=
'.select2(\'focus\')';
580 $msg .=
"</script>\n";
682function ajax_constantonoff($code, $input = array(), $entity =
null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix =
'', $mode =
'', $morecss =
'inline-block', $userconst = 0, $showwarning =
'', $disabled = 0)
686 $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity :
$conf->entity);
687 if (!isset($input)) {
693 if (empty(
$conf->use_javascript_ajax) || $forcenoajax) {
695 $out =
'<a '.($morecss ?
'class="'.$morecss.
'" ' :
'').
'href="'.$_SERVER[
'PHP_SELF'].
'?action=set_'.$code.
'&token='.
newToken().
'&entity='.$entity.($mode ?
'&mode='.$mode :
'').($forcereload ?
'&dol_resetcache=1' :
'').
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
697 $out =
'<a '.($morecss ?
'class="'.$morecss.
'" ' :
'').
' href="'.$_SERVER[
'PHP_SELF'].
'?action=del_'.$code.
'&token='.
newToken().
'&entity='.$entity.($mode ?
'&mode='.$mode :
'').($forcereload ?
'&dol_resetcache=1' :
'').
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
701 if (is_object($userconst)) {
702 $userconstid = $userconst->id;
703 } elseif (is_numeric($userconst) && $userconst > 0) {
704 $userconstid = $userconst;
706 $userconst->fetch($userconstid);
710 $morecss .=
' disabled opacitymedium';
712 $out =
"\n<!-- Ajax code to switch constant ".$code.
" -->".
'
714 $(document).ready(function() {
715 var input = '.json_encode($input).
';
716 var url = \''.DOL_URL_ROOT.
'/core/ajax/constantonoff.php\';
718 var entity = \
''.dol_escape_js((
string) $entity).
'\';
719 var strict = \
''.dol_escape_js((
string) $strict).
'\';
720 var userid = \
''.dol_escape_js((
string) $user->id).
'\';
721 var userconst =
'.((int) $userconstid).';
722 var yesButton = \
''.dol_escape_js($langs->transnoentities(
"Yes")).
'\';
723 var noButton = \
''.dol_escape_js($langs->transnoentities(
"No")).
'\';
724 var token = \
''.currentToken().
'\';
725 var warning = \
''.dol_escape_js($showwarning).
'\';
728 $(
"#set_" + code).click(
function() {
733 if (input.alert && input.alert.set) {
734 if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
735 if (input.alert.set.noButton) noButton = input.alert.set.noButton;
736 confirmConstantAction(
"set", url, code, input, input.alert.set, entity, yesButton, noButton, strict, userid, token);
738 setConstant(url, code, input, entity, 0,
'.((int) $forcereload).', userid, token, 1, userconst);
743 $(
"#del_" + code).click(
function() {
744 if (input.alert && input.alert.del) {
745 if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
746 if (input.alert.del.noButton) noButton = input.alert.del.noButton;
747 confirmConstantAction(
"del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid, token);
749 if (empty($setzeroinsteadofdel)) {
750 $out .= ' delConstant(url, code, input, entity, 0,
'.((int) $forcereload).', userid, token, userconst);
';
752 $out .= ' setConstant(url, code, input, entity, 0,
'.((int) $forcereload).', userid, token, 0, userconst);
';
760 if (!empty($userconst) && $userconst instanceof User) {
761 $value = getDolUserString($code, '', $userconst);
763 $value = getDolGlobalString($code);
766 if (is_array($suffix)) {
767 $suffixon = $suffix['ifon
'];
768 $suffixoff = $suffix['ifoff
'];
769 } else { // old mode deprecated
770 $suffixon = (string) $suffix;
774 $out .= '<div
id=
"confirm_'.$code.'" title=
"" style=
"display: none;"></div>
';
775 $out .= '<span
id=
"set_'.$code.'" class=
"valignmiddle inline-block linkobject '.($value ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'">
'.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on
'.$suffixoff, '', 0, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off
'.$suffixoff, '', 0, 0, 0, '', '', $marginleftonlyshort)).'</span>
';
776 $out .= '<span
id=
"del_'.$code.'" class=
"valignmiddle inline-block linkobject '.($value ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'">
'.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off
'.$suffixon, '', 0, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on
'.$suffixon, '', 0, 0, 0, '', '', $marginleftonlyshort)).'</span>
';
801function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '
', $htmlname = '', $forcenojs = 0, $moreparam = '', $readonly = 0)
803 global $conf, $langs;
805 if (empty($htmlname)) {
811 if (!empty($conf->use_javascript_ajax) && empty($forcenojs) && empty($readonly)) {
814 var input =
'.json_encode($input).';
817 $(
"#set_'.$htmlname.'_'.$object->id.'").click(
function() {
818 console.log(
"Click managed by ajax_object_onoff");
819 $.get(
"'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
821 field: \''.dol_escape_js($field).
'\',
824 id: \
''.((int)
$object->id).
'\',
825 token: \
''.currentToken().
'\'
829 var data = JSON.parse(response);
832 console.log(response);
835 $(
"#set_'.$htmlname.'_'.$object->id.'").hide();
836 $(
"#del_'.$htmlname.'_'.$object->id.'").show();
838 if (input.disabled && input.disabled.length > 0) {
839 $.each(input.disabled,
function(key,value) {
840 $(
"#" + value).removeAttr(
"disabled");
841 if ($(
"#" + value).hasClass(
"butActionRefused") == true) {
842 $(
"#" + value).removeClass(
"butActionRefused");
843 $(
"#" + value).addClass(
"butAction");
847 }
else if (input.showhide && input.showhide.length > 0) {
848 $.each(input.showhide,
function(key,value) {
849 $(
"#" + value).show();
855 console.warn(response.responseText);
856 Dolibarr.tools.setEventMessage(response.responseText,
"errors");
862 $(
"#del_'.$htmlname.'_'.$object->id.'").click(
function() {
863 console.log(
"Click managed by ajax_object_onoff");
864 $.get(
"'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
866 field: \''.dol_escape_js($field).
'\',
869 id: \''.((int)
$object->id).
'\',
874 var data = JSON.parse(response);
877 console.log(response);
880 $("#del_'.$htmlname.
'_'.
$object->id.
'").hide();
881 $("#set_'.$htmlname.
'_'.
$object->id.
'").show();
882 // Disable another element
883 if (input.disabled && input.disabled.length > 0) {
884 $.each(input.disabled, function(key,value) {
885 $("#" + value).prop("disabled", true);
886 if ($("#" + value).hasClass("butAction") == true) {
887 $("#" + value).removeClass("butAction");
888 $("#" + value).addClass("butActionRefused");
891 // Hide another element
892 } else if (input.showhide && input.showhide.length > 0) {
893 $.each(input.showhide, function(key,value) {
894 $("#" + value).hide();
899 //alert(response.responseText);
900 console.warn(response.responseText);
901 Dolibarr.tools.setEventMessage(response.responseText, "errors");
909 $switchon =
'switch_on';
910 $switchoff =
'switch_off';
913 $tmparray = explode(
':', $text_on);
914 if (!empty($tmparray[1])) {
915 $text_on = $tmparray[0];
916 $switchon = $tmparray[1];
917 if (!empty($tmparray[2])) {
918 $cssswitchon = $tmparray[2];
921 $tmparray = explode(
':', $text_off);
922 if (!empty($tmparray[1])) {
923 $text_off = $tmparray[0];
924 $switchoff = $tmparray[1];
925 if (!empty($tmparray[2])) {
926 $cssswitchoff = $tmparray[2];
930 if (empty(
$conf->use_javascript_ajax) || $forcenojs) {
931 $url = DOL_URL_ROOT.
'/core/ajax/objectonoff.php?action=set&token='.
newToken().
'&id='.((int)
$object->id).
'&element='.urlencode(
$object->element).
'&field='.urlencode($field).
'&value=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.($moreparam ?
'&'.$moreparam :
''));
935 $out .=
'<a id="set_'.$htmlname.
'_'.
$object->id.
'" class="linkobject '.(
$object->$code == 1 ?
'hideobject' :
'').($morecss ?
' '.$morecss :
'').
'" href="'.$url.
'">'.
img_picto($langs->trans($text_off), $switchoff,
'', 0, 0, 0,
'', $cssswitchoff).
'</a>';
936 $url = DOL_URL_ROOT.
'/core/ajax/objectonoff.php?action=set&token='.
newToken().
'&id='.((int)
$object->id).
'&element='.urlencode(
$object->element).
'&field='.urlencode($field).
'&value=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.($moreparam ?
'&'.$moreparam :
''));
940 $out .=
'<a id="del_'.$htmlname.
'_'.
$object->id.
'" class="linkobject '.(
$object->$code == 1 ?
'' :
'hideobject').($morecss ?
' '.$morecss :
'').
'" href="'.$url.
'">'.
img_picto($langs->trans($text_on), $switchon,
'', 0, 0, 0,
'', $cssswitchon).
'</a>';
942 $out .=
'<span id="set_'.$htmlname.
'_'.
$object->id.
'" class="linkobject '.(
$object->$code == 1 ?
'hideobject' :
'').($morecss ?
' '.$morecss :
'').
'">'.
img_picto($langs->trans($text_off), $switchoff,
'', 0, 0, 0,
'', $cssswitchoff).
'</span>';
943 $out .=
'<span id="del_'.$htmlname.
'_'.
$object->id.
'" class="linkobject '.(
$object->$code == 1 ?
'' :
'hideobject').($morecss ?
' '.$morecss :
'').
'">'.
img_picto($langs->trans($text_on), $switchon,
'', 0, 0, 0,
'', $cssswitchon).
'</span>';
ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array(), $moreparams='')
Generic function that return javascript to add to transform a common input text or select field into ...
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLength=2, $autoselect=0)
Generic function that return javascript to add to a page to transform a common input text field into ...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)