<commit_before><?php

/* This file is part of the acVinComptePlugin package.
 * Copyright (c) 2011 Actualys
 * Authors :
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * acVinComptePlugin task.
 *
 * @package    acVinComptePlugin
 * @subpackage lib
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @version    0.1
 */
class acVinCompteUpdateProductionTagTask extends sfBaseTask {

    protected $debug = false;
    protected static $accent_matching = array('accent' => array('Ô','ô', 'Â','â','ê','è','é','É', 'È','Ê','û','Û','î','Î'), 'to_replace' => array('o','o', 'A','a','e','e','e','e','e','e','u','u','i','i'));

    protected function configure() {
        $this->addOptions(array(
            new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'declaration'),
            new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
            new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'default'),
            new sfCommandOption('campagne', null, sfCommandOption::PARAMETER_OPTIONAL, 'Campagne', null),
            new sfCommandOption('reinitialisation_tags_produit', null, sfCommandOption::PARAMETER_REQUIRED, 'Reset tags', false),
            new sfCommandOption('reinitialisation_tags_export', null, sfCommandOption::PARAMETER_REQUIRED, 'Reset tags', false),
            new sfCommandOption('reinitialisation_tags_domaines', null, sfCommandOption::PARAMETER_REQUIRED, 'Reset tags', false),
            new sfCommandOption('debug', null, sfCommandOption::PARAMETER_OPTIONAL, 'use only one code creation', '0'),
        ));

        $this->namespace = 'compte';
        $this->name = 'updateProductionTag';
        $this->briefDescription = '';
        $this->detailedDescription = '';
    }

    protected function execute($arguments = array(), $options = array()) {
        $databaseManager = new sfDatabaseManager($this->configuration);
        $context = sfContext::createInstance($this->configuration);
        $connection = $databaseManager->getDatabase($options['connection'])->getConnection();

        $this->debug = array_key_exists('debug', $options) && $options['debug'];


        if (!isset($options['campagne']) || !$options['campagne']) {
            $campagne = ConfigurationClient::getInstance()->getCurrentCampagne();
        } else {
            $campagne = $options['campagne'];
        }

        $this->logSection("campagne use", $campagne);

        foreach (EtablissementAllView::getInstance()->findByInterproStatutAndFamilleVIEW('INTERPRO-declaration', EtablissementClient::STATUT_ACTIF, null) as $e) {
            $id = $e->key[EtablissementAllView::KEY_ETABLISSEMENT_ID];
            $tags = array('export' => array(), 'produit' => array(), 'domaines' => array());

            $mvts = SV12MouvementsConsultationView::getInstance()->getByIdentifiantAndCampagne($id, $campagne);
            foreach ($mvts as $m) {
                $produit_libelle = $this->getProduitLibelle($m->produit_hash);
                if(!$produit_libelle) {
                    continue;
                }
                $tags['produit'][$produit_libelle] = 1;
            }
            $mvts = DRMMouvementsConsultationView::getInstance()->getByIdentifiantAndCampagne($id, $campagne);
            foreach ($mvts as $m) {
                $produit_libelle = $this->getProduitLibelle($m->produit_hash);
                if(!$produit_libelle) {
                    continue;
                }
                $tags['produit'][$produit_libelle] = 1;
                if ($m->detail_libelle && preg_match("/Export/", $m->type_libelle)) {
                    $tags['export'][$m->detail_libelle] = 1;
                }
            }
            $contratDomaines = VracDomainesView::getInstance()->findDomainesByVendeur(str_replace('ETABLISSEMENT-', '', $id));
            foreach ($contratDomaines->rows as $domaineView) {<commit_msg>Remplacement des accents dans les pays aussi<commit_after><?php

/* This file is part of the acVinComptePlugin package.
 * Copyright (c) 2011 Actualys
 * Authors :
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * acVinComptePlugin task.
 *
 * @package    acVinComptePlugin
 * @subpackage lib
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @version    0.1
 */
class acVinCompteUpdateProductionTagTask extends sfBaseTask {

    protected $debug = false;
    protected static $accent_matching = array('accent' => array('Ô','ô', 'Â','â','ê','è','é','É', 'È','Ê','û','Û','î','Î'), 'to_replace' => array('o','o', 'A','a','e','e','e','e','e','e','u','u','i','i'));

    protected function configure() {
        $this->addOptions(array(
            new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'declaration'),
            new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
            new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'default'),
            new sfCommandOption('campagne', null, sfCommandOption::PARAMETER_OPTIONAL, 'Campagne', null),
            new sfCommandOption('reinitialisation_tags_produit', null, sfCommandOption::PARAMETER_REQUIRED, 'Reset tags', false),
            new sfCommandOption('reinitialisation_tags_export', null, sfCommandOption::PARAMETER_REQUIRED, 'Reset tags', false),
            new sfCommandOption('reinitialisation_tags_domaines', null, sfCommandOption::PARAMETER_REQUIRED, 'Reset tags', false),
            new sfCommandOption('debug', null, sfCommandOption::PARAMETER_OPTIONAL, 'use only one code creation', '0'),
        ));

        $this->namespace = 'compte';
        $this->name = 'updateProductionTag';
        $this->briefDescription = '';
        $this->detailedDescription = '';
    }

    protected function execute($arguments = array(), $options = array()) {
        $databaseManager = new sfDatabaseManager($this->configuration);
        $context = sfContext::createInstance($this->configuration);
        $connection = $databaseManager->getDatabase($options['connection'])->getConnection();

        $this->debug = array_key_exists('debug', $options) && $options['debug'];


        if (!isset($options['campagne']) || !$options['campagne']) {
            $campagne = ConfigurationClient::getInstance()->getCurrentCampagne();
        } else {
            $campagne = $options['campagne'];
        }

        $this->logSection("campagne use", $campagne);

        foreach (EtablissementAllView::getInstance()->findByInterproStatutAndFamilleVIEW('INTERPRO-declaration', EtablissementClient::STATUT_ACTIF, null) as $e) {
            $id = $e->key[EtablissementAllView::KEY_ETABLISSEMENT_ID];
            $tags = array('export' => array(), 'produit' => array(), 'domaines' => array());

            $mvts = SV12MouvementsConsultationView::getInstance()->getByIdentifiantAndCampagne($id, $campagne);
            foreach ($mvts as $m) {
                $produit_libelle = $this->getProduitLibelle($m->produit_hash);
                if(!$produit_libelle) {
                    continue;
                }
                $tags['produit'][$produit_libelle] = 1;
            }
            $mvts = DRMMouvementsConsultationView::getInstance()->getByIdentifiantAndCampagne($id, $campagne);
            foreach ($mvts as $m) {
                $produit_libelle = $this->getProduitLibelle($m->produit_hash);
                if(!$produit_libelle) {
                    continue;
                }
                $tags['produit'][$produit_libelle] = 1;
                if ($m->detail_libelle && preg_match("/Export/", $m->type_libelle)) {
                    $tags['export'][$this->replaceAccents($m->detail_libelle)] = 1;
                }
            }
            $contratDomaines = VracDomainesView::getInstance()->findDomainesByVendeur(str_replace('ETABLISSEMENT-', '', $id));
            foreach ($contratDomaines->rows as $domaineView) {
{'fraction_non_alphanumeric': 0.15904828879512423, 'fraction_numerical': 0.0028129395218002813, 'mean_word_length': 3.253738783649053, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 112, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5400258', 'n_tokens_mistral': 2478, 'n_tokens_neox': 2470, 'n_words': 466}