]> mj.ucw.cz Git - pciids.git/blobdiff - PciIds/DBQ.pm
Count of pending events in admin interface
[pciids.git] / PciIds / DBQ.pm
index bf7134de1a566c67e5066bb94374070df40af25e..2740de554435fde765990c7a18e659325b425bdd 100644 (file)
@@ -119,7 +119,8 @@ sub new( $ ) {
                'hasChildren' => 'SELECT DISTINCT 1 FROM locations WHERE parent = ?',
                'hasMain' => 'SELECT DISTINCT 1 FROM locations WHERE id = ? AND mainhistory IS NOT NULL',
                'notif-exists' => 'SELECT DISTINCT 1 FROM notifications WHERE user = ? AND ( location = ? OR ( recursive = 1 AND type <= 1 AND SUBSTR( ?, 1, LENGTH( location ) ) = location ) )',
-               'itemname' => 'SELECT name FROM locations WHERE id = ?'
+               'itemname' => 'SELECT name FROM locations WHERE id = ?',
+               'admincount' => 'SELECT COUNT( DISTINCT location ) FROM history WHERE seen = 0 AND location LIKE ?'
        } );
 }
 
@@ -394,4 +395,9 @@ sub itemName( $$ ) {
        return defined $result ? $result : '';
 }
 
+sub adminCount( $$ ) {
+       my( $tables, $prefix ) = @_;
+       return $tables->query( 'admincount', [ "$prefix%" ] )->[0]->[0];
+}
+
 1;