Bugzilla – Attachment 49288 Details for
Bug 11592
opac detail scripts do not respect MARC tag visibility
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add ShouldHideMARC to ViewPolicy filter
Add-ShouldHideMARC-to-ViewPolicy-filter.patch (text/plain), 2.51 KB, created by
Mark Tompsett
on 2016-03-17 23:26:21 UTC
(
hide
)
Description:
Add ShouldHideMARC to ViewPolicy filter
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2016-03-17 23:26:21 UTC
Size:
2.51 KB
patch
obsolete
>From b8766376ad0164d6c9cce0e50f84951d799d3d60 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Wed, 16 Mar 2016 17:10:02 -0400 >Subject: [PATCH] Add ShouldHideMARC to ViewPolicy filter > >https://bugs.koha-community.org/show_bug.cgi?id=11592 >--- > Koha/Filter/MARC/ViewPolicy.pm | 57 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 57 insertions(+) > >diff --git a/Koha/Filter/MARC/ViewPolicy.pm b/Koha/Filter/MARC/ViewPolicy.pm >index 98df72d..0515cec 100644 >--- a/Koha/Filter/MARC/ViewPolicy.pm >+++ b/Koha/Filter/MARC/ViewPolicy.pm >@@ -215,6 +215,63 @@ sub _should_hide_on_interface { > return $hide; > } > >+ >+=head2 ShouldHideMARC >+ >+Return a hash reference of whether a field, built from >+kohafield and tag, is hidden (1) or not (0) for a given >+interface >+ >+ my $OpacHideMARC = >+ GetOpacHideMARC( { >+ frameworkcode => $frameworkcode, >+ interface => 'opac', >+ } ); >+ >+ if ($OpacHideMARC->{'stocknumber'}==1) { >+ print "Hidden!\n"; >+ } >+ >+C<$OpacHideMARC> is a ref to a hash which contains a series >+of key value pairs indicating if that field (key) is >+hidden (value == 1) or not (value == 0). >+ >+C<$frameworkcode> is the framework code. >+ >+C<$interface> is the interface. It defaults to 'opac' if >+nothing is passed. Valid values include 'opac' or 'intranet'. >+ >+=cut >+ >+sub ShouldHideMARC { >+ my ($self,$parms) = @_; >+ my $frameworkcode = $parms->{frameworkcode} // ''; >+ my $interface = $parms->{interface} // 'opac'; >+ my $hide = _should_hide_on_interface(); >+ >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("SELECT kohafield AS field, tagfield AS tag, hidden FROM marc_subfield_structure WHERE kohafield>'' AND frameworkcode=? ORDER BY field, tagfield;"); >+ $sth->execute($frameworkcode); >+ >+ my %shouldhidemarc; >+ my $data = $sth->fetchall_hashref( [ qw(field tag) ] ); >+ foreach my $fullfield (keys %{$data}) { >+ my @tmpsplit = split(/\./,$fullfield); >+ my $field = $tmpsplit[-1]; >+ foreach my $tag (keys %{$data->{$fullfield}}) { >+ my $shouldhide = $hide->{$interface}->{ $data->{$fullfield}->{$tag}->{'hidden'} }; >+ if ($shouldhide) { >+ $shouldhidemarc{ $field } = 1; >+ } >+ elsif ( !exists($shouldhidemarc{ $field }) ) { >+ $shouldhidemarc{ $field } = 0; >+ } >+ } >+ } >+ return \%shouldhidemarc; >+} >+ >+ > =head1 DIAGNOSTICS > > $ prove -v t/RecordProcessor.t >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11592
:
24600
|
24601
|
24611
|
24629
|
24654
|
24655
|
24657
|
24658
|
24659
|
24660
|
24661
|
24662
|
24663
|
24664
|
24875
|
24876
|
24952
|
24953
|
28002
|
28003
|
28477
|
28478
|
28479
|
28480
|
28724
|
31356
|
32382
|
32383
|
33356
|
33357
|
33358
|
33689
|
35855
|
35856
|
35857
|
35858
|
47993
|
47996
|
47997
|
48001
|
49288
|
49289
|
49290
|
49291
|
49612
|
49613
|
49614
|
49615
|
50484
|
50485
|
50486
|
50489
|
50542
|
50550
|
50551
|
50552
|
50553
|
50554
|
51313
|
51314
|
51315
|
51316
|
51317
|
51318
|
51326
|
53440
|
53441
|
53442
|
53443
|
53444
|
55040
|
55041
|
55042
|
55043
|
55044
|
55045
|
55046
|
55184
|
55185