http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10542

David Cook <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #11 from David Cook <[email protected]> ---
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.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to