mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-01 04:49:36 +00:00
fix @MayNiklas reported bug: when manually submitting the form (from a barcode scan or manual input) redirect to Create New part screen for the decoded information instead of showing 'Format Unknown' popup error message
This commit is contained in:
parent
4881418af3
commit
2d55b90311
1 changed files with 13 additions and 2 deletions
|
|
@ -100,8 +100,19 @@ class ScanController extends AbstractController
|
|||
|
||||
// If not in info mode, mimic “normal scan” behavior: redirect if possible.
|
||||
if (!$infoMode) {
|
||||
$url = $this->barcodeParser->getRedirectURL($scan);
|
||||
return $this->redirect($url);
|
||||
try {
|
||||
$url = $this->barcodeParser->getRedirectURL($scan);
|
||||
return $this->redirect($url);
|
||||
} catch (EntityNotFoundException) {
|
||||
// Decoded OK, but no part is found. If it’s a vendor code, redirect to create.
|
||||
$createUrl = $this->buildCreateUrlForScanResult($scan, $request->getLocale());
|
||||
if ($createUrl !== null) {
|
||||
return $this->redirect($createUrl);
|
||||
}
|
||||
|
||||
// Otherwise: show “not found” (not “format unknown”)
|
||||
$this->addFlash('warning', 'scan.qr_not_found');
|
||||
}
|
||||
}
|
||||
|
||||
// Info mode fallback: render page with prefilled result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue