Skip to content

Commit

Permalink
fix RPPS title import
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizokou committed Oct 1, 2024
1 parent 27d7b5a commit eae2c43
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/Service/RPPSService.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,31 @@ protected function processRPPS(array $data): ?RPPS
}

$rpps->setIdRpps($data[1]);
$rpps->setTitle($data[6]);

// $data[3] : DR
// $data[4] : Docteur
// $data[5] : M
// $data[6] : Monsieur
// Title assignment based on priority: data[4] / data[3] / data[6] / data[5]
$title = null;
foreach ([$data[4], $data[3], $data[6], $data[5]] as $candidate) {
if (!empty($candidate)) {
$title = $candidate;
break;
}
}

// Map short titles to extended versions
$titleMapping = [
'M' => 'Monsieur',
'DR' => 'Docteur',
'MME' => 'Madame',
'PR' => 'Professeur',
];

$expandedTitle = $titleMapping[$title] ?? $title;
$rpps->setTitle($expandedTitle);

$rpps->setLastName($data[7]);
$rpps->setFirstName($data[8]);

Expand Down

0 comments on commit eae2c43

Please sign in to comment.