diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index d07cca4..34c51fc 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -245,13 +245,16 @@ sub SearchAuthorities { $attr .=" \@attr 5=1 \@attr 4=6 ";## Word list, right truncated, anywhere } $attr =$attr."\"".@$value[$i]."\""; + $q2 = $and.$q2 if $q2; #Add @and if we already have existing queries $q2 .=$attr; $dosearch=1; }#if value } ##Add how many queries generated - if ($query=~/\S+/){ - $query= $and.$query.$q2 + if ($query=~/\S+/){ + if($q2=~/\S+/){ + $query= $and.$query.$q2; + } } else { $query=$q2; } @@ -264,8 +267,9 @@ sub SearchAuthorities { '@attr 7=2 @attr 1=Heading 0' :'' ); - $query=($query?"\@or $orderstring $query":"\@or \@attr 1=_ALLRECORDS \@attr 2=103 '' $orderstring "); - + $query=($query?$query:"\@attr 1=_ALLRECORDS \@attr 2=103 ''"); + $query="\@or $orderstring $query" if $orderstring; + $offset=0 unless $offset; my $counter = $offset; $length=10 unless $length;