Skip to content

Commit

Permalink
fix: add support for deceased date
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thulin committed Mar 6, 2024
1 parent 1634119 commit 4d045c2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions frontend/app/source/php/Controller/Sok.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ public function actionSok(array $req) {
$this->data['basicData'] = [];

if($this->isDeregistered($person)) {

//Create deregistration state
$this->data['isDeregistered'] = true;
$this->data['deregistrationReason'] = $this->getDeristrationSentence(
$person->deregistrationReason
);

$this->data['basicData'] = $this->createBasicDataList(
$person,
Format::socialSecuriyNumber($req->pnr),
$this->getCivilStatus($this->data['searchFor'])
);

//Create deregistration state
$this->data['isDeregistered'] = true;
$this->data['deregistrationReason'] = $this->getDeristrationSentence(
$person->deregistrationReason,
$person->deregistrationDate ?? null
);

} else {

//Is not deregistered
Expand Down Expand Up @@ -162,7 +162,10 @@ public function isDeregistered($person) {
* @param string $reason The reason for deregistration.
* @return string The sentence indicating the deregistration status.
*/
public function getDeristrationSentence($reason) {
public function getDeristrationSentence($reason, $date = null) {
if(!is_null($date)) {
return "Personen är avregistrerad och har fått statusen: " . $reason . Format::addPharanthesis(Format::date($date));
}
return "Personen är avregistrerad och har fått statusen: " . $reason;
}

Expand Down

0 comments on commit 4d045c2

Please sign in to comment.