From 4ba16e108ac0da5c14000bcff376c2edcf3492eb Mon Sep 17 00:00:00 2001 From: Samuel Launay <107540223+Lainow@users.noreply.github.com> Date: Fri, 27 Nov 2026 09:59:20 +0100 Subject: [PATCH] BACKPORT-CONFLICT --- CHANGELOG.md | 5 +++ ...rtFormcreatorActorsNotificationCommand.php | 21 +++++++++++++ src/Service/InitManager.php | 31 +++++++++++++++++++ src/Service/InstallManager.php | 3 ++ 4 files changed, 60 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a0cb0..a98878c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added +<<<<<<< HEAD - Add translations management through Transifex - "Email followup" destination field to disable the followup per actor source, with a command to import it from Formcreator - Add "Allow specific languages" form access policy - Add "GLPI system information" and "GLPI core or plugins concerned" question types +======= +- Add an "Email" form destination, sending a customized email when a form is submitted +- "Email followup" destination field to disable the followup per actor source, with a command to import it from Formcreator +>>>>>>> 6c51cde (Fix email follow up by actor (GLPI 11.0.x) (#97)) ### Fixed diff --git a/src/Console/ImportFormcreatorActorsNotificationCommand.php b/src/Console/ImportFormcreatorActorsNotificationCommand.php index 8e3d21b..1cc0e37 100644 --- a/src/Console/ImportFormcreatorActorsNotificationCommand.php +++ b/src/Console/ImportFormcreatorActorsNotificationCommand.php @@ -34,6 +34,10 @@ namespace GlpiPlugin\Advancedforms\Console; use Config; +<<<<<<< HEAD +======= +use DBmysql; +>>>>>>> 6c51cde (Fix email follow up by actor (GLPI 11.0.x) (#97)) use Glpi\Console\AbstractCommand; use Glpi\Form\Destination\CommonITILField\ITILActorFieldConfig; use Glpi\Form\Destination\CommonITILField\ITILActorFieldStrategy; @@ -47,6 +51,10 @@ use GlpiPlugin\Advancedforms\Model\Destination\ActorNotificationFieldConfig; use Override; use Ramsey\Uuid\Uuid; +<<<<<<< HEAD +======= +use RuntimeException; +>>>>>>> 6c51cde (Fix email follow up by actor (GLPI 11.0.x) (#97)) use Supplier; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Table; @@ -207,6 +215,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int return $this->has_failed_destinations ? Command::FAILURE : Command::SUCCESS; } +<<<<<<< HEAD +======= + /** GLPI 11 has no AbstractCommand::getDb() (added in GLPI 12). */ + private function getDb(): DBmysql + { + if ($this->db === null) { + throw new RuntimeException('No database connection available.'); + } + + return $this->db; + } + +>>>>>>> 6c51cde (Fix email follow up by actor (GLPI 11.0.x) (#97)) /** @return list */ private function getMissingFormcreatorTables(): array { diff --git a/src/Service/InitManager.php b/src/Service/InitManager.php index ab0af6d..bb58a99 100644 --- a/src/Service/InitManager.php +++ b/src/Service/InitManager.php @@ -34,8 +34,13 @@ namespace GlpiPlugin\Advancedforms\Service; use Config; +<<<<<<< HEAD use Glpi\Form\Destination\FormDestinationChange; use Glpi\Form\AccessControl\FormAccessControlManager; +======= +use Glpi\Form\Destination\FormDestination; +use Glpi\Form\Destination\FormDestinationChange; +>>>>>>> 6c51cde (Fix email follow up by actor (GLPI 11.0.x) (#97)) use Glpi\Form\Destination\FormDestinationManager; use Glpi\Form\Destination\FormDestinationProblem; use Glpi\Form\Destination\FormDestinationTicket; @@ -46,6 +51,10 @@ use GlpiPlugin\Advancedforms\Model\AccessControl\LanguageAccessControl; use GlpiPlugin\Advancedforms\Model\Config\ConfigTab; use GlpiPlugin\Advancedforms\Model\Destination\ActorNotificationField; +<<<<<<< HEAD +======= +use GlpiPlugin\Advancedforms\Model\Destination\Email\EmailDestinationConfigNormalizer; +>>>>>>> 6c51cde (Fix email follow up by actor (GLPI 11.0.x) (#97)) use GlpiPlugin\Advancedforms\Model\Destination\PreReservationField; use GlpiPlugin\Advancedforms\Model\QuestionType\AdvancedCategory; use GlpiPlugin\Advancedforms\Model\QuestionType\LegacyQuestionTypeInterface; @@ -147,6 +156,28 @@ private function registerDestinationFields(): void fn($registered_field) => $registered_field instanceof $field, ); if ($already_registered !== []) { +<<<<<<< HEAD +======= + continue; + } + + $destination_manager->registerPluginCommonITILConfigField($destination_class, $field); + } + } + + private function registerDestinationTypes(): void + { + $destination_manager = FormDestinationManager::getInstance(); + + // init() may run multiple times per process; avoid double-registering a type. + $registered_classes = array_map( + get_class(...), + $destination_manager->getDestinationTypes(), + ); + + foreach (ConfigManager::getInstance()->getEnabledDestinations() as $destination) { + if (in_array($destination::class, $registered_classes, true)) { +>>>>>>> 6c51cde (Fix email follow up by actor (GLPI 11.0.x) (#97)) continue; } diff --git a/src/Service/InstallManager.php b/src/Service/InstallManager.php index c27e960..d9183c7 100644 --- a/src/Service/InstallManager.php +++ b/src/Service/InstallManager.php @@ -40,7 +40,10 @@ use Glpi\Form\AccessControl\FormAccessControl; use Glpi\Toolbox\SingletonTrait; use GlpiPlugin\Advancedforms\Console\ImportFormcreatorActorsNotificationCommand; +<<<<<<< HEAD use GlpiPlugin\Advancedforms\Model\AccessControl\LanguageAccessControl; +======= +>>>>>>> 6c51cde (Fix email follow up by actor (GLPI 11.0.x) (#97)) use GlpiPlugin\Advancedforms\Model\TicketReservationRequest; use Migration; use Notification;