Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 213 → Rev 214

/trunk/scripts/modules/versionnage/Versionnage.php
37,6 → 37,7
private $noms = null;
private $noms_precedents = null;
private $noms_stat = null;
private $noms_stat_partiel = null;
private $champs_ordre = null;
private $champs_nom = null;
private $champs_nom_partiel = null;
45,6 → 46,7
private $diff_modif_types = null;
private $signature_md5 = null;
private $signature_md5_partiel = null;
private $exclure_taxref = null;
private $resultatDao = null;
private $traitementDao = null;
154,6 → 156,8
$this->noms_stat['combinaison'] = $this->getNombreCombinaison();
$this->noms_stat['taxon'] = $this->getNombreTaxon();
Debug::printr("Stats :".print_r($this->noms_stat, true));
$this->noms_stat_partiel = $this->getStatsPartiel();
Debug::printr("Stats partiel:".print_r($this->noms_stat_partiel, true));
}
private function getNombreCombinaison() {
170,6 → 174,20
return $nbre;
}
private function getStatsPartiel() {
$stat['combinaison'] = 0;
$stat['taxon'] = 0;
foreach ($this->noms as $nom) {
if ($nom['exclure_taxref'] != '1') {
$stat['combinaison']++;
if ($nom['num_nom_retenu'] == $nom['num_nom']) {
$stat['taxon']++;
}
}
}
return $stat;
}
private function creerFichiers() {
// Respecter l'ordre de traitement : BDNT puis DIFF puis META
$donnees =& $this->creerFichierBdnt();
378,6 → 396,7
$this->noms_stat['modification'] = 0;
$diff = array();
$i = 0;
foreach ($this->noms as $id => $nom) {
$this->noms[$id] = null;
$infos = array();
386,8 → 405,12
} else {
$nom_precedent = $this->noms_precedents[$id];
$this->noms_precedents[$id] = null;
array_walk($nom_precedent, create_function('&$val', '$val = trim($val);'));
$infos = $this->traiterDiffModif($nom, $nom_precedent);
}
if ($nom['exclure_taxref'] == '1') {
$this->exclure_taxref[] = $id;
}
if (count($infos) > 0) {
$infos = $this->remplacerTabulation($infos);
395,9 → 418,17
$diff[$id] = $infos;
}
}
$this->verifierLignesSupprimees();
return $diff;
}
private function verifierLignesSupprimees() {
$e = count($this->noms_precedents)." lignes ont été supprimées vis à vis de la version ".
"précédentes. Cela concerne les noms : ".implode(', ', array_keys($this->noms_precedents));
$this->ajouterMessage($e);
}
private function traiterDiffAjout(&$nom) {
$infos = $nom;
$infos['modification_type'] = 'A';
410,7 → 441,8
private function traiterDiffModif(&$nom, &$nom_precedent) {
$infos = array();
$nom_diff = array_diff_assoc($nom, $nom_precedent); $bdnt_partielle_tsv = 'trest';
$nom_diff = array_diff_assoc($nom, $nom_precedent);
if (count($nom_diff) > 0) {
$modif['modification_type'] = 'M';
$modif['modification_type_1'] = '0';
419,7 → 451,8
foreach ($this->champs_nom as $champ) {
if (isset($nom_diff[$champ])) {
$infos[$champ] = $nom_diff[$champ];
// Si le champ modifié est vide nous retournons le mot clé "NULL" pour identifier le champ modifié
$infos[$champ] = ($nom_diff[$champ] != '') ? $nom_diff[$champ] : 'NULL';
$type = $this->getDiffType($champ);
$modif['modification_type_'.$type] = '1';
} else {
463,7 → 496,28
}
private function creerFichierDiffPartiel(&$donnees) {
if (count($donnees) > 0) {
$this->noms_stat_partiel['modification'] = 0;
if (count($donnees) > 0 && count($donnees['diff']) > 0) {
foreach ($donnees['diff'] as $id => $nom) {
if (!in_array($id, $this->exclure_taxref)) {
if ($nom['modification_type'] == 'A') {
$donnees['diff_partiel'][$id] = $nom;
} else {
foreach ($nom as $champ => $valeur) {
$ok = false;
if ($valeur != '' && $champ != 'num_nom' && in_array($champ, $this->champs_nom_partiel)) {
$donnees['diff_partiel'][$id] = $nom;
Debug::printr($id.":".$champ."/".$valeur);
break;
}
}
}
if (array_key_exists($id, $donnees['diff_partiel'])) {
$this->noms_stat_partiel['modification']++;
}
}
unset($donnees['diff'][$id]);
}
$donnees['champs_partiel_diff'] = array_merge($this->champs_nom_partiel, $this->champs_diff);
$donnees['dernier_champ'] = end($donnees['champs_partiel_diff']);
$diff_tsv_partiel =& $this->getVue('versionnage/squelettes/diff_partiel', &$donnees, '.tpl.tsv');
506,6 → 560,8
private function creerFichierMetaPartiel(&$donnees) {
$donnees['signature'] = $this->signature_md5_partiel;
$donnees['stats'] = $this->noms_stat_partiel;
$donnees['notes'] = trim('Édition partielle. '.$donnees['notes']);
$meta_tsv_partiel =& $this->getVue('versionnage/squelettes/meta', &$donnees, '.tpl.tsv');
$this->ecrireFichierMetaPartiel($meta_tsv_partiel);
}
/trunk/scripts/modules/versionnage/squelettes/diff_partiel.tpl.tsv
1,10 → 1,8
<?=implode("\t", $champs_partiel_diff)?>
 
<?php foreach ($diff as $id => $nom_infos) :
if (!isset($nom_infos['exclure_taxref']) || $nom_infos['exclure_taxref'] != '1') :
foreach ($champs_partiel_diff as $champ) :
echo $nom_infos[$champ];
echo ($dernier_champ == $champ) ? "\n" : "\t";
endforeach;
endif;
<?php foreach ($diff_partiel as $id => $nom_infos) :
foreach ($champs_partiel_diff as $champ) :
echo $nom_infos[$champ];
echo ($dernier_champ == $champ) ? "\n" : "\t";
endforeach;
endforeach; ?>