<commit_before><?php

class DRMMouvementsFactureView extends acCouchdbView
{
    const KEY_FACTURE = 0;
    const KEY_FACTURABLE = 1;
    const KEY_ETABLISSEMENT_IDENTIFIANT = 2;
    const KEY_PRODUIT_HASH = 3;
    const KEY_TYPE_HASH = 4;

    const VALUE_PRODUIT_LIBELLE = 0;
    const VALUE_TYPE_LIBELLE = 1;
    const VALUE_VOLUME = 2;
    const VALUE_DETAIL_LIBELLE = 3;
    const VALUE_CVO = 4;
    const VALUE_NUMERO = 5;

    public static function getInstance() {

        return acCouchdbManager::getView('drm', 'mouvements_facture', 'DRM');
    }
    
    
    public function getFacturationByEtablissement($etablissement,$facturable,$facturee) {
        
        return $this->client
            ->startkey(array($facturee,$facturable,$etablissement->identifiant))
            ->endkey(array($facturee,$facturable,$etablissement->identifiant, array()))
            ->getView($this->design, $this->view)->rows;
    }

    public function getAFactureByEtablissement($etablissement) {

        return $this->buildMouvements($this->getFacturationByEtablissement($etablissement, 1, 0));      
    }

    protected function buildMouvements($rows) {
        $mouvements = array();
        foreach($rows as $row) {
            $mouvements[] = $this->buildMouvement($row);
        }

        return $mouvements;
    }

    protected function buildMouvement($row) {<commit_msg>maj de facture/facturable dans les fct<commit_after><?php

class DRMMouvementsFactureView extends acCouchdbView
{
    const KEY_FACTURE = 0;
    const KEY_FACTURABLE = 1;
    const KEY_ETABLISSEMENT_IDENTIFIANT = 2;
    const KEY_PRODUIT_HASH = 3;
    const KEY_TYPE_HASH = 4;

    const VALUE_PRODUIT_LIBELLE = 0;
    const VALUE_TYPE_LIBELLE = 1;
    const VALUE_VOLUME = 2;
    const VALUE_DETAIL_LIBELLE = 3;
    const VALUE_CVO = 4;
    const VALUE_NUMERO = 5;

    public static function getInstance() {

        return acCouchdbManager::getView('drm', 'mouvements_facture', 'DRM');
    }
    
    
    public function getFacturationByEtablissement($etablissement,$facturee, $facturable) {
        
        return $this->client
            ->startkey(array($facturee,$facturable,$etablissement->identifiant))
            ->endkey(array($facturee,$facturable,$etablissement->identifiant, array()))
            ->getView($this->design, $this->view)->rows;
    }

    public function getAFactureByEtablissement($etablissement) {

        return $this->buildMouvements($this->getFacturationByEtablissement($etablissement, 0, 1));      
    }

    protected function buildMouvements($rows) {
        $mouvements = array();
        foreach($rows as $row) {
            $mouvements[] = $this->buildMouvement($row);
        }

        return $mouvements;
    }

    protected function buildMouvement($row) {
{'fraction_non_alphanumeric': 0.10955459770114942, 'fraction_numerical': 0.009339080459770116, 'mean_word_length': 3.144345238095238, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '3867955', 'n_tokens_mistral': 963, 'n_tokens_neox': 930, 'n_words': 162}