diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 22af450b997..8e03f158a02 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -393,9 +393,10 @@ class FormAdmin * @param string $htmlname Name of HTML select field * @param string $filter Value to filter on code * @param int $showempty Add empty value + * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) * @return string Return HTML output */ - public function select_paper_format($selected = '', $htmlname = 'paperformat_id', $filter = 0, $showempty = 0) + public function select_paper_format($selected = '', $htmlname = 'paperformat_id', $filter = 0, $showempty = 0, $forcecombo = 0) { // phpcs:enable global $langs; @@ -444,8 +445,10 @@ class FormAdmin } $out .= ''; - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname); + if (!$forcecombo) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlname); + } return $out; } diff --git a/test/phpunit/FormAdminTest.php b/test/phpunit/FormAdminTest.php index 79019e1e7ed..7217f3b57e2 100644 --- a/test/phpunit/FormAdminTest.php +++ b/test/phpunit/FormAdminTest.php @@ -139,7 +139,7 @@ class FormAdminTest extends PHPUnit\Framework\TestCase $db=$this->savdb; $localobject=new FormAdmin($this->savdb); - $result=$localobject->select_paper_format('', 'paperformat_id', 'A4'); + $result=$localobject->select_paper_format('', 'paperformat_id', 'A4', 0, 1); $this->assertEquals($result, ''); print __METHOD__." result=".$result."\n";