Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3662 → Rev 3663

/trunk/scripts/modules/nettoyage/Nettoyage.php
25,6 → 25,7
protected $colonnes;
protected $bd_cel = "tb_nettoye_cel";
protected $bd_del = "tb_del";
protected $bd_flore = "tb_eflore";
 
 
public function __construct($script_nom, $parametres_cli) {
32,6 → 33,7
$this->bdd = new Bdd();
$this->bd_cel = Config::get('nettoyage.cel_nettoye');
$this->bd_del = Config::get('nettoyage.del');
$this->bd_flore = Config::get('nettoyage.flore');
}
 
public function executer() {
47,7 → 49,7
$this->unifierNull();
$this->unifierNomReferentiel();
$this->unifierCertitude();
$this->supprimerCertitudeAutre();
//$this->supprimerCertitudeAutre();
$this->unifierUtilisateur();
$this->unifierPhenologie();
$this->verifierCodeInsee();
101,7 → 103,7
$this->unifierUtilisateur();
break;
case 'unifierInfosEspece' :
$this->unifierUtilisateur();
$this->unifierInfosEspeces();
break;
case 'unifierPhenologie' :
$this->unifierPhenologie();
639,13 → 641,103
}
}
private function unifierInfosEspeces() {
echo "maj infos espèces \n";
/*$requete = "ALTER TABLE ".$this->bd_cel.".`cel_obs` ADD infosnn varchar(2),
ADD bd_nom_sci varchar(250), ADD bd_num_nom int(11), ADD bd_nom_sci_retenu varchar(250),
ADD bd_num_nom_retenu int(11) ;";
$this->bdd->requeter($requete);
*/
$liste_referentiels = array("bdtfx" => "bdtfx_v6_00", "bdtre" => "bdtre_v1_00",
"isfan" => "isfan_v2013", "apd" => "apd_v3_4_0", "bdtxa" => "bdtxa_v1_01",
"aublet" => "aublet_v2016_09", "florical" => "florical_v2016_04_22", "lbf" => "lbf_v1_00");
$this->unifierInfosEspecesBDTFX();
foreach ($liste_referentiels as $ref => $version) {
//Num nom et nom sci sont les mêmes
// chercher les versions
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`
join (SELECT `num_nom`, `num_nom_retenu`, `nom_sci`,
case when annee = '' THEN concat(`nom_sci`, ' ', auteur) ELSE concat(`nom_sci`, ' ', auteur, ' [',annee,']') END as nom_sci_complet,
nom_sci_complet_ret FROM ".$this->bd_flore.".".$version.
'left join (select `num_nom` as nn, `nom_sci` as nom_sci_ret,
case when annee = "" THEN concat(`nom_sci`, " ", auteur) ELSE concat(`nom_sci`, " ", auteur, " [",annee,"]") END as nom_sci_complet_ret
from ".$this->bd_flore.".".$version." where `num_nom` = `num_nom_retenu`) ret
on `num_nom_retenu` = nn) bdtfx
on `nom_sel_nn` = num_nom and `nom_sel` like concat(nom_sci,"%")
SET `nom_sel` = nom_sci_complet, `nom_sel_nn` = num_nom , `nom_ret` = nom_sci_complet_ret, `nom_ret_nn` = num_nom_retenu,
infosnn = 1
WHERE nom_referentiel = "'.$ref.'"';
$this->bdd->requeter($requete);
//Num nom id, nom sci !=
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`
join (SELECT `num_nom`, `num_nom_retenu`, `nom_sci`,
case when annee = '' THEN concat(`nom_sci`, ' ', auteur) ELSE concat(`nom_sci`, ' ', auteur, ' [',annee,']') END as nom_sci_complet,
nom_sci_complet_ret FROM ".$this->bd_flore.".".$version.
'left join (select `num_nom` as nn, `nom_sci` as nom_sci_ret,
case when annee = "" THEN concat(`nom_sci`, " ", auteur) ELSE concat(`nom_sci`, " ", auteur, " [",annee,"]") END as nom_sci_complet_ret
from ".$this->bd_flore.".".$version." where `num_nom` = `num_nom_retenu`) ret
on `num_nom_retenu` = nn) bdtfx
on `nom_sel_nn` = num_nom and and (nom_sel like concat(nom_sci,"%") and nom_ret like concat(nom_sci,"%"))
and (nom_sel like concat(nom_sci_ret,"%") and nom_ret like concat(nom_sci_ret,"%"))
SET `nom_sel` = nom_sci_complet, `nom_sel_nn` = num_nom , `nom_ret` = nom_sci_complet_ret, `nom_ret_nn` = num_nom_retenu,
infosnn = 2
WHERE nom_referentiel = "'.$ref.'" and infosnn != 1';
$this->bdd->requeter($requete);
//
}
}
private function unifierInfosEspecesBDTFX() {
echo "maj infos espèces \n";
/*$requete = "ALTER TABLE ".$this->bd_cel.".`cel_obs` ADD infosnn varchar(2),
ADD bd_nom_sci varchar(250), ADD bd_num_nom int(11), ADD bd_nom_sci_retenu varchar(250),
ADD bd_num_nom_retenu int(11) ;";
$this->bdd->requeter($requete);
*/
//Num nom et nom sci sont les mêmes
// chercher les versions
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`"
.' join bdtfx on `nom_sel_nn` = num_nom and `nom_sel` like concat(nom_sci, "%")
SET `nom_sel` = nom_sci_complet, `nom_sel_nn` = num_nom ,
`nom_ret` = nom_ret_complet, `nom_ret_nn` = num_nom_retenu,
infosnn = 1
where `nom_referentiel` = "bdtfx" ';
$this->bdd->requeter($requete);
//Num nom id, nom sci +-=
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`"
.' join bdtfx on `nom_sel_nn` = num_nom and and (nom_sel like concat(nom_sci,"%") and nom_ret like concat(nom_sci,"%"))
and (nom_sel like concat(nom_sci_ret,"%") and nom_ret like concat(nom_sci_ret,"%"))
SET `nom_sel` = nom_sci_complet, `nom_sel_nn` = num_nom ,
`nom_ret` = nom_ret_complet, `nom_ret_nn` = num_nom_retenu,
infosnn = 2
where `nom_referentiel` = "bdtfx" and infosnn != "1"';
$this->bdd->requeter($requete);
//Num nom id, nom sci +-=
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`"
.' join bdtfx on `nom_sel_nn` = num_nom and and (nom_sel not like concat(nom_sci,"%") and nom_ret not like concat(nom_sci,"%"))
and (nom_sel not like concat(nom_sci_ret,"%") and nom_ret not like concat(nom_sci_ret,"%"))
SET `bd_nom_sci` = nom_sci_complet, `bd_num_nom` = num_nom ,
`bd_nom_sci_retenu` = nom_ret_complet, `bd_num_nom_retenu` = num_nom_retenu,
infosnn = 3
where `nom_referentiel` = "bdtfx" and infosnn not in ("1", "2")';
$this->bdd->requeter($requete);
}
private function supprimerImagesetTagAnonymes() {
echo "vérification de la présence de l'annuaire \n";
$requete = "SELECT * FROM ".$this->bd_cel.".`users`;";
$result = $this->bdd->requeter($requete);
if ($result === NULL) {echo $requete;
echo "Il manque la table annuaire (à recopier de telaorg users\n";
exit;
if ($result === NULL) {
echo $requete;
echo "Il manque la table annuaire (à recopier de telaorg users\n";
exit;
}
echo "suppression de le colonne ordre \n";
/trunk/scripts/configurations/config.defaut.ini
69,4 → 69,5
cel_nettoye = "tb_nettoye_cel"
cel_new = "tb_new_cel"
chemin_photo = "/home/test/www/images/"
flore = "tb_eflore"
del = "tb_del"