https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10589

--- Comment #48 from M. Tompsett <mtomp...@hotmail.com> ---
(In reply to Tomás Cohen Arazi from comment #47)
> Please take a look at bug 22454 and bug 22455. The rationale is that if you
> have the biblio object, you can know all that is needed regarding hiding in
> OPAC without fetching MARC data or complex calculations. And if we were to
> add parameters like category and library, I would rather pass the
> Koha::Patron object altogether.
> This check, with bug 22457 in mind could be written:
> 
> my $should_hide = ( $patron->category->overrides_opac_hidding_policy or
>                     $patron->library->overrides_opac_hidding_policy )
>                 ? 0
>                 : 1;
> 
> while ( my $biblio = $biblios->next ) {
>  next if $biblio->hidden_in_opac and $should_hide;
>  do_your_things();
> }
> 
> This check should be written on the controller script.

Doesn't quite work.

The idea is:
if (! defined $patron) {
    $globally_override = 0;
} elsif (! defined $patron->category) {
    $globally_override = 0;
} else {
    $globally_override = $patron->category->globally_overrides_opac_hiding;
}
while ( my $biblio = $bilbios->next ) {
    if (! defined $patron) {
        $locally_override = 0;
    } else {
        $locally_override = ($patron->branchcode ne $biblio->homebranch)
            ? 0
            : $patron->category->overrides_opac_hiding_policy_locally;
    }
    $should_show = $globally_override || $locally_override;
    $should_hide = ! $should_show;
    next if $biblio->hidden_in_opac && $should_hide;
    do_your_things();
}

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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