fix /NOT
[id3fs.git] / lib / ID3FS / Path.pm
index ea22065..0f3241c 100644 (file)
@@ -416,8 +416,7 @@ sub sort_elements
 sub used_tags
 {
     my($self)=@_;
-    print "TAGTREE UNDEF\n" unless(defined($self->{tagtree}));
-    return undef unless(defined($self->{tagtree}));
+    return() unless(defined($self->{tagtree}));
     return($self->{tagtree}->used_tags());
 }
 
@@ -471,7 +470,7 @@ sub tail_parent
 sub tags
 {
     my($self)=@_;
-    if(!@{$self->{elements}}) # /
+    if(!$self->{tagtree}) # / or /NOT
     {
        my $sql="SELECT DISTINCT name FROM tags WHERE parents_id='';";
        return($self->{db}->cmd_firstcol($sql));
@@ -486,7 +485,7 @@ sub tags
             ") AS subselect\n" .
             "INNER JOIN files_x_tags ON subselect.files_id=files_x_tags.files_id\n" .
             "INNER JOIN tags ON files_x_tags.tags_id=tags.id\n");
-    my (@allused)=$self->used_tags();
+    my @allused=$self->used_tags();
     my @used=grep { ref($_) ne "ARRAY"; } @allused;
     my @used_with_vals=grep { ref($_) eq "ARRAY"; } @allused;
 #    print "tags(): USED: ", join(", ", @used), "\n";
@@ -722,7 +721,7 @@ sub tags_subselect
 #      print "Trailing id: $tag\n";
     }
     my ($sqlclause, @joins)=(undef, ());
-    ($sqlclause, @joins) = $tree->to_sql($tag) if($tree);
+    ($sqlclause, @joins) = $tree->to_sql() if($tree);
 #    print "SQL(" . scalar(@joins) .": $sqlclause\n";
     my $sql="\tSELECT fxt1.files_id FROM tags t1";
     my @crosses=();