Assembly um IPN-Eingabemöglichkeit und Automatismus zur Name-Angabe erweitern

This commit is contained in:
Marcel Diegelmann 2025-06-26 14:43:25 +02:00
parent bba619797e
commit 4f9c20a409
29 changed files with 287 additions and 3 deletions

View file

@ -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();