Skip to content

Commit abc2ee5

Browse files
committed
Changed validation to check for empty string instead of null
1 parent 715c5c4 commit abc2ee5

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

modules/os2forms_fbs_handler/src/Plugin/AdvancedQueue/JobType/FbsCreateUser.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,15 @@ public function process(Job $job): JobResult {
110110
if (!is_null($patron)) {
111111
// Create Patron object with updated values.
112112
$patron->preferredPickupBranch = $data['afhentningssted'];
113-
$patron->emailAddresses = [
114-
[
115-
'emailAddress' => $data['barn_mail'],
116-
'receiveNotification' => TRUE,
117-
],
118-
];
119-
if (isset($data['barn_tlf'])) {
113+
if (!empty($data['barn_mail'])) {
114+
$patron->emailAddresses = [
115+
[
116+
'emailAddress' => $data['barn_mail'],
117+
'receiveNotification' => TRUE,
118+
],
119+
];
120+
}
121+
if (!empty($data['barn_tlf'])) {
120122
$patron->phoneNumber = $data['barn_tlf'];
121123
}
122124
$patron->receiveEmail = TRUE;
@@ -130,16 +132,18 @@ public function process(Job $job): JobResult {
130132
// If "no" create child patron and guardian.
131133
$patron = new Patron();
132134
$patron->preferredPickupBranch = $data['afhentningssted'];
133-
$patron->emailAddresses = [
134-
[
135-
'emailAddress' => $data['barn_mail'],
136-
'receiveNotification' => TRUE,
137-
],
138-
];
135+
if (!empty($data['barn_mail'])) {
136+
$patron->emailAddresses = [
137+
[
138+
'emailAddress' => $data['barn_mail'],
139+
'receiveNotification' => TRUE,
140+
],
141+
];
142+
}
139143
$patron->receiveEmail = TRUE;
140144
$patron->personId = $data['barn_cpr'];
141145
$patron->pincode = $data['pinkode'];
142-
if (isset($data['barn_tlf'])) {
146+
if (!empty($data['barn_tlf'])) {
143147
$patron->phoneNumber = $data['barn_tlf'];
144148
}
145149

0 commit comments

Comments
 (0)