Commit 63e38bac authored by Laurent's avatar Laurent

Merge branch 'hotline#106570_bug_reservation_anomalie_d_accent_des_lecteurs' into 'hotline'

hotline #106570 fix import patrons with DOS encoded file

See merge request !3576
parents f91e68fb 4f360150
Pipeline #10646 passed with stage
in 45 minutes and 26 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
public function importPatronRecord($data, $integration) {
$patron = new Class_Cosmogramme_Integration_Record_Patron($integration);
return $patron->import($integration->isFormatXml()
? $data
: $this->mapRecordColumns($integration, $data),
......
......@@ -41,6 +41,8 @@ class Class_Cosmogramme_Integration_Record_Patron {
public function importFicheArray($enreg) {
$enreg = array_map([$this, 'changeAccents'],
$enreg);
$enreg = $this->prepareData($enreg);
if ($library_code = $this->_known_fields->libraryCodeFrom($enreg)) {
......
......@@ -739,4 +739,40 @@ class PhasePatronsUpdateWithEmptyMailTest extends PhasePatronsTestCase {
public function harlockShouldHaveEmptyMail() {
$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
Markdown is supported
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