[Koha-bugs] [Bug 10542] QueryParser + OpacSuppression doesn't allow search in 'all libraries'
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Jul 17 09:24:50 CEST 2014
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10542
David Cook <dcook at prosentient.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dcook at prosentient.com.au
--- Comment #11 from David Cook <dcook at prosentient.com.au> ---
Here's the start of the solution:
Add the following line of code to the OpacSuppression code block:
$query = '@not '.$query.' @attr 1=9011 1';
if (C4::Context->preference('OpacSuppression')) {
# OPAC suppression by IP address
if (C4::Context->preference('OpacSuppressionByIPRange')) {
my $IPAddress = $ENV{'REMOTE_ADDR'};
my $IPRange = C4::Context->preference('OpacSuppressionByIPRange');
if ($IPAddress !~ /^$IPRange/) {
$query = "($query) not Suppress=1";
}
}
else {
#$query = "($query) not Suppress=1";
$query = '@not '.$query.' @attr 1=9011 1';
}
}
Now...we can't comment out [$query = "($query) not Suppress=1";]. That's just
for demonstration purposes.
Unfortunately, we can't use the QP syspref to detect whether we should use the
CCL version or the PQF version, because buildQuery can output both depending on
the query that is input into it.
So...the hack here is to use some regex to detect "@attr" in the outbound query
probably. You can get fancier than that.
Even better...changing buildQuery, so that it returns what query language it's
using! Then no hacking necessary.
I can probably do a patch for this sometime when I'm less pressed for time.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list