YesWiki
Requetes SQL
Sélectionner les fiches d’un formulaire
select * from yeswiki_pages where tag in (select resource from yeswiki_triples where value = 'fiche_bazar') and latest = 'Y' and JSON_VALUE(body, '$.id_typeannonce') = $NUM$;
Sélectionner toutes les fiches bazar non géolocalisées
select * from yeswiki_pages where tag in (select resource from yeswiki_triples where value = 'fiche_bazar') and latest = 'Y' and JSON_VALUE(body, '$.id_typeannonce') = $NUM$ and JSON_EXISTS(body, '$.geolocation') = false;
Supprimer les fiches avec certains champs vides
delete from yeswiki_pages where tag in (select resource from yeswiki_triples where value = 'fiche_bazar') and latest = 'Y' and JSON_VALUE(body, '$.id_typeannonce') = $NUM$ and JSON_EXTRACT(body, '$.CHAMP') = '' and JSON_EXTRACT(body, '$.CHAMP') = "" and JSON_EXTRACT(body, "$.CHAMP") = "";
Mettre à jour un nom de champ
update yeswiki_pages set body=JSON_INSERT(body, "$.NOUVEAU NOM",JSON_VALUE(body, "$.ANCIEN_NOM")) where tag in (select resource from yeswiki_triples where value = 'fiche_bazar') and latest = 'Y' and JSON_VALUE(body, '$.id_typeannonce') = $NUM$ and JSON_EXISTS(body, "$.ANCIEN_NOM");
Supprimer les espaces en trop
update yeswiki_pages set body = regexp_replace(body, ', "', ',"') where tag in (select resource from yeswiki_triples where value = 'fiche_bazar') and JSON_VALUE(body, '$.id_typeannonce') = 2 and body REGEXP ', "';
update yeswiki_pages set body = regexp_replace(body, ': "', ':"') where tag in (select resource from yeswiki_triples where value = 'fiche_bazar') and JSON_VALUE(body, '$.id_typeannonce') = 2 and body REGEXP ': "';
Formulaires
Cacher les champs vides d’un formulaire :
<script>var non_empty_cor = Array.prototype.filter.call( document.getElementsByClassName('field-text'),function (el) { return el.dataset.id.match('correspondant[0-4]$'); },); for (el of non_empty_cor) { document.getElementById(el.dataset.id).hidden=false; } </script>