diff --git a/inc/territoire.php b/inc/territoire.php index 4574f23..13f27f3 100644 --- a/inc/territoire.php +++ b/inc/territoire.php @@ -129,7 +129,7 @@ function territoire_peupler($type, $pays, $options = array()) { $territoire['edite'] = 'oui'; } - if ($id = objet_inserer('territoire', null, $territoire)) { + if ($id = sql_insertq('spip_territoires', $territoire)) { // On consigne le couple (iso, id) pour rétablir les liens si besoin $ids[$territoire['iso_territoire']] = $id; @@ -229,9 +229,9 @@ function territoire_peupler($type, $pays, $options = array()) { // Log du traitement pour debug $duree = $timestamp['fin'] - $timestamp['debut']; - spip_log("Les territoires (Type '${type}' - Pays '${pays}') ont été chargées en ${duree} s", 'territoires' . _LOG_DEBUG); + spip_log("Les territoires (Type '${type}' - Pays '${pays}') ont été chargées en ${duree} s", 'territoires' . _LOG_INFO_IMPORTANTE); if ( - defined(_LOG_FILTRE_GRAVITE) + defined('_LOG_FILTRE_GRAVITE') and (_LOG_FILTRE_GRAVITE >= _LOG_DEBUG) ) { $timestamp_debut = $timestamp['debut']; diff --git a/prive/objets/liste/territoires.html b/prive/objets/liste/territoires.html index 5f069fd..1ed0d70 100644 --- a/prive/objets/liste/territoires.html +++ b/prive/objets/liste/territoires.html @@ -14,7 +14,10 @@
[
- (#ENV*{titre,#GRAND_TOTAL|objet_afficher_nb{territoires}}) + + (#ENV*{titre,#GRAND_TOTAL|objet_afficher_nb{territoires}}) + [(#ENV{titre}|oui) \(#GRAND_TOTAL\)] + [(#GET{avec_filtre}|oui)
[
diff --git a/saisies/territoires_pays.html b/saisies/territoires_pays.html index 0ddb2a8..f552912 100644 --- a/saisies/territoires_pays.html +++ b/saisies/territoires_pays.html @@ -7,8 +7,8 @@ ] [(#ENV{multiple}|oui) - ] + ] [(#ENV{multiple}|non) - ] + ] diff --git a/territoires_fonctions.php b/territoires_fonctions.php index f51c8b2..49c922b 100644 --- a/territoires_fonctions.php +++ b/territoires_fonctions.php @@ -68,6 +68,9 @@ function territoire_informer_ascendance($iso_territoire, $iso_parent = null, $or */ function territoire_lister_pays($type = '', $categorie = '') { + // Initialisation de la sortie en erreur + $pays = array(); + // Filtre sur la catégorie et le type si demandé $where = array(); if ($categorie) { @@ -82,17 +85,20 @@ function territoire_lister_pays($type = '', $categorie = '') { // -- ou simplement tous les pays (type = country). if ($type === 'country') { $select = array('t1.iso_territoire as pays', 't1.nom_usage'); - $pays = sql_allfetsel($select, 'spip_territoires as t1', $where); + $liste = sql_allfetsel($select, 'spip_territoires as t1', $where); } else { $from = array('spip_territoires as t1', 'spip_territoires as t2'); $select = array('t1.iso_pays as pays', 't2.nom_usage'); $where[] = 't1.iso_pays = t2.iso_territoire'; $group_by = array('t1.iso_pays'); - $pays = sql_allfetsel($select, $from, $where, $group_by); + $liste = sql_allfetsel($select, $from, $where, $group_by); } - if ($pays) { - $pays = array_column($pays, 'nom_usage', 'pays'); + if ($liste) { + include_spip('inc/filtres'); + foreach ($liste as $_pays) { + $pays[$_pays['pays']] = extraire_multi($_pays['nom_usage']); + } } return $pays; @@ -128,10 +134,10 @@ function territoire_lister_categorie($type = '', $pays = '') { $where[] = 'iso_pays=' . sql_quote($pays); } - $ids_categorie = sql_allfetsel($select, 'spip_territoires', $where, $group_by); - if ($ids_categorie) { - foreach ($ids_categorie as $_id_categorie) { - $categorie = $_id_categorie['categorie']; + $liste = sql_allfetsel($select, 'spip_territoires', $where, $group_by); + if ($liste) { + foreach ($liste as $_categorie) { + $categorie = $_categorie['categorie']; $categories[$categorie] = _T("territoire:categorie_${categorie}"); } }