Skip to content
Snippets Groups Projects
Commit 4f360150 authored by Laurent's avatar Laurent
Browse files

hotline #106570 fix import patrons with DOS encoded file

parent 6904ff72
Branches
Tags
2 merge requests!3578Hotline,!3576hotline #106570 fix import patrons with DOS encoded file
Pipeline #10643 passed with stage
in 44 minutes and 21 seconds
- ticket #106570 : Correction de l'import des abonnés via fichier CSV au format DOS
\ No newline at end of file
...@@ -39,7 +39,6 @@ class Class_Cosmogramme_Integration_PhasePatrons extends Class_Cosmogramme_Integ ...@@ -39,7 +39,6 @@ class Class_Cosmogramme_Integration_PhasePatrons extends Class_Cosmogramme_Integ
public function importPatronRecord($data, $integration) { public function importPatronRecord($data, $integration) {
$patron = new Class_Cosmogramme_Integration_Record_Patron($integration); $patron = new Class_Cosmogramme_Integration_Record_Patron($integration);
return $patron->import($integration->isFormatXml() return $patron->import($integration->isFormatXml()
? $data ? $data
: $this->mapRecordColumns($integration, $data), : $this->mapRecordColumns($integration, $data),
......
...@@ -41,6 +41,8 @@ class Class_Cosmogramme_Integration_Record_Patron { ...@@ -41,6 +41,8 @@ class Class_Cosmogramme_Integration_Record_Patron {
public function importFicheArray($enreg) { public function importFicheArray($enreg) {
$enreg = array_map([$this, 'changeAccents'],
$enreg);
$enreg = $this->prepareData($enreg); $enreg = $this->prepareData($enreg);
if ($library_code = $this->_known_fields->libraryCodeFrom($enreg)) { if ($library_code = $this->_known_fields->libraryCodeFrom($enreg)) {
......
...@@ -739,4 +739,40 @@ class PhasePatronsUpdateWithEmptyMailTest extends PhasePatronsTestCase { ...@@ -739,4 +739,40 @@ class PhasePatronsUpdateWithEmptyMailTest extends PhasePatronsTestCase {
public function harlockShouldHaveEmptyMail() { public function harlockShouldHaveEmptyMail() {
$this->assertEquals('', Class_Users::find(4293)->getMail()); $this->assertEquals('', Class_Users::find(4293)->getMail());
} }
}
class PhasePatronsCsvDosTest extends PhasePatronsTestCase {
protected $_helene;
public function setUp() {
parent::setUp();
Class_IntProfilDonnees::find(102)
->setAccents(Class_IntProfilDonnees::ENCODING_ASCII_DOS)
->setAttributs([1 => ['champs' => 'IDABON;PASSWORD;NOM;PRENOM;ID_SIGB;DATE_DEBUT;DATE_FIN']])
->assertSave();
Class_Cosmogramme_Integration::find(999)
->setFichier('patron_dos.csv')
->assertSave();
$this->_phase->run();
$this->_helene = Class_Users::findFirstBy(['order' => 'id desc']);
}
/** @test */
public function prenomShouldBeHelene() {
$this->assertEquals('Hélène', $this->_helene->getPrenom());
}
/** @test */
public function idabonShouldBe1000305148() {
$this->assertEquals('1000305148', $this->_helene->getIdabon());
}
} }
\ No newline at end of file
1000305148|1982|FRANI|Hlne|4062|13/01/2020|13/01/2021
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment