Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit ddb0a32

Browse files
authored
Merge pull request #161 from itk-dev/feature/3.1.0-updates
Feature/3.1.0 updates
2 parents c40e7c5 + 874a6a7 commit ddb0a32

20 files changed

+335
-136
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.env

+1-5
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ MAILER_URL=smtp://mailhog:1020
3636
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
3737
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
3838
# Configure your db driver and server_version in config/packages/doctrine.yaml
39-
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
40-
# Defaults to mysql 5.7
39+
DATABASE_URL=mysql://root:password@mariadb:3306/db?serverVersion=mariadb-10.11.5
4140
DATABASE_SERVER_VERSION='5.7'
4241
###< doctrine/doctrine-bundle ###
4342

@@ -65,7 +64,6 @@ DATAFORDELER_CVR_PRIVATE_KEY_FILE=''
6564
DATAFORDELER_CVR_PUBLIC_KEY_FILE=''
6665
DATAFORDELER_CVR_PUBLIC_KEY_PASSWORD=''
6766

68-
6967
SAML_SP_ENTITY_ID='https://kontrolgruppen.example.com'
7068
SAML_IDP_CONFIG_FILE='%kernel.project_dir%/saml/idp/idp.xml'
7169
# Optional
@@ -84,8 +82,6 @@ EXPORT_DIRECTORY='%kernel.project_dir%/files/export'
8482
# CPR Service
8583
CPR_SERVICE_URL=http://borgerdata:8081
8684

87-
88-
8985
AZURE_TENANT_ID=''
9086
AZURE_APPLICATION_ID=''
9187
AZURE_CLIENT_SECRET=''

CHANGELOG.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@ Versioning](https://semver.org/spec/v2.0.0.html).
1010

1111
## [Unreleased]
1212

13+
## [3.1.0] - 2023-11-08
14+
15+
### Changed
16+
17+
#### Features
18+
19+
- Name updates in database if changed in azure when user logs in with SAML
20+
- Case worker will be added automatically when case is created
21+
- Existing case columns removed
22+
- Texts has been updated
23+
24+
#### Bugfixes
25+
26+
- SAML working
27+
- Clicking on spouse will not show wrong person if there is a child in the list
28+
- Routing works from base url
29+
- Roles updates in database from Azure when logging in with SAML
30+
- Dash has been added to CPR when creating a case
31+
- OIS SSL bug will not longer break the visitation
32+
- There is no longer duplicate buttons in case page
33+
- Controllers use `EntityManagerInterface` from `BaseController` instead of\
34+
using `Doctrine`
35+
- Cases can be ended without breaking
36+
- Filters works in dashboard
37+
- Filters works in client journal
38+
1339
## [3.0.0] - 2023-11-08
1440

1541
### Changed
@@ -208,7 +234,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
208234

209235
- [KON-361](https://github.com/aakb/kontrolgruppen/pull/81): Changed datepicker
210236

211-
[Unreleased]: https://github.com/itk-dev/kontrolgruppen/compare/2.0.3...HEAD
237+
[Unreleased]: https://github.com/itk-dev/kontrolgruppen/compare/3.1.0...HEAD
238+
[3.1.0]: https://github.com/itk-dev/kontrolgruppen/compare/3.0.0...3.1.0
212239
[3.0.0]: https://github.com/itk-dev/kontrolgruppen/compare/2.0.3...3.0.0
213240
[2.0.3]: https://github.com/itk-dev/kontrolgruppen/compare/2.0.2...2.0.3
214241
[2.0.2]: https://github.com/itk-dev/kontrolgruppen/compare/2.0.1...2.0.2

UPGRADE.md

+27-14
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
11
<!-- markdownlint-disable MD024 -->
22

3-
# Release Notes
3+
# Upgrade notes
44

55
All upgrade notes for this project will be documented in this file.
66

77
## [Unreleased]
88

9+
## [3.1.0] - 2023-11-20
10+
11+
Nothing has been changed
12+
913
## [3.0.0] - 2023-11-08
1014

1115
- Run migrations
1216
- Run composer install
13-
- Create a `certs` folder in the root of the project and add Datafordeler certificates in the folder (ask @ahma0942 for certificates)
14-
- The following environment keys has been introduced (ask @ahma0942 for URLs & Public key passwords):
15-
```
16-
DATAFORDELER_CPR_URL=''
17-
DATAFORDELER_CPR_PRIVATE_KEY_FILE=''
18-
DATAFORDELER_CPR_PUBLIC_KEY_FILE=''
19-
DATAFORDELER_CPR_PUBLIC_KEY_PASSWORD=''
20-
21-
DATAFORDELER_CVR_URL=''
22-
DATAFORDELER_CVR_PRIVATE_KEY_FILE=''
23-
DATAFORDELER_CVR_PUBLIC_KEY_FILE=''
24-
DATAFORDELER_CVR_PUBLIC_KEY_PASSWORD=''
25-
```
17+
- Create a `certs` folder in the root of the project and add Datafordeler\
18+
certificates in the folder (ask @ahma0942 for certificates)
19+
- The following environment keys has been introduced (ask @ahma0942 for URLs &\
20+
Public key passwords):
21+
22+
```yaml
23+
DATAFORDELER_CPR_URL=''
24+
DATAFORDELER_CPR_PRIVATE_KEY_FILE=''
25+
DATAFORDELER_CPR_PUBLIC_KEY_FILE=''
26+
DATAFORDELER_CPR_PUBLIC_KEY_PASSWORD=''
27+
28+
DATAFORDELER_CVR_URL=''
29+
DATAFORDELER_CVR_PRIVATE_KEY_FILE=''
30+
DATAFORDELER_CVR_PUBLIC_KEY_FILE=''
31+
DATAFORDELER_CVR_PUBLIC_KEY_PASSWORD=''
32+
33+
DEFAULT_URI=''
34+
```
35+
36+
[Unreleased]: https://github.com/itk-dev/kontrolgruppen/compare/3.1.0...HEAD
37+
[3.1.0]: https://github.com/itk-dev/kontrolgruppen/compare/3.0.0...3.1.0
38+
[3.0.0]: https://github.com/itk-dev/kontrolgruppen/compare/2.0.3...3.0.0

core/Controller/ProcessClientController.php

+52
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Kontrolgruppen\CoreBundle\CPR\CprException;
1616
use Kontrolgruppen\CoreBundle\CPR\CprServiceInterface;
1717
use Kontrolgruppen\CoreBundle\Entity\AbstractProcessClient;
18+
use Kontrolgruppen\CoreBundle\Entity\Car;
19+
use Kontrolgruppen\CoreBundle\Entity\ContactPerson;
1820
use Kontrolgruppen\CoreBundle\Entity\Process;
1921
use Kontrolgruppen\CoreBundle\Entity\ProcessClientCompany;
2022
use Kontrolgruppen\CoreBundle\Entity\ProcessClientPerson;
@@ -201,6 +203,56 @@ public function update(Request $request, Process $process, TranslatorInterface $
201203
return $this->redirectToRoute('client_show', ['process' => $process]);
202204
}
203205

206+
/**
207+
* @Route("/update_client", name="client_update_info", methods={"POST"})
208+
*
209+
* @param Request $request
210+
* @param Process $process
211+
*
212+
* @return Response
213+
*/
214+
public function updateClient(Request $request, Process $process): Response
215+
{
216+
$this->denyAccessUnlessGranted('edit', $process);
217+
218+
// Redirect to show if process is completed.
219+
if (null !== $process->getCompletedAt()) {
220+
return $this->redirectToRoute('client_show', [
221+
'process' => $process->getId(),
222+
]);
223+
}
224+
225+
$client = $process->getProcessClient();
226+
227+
// Get the ProcessClient Identifier from process
228+
$processClientIdentifier = $client->getIdentifier();
229+
// Get client type
230+
$clientType = $client->getType();
231+
232+
if (ProcessClientPerson::PERSON === $clientType) {
233+
$client->setTelephone($request->get('telephone'));
234+
$car = new Car();
235+
$car->setRegistrationNumber($request->get('registrationNumber'));
236+
$client->addCar($car);
237+
$this->em->flush();
238+
$this->em->persist($client);
239+
$this->em->flush();
240+
} elseif (ProcessClientCompany::COMPANY === $clientType) {
241+
$contactPerson = new ContactPerson();
242+
$contactPerson->setName($request->get('contactPersonName'));
243+
$contactPerson->setTelephone($request->get('contactPersonPhone'));
244+
$client->setContactPerson($contactPerson);
245+
$client->setPNumber($request->get('pNumber'));
246+
$this->em->flush();
247+
$this->em->persist($client);
248+
$this->em->flush();
249+
}
250+
251+
return $this->redirectToRoute('client_show', [
252+
'process' => $process->getId(),
253+
]);
254+
}
255+
204256
/**
205257
* Check if new info is available for a client.
206258
*

core/Controller/ProcessController.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,12 @@ public function new(Request $request, ProcessManager $processManager, ProcessCli
205205
} catch (\Exception $exception) {
206206
$this->addFlash('danger', $exception->getMessage());
207207
}
208-
$case_worker = $request->get('case_worker');
208+
$caseWorker = $request->get('case_worker');
209209
$identifier = $request->get('identifier');
210210

211-
212-
$case_worker = $userRepository->findOneBy(['username' => $case_worker]);
211+
$caseWorker = $userRepository->findOneBy(['username' => $caseWorker]);
213212
$process->setProcessClient($client);
214-
$process->setCaseWorker($case_worker);
213+
$process->setCaseWorker($caseWorker);
215214

216215
$form = $this->createForm(ProcessType::class, $process, [
217216
// Add the `personnummer` option to the form.
@@ -241,7 +240,7 @@ public function new(Request $request, ProcessManager $processManager, ProcessCli
241240
$dataFordelerData = $datafordelerService->getPersonData($processClientIdentifier);
242241
} elseif (ProcessClientCompany::COMPANY === $clientType) {
243242
$dataFordelerData = $datafordelerService->getVirksomhedData($processClientIdentifier);
244-
$client->setAddress($dataFordelerData['beliggenhedsadresse']['CVRAdresse_vejnavn'] . " " . $dataFordelerData['beliggenhedsadresse']['CVRAdresse_husnummerFra'] ?? null);
243+
$client->setAddress($dataFordelerData['beliggenhedsadresse']['CVRAdresse_vejnavn'].' '.$dataFordelerData['beliggenhedsadresse']['CVRAdresse_husnummerFra'] ?? null);
245244
$client->setPostalCode($dataFordelerData['beliggenhedsadresse']['CVRAdresse_postnummer'] ?? null);
246245
$client->setCity($dataFordelerData['beliggenhedsadresse']['CVRAdresse_postdistrikt'] ?? null);
247246

core/Resources/translations/messages.da.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ common:
215215
title: Kontrolgruppen
216216
loading: Henter data ...
217217
empty_field_value: Feltet er ikke udfyldt
218+
enter_name: Indtast navn
219+
enter_p_number: Tilknyt relateret p-nummer
220+
enter_phone: Indtast telefonnummer
221+
enter_register: Indtast nummerplade
218222

219223
conclusion:
220224
edit:
@@ -634,7 +638,7 @@ visitation:
634638
address: Adresse
635639
phone: Telefon
636640
mail: Mail
637-
registration_history: Registrations Historik
641+
registration_history: Registreringshistorik
638642
p_number_history: Hent Flere
639643
period: Periode
640644
workers: Ansatte
@@ -1169,6 +1173,7 @@ sidebar:
11691173
cpr: CPR nummer
11701174
name: Navn
11711175
car_shared_ownership: Fælles ejet
1176+
plate: Nummerplade
11721177

11731178
weighted_conclusion:
11741179
form:

core/Resources/views/client/company/show.html.twig

+93-19
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,108 @@
1313
{% endif %}
1414
{% endif %}
1515

16-
<h1>{{ 'client.show.title'|trans }}</h1>
16+
<h1 class="mt-5">{{ 'client.show.title'|trans }}</h1>
1717

1818
{% if process.completedAt %}
1919
<div class="alert alert-warning">{{ 'process.completed_message'|trans }}</div>
2020
{% endif %}
21+
{% if canEdit %}
22+
<hr class="mt-2">
23+
<div class="row col-md-12">
24+
<div class="col-md-12 mb-5">
25+
<form method="POST" action="{{ path('client_update_info', {'process': process}) }}">
26+
<div class="form-group col-md-6">
27+
<div class="form-group">
28+
<label for="pNumber">{{ 'visitation.company.p_numbers'|trans }}</label>
29+
<select name="pNumber" id="pNumber" class="form-control" placeholder="{{ 'common.enter_p_numbers'|trans }}">
30+
{% for all_pnumbers in data.produktionsenheder %}
31+
<option value="{{ all_pnumbers.pNummer|e }}" {% if client.pNumber is not empty and client.pNumber == all_pnumbers.pNummer %}selected{% endif %}>{{ all_pnumbers.pNummer|e }}</option>
32+
{% endfor %}
33+
</select>
34+
</div>
35+
</div>
36+
<div class="form-group col-md-12">
37+
<div class="row">
38+
<div class="col-md-12">
39+
<label>{{ 'client.sections.contact_person'|trans }}</label>
40+
</div>
41+
<div class="col-md-6">
42+
<input type="text" id="contactPersonName" name="contactPersonName" class="form-control" placeholder="{{ 'common.enter_name'|trans }}" value="{{ client.contactPerson.name ? client.contactPerson.name : '' }}">
43+
</div>
44+
<div class="col-md-6">
45+
<input type="text" id="contactPersonPhone" name="contactPersonPhone" class="form-control" placeholder="{{ 'common.enter_phone'|trans }}" value="{{ client.contactPerson.telephone ? client.contactPerson.telephone : '' }}">
46+
</div>
47+
</div>
48+
</div>
49+
<div class="col-md-12">
50+
<button type="submit" id="submit-button" class="btn btn-primary mt-4 float-right">{{ 'common.actions.save'|trans }}</button>
51+
</div>
52+
</form>
53+
</div>
54+
</div>
55+
<hr class="mt-2">
2156

22-
<div class="col-md-9 left-tables">
23-
{# Adresse historik Table #}
24-
{% include '@KontrolgruppenCore/visitation/company_tables/created_date.html.twig' with {'data': data} %}
57+
{% endif %}
58+
<div class="row col-md-12">
59+
<div class="col-md-12 left-tables mt-2">
60+
{# Adresse historik Table #}
61+
{% include '@KontrolgruppenCore/visitation/company_tables/created_date.html.twig' with {'data': data} %}
2562

26-
{# Bopælssamling Table #}
27-
{% include '@KontrolgruppenCore/visitation/company_tables/real_owners.html.twig' %}
63+
{# Bopælssamling Table #}
64+
{% include '@KontrolgruppenCore/visitation/company_tables/real_owners.html.twig' %}
2865

29-
{# Bolig Table #}
30-
{% include '@KontrolgruppenCore/visitation/company_tables/registration_history.html.twig' %}
66+
{# Bolig Table #}
67+
{% include '@KontrolgruppenCore/visitation/company_tables/registration_history.html.twig' %}
3168

32-
{# Børn Table #}
33-
{% include '@KontrolgruppenCore/visitation/company_tables/history.html.twig' %}
69+
{# Børn Table #}
70+
{% include '@KontrolgruppenCore/visitation/company_tables/history.html.twig' %}
3471

35-
{# Civilstatus Table #}
36-
{% include '@KontrolgruppenCore/visitation/company_tables/p_number.html.twig' %}
72+
{# Civilstatus Table #}
73+
{% include '@KontrolgruppenCore/visitation/company_tables/p_number.html.twig' %}
3774

38-
{# CPR historik Table #}
39-
{% include '@KontrolgruppenCore/visitation/company_tables/amount_workers.html.twig' %}
40-
<div class="d-flex justify-content-between">
41-
<div></div>
42-
{% if canEdit %}
43-
<a href="{{ path('client_edit', {'process': process.id}) }}" class="btn btn-primary float-right pl-5 pr-5">{{ 'common.actions.edit'|trans }}</a>
44-
{% endif %}
75+
{# CPR historik Table #}
76+
{% include '@KontrolgruppenCore/visitation/company_tables/amount_workers.html.twig' %}
77+
78+
</div>
4579
</div>
4680
{% endblock %}
81+
{% block javascripts %}
82+
{{ parent() }}
83+
<script>
84+
$(document).ready(function() {
85+
// Function to check the state of inputs and toggle the button's disabled state
86+
function toggleSubmitButtonState() {
87+
var ispNumber = $('#pNumber').val() === '';
88+
var isContactPersonName = $('#contactPersonName').val() === '';
89+
90+
// If either input is empty, disable the button, else enable it
91+
$('#submit-button').prop('disabled', ispNumber || isContactPersonName);
92+
}
93+
94+
// Call the function to set the initial state of the button
95+
toggleSubmitButtonState();
96+
97+
// Bind the input fields to the keyup event to check their state every time the user types
98+
$('#pNumber, #contactPersonName').on('keyup', toggleSubmitButtonState);
99+
});
100+
</script>
101+
{% endblock %}
102+
{% block stylesheets %}
103+
{{ parent() }}
104+
<style>
105+
.form-button-top-left {
106+
position: absolute;
107+
top: 0;
108+
left: 150%;
109+
margin-top: 1rem; /* Adjust as needed */
110+
margin-left: 1rem; /* Adjust as needed */
111+
}
112+
.parent-relative {
113+
position: relative;
114+
}
115+
hr{
116+
border-top: 1px solid #000000;
117+
}
118+
</style>
119+
{% endblock %}
120+

0 commit comments

Comments
 (0)