db (); $db->logger = new logger (); if ($within_the_last) { pageheader("List of Books released within the last $within_the_last days lacking a Subject and/or a LoCC"); } else { pageheader("List of Books lacking a Subject and/or a LoCC"); } class SubjLoccByEtextTable extends MoreTable { function __construct () { $this->AddColumn ("#pk#", "Etext Nr. (edit link)", "right"); $this->AddSimpleColumn ("author", "Author"); $this->AddColumn ("#title#", "Title (bibrec link)"); $this->AddColumn ("" . "       ", "No Subj", "narrow"); $this->AddColumn ("" . "       ", "No LoCC", "narrow"); $this->limit = 30; $this->relay = array (); } } $table = new SubjLoccByEtextTable (); $sql="select distinct on (fk_books) fk_books as pk, text as title, author, " . "(case when fk_subjects is null then 'black' end) as nosubj, " . "(case when fk_loccs is null then 'black' end) as nolocc " . "from attributes left join mn_books_subjects using (fk_books) " . "left join mn_books_loccs using (fk_books) " . "join mn_books_authors using (fk_books) " . "join authors on authors.pk=fk_authors "; if ($within_the_last) { $sql=$sql . "join books on books.pk=fk_books "; } // gbn: the fk_roles skips records that don't have an Author or Creator: $sql=$sql . "where fk_attriblist=245 and "; // . // "fk_roles in ('aut', 'cre') and heading=1 and "; if ($within_the_last) { $sql=$sql . "books.release_date >= current_date - interval '$within_the_last days' and "; } $sql=$sql . "((fk_subjects is null) or (fk_loccs is null)) " . "order by fk_books, text, author" . $table->MkOffset (); // echo ("

$sql

"); $db->Exec($sql); # gbn: 20091213 print "

Last day only

\n"; $table->PrintTable($db, "Books lacking a Subject and/or a LoCC"); pagefooter();