Skip to content

Commit 8c1b267

Browse files
Contact/Contactgroup(From): Add value for external_uuid column on insert
Contactgroup: Don't trim groupname, as we donot do this in any other form.
1 parent fe770b9 commit 8c1b267

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

application/forms/ContactGroupForm.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use ipl\Web\Compat\CompatForm;
1818
use ipl\Web\FormElement\TermInput;
1919
use ipl\Web\FormElement\TermInput\Term;
20+
use Ramsey\Uuid\Uuid;
2021

2122
class ContactGroupForm extends CompatForm
2223
{
@@ -173,7 +174,13 @@ public function addGroup(): int
173174

174175
$this->db->beginTransaction();
175176

176-
$this->db->insert('contactgroup', ['name' => trim($data['group_name'])]);
177+
$this->db->insert(
178+
'contactgroup',
179+
[
180+
'name' => $data['group_name'],
181+
'external_uuid' => Uuid::uuid4()->toString()
182+
]
183+
);
177184

178185
$groupIdentifier = $this->db->lastInsertId();
179186

library/Notifications/Web/Form/ContactForm.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use ipl\Validator\EmailAddressValidator;
1919
use ipl\Web\Common\CsrfCounterMeasure;
2020
use ipl\Web\Compat\CompatForm;
21+
use Ramsey\Uuid\Uuid;
2122

2223
class ContactForm extends CompatForm
2324
{
@@ -190,6 +191,7 @@ public function addOrUpdateContact(): void
190191

191192
$addressFromDb = [];
192193
if ($this->contactId === null) {
194+
$contact['external_uuid'] = Uuid::uuid4()->toString();
193195
$this->db->insert('contact', $contact);
194196
$this->contactId = $this->db->lastInsertId();
195197
} else {

0 commit comments

Comments
 (0)