';
// Barcode value
diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php
index 6780f01735a..7b0f7bd06fe 100644
--- a/htdocs/core/class/html.formbarcode.class.php
+++ b/htdocs/core/class/html.formbarcode.class.php
@@ -1,21 +1,22 @@
- * Copyright (C) 2008-2012 Laurent Destailleur
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-*/
+/* Copyright (C) 2007-2012 Regis Houssin
+ * Copyright (C) 2008-2012 Laurent Destailleur
+ * Copyright (C) 2018 Frédéric France
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
/**
* \file htdocs/core/class/html.formbarcode.class.php
@@ -32,11 +33,11 @@ class FormBarCode
* @var DoliDB Database handler.
*/
public $db;
-
+
/**
- * @var string Error code (or message)
- */
- public $error='';
+ * @var string Error code (or message)
+ */
+ public $error='';
/**
@@ -104,17 +105,33 @@ class FormBarCode
}
/**
- * Return form to select type of barcode
+ * Print form to select type of barcode
*
* @param int $selected Id code pre-selected
* @param string $htmlname Name of HTML select field
* @param int $useempty Affiche valeur vide dans liste
* @return void
+ * @deprecated
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- function select_barcode_type($selected='',$htmlname='barcodetype_id',$useempty=0)
+ function select_barcode_type($selected='', $htmlname='barcodetype_id', $useempty=0)
{
- global $langs,$conf;
+ print $this->selectBarcodeType($selected, $htmlname, $useempty);
+ }
+
+ /**
+ * Return html form to select type of barcode
+ *
+ * @param int $selected Id code pre-selected
+ * @param string $htmlname Name of HTML select field
+ * @param int $useempty Display empty value in select
+ * @return string
+ */
+ function selectBarcodeType($selected='', $htmlname='barcodetype_id', $useempty=0)
+ {
+ global $langs, $conf;
+
+ $out = '';
$sql = "SELECT rowid, code, libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
@@ -123,44 +140,37 @@ class FormBarCode
$sql.= " ORDER BY code";
$result = $this->db->query($sql);
- if ($result)
- {
+ if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
- if ($useempty && $num > 0)
- {
- print '