dolibarr  19.0.0-dev
html.formaccounting.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
3  * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
4  * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
5  * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
6  * Copyright (C) 2016-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
27 require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
28 
29 
33 class FormAccounting extends Form
34 {
35  private $options_cache = array();
36 
40  public $db;
41 
45  public $error = '';
46 
50  public $nbaccounts;
51 
52 
58  public function __construct($db)
59  {
60  $this->db = $db;
61  }
62 
63  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
78  public function select_journal($selectid, $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '', $disabledajaxcombo = 0)
79  {
80  // phpcs:enable
81  global $conf, $langs;
82 
83  $out = '';
84 
85  $options = array();
86  if ($usecache && !empty($this->options_cache[$usecache])) {
87  $options = $this->options_cache[$usecache];
88  $selected = $selectid;
89  } else {
90  $sql = "SELECT rowid, code, label, nature, entity, active";
91  $sql .= " FROM ".$this->db->prefix()."accounting_journal";
92  $sql .= " WHERE active = 1";
93  $sql .= " AND entity = ".$conf->entity;
94  if ($nature && is_numeric($nature)) {
95  $sql .= " AND nature = ".((int) $nature);
96  }
97  $sql .= " ORDER BY code";
98 
99  dol_syslog(get_class($this)."::select_journal", LOG_DEBUG);
100  $resql = $this->db->query($sql);
101 
102  if (!$resql) {
103  $this->error = "Error ".$this->db->lasterror();
104  dol_syslog(get_class($this)."::select_journal ".$this->error, LOG_ERR);
105  return -1;
106  }
107 
108  $selected = 0;
109  $langs->load('accountancy');
110  while ($obj = $this->db->fetch_object($resql)) {
111  $label = $obj->code.' - '.$langs->trans($obj->label);
112 
113  $select_value_in = $obj->rowid;
114  $select_value_out = $obj->rowid;
115 
116  // Try to guess if we have found default value
117  if ($select_in == 1) {
118  $select_value_in = $obj->code;
119  }
120  if ($select_out == 1) {
121  $select_value_out = $obj->code;
122  }
123  // Remember guy's we store in database llx_accounting_bookkeeping the code of accounting_journal and not the rowid
124  if ($selectid != '' && $selectid == $select_value_in) {
125  //var_dump("Found ".$selectid." ".$select_value_in);
126  $selected = $select_value_out;
127  }
128 
129  $options[$select_value_out] = $label;
130  }
131  $this->db->free($resql);
132 
133  if ($usecache) {
134  $this->options_cache[$usecache] = $options;
135  }
136  }
137 
138  $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, ($disabledajaxcombo ? 0 : 1));
139 
140  return $out;
141  }
142 
143  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
158  public function multi_select_journal($selectedIds = array(), $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = '', $usecache = '', $disabledajaxcombo = 0)
159  {
160  // phpcs:enable
161  global $conf, $langs;
162 
163  $out = '';
164 
165  $options = array();
166  if ($usecache && !empty($this->options_cache[$usecache])) {
167  $options = $this->options_cache[$usecache];
168  $selected = $selectedIds;
169  } else {
170  $sql = "SELECT rowid, code, label, nature, entity, active";
171  $sql .= " FROM ".$this->db->prefix()."accounting_journal";
172  $sql .= " WHERE active = 1";
173  $sql .= " AND entity = ".$conf->entity;
174  if ($nature && is_numeric($nature)) {
175  $sql .= " AND nature = ".((int) $nature);
176  }
177  $sql .= " ORDER BY code";
178 
179  dol_syslog(get_class($this)."::multi_select_journal", LOG_DEBUG);
180  $resql = $this->db->query($sql);
181 
182  if (!$resql) {
183  $this->error = "Error ".$this->db->lasterror();
184  dol_syslog(get_class($this)."::multi_select_journal ".$this->error, LOG_ERR);
185  return -1;
186  }
187 
188  $selected = array();
189  $langs->load('accountancy');
190  while ($obj = $this->db->fetch_object($resql)) {
191  $label = $langs->trans($obj->label);
192 
193  $select_value_in = $obj->rowid;
194  $select_value_out = $obj->rowid;
195 
196  // Try to guess if we have found default value
197  if ($select_in == 1) {
198  $select_value_in = $obj->code;
199  }
200  if ($select_out == 1) {
201  $select_value_out = $obj->code;
202  }
203  // Remember guy's we store in database llx_accounting_bookkeeping the code of accounting_journal and not the rowid
204  if (!empty($selectedIds) && in_array($select_value_in, $selectedIds)) {
205  //var_dump("Found ".$selectid." ".$select_value_in);
206  $selected[] = $select_value_out;
207  }
208  $options[$select_value_out] = $label;
209  }
210  $this->db->free($resql);
211 
212  if ($usecache) {
213  $this->options_cache[$usecache] = $options;
214  }
215  }
216 
217  $out .= Form::multiselectarray($htmlname, $options, $selected, $showempty, 0, $morecss, 0, 0, 0, 'code_journal', '', ($disabledajaxcombo ? 0 : 1));
218 
219  return $out;
220  }
221 
222  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
235  public function select_accounting_category($selected = '', $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0)
236  {
237  // phpcs:enable
238  global $db, $langs, $user, $mysoc;
239 
240  if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries)) {
241  dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
242  exit;
243  }
244 
245  if (!empty($mysoc->country_id)) {
246  $sql = "SELECT c.rowid, c.label as type, c.range_account";
247  $sql .= " FROM ".$this->db->prefix()."c_accounting_category as c";
248  $sql .= " WHERE c.active = 1";
249  $sql .= " AND c.category_type = 0";
250  if (empty($allcountries)) {
251  $sql .= " AND c.fk_country = ".((int) $mysoc->country_id);
252  }
253  $sql .= " ORDER BY c.label ASC";
254  } else {
255  $sql = "SELECT c.rowid, c.label as type, c.range_account";
256  $sql .= " FROM ".$this->db->prefix()."c_accounting_category as c, ".$this->db->prefix()."c_country as co";
257  $sql .= " WHERE c.active = 1";
258  $sql .= " AND c.category_type = 0";
259  $sql .= " AND c.fk_country = co.rowid";
260  if (empty($allcountries)) {
261  $sql .= " AND co.code = '".$this->db->escape($mysoc->country_code)."'";
262  }
263  $sql .= " ORDER BY c.label ASC";
264  }
265 
266  dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
267  $resql = $this->db->query($sql);
268  if ($resql) {
269  $num = $this->db->num_rows($resql);
270  if ($num) {
271  $out = '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'">';
272  $i = 0;
273 
274  if ($useempty) {
275  $out .= '<option value="0">&nbsp;</option>';
276  }
277  while ($i < $num) {
278  $obj = $this->db->fetch_object($resql);
279 
280  $titletoshowhtml = ($maxlen ? dol_trunc($obj->type, $maxlen) : $obj->type).($obj->range_account ? ' <span class="opacitymedium">('.$obj->range_account.')</span>' : '');
281  $titletoshow = ($maxlen ? dol_trunc($obj->type, $maxlen) : $obj->type).($obj->range_account ? ' ('.$obj->range_account.')' : '');
282 
283  $out .= '<option value="'.$obj->rowid.'"';
284  if ($obj->rowid == $selected) {
285  $out .= ' selected';
286  }
287  $out .= ' data-html="'.dol_escape_htmltag(dol_string_onlythesehtmltags($titletoshowhtml, 1, 1, 0, 0, array('span'))).'"';
288  $out .= '>';
289  $out .= dol_escape_htmltag($titletoshow);
290  $out .= '</option>';
291  $i++;
292  }
293  $out .= '</select>';
294  //if ($user->admin && $help) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
295  } else {
296  $out = $langs->trans("ErrorNoAccountingCategoryForThisCountry", $mysoc->country_code);
297  }
298  } else {
299  dol_print_error($this->db);
300  }
301 
302  $out .= ajax_combobox($htmlname, array());
303 
304  return $out;
305  }
306 
307  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
315  public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
316  {
317  // phpcs:enable
318  $options = array();
319 
320  $sql = "SELECT DISTINCT import_key FROM ".$this->db->prefix()."accounting_bookkeeping";
321  $sql .= " WHERE entity IN (".getEntity('accountancy').")";
322  $sql .= ' ORDER BY import_key DESC';
323 
324  dol_syslog(get_class($this)."::select_bookkeeping_importkey", LOG_DEBUG);
325  $resql = $this->db->query($sql);
326 
327  if (!$resql) {
328  $this->error = "Error ".$this->db->lasterror();
329  dol_syslog(get_class($this)."::select_bookkeeping_importkey ".$this->error, LOG_ERR);
330  return -1;
331  }
332 
333  while ($obj = $this->db->fetch_object($resql)) {
334  $options[$obj->import_key] = $obj->import_key;
335  }
336 
337  return Form::selectarray($htmlname, $options, $selectedkey);
338  }
339 
340  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
355  public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $active = '1')
356  {
357  // phpcs:enable
358  global $conf, $langs;
359 
360  require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
361 
362  $out = '';
363 
364  $options = array();
365 
366  if ($showempty == 2) {
367  $options['0'] = '--- '.$langs->trans("None").' ---';
368  }
369 
370  if ($usecache && !empty($this->options_cache[$usecache])) {
371  $options = $options + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0
372  $selected = $selectid;
373  } else {
374  $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', 50);
375 
376  $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.labelshort, aa.rowid, aa.fk_pcg_version";
377  $sql .= " FROM ".$this->db->prefix()."accounting_account as aa";
378  $sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
379  $sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
380  if ($active === '1') {
381  $sql .= " AND aa.active = 1";
382  } elseif ($active === '0') {
383  $sql .= " AND aa.active = 0";
384  }
385  $sql .= " AND aa.entity=".((int) $conf->entity);
386  $sql .= " ORDER BY aa.account_number";
387 
388  dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
389  $resql = $this->db->query($sql);
390 
391  if (!$resql) {
392  $this->error = "Error ".$this->db->lasterror();
393  dol_syslog(get_class($this)."::select_account ".$this->error, LOG_ERR);
394  return -1;
395  }
396 
397  $num_rows = $this->db->num_rows($resql);
398 
399  if ($num_rows == 0 && (empty(getDolGlobalInt('CHARTOFACCOUNTS')) || getDolGlobalInt('CHARTOFACCOUNTS') < 0)) {
400  $langs->load("errors");
401  $showempty = $langs->trans("ErrorYouMustFirstSetupYourChartOfAccount");
402  } else {
403  $selected = $selectid; // selectid can be -1, 0, 123
404  while ($obj = $this->db->fetch_object($resql)) {
405  if (empty($obj->labelshort)) {
406  $labeltoshow = $obj->label;
407  } else {
408  $labeltoshow = $obj->labelshort;
409  }
410 
411  $label = length_accountg($obj->account_number).' - '.$labeltoshow;
412  $label = dol_trunc($label, $trunclength);
413 
414  $select_value_in = $obj->rowid;
415  $select_value_out = $obj->rowid;
416 
417  // Try to guess if we have found default value
418  if ($select_in == 1) {
419  $select_value_in = $obj->account_number;
420  }
421  if ($select_out == 1) {
422  $select_value_out = $obj->account_number;
423  }
424  // Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
425  // Because same account_number can be share between different accounting_system and do have the same meaning
426  if ($selectid != '' && $selectid == $select_value_in) {
427  //var_dump("Found ".$selectid." ".$select_value_in);
428  $selected = $select_value_out;
429  }
430 
431  $options[$select_value_out] = $label;
432  }
433  }
434 
435  $this->db->free($resql);
436 
437  if ($usecache) {
438  $this->options_cache[$usecache] = $options;
439  unset($this->options_cache[$usecache]['0']);
440  }
441  }
442 
443 
444  $out .= Form::selectarray($htmlname, $options, $selected, ($showempty ? (is_numeric($showempty) ? 1 : $showempty): 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
445 
446  $this->nbaccounts = count($options) - ($showempty == 2 ? 1 : 0);
447 
448  return $out;
449  }
450 
451  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
463  public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $labelhtmlname = '')
464  {
465  // phpcs:enable
466  global $conf;
467 
468  $aux_account = array();
469 
470  if ($usecache && !empty($this->options_cache[$usecache])) {
471  $aux_account = $aux_account + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0
472  } else {
473  dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
474 
475  // Auxiliary thirdparties account
476  $sql = "SELECT code_compta, code_compta_fournisseur, nom as name";
477  $sql .= " FROM ".$this->db->prefix()."societe";
478  $sql .= " WHERE entity IN (".getEntity('societe').")";
479  $sql .= " AND (client IN (1,3) OR fournisseur = 1)";
480 
481  $resql = $this->db->query($sql);
482  if ($resql) {
483  while ($obj = $this->db->fetch_object($resql)) {
484  if (!empty($obj->code_compta)) {
485  $aux_account[$obj->code_compta] = $obj->code_compta.' <span class="opacitymedium">('.$obj->name.')</span>';
486  }
487  if (!empty($obj->code_compta_fournisseur)) {
488  $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' <span class="opacitymedium">('.$obj->name.')</span>';
489  }
490  }
491  } else {
492  $this->error = "Error ".$this->db->lasterror();
493  dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
494  return -1;
495  }
496 
497  ksort($aux_account);
498 
499  $this->db->free($resql);
500 
501  // Auxiliary user account
502  $sql = "SELECT DISTINCT accountancy_code, lastname, firstname ";
503  $sql .= " FROM ".$this->db->prefix()."user";
504  $sql .= " WHERE entity IN (".getEntity('user').")";
505  $sql .= " ORDER BY accountancy_code";
506 
507  $resql = $this->db->query($sql);
508  if ($resql) {
509  while ($obj = $this->db->fetch_object($resql)) {
510  if (!empty($obj->accountancy_code)) {
511  $aux_account[$obj->accountancy_code] = $obj->accountancy_code.' <span class="opacitymedium">('.dolGetFirstLastname($obj->firstname, $obj->lastname).')</span>';
512  }
513  }
514  } else {
515  $this->error = "Error ".$this->db->lasterror();
516  dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
517  return -1;
518  }
519  $this->db->free($resql);
520 
521  if ($usecache) {
522  $this->options_cache[$usecache] = $aux_account;
523  }
524  }
525 
526  // Build select
527  $out = '';
528  $out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty): 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
529  //automatic filling if we give the name of the subledger_label input
530  if (!empty($conf->use_javascript_ajax) && !empty($labelhtmlname)) {
531  $out .= '<script nonce="'.getNonce().'">
532  jQuery(document).ready(() => {
533  $("#'.$htmlname.'").on("select2:select", function(e) {
534  var regExp = /\‍(([^)]+)\‍)/;
535  const match = regExp.exec(e.params.data.text);
536  $(\'input[name="'.dol_escape_js($labelhtmlname).'"]\').val(match[1]);
537  });
538  });
539 
540  </script>';
541  }
542 
543  return $out;
544  }
545 
546  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
556  public function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
557  {
558  // phpcs:enable
559  global $conf;
560 
561  $out_array = array();
562 
563  $sql = "SELECT DISTINCT date_format(doc_date, '%Y') as dtyear";
564  $sql .= " FROM ".$this->db->prefix()."accounting_bookkeeping";
565  $sql .= " WHERE entity IN (".getEntity('accountancy').")";
566  $sql .= " ORDER BY date_format(doc_date, '%Y')";
567  dol_syslog(__METHOD__, LOG_DEBUG);
568  $resql = $this->db->query($sql);
569 
570  if (!$resql) {
571  $this->error = "Error ".$this->db->lasterror();
572  dol_syslog(__METHOD__.$this->error, LOG_ERR);
573  return -1;
574  }
575  while ($obj = $this->db->fetch_object($resql)) {
576  $out_array[$obj->dtyear] = $obj->dtyear;
577  }
578  $this->db->free($resql);
579 
580  if ($output_format == 'html') {
581  return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
582  } else {
583  return $out_array;
584  }
585  }
586 }
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition: ajax.lib.php:449
Class to manage generation of HTML components for accounting management.
select_bookkeeping_importkey($htmlname='importkey', $selectedkey='')
Return select filter with date of transaction.
__construct($db)
Constructor.
select_journal($selectid, $htmlname='journal', $nature=0, $showempty=0, $select_in=0, $select_out=0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='', $disabledajaxcombo=0)
Return list of journals with label by nature.
select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='minwidth100 maxwidth300 maxwidthonsmartphone', $usecache='', $labelhtmlname='')
Return list of auxilary accounts.
selectyear_accountancy_bookkepping($selected='', $htmlname='yearid', $useempty=0, $output_format='html')
Return HTML combo list of years existing into book keepping.
multi_select_journal($selectedIds=array(), $htmlname='journal', $nature=0, $showempty=0, $select_in=0, $select_out=0, $morecss='', $usecache='', $disabledajaxcombo=0)
Return list of journals with label by nature.
select_account($selectid, $htmlname='account', $showempty=0, $event=array(), $select_in=0, $select_out=0, $morecss='minwidth100 maxwidth300 maxwidthonsmartphone', $usecache='', $active='1')
Return list of accounts with label by chart of accounts.
select_accounting_category($selected='', $htmlname='account_category', $useempty=0, $maxlen=0, $help=1, $allcountries=0)
Return list of accounting category.
Class to manage generation of HTML components Only common components must be here.
static selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='minwidth75', $addjscombo=1, $moreparamonempty='', $disablebademail=0, $nohtmlescape=0)
Return a HTML select string, built from an array of key+value.
static multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=-1)
Show a multiselect form from an array.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array(), $allowlink=0)
Clean a string to keep only desirable HTML tags.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...