Critère par non fonctionnel si le champ contient le caractère :
Dans une boucle DATA, j'ai tenté d'utiliser un critère {par fieldData/API02_Spectacles::Nom}
sans succès car ça génère une erreur de type critère inconnu.
En y regardant de plus prêt, j'ai trouvé comment faire pour que ce type de champ soit accepté par un critère {par XXX}
avec le patch suivant :
diff --git a/ecrire/iterateur/data.php b/ecrire/iterateur/data.php
index 0432a03d8..c6c85b9df 100644
--- a/ecrire/iterateur/data.php
+++ b/ecrire/iterateur/data.php
@@ -458,7 +458,7 @@ class IterateurDATA implements Iterator {
$aleas = 0;
foreach ($this->command['orderby'] as $tri) {
// virer le / initial pour les criteres de la forme {par /xx}
- if (preg_match(',^\.?([/\w]+)( DESC)?$,iS', ltrim($tri, '/'), $r)) {
+ if (preg_match(',^\.?([/\w:]+)( DESC)?$,iS', ltrim($tri, '/'), $r)) {
$r = array_pad($r, 3, null);
// tri par cle
diff --git a/ecrire/public/phraser_html.php b/ecrire/public/phraser_html.php
index 89f8a5985..bdfc202bc 100644
--- a/ecrire/public/phraser_html.php
+++ b/ecrire/public/phraser_html.php
@@ -60,7 +60,7 @@ define('BALISE_IDIOMES_ARGS', '@^\s*([^= ]*)\s*=\s*((' . NOM_DE_CHAMP . '[{][^}]
/** Champ sql dans parenthèse ex: (id_article) */
define('SQL_ARGS', '(\([^)]*\))');
/** Fonction SQL sur un champ ex: SUM(visites) */
-define('CHAMP_SQL_PLUS_FONC', '`?([A-Z_\/][A-Z_\/0-9.]*)' . SQL_ARGS . '?`?');
+define('CHAMP_SQL_PLUS_FONC', '`?([A-Z_\/][A-Z_\/0-9.:]*)' . SQL_ARGS . '?`?');
// https://code.spip.net/@phraser_inclure
function phraser_inclure($texte, $ligne, $result) {
Donc, simplement en ajoutant le caractère :
dans les deux regex qui filtres les valeurs acceptables par ce critère.
Avant d'envoyer une PR, je me pose la question des effets de bord potentiels. Vos avis ?