Skip to content

Commit 1ccb382

Browse files
authored
Merge branch 'develop' into feature/os2web_key
2 parents 44d0d3a + eecb47a commit 1ccb382

File tree

8 files changed

+86
-37
lines changed

8 files changed

+86
-37
lines changed

CHANGELOG.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,32 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1313

1414
- [#101](https://github.com/OS2Forms/os2forms/pull/101)
1515
- Added support for `os2web_key` in Digital post
16-
- Switched from saving settings in key value store to config, i.e
17-
the module needs to be reconfigured.
16+
- Switched from saving settings in key value store to config, i.e
17+
the module needs to be reconfigured.
1818
- Added support for `os2web_key` in Fasit handler.
1919
- Switched from saving settings in key value store to config, i.e
2020
the module needs to be reconfigured.
2121
- Removed modules ldap_auth, logging_alerts, maillog
22+
- Updating the display of os2forms package on the status page
23+
24+
## [4.0.0] 2025-03-06
25+
26+
- This is an alias for for 3.22.2. Major change is the module removal, which can lead to lack of backward support.
27+
See full release note here:
28+
https://github.com/OS2Forms/os2forms_docs/blob/master/docs/releases/2024-Q4-Release-notes.md
29+
30+
## [3.22.2] 2025-02-28
31+
32+
- Updated `os2web_audit`.
33+
34+
## [3.22.1] 2025-02-10
35+
36+
- Updated `os2forms_fbs_handler` to include and correct set phone number [#161](https://github.com/OS2Forms/os2forms/pull/161)
37+
38+
## [3.22.0] 2025-02-03
39+
40+
- Removed modules ldap_auth, logging_alerts, maillog [#151](https://github.com/OS2Forms/os2forms/pull/151)
41+
- Removed module image_widget_crop [#OS-143](https://github.com/OS2Forms/os2forms/pull/159)
2242

2343
## [3.21.2] 2025-01-07
2444

@@ -77,6 +97,13 @@ before starting to add changes. Use example [placed in the end of the page](#exa
7797

7898
## [3.16.0-beta1] 2024-08-27
7999

100+
## [3.16.0] 2024-08-27
101+
102+
f/OS-115_dawa_address
103+
- [OS-115] Skipping empty maktrikula objects
104+
105+
106+
80107
[#110](https://github.com/OS2Forms/os2forms/pull/110)
81108

82109
- Obsolete module removing - os2forms_consent
@@ -342,7 +369,10 @@ before starting to add changes. Use example [placed in the end of the page](#exa
342369
- Security in case of vulnerabilities.
343370
```
344371

345-
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.21.2...HEAD
372+
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.22.2...HEAD
373+
[3.22.2]: https://github.com/OS2Forms/os2forms/compare/3.22.1...3.22.2
374+
[3.22.1]: https://github.com/OS2Forms/os2forms/compare/3.22.0...3.22.1
375+
[3.22.0]: https://github.com/OS2Forms/os2forms/compare/3.21.2...3.22.0
346376
[3.21.2]: https://github.com/OS2Forms/os2forms/compare/3.21.1...3.21.2
347377
[3.21.1]: https://github.com/OS2Forms/os2forms/compare/3.21.0...3.21.1
348378
[3.21.0]: https://github.com/OS2Forms/os2forms/compare/3.20.1...3.21.0

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"drupal/events_logging": "^2.0@beta",
2323
"drupal/gin": "^3.0-rc",
2424
"drupal/honeypot": "^2.0",
25-
"drupal/image_widget_crop": "^2.3",
2625
"drupal/ldap": "^4.2",
2726
"drupal/leaflet": "^10.0",
2827
"drupal/leaflet_layers": "^1.1",
@@ -58,7 +57,7 @@
5857
"itk-dev/beskedfordeler-drupal": "^1.0",
5958
"itk-dev/serviceplatformen": "^1.5",
6059
"mglaman/composer-drupal-lenient": "^1.0",
61-
"os2web/os2web_audit": "^0.1.6",
60+
"os2web/os2web_audit": "^1.0",
6261
"os2web/os2web_datalookup": "^2.0",
6362
"os2web/os2web_key": "^1.0",
6463
"os2web/os2web_nemlogin": "^1.0",

modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ public function getMatrikulaEntries(string $matrikulaId) : array {
104104
if (NestedArray::keyExists($jsonDecoded, ['features', 0, 'properties', 'jordstykke'])) {
105105
$jordstykker = NestedArray::getValue($jsonDecoded, ['features', 0, 'properties', 'jordstykke']);
106106
foreach ($jordstykker as $jordstyk) {
107-
$matrikulaEntries[] = new DatafordelerMatrikula($jordstyk);
107+
try {
108+
$matrikulaEntries[] = new DatafordelerMatrikula($jordstyk);
109+
}
110+
catch (\TypeError $e) {
111+
// Could not create matrikula object.
112+
}
108113
}
109114
}
110115
}

modules/os2forms_fbs_handler/src/Client/FBS.php renamed to modules/os2forms_fbs_handler/src/Client/Fbs.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* Minimalistic client to create user with guardians at FBS.
1313
*/
14-
class FBS {
14+
class Fbs {
1515

1616
/**
1717
* FBS session key.
@@ -118,8 +118,14 @@ public function createPatronWithGuardian(Patron $patron, Guardian $guardian) {
118118
'pincode' => $patron->pincode,
119119
'preferredPickupBranch' => $patron->preferredPickupBranch,
120120
'name' => 'Unknown Name',
121-
'emailAddresses' => $patron->emailAddresses,
121+
'emailAddresses' => $patron->emailAddresses ?? [],
122122
'guardian' => $guardian->toArray(),
123+
'phoneNumbers' => $patron->phoneNumber ? [
124+
[
125+
'receiveNotification' => TRUE,
126+
'phoneNumber' => $patron->phoneNumber,
127+
],
128+
] : [],
123129
];
124130

125131
return $this->request($uri, $payload);
@@ -148,12 +154,13 @@ public function getPatron(string $patronId): ?Patron {
148154
(bool) $json->patron->receiveSms,
149155
(bool) $json->patron->receivePostalMail,
150156
$json->patron->notificationProtocols,
151-
$json->patron->phoneNumber,
152157
is_null($json->patron->onHold) ? $json->patron->onHold : (array) $json->patron->onHold,
153158
$json->patron->preferredLanguage,
154159
(bool) $json->patron->guardianVisibility,
155160
$json->patron->defaultInterestPeriod,
156161
(bool) $json->patron->resident,
162+
$json->patron->phoneNumber,
163+
157164
[
158165
[
159166
'emailAddress' => $json->patron->emailAddress,
@@ -185,15 +192,15 @@ public function updatePatron(Patron $patron): bool {
185192
$payload = [
186193
'patron' => [
187194
'preferredPickupBranch' => $patron->preferredPickupBranch,
188-
'emailAddresses' => $patron->emailAddresses,
195+
'emailAddresses' => $patron->emailAddresses ?? [],
189196
'guardianVisibility' => $patron->guardianVisibility,
190197
'receivePostalMail' => $patron->receiveEmail,
191-
'phoneNumbers' => [
198+
'phoneNumbers' => $patron->phoneNumber ? [
192199
[
193200
'receiveNotification' => TRUE,
194201
'phoneNumber' => $patron->phoneNumber,
195202
],
196-
],
203+
] : [],
197204
],
198205
'pincodeChange' => [
199206
'pincode' => $patron->pincode,

modules/os2forms_fbs_handler/src/Client/Model/Patron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public function __construct(
1919
public readonly ?bool $receiveSms = FALSE,
2020
public readonly ?bool $receivePostalMail = FALSE,
2121
public readonly ?array $notificationProtocols = NULL,
22-
public readonly ?string $phoneNumber = NULL,
2322
public readonly ?array $onHold = NULL,
2423
public readonly ?string $preferredLanguage = NULL,
2524
public readonly ?bool $guardianVisibility = NULL,
2625
public readonly ?int $defaultInterestPeriod = NULL,
2726
public readonly ?bool $resident = NULL,
2827
// Allow these properties below to be updatable.
28+
public ?string $phoneNumber = NULL,
2929
public ?array $emailAddresses = NULL,
3030
public ?bool $receiveEmail = NULL,
3131
public ?string $preferredPickupBranch = NULL,

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Drupal\advancedqueue\Job;
99
use Drupal\advancedqueue\JobResult;
1010
use Drupal\advancedqueue\Plugin\AdvancedQueue\JobType\JobTypeBase;
11-
use Drupal\os2forms_fbs_handler\Client\FBS;
11+
use Drupal\os2forms_fbs_handler\Client\Fbs;
1212
use Drupal\os2forms_fbs_handler\Client\Model\Guardian;
1313
use Drupal\os2forms_fbs_handler\Client\Model\Patron;
1414
use Drupal\os2web_audit\Service\Logger;
@@ -84,7 +84,7 @@ public function process(Job $job): JobResult {
8484
$config = $payload['configuration'];
8585

8686
try {
87-
$fbs = new FBS($this->client, $config['endpoint_url'], $config['agency_id'], $config['username'], $config['password']);
87+
$fbs = new Fbs($this->client, $config['endpoint_url'], $config['agency_id'], $config['username'], $config['password']);
8888

8989
// Log into FBS and obtain session.
9090
$fbs->login();
@@ -110,12 +110,17 @@ 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-
];
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'])) {
122+
$patron->phoneNumber = $data['barn_tlf'];
123+
}
119124
$patron->receiveEmail = TRUE;
120125
$patron->pincode = $data['pinkode'];
121126

@@ -127,15 +132,20 @@ public function process(Job $job): JobResult {
127132
// If "no" create child patron and guardian.
128133
$patron = new Patron();
129134
$patron->preferredPickupBranch = $data['afhentningssted'];
130-
$patron->emailAddresses = [
131-
[
132-
'emailAddress' => $data['barn_mail'],
133-
'receiveNotification' => TRUE,
134-
],
135-
];
135+
if (!empty($data['barn_mail'])) {
136+
$patron->emailAddresses = [
137+
[
138+
'emailAddress' => $data['barn_mail'],
139+
'receiveNotification' => TRUE,
140+
],
141+
];
142+
}
136143
$patron->receiveEmail = TRUE;
137144
$patron->personId = $data['barn_cpr'];
138145
$patron->pincode = $data['pinkode'];
146+
if (!empty($data['barn_tlf'])) {
147+
$patron->phoneNumber = $data['barn_tlf'];
148+
}
139149

140150
$fbs->createPatronWithGuardian($patron, $guardian);
141151
}

modules/os2forms_fbs_handler/src/Plugin/WebformHandler/FbsWebformHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public function postSave(WebformSubmissionInterface $webform_submission, $update
183183
'afhentningssted',
184184
'barn_cpr',
185185
'barn_mail',
186+
'barn_tlf',
186187
'cpr',
187188
'email',
188189
'navn',

os2forms.install

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Install file for OS2Forms module.
66
*/
77

8+
use Composer\InstalledVersions;
89
use Drupal\field\Entity\FieldConfig;
910
use Drupal\field\Entity\FieldStorageConfig;
1011
use Drupal\taxonomy\Entity\Term;
@@ -63,21 +64,17 @@ function os2forms_requirements($phase) {
6364
'value' => $messages,
6465
];
6566

66-
$commit_sha = exec('git rev-parse HEAD');
67-
$tag = exec("git describe --tags --abbrev=0");
68-
$remote = exec('git config --get remote.origin.url');
67+
$reference = InstalledVersions::getReference("os2forms/os2forms");
68+
$version = InstalledVersions::getPrettyVersion("os2forms/os2forms");
6969

7070
$version_messages = [
7171
'#prefix' => t('OS2Forms version'),
7272
'#theme' => 'item_list',
7373
'#items' => [
74-
0 => t('tag <strong>@tag</strong> (commit: <strong>@commit</strong>)', [
75-
'@tag' => $tag,
76-
'@commit' => $commit_sha,
77-
]),
78-
1 => t('remote: <strong>@remote</strong>', [
79-
'@remote' => $remote,
80-
]),
74+
0 => t('version <strong>@version</strong> (commit: <strong>@reference</strong>)', [
75+
'@version' => $version,
76+
'@reference' => $reference,
77+
])
8178
],
8279
];
8380

0 commit comments

Comments
 (0)