Skip to content

Commit c7e4747

Browse files
authored
Merge pull request #1413 from it-at-m/feature-zmskvr-813-show-location-infomation-for-wating-area-in-citizenview
feat(zmskvr-813):make hint available to AppointmentSummary
2 parents 5b8dc17 + 0981682 commit c7e4747

19 files changed

+100
-45
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ We use PHPCS (following PSR-12 standards) and PHPMD to maintain code quality and
129129
To run Checks locally in your local docker container:
130130

131131
0. Run all at once:
132-
- `ddev exec "./cli modules loop 'vendor/bin/phpcs --standard=psr12 src/'"`
133-
- `ddev exec "./cli modules loop 'vendor/bin/phpcbf --standard=psr12 src/'"`
132+
- `ddev exec "./cli modules loop 'vendor/bin/phpcs --standard=psr12 src/'" && ddev exec "./cli modules loop 'vendor/bin/phpcbf --standard=psr12 src'"`
134133
1. Enter the container (if using DDEV or Docker):
135134
- `ddev ssh`
136135
2. Go to the desired module directory:

zmscitizenapi/src/Zmscitizenapi/Models/ThinnedScope.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ class ThinnedScope extends Entity implements JsonSerializable
3131
public ?string $slotsPerAppointment;
3232
public ?string $appointmentsPerMail;
3333
public ?string $whitelistedMails;
34-
public ?int $reservationDuration = null;
35-
public ?int $activationDuration = null;
34+
public ?int $reservationDuration;
35+
public ?int $activationDuration;
36+
public ?string $hint;
3637

37-
public function __construct(int $id = 0, ?ThinnedProvider $provider = null, ?string $shortName = null, ?string $emailFrom = null, ?bool $emailRequired = null, ?bool $telephoneActivated = null, ?bool $telephoneRequired = null, ?bool $customTextfieldActivated = null, ?bool $customTextfieldRequired = null, ?string $customTextfieldLabel = null, ?bool $customTextfield2Activated = null, ?bool $customTextfield2Required = null, ?string $customTextfield2Label = null, ?bool $captchaActivatedRequired = null, ?string $infoForAppointment = null, ?string $infoForAllAppointments = null, ?string $slotsPerAppointment = null, ?string $appointmentsPerMail = null, ?string $whitelistedMails = null, ?int $reservationDuration = null, ?int $activationDuration = null)
38+
public function __construct(int $id = 0, ?ThinnedProvider $provider = null, ?string $shortName = null, ?string $emailFrom = null, ?bool $emailRequired = null, ?bool $telephoneActivated = null, ?bool $telephoneRequired = null, ?bool $customTextfieldActivated = null, ?bool $customTextfieldRequired = null, ?string $customTextfieldLabel = null, ?bool $customTextfield2Activated = null, ?bool $customTextfield2Required = null, ?string $customTextfield2Label = null, ?bool $captchaActivatedRequired = null, ?string $infoForAppointment = null, ?string $infoForAllAppointments = null, ?string $slotsPerAppointment = null, ?string $appointmentsPerMail = null, ?string $whitelistedMails = null, ?int $reservationDuration = null, ?int $activationDuration = null, ?string $hint = null)
3839
{
3940
$this->id = $id;
4041
$this->provider = $provider;
@@ -57,6 +58,7 @@ public function __construct(int $id = 0, ?ThinnedProvider $provider = null, ?str
5758
$this->whitelistedMails = $whitelistedMails;
5859
$this->reservationDuration = $reservationDuration;
5960
$this->activationDuration = $activationDuration;
61+
$this->hint = $hint;
6062
$this->ensureValid();
6163
}
6264

@@ -167,6 +169,11 @@ public function getActivationDuration(): ?int
167169
return $this->activationDuration;
168170
}
169171

172+
public function getHint(): ?string
173+
{
174+
return $this->hint;
175+
}
176+
170177
public function toArray(): array
171178
{
172179
return [
@@ -190,7 +197,8 @@ public function toArray(): array
190197
'appointmentsPerMail' => $this->appointmentsPerMail,
191198
'whitelistedMails' => $this->whitelistedMails,
192199
'reservationDuration' => $this->reservationDuration,
193-
'activationDuration' => $this->activationDuration
200+
'activationDuration' => $this->activationDuration,
201+
'hint' => $this->hint
194202
];
195203
}
196204

zmscitizenapi/src/Zmscitizenapi/Services/Core/MapperService.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ public static function mapOfficesWithScope(ProviderList $providerList, bool $sho
105105
continue;
106106
}
107107

108-
$rd = self::extractReservationDuration($providerScope);
109-
110108
$offices[] = new Office(
111109
id: isset($provider->id) ? (int) $provider->id : 0,
112110
name: isset($provider->displayName) ? $provider->displayName : (isset($provider->name) ? $provider->name : null),
@@ -142,8 +140,9 @@ public static function mapOfficesWithScope(ProviderList $providerList, bool $sho
142140
: null,
143141
appointmentsPerMail: isset($providerScope->appointmentsPerMail) ? ((string) $providerScope->appointmentsPerMail === '' ? null : (string) $providerScope->appointmentsPerMail) : null,
144142
whitelistedMails: isset($providerScope->whitelistedMails) ? ((string) $providerScope->whitelistedMails === '' ? null : (string) $providerScope->whitelistedMails) : null,
145-
reservationDuration: $rd,
146-
activationDuration: self::extractActivationDuration($providerScope)
143+
reservationDuration: (int) self::extractReservationDuration($providerScope),
144+
activationDuration: self::extractActivationDuration($providerScope),
145+
hint: isset($providerScope->hint) ? (trim((string) $providerScope->hint) === '' ? null : (string) $providerScope->hint) : null
147146
) : null,
148147
maxSlotsPerAppointment: isset($providerScope) && !isset($providerScope['errors']) && isset($providerScope->slotsPerAppointment) ? ((string) $providerScope->slotsPerAppointment === '' ? null : (string) $providerScope->slotsPerAppointment) : null
149148
);
@@ -299,7 +298,8 @@ public static function scopeToThinnedScope(Scope $scope): ThinnedScope
299298
appointmentsPerMail: isset($scope->data['appointmentsPerMail']) ? ((string) $scope->data['appointmentsPerMail'] === '' ? null : (string) $scope->data['appointmentsPerMail']) : null,
300299
whitelistedMails: isset($scope->data['whitelistedMails']) ? ((string) $scope->data['whitelistedMails'] === '' ? null : (string) $scope->data['whitelistedMails']) : null,
301300
reservationDuration: MapperService::extractReservationDuration($scope),
302-
activationDuration: MapperService::extractActivationDuration($scope)
301+
activationDuration: MapperService::extractActivationDuration($scope),
302+
hint: (trim((string) ($scope->getScopeHint() ?? '')) === '') ? null : (string) $scope->getScopeHint()
303303
);
304304
}
305305

zmscitizenapi/src/Zmscitizenapi/Services/Core/ZmsApiFacadeService.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public static function getOffices(bool $showUnpublished = false): OfficeList
9191
}
9292

9393
$matchingScope = $scopeMap[$provider->source . '_' . $provider->id] ?? null;
94-
$rd = MapperService::extractReservationDuration($matchingScope);
9594
$offices[] = new Office(
9695
id: (int) $provider->id,
9796
name: $provider->displayName ?? $provider->name,
@@ -122,8 +121,9 @@ public static function getOffices(bool $showUnpublished = false): OfficeList
122121
slotsPerAppointment: ((string) $matchingScope->getSlotsPerAppointment() === '' ? null : (string) $matchingScope->getSlotsPerAppointment()),
123122
appointmentsPerMail: ((string) $matchingScope->getAppointmentsPerMail() === '' ? null : (string) $matchingScope->getAppointmentsPerMail()),
124123
whitelistedMails: ((string) $matchingScope->getWhitelistedMails() === '' ? null : (string) $matchingScope->getWhitelistedMails()),
125-
reservationDuration: $rd,
126-
activationDuration: MapperService::extractActivationDuration($matchingScope)
124+
activationDuration: MapperService::extractActivationDuration($matchingScope),
125+
reservationDuration: (int) MapperService::extractReservationDuration($matchingScope),
126+
hint: ($matchingScope && trim((string) $matchingScope->getScopeHint()) !== '') ? (string) $matchingScope->getScopeHint() : null
127127
) : null,
128128
maxSlotsPerAppointment: $matchingScope ? ((string) $matchingScope->getSlotsPerAppointment() === '' ? null : (string) $matchingScope->getSlotsPerAppointment()) : null
129129
);
@@ -160,7 +160,6 @@ public static function getScopes(): ThinnedScopeList|array
160160
$key = $provider->source . '_' . $provider->id;
161161
if (isset($scopeMap[$key])) {
162162
$matchingScope = $scopeMap[$key];
163-
$rd = MapperService::extractReservationDuration($matchingScope);
164163
$scopesProjectionList[] = new ThinnedScope(
165164
id: (int) $matchingScope->id,
166165
provider: MapperService::providerToThinnedProvider($provider),
@@ -181,8 +180,9 @@ public static function getScopes(): ThinnedScopeList|array
181180
slotsPerAppointment: ((string) $matchingScope->getSlotsPerAppointment() === '' ? null : (string) $matchingScope->getSlotsPerAppointment()),
182181
appointmentsPerMail: ((string) $matchingScope->getAppointmentsPerMail() === '' ? null : (string) $matchingScope->getAppointmentsPerMail()),
183182
whitelistedMails: ((string) $matchingScope->getWhitelistedMails() === '' ? null : (string) $matchingScope->getWhitelistedMails()),
184-
reservationDuration: $rd,
185-
activationDuration: MapperService::extractActivationDuration($matchingScope)
183+
reservationDuration: (int) MapperService::extractReservationDuration($matchingScope),
184+
activationDuration: MapperService::extractActivationDuration($matchingScope),
185+
hint: ($matchingScope && trim((string) $matchingScope->getScopeHint()) !== '') ? (string) $matchingScope->getScopeHint() : null
186186
);
187187
}
188188
}
@@ -277,7 +277,6 @@ public static function getScopeByOfficeId(int $officeId): ThinnedScope|array
277277
$finalProvider = $providerKey && isset($providerMap[$providerKey])
278278
? $providerMap[$providerKey]
279279
: $scopeProvider;
280-
$rd = MapperService::extractReservationDuration($matchingScope);
281280
$result = [
282281
'id' => $matchingScope->id,
283282
'provider' => MapperService::providerToThinnedProvider($finalProvider) ?? null,
@@ -298,8 +297,9 @@ public static function getScopeByOfficeId(int $officeId): ThinnedScope|array
298297
'slotsPerAppointment' => ((string) $matchingScope->getSlotsPerAppointment() === '' ? null : (string) $matchingScope->getSlotsPerAppointment()) ?? null,
299298
'appointmentsPerMail' => ((string) $matchingScope->getAppointmentsPerMail() === '' ? null : (string) $matchingScope->getAppointmentsPerMail()) ?? null,
300299
'whitelistedMails' => ((string) $matchingScope->getWhitelistedMails() === '' ? null : (string) $matchingScope->getWhitelistedMails()) ?? null,
301-
'reservationDuration' => $rd,
302-
'activationDuration' => MapperService::extractActivationDuration($matchingScope)
300+
'reservationDuration' => (int) MapperService::extractReservationDuration($matchingScope),
301+
'activationDuration' => MapperService::extractActivationDuration($matchingScope),
302+
'hint' => (trim((string) ($matchingScope->getScopeHint() ?? '')) === '') ? null : (string) $matchingScope->getScopeHint(),
303303
];
304304
return new ThinnedScope(
305305
id: (int) $result['id'],
@@ -322,7 +322,8 @@ public static function getScopeByOfficeId(int $officeId): ThinnedScope|array
322322
appointmentsPerMail: $result['appointmentsPerMail'],
323323
whitelistedMails: $result['whitelistedMails'],
324324
reservationDuration: $result['reservationDuration'],
325-
activationDuration: $result['activationDuration']
325+
activationDuration: $result['activationDuration'],
326+
hint: $result['hint']
326327
);
327328
}
328329

@@ -434,7 +435,6 @@ public static function getScopeById(?int $scopeId): ThinnedScope|array
434435
$matchingProv = ($providerKey && isset($providerMap[$providerKey]))
435436
? $providerMap[$providerKey]
436437
: $scopeProvider;
437-
$rd = MapperService::extractReservationDuration($matchingScope);
438438
return new ThinnedScope(
439439
id: (int) $matchingScope->id,
440440
provider: MapperService::providerToThinnedProvider($matchingProv),
@@ -455,8 +455,9 @@ public static function getScopeById(?int $scopeId): ThinnedScope|array
455455
slotsPerAppointment: ((string) $matchingScope->getSlotsPerAppointment() === '' ? null : (string) $matchingScope->getSlotsPerAppointment()) ?? null,
456456
appointmentsPerMail: ((string) $matchingScope->getAppointmentsPerMail() === '' ? null : (string) $matchingScope->getAppointmentsPerMail()) ?? null,
457457
whitelistedMails: ((string) $matchingScope->getWhitelistedMails() === '' ? null : (string) $matchingScope->getWhitelistedMails()) ?? null,
458-
reservationDuration: $rd,
459-
activationDuration: MapperService::extractActivationDuration($matchingScope)
458+
reservationDuration: (int) MapperService::extractReservationDuration($matchingScope),
459+
activationDuration: MapperService::extractActivationDuration($matchingScope),
460+
hint: ((string) $matchingScope->getScopeHint() === '' ? null : (string) $matchingScope->getScopeHint()) ?? null
460461
);
461462
}
462463

@@ -719,7 +720,6 @@ public static function getThinnedProcessById(?int $processId, ?string $authKey):
719720
$providerKey = $scopeProvider ? ($scopeProvider->getSource() . '_' . $scopeProvider->id) : null;
720721
$matchingProvider = $providerKey && isset($providerMap[$providerKey]) ? $providerMap[$providerKey] : $scopeProvider;
721722
$thinnedProvider = MapperService::providerToThinnedProvider($matchingProvider);
722-
$rd = MapperService::extractReservationDuration($process->scope);
723723
$thinnedScope = new ThinnedScope(
724724
id: (int) $process->scope->id,
725725
provider: $thinnedProvider,
@@ -740,8 +740,9 @@ public static function getThinnedProcessById(?int $processId, ?string $authKey):
740740
slotsPerAppointment: ((string) $process->scope->getSlotsPerAppointment() === '' ? null : (string) $process->scope->getSlotsPerAppointment()) ?? null,
741741
appointmentsPerMail: ((string) $process->scope->getAppointmentsPerMail() === '' ? null : (string) $process->scope->getAppointmentsPerMail()) ?? null,
742742
whitelistedMails: ((string) $process->scope->getWhitelistedMails() === '' ? null : (string) $process->scope->getWhitelistedMails()) ?? null,
743-
reservationDuration: $rd,
744-
activationDuration: MapperService::extractActivationDuration($process->scope)
743+
reservationDuration: (int) MapperService::extractReservationDuration($process->scope),
744+
activationDuration: MapperService::extractActivationDuration($process->scope),
745+
hint: ((string) $process->scope->getScopeHint() === '' ? null : (string) $process->scope->getScopeHint()) ?? null
745746
);
746747
}
747748

zmscitizenapi/tests/Zmscitizenapi/Controllers/Appointment/AppointmentByIdControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ public function testRendering()
105105
"appointmentsPerMail" => 1,
106106
"whitelistedMails" => null,
107107
"reservationDuration" => 15,
108-
"activationDuration" => 15
108+
"activationDuration" => 15,
109+
"hint"=> null
109110
],
110111
"subRequestCounts" => [],
111112
"serviceId" => 1063424,

zmscitizenapi/tests/Zmscitizenapi/Controllers/Appointment/AppointmentCancelControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public function testRendering()
109109
"appointmentsPerMail" => null,
110110
"whitelistedMails" => null,
111111
"reservationDuration" => null,
112-
"activationDuration" => null
112+
"activationDuration" => null,
113+
"hint" => null
113114
],
114115
'subRequestCounts' => [],
115116
'serviceId' => 10242339,

zmscitizenapi/tests/Zmscitizenapi/Controllers/Appointment/AppointmentConfirmControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public function testRendering()
106106
"appointmentsPerMail" => null,
107107
"whitelistedMails" => null,
108108
"reservationDuration" => null,
109-
"activationDuration" => null
109+
"activationDuration" => null,
110+
"hint" => null
110111
],
111112
'subRequestCounts' => [],
112113
'serviceId' => 10242339,

zmscitizenapi/tests/Zmscitizenapi/Controllers/Appointment/AppointmentPreconfirmControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ public function testRendering()
104104
"appointmentsPerMail" => null,
105105
"whitelistedMails" => null,
106106
"reservationDuration" => null,
107-
"activationDuration" => null
107+
"activationDuration" => null,
108+
"hint" => null
108109
],
109110
'subRequestCounts' => [],
110111
'serviceId' => 10242339,

zmscitizenapi/tests/Zmscitizenapi/Controllers/Appointment/AppointmentReserveControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ public function testRendering()
108108
"appointmentsPerMail" => null,
109109
"whitelistedMails" => null,
110110
"reservationDuration" => null,
111-
"activationDuration" => null
111+
"activationDuration" => null,
112+
"hint" => null
112113
],
113114
"subRequestCounts" => [],
114115
"serviceId" => 0,

zmscitizenapi/tests/Zmscitizenapi/Controllers/Appointment/AppointmentUpdateControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ public function testRendering()
105105
"appointmentsPerMail" => null,
106106
"whitelistedMails" => null,
107107
"reservationDuration" => null,
108-
"activationDuration" => null
108+
"activationDuration" => null,
109+
"hint" => null
109110
],
110111
"status" => "reserved",
111112
"subRequestCounts" => [],

0 commit comments

Comments
 (0)