From ac26be32fdf77be81f4d95a195c2ebb99c8555d2 Mon Sep 17 00:00:00 2001 From: Thiago Date: Tue, 22 Oct 2024 16:51:57 -0400 Subject: [PATCH 1/2] Select default imprint in registration form Issue: documentacao-e-tarefas/desenvolvimento_e_infra#911 Signed-off-by: Thiago --- classes/ThothRegister.inc.php | 5 +++-- classes/components/forms/RegisterForm.inc.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/classes/ThothRegister.inc.php b/classes/ThothRegister.inc.php index f961f41..b0f1d0e 100644 --- a/classes/ThothRegister.inc.php +++ b/classes/ThothRegister.inc.php @@ -70,7 +70,7 @@ public function addImprintField($hookName, $form) $publishers = $thothClient->linkedPublishers(); $imprints = $thothClient->imprints(['publishers' => array_column($publishers, 'publisherId')]); - $imprintOptions = [['value' => '', 'label' => '']]; + $imprintOptions = []; foreach ($imprints as $imprint) { $imprintOptions[] = [ 'value' => $imprint['imprintId'], @@ -91,7 +91,8 @@ public function addImprintField($hookName, $form) 'options' => $imprintOptions, 'required' => true, 'showWhen' => 'registerConfirmation', - 'groupId' => 'default' + 'groupId' => 'default', + 'value' => $imprints[0]['imprintId'] ?? null ])); } catch (ThothException $e) { $warningIconHtml = ''; diff --git a/classes/components/forms/RegisterForm.inc.php b/classes/components/forms/RegisterForm.inc.php index 52ad046..11e51e3 100644 --- a/classes/components/forms/RegisterForm.inc.php +++ b/classes/components/forms/RegisterForm.inc.php @@ -51,7 +51,7 @@ public function __construct($action, $imprints, $errors) return; } - $imprintOptions = [['value' => '', 'label' => '']]; + $imprintOptions = []; foreach ($imprints as $imprint) { $imprintOptions[] = [ 'value' => $imprint['imprintId'], @@ -80,7 +80,8 @@ public function __construct($action, $imprints, $errors) 'label' => __('plugins.generic.thoth.imprint'), 'options' => $imprintOptions, 'required' => true, - 'groupId' => 'default' + 'groupId' => 'default', + 'value' => $imprints[0]['imprintId'] ?? null ])); } From b5d2b79b77db8b87097be75056ba742b2a4ed263 Mon Sep 17 00:00:00 2001 From: Thiago Date: Tue, 22 Oct 2024 17:01:10 -0400 Subject: [PATCH 2/2] Update version.xml Issue: documentacao-e-tarefas/desenvolvimento_e_infra#911 Signed-off-by: Thiago --- version.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.xml b/version.xml index e28a2f2..f21fa3a 100644 --- a/version.xml +++ b/version.xml @@ -3,8 +3,8 @@ thoth plugins.generic - 0.2.1.2 - 2024-10-21 + 0.2.1.3 + 2024-10-22 1 ThothPlugin