dolibarr  13.0.2
ajax.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2007-2015 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  * or see https://www.gnu.org/
19  */
20 
47 function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array(), $moreparams = '')
48 {
49  if (empty($minLength)) $minLength = 1;
50 
51  $dataforrenderITem = 'ui-autocomplete';
52  $dataforitem = 'ui-autocomplete-item';
53  // Allow two constant to use other values for backward compatibility
54  if (defined('JS_QUERY_AUTOCOMPLETE_RENDERITEM')) $dataforrenderITem = constant('JS_QUERY_AUTOCOMPLETE_RENDERITEM');
55  if (defined('JS_QUERY_AUTOCOMPLETE_ITEM')) $dataforitem = constant('JS_QUERY_AUTOCOMPLETE_ITEM');
56 
57  // Input search_htmlname is original field
58  // Input htmlname is a second input field used when using ajax autocomplete.
59  $script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" '.($moreparams ? $moreparams : '').' />';
60 
61  $script .= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
62  $script .= '<script>'."\n";
63  $script .= '$(document).ready(function() {
64  var autoselect = '.$autoselect.';
65  var options = '.json_encode($ajaxoptions).'; /* Option of actions to do after keyup, or after select */
66 
67  /* 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 loosing the product id. This is needed only for select of predefined product */
68  $("input#search_'.$htmlname.'").keydown(function(e) {
69  if (e.keyCode != 9) /* If not "Tab" key */
70  {
71  if (e.keyCode == 13) { return false; } /* disable "ENTER" key useful for barcode readers */
72  console.log("Clear id previously selected for field '.$htmlname.'");
73  $("#'.$htmlname.'").val("");
74  }
75  });
76 
77  // Check options for secondary actions when keyup
78  $("input#search_'.$htmlname.'").keyup(function() {
79  if ($(this).val().length == 0)
80  {
81  $("#search_'.$htmlname.'").val("");
82  $("#'.$htmlname.'").val("").trigger("change");
83  if (options.option_disabled) {
84  $("#" + options.option_disabled).removeAttr("disabled");
85  }
86  if (options.disabled) {
87  $.each(options.disabled, function(key, value) {
88  $("#" + value).removeAttr("disabled");
89  });
90  }
91  if (options.update) {
92  $.each(options.update, function(key, value) {
93  $("#" + key).val("").trigger("change");
94  });
95  }
96  if (options.show) {
97  $.each(options.show, function(key, value) {
98  $("#" + value).hide().trigger("hide");
99  });
100  }
101  if (options.update_textarea) {
102  $.each(options.update_textarea, function(key, value) {
103  if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") {
104  CKEDITOR.instances[key].setData("");
105  } else {
106  $("#" + key).html("");
107  }
108  });
109  }
110  }
111  });
112 
113  $("input#search_'.$htmlname.'").autocomplete({
114  source: function( request, response ) {
115  $.get("'.$url.($urloption ? '?'.$urloption : '').'", { '.$htmlname.': request.term }, function(data){
116  if (data != null)
117  {
118  response($.map( data, function(item) {
119  if (autoselect == 1 && data.length == 1) {
120  $("#search_'.$htmlname.'").val(item.value);
121  $("#'.$htmlname.'").val(item.key).trigger("change");
122  }
123  var label = item.label.toString();
124  var update = {};
125  if (options.update) {
126  $.each(options.update, function(key, value) {
127  update[key] = item[value];
128  });
129  }
130  var textarea = {};
131  if (options.update_textarea) {
132  $.each(options.update_textarea, function(key, value) {
133  textarea[key] = item[value];
134  });
135  }
136  return { label: label, value: item.value, id: item.key, disabled: item.disabled,
137  update: update, textarea: textarea,
138  pbq: item.pbq, type: item.type, qty: item.qty, discount: item.discount, pricebasetype: item.pricebasetype, price_ht: item.price_ht, price_ttc: item.price_ttc }
139  }));
140  }
141  else console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array.");
142  }, "json");
143  },
144  dataType: "json",
145  minLength: '.$minLength.',
146  select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
147  console.log("We will trigger change on input '.$htmlname.' because of the select definition of autocomplete code for input#search_'.$htmlname.'");
148  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");
149 
150  console.log("Propagate before some properties retrieved into data-xxx properties");
151  $("#'.$htmlname.'").attr("data-pbq", ui.item.pbq);
152  $("#'.$htmlname.'").attr("data-pbqup", ui.item.price_ht);
153  $("#'.$htmlname.'").attr("data-pbqbase", ui.item.pricebasetype);
154  $("#'.$htmlname.'").attr("data-pbqqty", ui.item.qty);
155  $("#'.$htmlname.'").attr("data-pbqpercent", ui.item.discount);
156 
157  $("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
158 
159  // Disable an element
160  if (options.option_disabled) {
161  console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)
162  if (ui.item.disabled) {
163  $("#" + options.option_disabled).prop("disabled", true);
164  if (options.error) {
165  $.jnotify(options.error, "error", true); // Output with jnotify the error message
166  }
167  if (options.warning) {
168  $.jnotify(options.warning, "warning", false); // Output with jnotify the warning message
169  }
170  } else {
171  $("#" + options.option_disabled).removeAttr("disabled");
172  }
173  }
174 
175  if (options.disabled) {
176  console.log("Make action disabled on each "+options.option_disabled)
177  $.each(options.disabled, function(key, value) {
178  $("#" + value).prop("disabled", true);
179  });
180  }
181  if (options.show) {
182  console.log("Make action show on each "+options.show)
183  $.each(options.show, function(key, value) {
184  $("#" + value).show().trigger("show");
185  });
186  }
187 
188  // Update an input
189  if (ui.item.update) {
190  console.log("Make action update on each ui.item.update")
191  // loop on each "update" fields
192  $.each(ui.item.update, function(key, value) {
193  console.log("Set value "+value+" into #"+key);
194  $("#" + key).val(value).trigger("change");
195  });
196  }
197  if (ui.item.textarea) {
198  console.log("Make action textarea on each ui.item.textarea")
199  $.each(ui.item.textarea, function(key, value) {
200  if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") {
201  CKEDITOR.instances[key].setData(value);
202  CKEDITOR.instances[key].focus();
203  } else {
204  $("#" + key).html(value);
205  $("#" + key).focus();
206  }
207  });
208  }
209  console.log("ajax_autocompleter new value selected, we trigger change also on original component so on field #search_'.$htmlname.'");
210 
211  $("#search_'.$htmlname.'").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.
212  }
213  ,delay: 500
214  }).data("'.$dataforrenderITem.'")._renderItem = function( ul, item ) {
215  return $("<li>")
216  .data( "'.$dataforitem.'", item ) // jQuery UI > 1.10.0
217  .append( \'<a><span class="tag">\' + item.label + "</span></a>" )
218  .appendTo(ul);
219  };
220 
221  });';
222  $script .= '</script>';
223 
224  return $script;
225 }
226 
241 function ajax_multiautocompleter($htmlname, $fields, $url, $option = '', $minLength = 2, $autoselect = 0)
242 {
243  $script = '<!-- Autocomplete -->'."\n";
244  $script .= '<script>';
245  $script .= 'jQuery(document).ready(function() {
246  var fields = '.json_encode($fields).';
247  var nboffields = fields.length;
248  var autoselect = '.$autoselect.';
249  //alert(fields + " " + nboffields);
250 
251  jQuery("input#'.$htmlname.'").autocomplete({
252  dataType: "json",
253  minLength: '.$minLength.',
254  source: function( request, response ) {
255  jQuery.getJSON( "'.$url.($option ? '?'.$option : '').'", { '.$htmlname.': request.term }, function(data){
256  response( jQuery.map( data, function( item ) {
257  if (autoselect == 1 && data.length == 1) {
258  jQuery("#'.$htmlname.'").val(item.value);
259  // TODO move this to specific request
260  if (item.states) {
261  jQuery("#state_id").html(item.states);
262  }
263  for (i=0;i<nboffields;i++) {
264  if (item[fields[i]]) { // If defined
265  //alert(item[fields[i]]);
266  jQuery("#" + fields[i]).val(item[fields[i]]);
267  }
268  }
269  }
270  return item
271  }));
272  });
273  },
274  select: function( event, ui ) {
275  needtotrigger = "";
276  for (i=0;i<nboffields;i++) {
277  //alert(fields[i] + " = " + ui.item[fields[i]]);
278  if (fields[i]=="selectcountry_id")
279  {
280  if (ui.item[fields[i]] > 0) // Do not erase country if unknown
281  {
282  oldvalue=jQuery("#" + fields[i]).val();
283  newvalue=ui.item[fields[i]];
284  //alert(oldvalue+" "+newvalue);
285  jQuery("#" + fields[i]).val(ui.item[fields[i]]);
286  if (oldvalue != newvalue) // To force select2 to refresh visible content
287  {
288  needtotrigger="#" + fields[i];
289  }
290 
291  // If we set new country and new state, we need to set a new list of state to allow change
292  if (ui.item.states && ui.item["state_id"] != jQuery("#state_id").value) {
293  jQuery("#state_id").html(ui.item.states);
294  }
295  }
296  }
297  else if (fields[i]=="state_id" || fields[i]=="state_id")
298  {
299  if (ui.item[fields[i]] > 0) // Do not erase state if unknown
300  {
301  oldvalue=jQuery("#" + fields[i]).val();
302  newvalue=ui.item[fields[i]];
303  //alert(oldvalue+" "+newvalue);
304  jQuery("#" + fields[i]).val(ui.item[fields[i]]); // This may fails if not correct country
305  if (oldvalue != newvalue) // To force select2 to refresh visible content
306  {
307  needtotrigger="#" + fields[i];
308  }
309  }
310  }
311  else if (ui.item[fields[i]]) { // If defined
312  oldvalue=jQuery("#" + fields[i]).val();
313  newvalue=ui.item[fields[i]];
314  //alert(oldvalue+" "+newvalue);
315  jQuery("#" + fields[i]).val(ui.item[fields[i]]);
316  if (oldvalue != newvalue) // To force select2 to refresh visible content
317  {
318  needtotrigger="#" + fields[i];
319  }
320  }
321 
322  if (needtotrigger != "") // To force select2 to refresh visible content
323  {
324  // We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done
325  // This is required for example when changing zip with autocomplete that change the country
326  jQuery(needtotrigger).delay(500).queue(function() {
327  jQuery(this).trigger("change");
328  });
329  }
330  }
331  }
332  });
333  });';
334  $script .= '</script>';
335 
336  return $script;
337 }
338 
348 function ajax_dialog($title, $message, $w = 350, $h = 150)
349 {
350  global $langs;
351 
352  $newtitle = dol_textishtml($title) ?dol_string_nohtmltag($title, 1) : $title;
353  $msg = '<div id="dialog-info" title="'.dol_escape_htmltag($newtitle).'">';
354  $msg .= $message;
355  $msg .= '</div>'."\n";
356  $msg .= '<script>
357  jQuery(function() {
358  jQuery("#dialog-info").dialog({
359  resizable: false,
360  height:'.$h.',
361  width:'.$w.',
362  modal: true,
363  buttons: {
364  Ok: function() {
365  jQuery(this).dialog(\'close\');
366  }
367  }
368  });
369  });
370  </script>';
371 
372  $msg .= "\n";
373 
374  return $msg;
375 }
376 
377 
391 function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete = 'resolve')
392 {
393  global $conf;
394 
395  // select2 can be disabled for smartphones
396  if (!empty($conf->browser->layout) && $conf->browser->layout == 'phone' && !empty($conf->global->MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE)) return '';
397 
398  if (!empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
399  if (empty($conf->use_javascript_ajax)) return '';
400  if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) return '';
401  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return '';
402 
403  if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete = 0;
404 
405  $tmpplugin = 'select2';
406  $msg = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
407  <script>
408  $(document).ready(function () {
409  $(\''.(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname).'\').'.$tmpplugin.'({
410  dir: \'ltr\',
411  width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
412  minimumInputLength: '.$minLengthToAutocomplete.',
413  language: select2arrayoflanguage,
414  containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
415  templateResult: function (data, container) { /* Format visible output into combo list */
416  /* Code to add class of origin OPTION propagated to the new select2 <li> tag */
417  if (data.element) { $(container).addClass($(data.element).attr("class")); }
418  //console.log(data.html);
419  if ($(data.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(data.element).attr("data-html")); // If property html set, we decode html entities and use this
420  return data.text;
421  },
422  templateSelection: function (selection) { /* Format visible output of selected value */
423  return selection.text;
424  },
425  escapeMarkup: function(markup) {
426  return markup;
427  },
428  dropdownCssClass: \'ui-dialog\'
429  })';
430  if ($forcefocus) $msg .= '.select2(\'focus\')';
431  $msg .= ';'."\n";
432 
433  if (is_array($events) && count($events)) // If an array of js events to do were provided.
434  {
435  $msg .= '
436  jQuery("#'.$htmlname.'").change(function () {
437  var obj = '.json_encode($events).';
438  $.each(obj, function(key,values) {
439  if (values.method.length) {
440  runJsCodeForEvent'.$htmlname.'(values);
441  }
442  });
443  });
444 
445  function runJsCodeForEvent'.$htmlname.'(obj) {
446  var id = $("#'.$htmlname.'").val();
447  var method = obj.method;
448  var url = obj.url;
449  var htmlname = obj.htmlname;
450  var showempty = obj.showempty;
451  console.log("Run runJsCodeForEvent-'.$htmlname.' from ajax_combobox id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
452  $.getJSON(url,
453  {
454  action: method,
455  id: id,
456  htmlname: htmlname,
457  showempty: showempty
458  },
459  function(response) {
460  $.each(obj.params, function(key,action) {
461  if (key.length) {
462  var num = response.num;
463  if (num > 0) {
464  $("#" + key).removeAttr(action);
465  } else {
466  $("#" + key).attr(action, action);
467  }
468  }
469  });
470  $("select#" + htmlname).html(response.value);
471  if (response.num) {
472  var selecthtml_str = response.value;
473  var selecthtml_dom=$.parseHTML(selecthtml_str);
474  $("#inputautocomplete"+htmlname).val(selecthtml_dom[0][0].innerHTML);
475  } else {
476  $("#inputautocomplete"+htmlname).val("");
477  }
478  $("select#" + htmlname).change(); /* Trigger event change */
479  }
480  );
481  }';
482  }
483 
484  $msg .= '});'."\n";
485  $msg .= "</script>\n";
486 
487  return $msg;
488 }
489 
503 function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0)
504 {
505  global $conf, $langs, $user;
506 
507  $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
508  if (!isset($input)) $input = array();
509 
510  if (empty($conf->use_javascript_ajax) || $forcenoajax)
511  {
512  if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&token='.newToken().'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
513  else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&token='.newToken().'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
514  } else {
515  $out = "\n<!-- Ajax code to switch constant ".$code." -->".'
516  <script>
517  $(document).ready(function() {
518  var input = '.json_encode($input).';
519  var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
520  var code = \''.$code.'\';
521  var entity = \''.$entity.'\';
522  var strict = \''.$strict.'\';
523  var userid = \''.$user->id.'\';
524  var yesButton = \''.dol_escape_js($langs->transnoentities("Yes")).'\';
525  var noButton = \''.dol_escape_js($langs->transnoentities("No")).'\';
526  var token = \''.currentToken().'\';
527 
528  // Set constant
529  $("#set_" + code).click(function() {
530  if (input.alert && input.alert.set) {
531  if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
532  if (input.alert.set.noButton) noButton = input.alert.set.noButton;
533  confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict, userid, token);
534  } else {
535  setConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);
536  }
537  });
538 
539  // Del constant
540  $("#del_" + code).click(function() {
541  if (input.alert && input.alert.del) {
542  if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
543  if (input.alert.del.noButton) noButton = input.alert.del.noButton;
544  confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid, token);
545  } else {
546  delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);
547  }
548  });
549  });
550  </script>'."\n";
551 
552  $out .= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
553  $out .= '<span id="set_'.$code.'" class="valignmiddle linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
554  $out .= '<span id="del_'.$code.'" class="valignmiddle linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
555  $out .= "\n";
556  }
557 
558  return $out;
559 }
560 
573 function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array())
574 {
575  global $langs;
576 
577  $out = '<script>
578  $(function() {
579  var input = '.json_encode($input).';
580 
581  // Set constant
582  $("#set_'.$code.'_'.$object->id.'").click(function() {
583  $.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
584  action: \'set\',
585  field: \''.$field.'\',
586  value: \'1\',
587  element: \''.$object->element.'\',
588  id: \''.$object->id.'\',
589  token: \''.newToken().'\'
590  },
591  function() {
592  $("#set_'.$code.'_'.$object->id.'").hide();
593  $("#del_'.$code.'_'.$object->id.'").show();
594  // Enable another element
595  if (input.disabled && input.disabled.length > 0) {
596  $.each(input.disabled, function(key,value) {
597  $("#" + value).removeAttr("disabled");
598  if ($("#" + value).hasClass("butActionRefused") == true) {
599  $("#" + value).removeClass("butActionRefused");
600  $("#" + value).addClass("butAction");
601  }
602  });
603  // Show another element
604  } else if (input.showhide && input.showhide.length > 0) {
605  $.each(input.showhide, function(key,value) {
606  $("#" + value).show();
607  });
608  }
609  });
610  });
611 
612  // Del constant
613  $("#del_'.$code.'_'.$object->id.'").click(function() {
614  $.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
615  action: \'set\',
616  field: \''.$field.'\',
617  value: \'0\',
618  element: \''.$object->element.'\',
619  id: \''.$object->id.'\',
620  token: \''.newToken().'\'
621  },
622  function() {
623  $("#del_'.$code.'_'.$object->id.'").hide();
624  $("#set_'.$code.'_'.$object->id.'").show();
625  // Disable another element
626  if (input.disabled && input.disabled.length > 0) {
627  $.each(input.disabled, function(key,value) {
628  $("#" + value).prop("disabled", true);
629  if ($("#" + value).hasClass("butAction") == true) {
630  $("#" + value).removeClass("butAction");
631  $("#" + value).addClass("butActionRefused");
632  }
633  });
634  // Hide another element
635  } else if (input.showhide && input.showhide.length > 0) {
636  $.each(input.showhide, function(key,value) {
637  $("#" + value).hide();
638  });
639  }
640  });
641  });
642  });
643  </script>';
644  $out .= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
645  $out .= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>';
646 
647  return $out;
648 }
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto= 'UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
ajax_autocompleter($selected, $htmlname, $url, $urloption= '', $minLength=2, $autoselect=0, $ajaxoptions=array(), $moreparams= '')
Generic function that return javascript to add to a page to transform a common input field into an au...
Definition: ajax.lib.php:47
if(!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'] country if(!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'] typent code
Definition: list.php:566
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 field into an au...
Definition: ajax.lib.php:241
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
Definition: ajax.lib.php:391
select2arrayoflanguage
Set array used for select2 translations.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0)
On/off button for constant.
Definition: ajax.lib.php:503
ajax_dialog($title, $message, $w=350, $h=150)
Show an ajax dialog.
Definition: ajax.lib.php:348
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
Definition: index.php:89
newToken()
Return the value of token currently saved into session with name &#39;newtoken&#39;.
dol_textishtml($msg, $option=0)
Return if a text is a html content.