mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-13 13:49:33 +00:00
Assembly um IPN-Eingabemöglichkeit und Automatismus zur Name-Angabe erweitern
This commit is contained in:
parent
7e8d444ac8
commit
bdbaab98c5
29 changed files with 287 additions and 3 deletions
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Controller\AdminPages;
|
||||
|
||||
use App\DataTables\LogDataTable;
|
||||
use App\Entity\AssemblySystem\Assembly;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Attachments\AttachmentUpload;
|
||||
|
|
@ -193,6 +194,15 @@ abstract class BaseAdminController extends AbstractController
|
|||
$entity->setMasterPictureAttachment(null);
|
||||
}
|
||||
|
||||
if ($entity instanceof Assembly) {
|
||||
/* Replace ipn placeholder with the IPN information if applicable.
|
||||
* The '%%ipn%%' placeholder is automatically inserted into the Name property,
|
||||
* depending on CREATE_ASSEMBLY_USE_IPN_PLACEHOLDER_IN_NAME, when creating a new one,
|
||||
* to avoid having to insert it manually */
|
||||
|
||||
$entity->setName(str_ireplace('%%ipn%%', $entity->getIpn(), $entity->getName()));
|
||||
}
|
||||
|
||||
$this->commentHelper->setMessage($form['log_comment']->getData());
|
||||
|
||||
$em->persist($entity);
|
||||
|
|
@ -287,6 +297,15 @@ abstract class BaseAdminController extends AbstractController
|
|||
$new_entity->setMasterPictureAttachment(null);
|
||||
}
|
||||
|
||||
if ($new_entity instanceof Assembly) {
|
||||
/* Replace ipn placeholder with the IPN information if applicable.
|
||||
* The '%%ipn%%' placeholder is automatically inserted into the Name property,
|
||||
* depending on CREATE_ASSEMBLY_USE_IPN_PLACEHOLDER_IN_NAME, when creating a new one,
|
||||
* to avoid having to insert it manually */
|
||||
|
||||
$new_entity->setName(str_ireplace('%%ipn%%', $new_entity->getIpn(), $new_entity->getName()));
|
||||
}
|
||||
|
||||
$this->commentHelper->setMessage($form['log_comment']->getData());
|
||||
$em->persist($new_entity);
|
||||
$em->flush();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue