Autour du SIGB Koha

Comment afficher plusieurs valeurs autorisées dans une même requête (sous-requêtes SELECT)

Exemple pour le module adhérent :

SELECT
borrowers.cardnumber AS numero_carte,
borrowers.surname AS Nom,
borrowers.firstname AS Prenom,
borrowers.email AS email_principal,
borrowers.emailpro AS email_alternatif,
borrowers.dateenrolled AS date_inscription,
borrowers.dateexpiry AS date_expiration,
borrowers.categorycode AS categorie_pret,
(SELECT description FROM categories WHERE categorycode=borrowers.categorycode) AS categorie,
borrowers.sort1,
(SELECT lib FROM authorised_values WHERE category='Bsort1' AND authorised_value=sort1) AS sort1_description,
borrowers.sort2,
(SELECT lib FROM authorised_values WHERE category='Bsort2' AND authorised_value=sort2) AS sort1_description2
FROM borrowers
LEFT JOIN categories USING(categorycode)
ORDER BY borrowers.surname, borrowers.firstname

Exemple sur les exemplaires :

SELECT
items.homebranch AS SITE,
items.location AS LOCALISATION,
(SELECT description FROM itemtypes WHERE itemtype=items.itype) AS 'TYPE DOC',
items.itemcallnumber AS COTE,
items.barcode AS CB,
items.itemnotes AS NOTES,
(SELECT lib FROM authorised_values WHERE category='statut' AND authorised_value=notforloan) AS statut_description,
(SELECT lib FROM authorised_values WHERE category='LOST' AND authorised_value=itemlost) AS statut_perdu
FROM items
ORDER by items.itemcallnumber, items.location ASC

Résultat :