From 4d045c210d945ae78765ba677b609f7c23571805 Mon Sep 17 00:00:00 2001 From: Sebastian Thulin Date: Wed, 6 Mar 2024 11:55:17 +0100 Subject: [PATCH] fix: add support for deceased date --- frontend/app/source/php/Controller/Sok.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/app/source/php/Controller/Sok.php b/frontend/app/source/php/Controller/Sok.php index 3bd234f..a082d78 100644 --- a/frontend/app/source/php/Controller/Sok.php +++ b/frontend/app/source/php/Controller/Sok.php @@ -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 @@ -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; }