mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 09:53:35 +02:00
Added possibility to save parts and create an empty one
This commit is contained in:
parent
13de2afc28
commit
c088742dda
6 changed files with 1142 additions and 1120 deletions
|
@ -162,13 +162,17 @@ class PartController extends AbstractController
|
|||
|
||||
$em->persist($part);
|
||||
$em->flush();
|
||||
$this->addFlash('info', 'part.edited_flash');
|
||||
$this->addFlash('success', 'part.edited_flash');
|
||||
|
||||
//Redirect to clone page if user wished that...
|
||||
//@phpstan-ignore-next-line
|
||||
if ('save_and_clone' === $form->getClickedButton()->getName()) {
|
||||
return $this->redirectToRoute('part_clone', ['id' => $part->getID()]);
|
||||
}
|
||||
//@phpstan-ignore-next-line
|
||||
if ('save_and_new' === $form->getClickedButton()->getName()) {
|
||||
return $this->redirectToRoute('part_new');
|
||||
}
|
||||
|
||||
//Reload form, so the SIUnitType entries use the new part unit
|
||||
$form = $this->createForm(PartBaseType::class, $part);
|
||||
|
@ -310,6 +314,10 @@ class PartController extends AbstractController
|
|||
if ('save_and_clone' === $form->getClickedButton()->getName()) {
|
||||
return $this->redirectToRoute('part_clone', ['id' => $new_part->getID()]);
|
||||
}
|
||||
//@phpstan-ignore-next-line
|
||||
if ('save_and_new' === $form->getClickedButton()->getName()) {
|
||||
return $this->redirectToRoute('part_new');
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue