mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 09:53:35 +02:00
Added option to "save and clone" a part, which is especially useful, when creatiing multiple similar parts.
This should (partly) fix issue 45.
This commit is contained in:
parent
d4818d2fa1
commit
6602015a5a
4 changed files with 26 additions and 2 deletions
|
@ -180,6 +180,12 @@ class PartController extends AbstractController
|
|||
$em->persist($part);
|
||||
$em->flush();
|
||||
$this->addFlash('info', 'part.edited_flash');
|
||||
|
||||
//Redirect to clone page if user wished that...
|
||||
if ("save_and_clone" === $form->getClickedButton()->getName()) {
|
||||
return $this->redirectToRoute('part_clone', ['id' => $part->getID()]);
|
||||
}
|
||||
|
||||
//Reload form, so the SIUnitType entries use the new part unit
|
||||
$form = $this->createForm(PartBaseType::class, $part);
|
||||
} elseif ($form->isSubmitted() && ! $form->isValid()) {
|
||||
|
@ -301,6 +307,11 @@ class PartController extends AbstractController
|
|||
$em->flush();
|
||||
$this->addFlash('success', 'part.created_flash');
|
||||
|
||||
//Redirect to clone page if user wished that...
|
||||
if ("save_and_clone" === $form->getClickedButton()->getName()) {
|
||||
return $this->redirectToRoute('part_clone', ['id' => $new_part->getID()]);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue