mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-28 20:39:35 +00:00
Fixed modeEnum parsing
This commit is contained in:
parent
f77d201563
commit
f22bff7adc
1 changed files with 9 additions and 1 deletions
|
|
@ -309,7 +309,15 @@ class ScanController extends AbstractController
|
||||||
$this->denyAccessUnlessGranted('@tools.label_scanner');
|
$this->denyAccessUnlessGranted('@tools.label_scanner');
|
||||||
|
|
||||||
$input = trim($request->request->getString('input', ''));
|
$input = trim($request->request->getString('input', ''));
|
||||||
$modeEnum = $request->request->getEnum('mode', BarcodeSourceType::class);
|
|
||||||
|
// We cannot use getEnum here, because we get an empty string for mode, when auto mode is selected
|
||||||
|
$mode = $request->request->getString('mode', BarcodeSourceType::class, '');
|
||||||
|
if ($mode === '') {
|
||||||
|
$modeEnum = null;
|
||||||
|
} else {
|
||||||
|
$modeEnum = BarcodeSourceType::from($mode); // validate enum value; will throw if invalid
|
||||||
|
}
|
||||||
|
|
||||||
$infoMode = $request->request->getBoolean('info_mode', false);
|
$infoMode = $request->request->getBoolean('info_mode', false);
|
||||||
|
|
||||||
if ($input === '') {
|
if ($input === '') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue