Skip to content

Instantly share code, notes, and snippets.

@black23
Created December 21, 2015 08:42
Show Gist options
  • Save black23/15205a9e14caf24b5c0f to your computer and use it in GitHub Desktop.
Save black23/15205a9e14caf24b5c0f to your computer and use it in GitHub Desktop.
SQL výstup na zjištení historie rezervací čtenáře
SELECT CONCAT_WS("", "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=", bor.borrowernumber, "'>", bor.firstname, " ", bor.surname, "</a>") AS "Ctenar",
oldr.reservedate AS "Datum rezervace", br.branchname AS "Knihovna",
IF(ISNULL(cancellationdate), IF(found = "F", "<span style='color:green;font-weight:bold'>Vyřízeno</span>", found), CONCAT("<span style='color:red;'>Zrušeno ", cancellationdate, "</span>")) AS "Stav",
b.author AS "Autor",
CONCAT("<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=", b.biblionumber, "'>", b.title, "</a>") AS "Nazev",
i.stocknumber AS "P. cislo", i.barcode AS "Carovy kod", it.description AS "Typ jednotky"
FROM old_reserves oldr
JOIN borrowers bor ON oldr.borrowernumber = bor.borrowernumber
JOIN biblio b ON oldr.biblionumber = b.biblionumber
LEFT OUTER JOIN items i ON oldr.itemnumber = i.itemnumber
JOIN branches br ON oldr.branchcode = br.branchcode
LEFT OUTER JOIN itemtypes it ON i.itype = it.itemtype
JOIN (SELECT @borrower:=<<Číslo čtenáře nebo č. kód>> COLLATE utf8_unicode_ci) var
WHERE oldr.borrowernumber = @borrower OR bor.cardnumber = @borrower
ORDER BY oldr.reservedate DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment