Commit e79df88f authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

MAJ pays ISO (suppression des La/Le etc.. en fin d'intitulé)

UP Maj pays (administration)
parent b15d81f0
Loading
Loading
Loading
Loading
Loading
+1 −985

File changed.

Preview size limit exceeded, changes collapsed.

+4 −1
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@ fs.readFile(__dirname + '/iso-3166-src.xml', function(err, data) {
            let alpha2 = tr.td[2]._.replace(/(\r\n|\n|\r)/gm, "").replace(/\s\s+/g, ' ').trim();
            let alpha3 = tr.td[3]._.replace(/(\r\n|\n|\r)/gm, "").replace(/\s\s+/g, ' ').trim();
            let numeric = tr.td[4]._.replace(/(\r\n|\n|\r)/gm, "").replace(/\s\s+/g, ' ').trim();

            // Petit coup de propre
            fr = fr.replace(/^(.*) \((la |La|l'|le|la|les)?\)\*?$/gm, '$1');

            output.push({
                "en" : en,
                "fr" : fr,
@@ -21,7 +25,6 @@ fs.readFile(__dirname + '/iso-3166-src.xml', function(err, data) {
                "alpha3" : alpha3,
                "numeric" : numeric
            })

        });
        console.log(JSON.stringify(output));
    });
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class Country3166Repository extends EntityRepository

    public function getAllForSelects()
    {
        $out = [];
        $out = ["" => "Non-définit"];
        /** @var Country3166 $country */
        foreach ($this->getAll() as $country) {
            $out[$country->getFr()] = $country->getFr();
+4 −0
Original line number Diff line number Diff line
@@ -276,6 +276,10 @@ class OrganizationIdentificationForm extends \Zend\Form\Form implements InputFil
            'dateEnd'=> [
                'required' => false,
            ],

            'country' => [
                'required' => false
            ]
        ];
    }
}
 No newline at end of file
+7 −4
Original line number Diff line number Diff line
@@ -651,10 +651,6 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana

        $datas = json_decode(file_get_contents($referencielFilePath), true);
        $exists = $this->getCountries3166Repository()->allKeyByAlpha2();
        if( count($exists) ){
            var_dump($exists);
            die();
        }

        foreach ($datas as $data) {
            // Création du pays
@@ -666,6 +662,13 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana
                    ->setEn($data['en'])
                    ->setFr($data['fr'])
                    ->setNumeric(intval($data['numeric']));
            } else {
                $country = $exists[$data['alpha2']];
                $country->setAlpha2($data['alpha2'])
                    ->setAlpha3($data['alpha3'])
                    ->setEn($data['en'])
                    ->setFr($data['fr'])
                    ->setNumeric(intval($data['numeric']));
            }
        }
        $this->getEntityManager()->flush();