View | Details | Raw Unified | Return to bug 8204
Collapse All | Expand All

(-)a/C4/AuthoritiesMarc.pm (-31 / +64 lines)
Lines 955-960 sub BuildSummary { Link Here
955
        'f' => 'musical',
955
        'f' => 'musical',
956
        'g' => 'broader',
956
        'g' => 'broader',
957
        'h' => 'narrower',
957
        'h' => 'narrower',
958
        'n' => 'notapplicable',
958
        'i' => 'subfi',
959
        'i' => 'subfi',
959
        't' => 'parent'
960
        't' => 'parent'
960
    );
961
    );
Lines 1014-1048 sub BuildSummary { Link Here
1014
# construct UNIMARC summary, that is quite different from MARC21 one
1015
# construct UNIMARC summary, that is quite different from MARC21 one
1015
# accepted form
1016
# accepted form
1016
            foreach my $field ($record->field('2..')) {
1017
            foreach my $field ($record->field('2..')) {
1017
                push @authorized, $field->as_string('abcdefghijlmnopqrstuvwxyz');
1018
                push @authorized, { heading => $field->as_string('abcdefghijlmnopqrstuvwxyz'), field => $field->tag() };
1018
            }
1019
            }
1019
# rejected form(s)
1020
# rejected form(s)
1020
            foreach my $field ($record->field('3..')) {
1021
            foreach my $field ($record->field('3..')) {
1021
                push @notes, $field->subfield('a');
1022
                push @notes, { note => $field->subfield('a'), field => $field->tag() };
1022
            }
1023
            }
1023
            foreach my $field ($record->field('4..')) {
1024
            foreach my $field ($record->field('4..')) {
1024
                my $thesaurus = $field->subfield('2') ? "thes. : ".$thesaurus{"$field->subfield('2')"}." : " : '';
1025
                my $thesaurus = $field->subfield('2') ? "thes. : ".$thesaurus{"$field->subfield('2')"}." : " : '';
1025
                push @seefrom, { heading => $thesaurus . $field->as_string('abcdefghijlmnopqrstuvwxyz'), type => 'seefrom' };
1026
                push @seefrom, { heading => $thesaurus . $field->as_string('abcdefghijlmnopqrstuvwxyz'), type => 'seefrom', field => $field->tag() };
1026
            }
1027
            }
1027
# see :
1028
# see :
1028
            foreach my $field ($record->field('5..')) {
1029
            foreach my $field ($record->field('5..')) {
1029
                if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) {
1030
                if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) {
1030
                    push @seealso, { $field->as_string('abcdefgjxyz'), type => 'broader' };
1031
                    push @seealso, { $field->as_string('abcdefgjxyz'), type => 'broader', field => $field->tag() };
1031
                } elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){
1032
                } elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){
1032
                    push @seealso, { heading => $field->as_string('abcdefgjxyz'), type => 'narrower' };
1033
                    push @seealso, { heading => $field->as_string('abcdefgjxyz'), type => 'narrower', field => $field->tag() };
1033
                } elsif ($field->subfield('a')) {
1034
                } elsif ($field->subfield('a')) {
1034
                    push @seealso, { heading => $field->as_string('abcdefgxyz'), type => 'seealso' };
1035
                    push @seealso, { heading => $field->as_string('abcdefgxyz'), type => 'seealso', field => $field->tag() };
1035
                }
1036
                }
1036
            }
1037
            }
1037
# // form
1038
# // form
1038
            foreach my $field ($record->field('7..')) {
1039
            foreach my $field ($record->field('7..')) {
1039
                my $lang = substr($field->subfield('8'),3,3);
1040
                my $lang = substr($field->subfield('8'),3,3);
1040
                push @otherscript, { lang => $lang, term => $field->subfield('a') };
1041
                push @otherscript, { lang => $lang, term => $field->subfield('a'), direction => 'ltr', field => $field->tag() };
1041
            }
1042
            }
1042
        } else {
1043
        } else {
1043
# construct MARC21 summary
1044
# construct MARC21 summary
1044
# FIXME - looping over 1XX is questionable
1045
# FIXME - looping over 1XX is questionable
1045
# since MARC21 authority should have only one 1XX
1046
# since MARC21 authority should have only one 1XX
1047
            my $subfields_to_report;
1046
            foreach my $field ($record->field('1..')) {
1048
            foreach my $field ($record->field('1..')) {
1047
                my $tag = $field->tag();
1049
                my $tag = $field->tag();
1048
                next if "152" eq $tag;
1050
                next if "152" eq $tag;
Lines 1050-1104 sub BuildSummary { Link Here
1050
# in MARC21 -- purely local tags really ought to be
1052
# in MARC21 -- purely local tags really ought to be
1051
# 9XX
1053
# 9XX
1052
                if ($tag eq '100') {
1054
                if ($tag eq '100') {
1053
                    push @authorized, $field->as_string('abcdefghjklmnopqrstvxyz68');
1055
                    $subfields_to_report = 'abcdefghjklmnopqrstvxyz';
1054
                } elsif ($tag eq '110') {
1056
                } elsif ($tag eq '110') {
1055
                    push @authorized, $field->as_string('abcdefghklmnoprstvxyz68');
1057
                    $subfields_to_report = 'abcdefghklmnoprstvxyz';
1056
                } elsif ($tag eq '111') {
1058
                } elsif ($tag eq '111') {
1057
                    push @authorized, $field->as_string('acdefghklnpqstvxyz68');
1059
                    $subfields_to_report = 'acdefghklnpqstvxyz';
1058
                } elsif ($tag eq '130') {
1060
                } elsif ($tag eq '130') {
1059
                    push @authorized, $field->as_string('adfghklmnoprstvxyz68');
1061
                    $subfields_to_report = 'adfghklmnoprstvxyz';
1060
                } elsif ($tag eq '148') {
1062
                } elsif ($tag eq '148') {
1061
                    push @authorized, $field->as_string('abvxyz68');
1063
                    $subfields_to_report = 'abvxyz';
1062
                } elsif ($tag eq '150') {
1064
                } elsif ($tag eq '150') {
1063
                    push @authorized, $field->as_string('abvxyz68');
1065
                    $subfields_to_report = 'abvxyz';
1064
                } elsif ($tag eq '151') {
1066
                } elsif ($tag eq '151') {
1065
                    push @authorized, $field->as_string('avxyz68');
1067
                    $subfields_to_report = 'avxyz';
1066
                } elsif ($tag eq '155') {
1068
                } elsif ($tag eq '155') {
1067
                    push @authorized, $field->as_string('abvxyz68');
1069
                    $subfields_to_report = 'abvxyz';
1068
                } elsif ($tag eq '180') {
1070
                } elsif ($tag eq '180') {
1069
                    push @authorized, $field->as_string('vxyz68');
1071
                    $subfields_to_report = 'vxyz';
1070
                } elsif ($tag eq '181') {
1072
                } elsif ($tag eq '181') {
1071
                    push @authorized, $field->as_string('vxyz68');
1073
                    $subfields_to_report = 'vxyz';
1072
                } elsif ($tag eq '182') {
1074
                } elsif ($tag eq '182') {
1073
                    push @authorized, $field->as_string('vxyz68');
1075
                    $subfields_to_report = 'vxyz';
1074
                } elsif ($tag eq '185') {
1076
                } elsif ($tag eq '185') {
1075
                    push @authorized, $field->as_string('vxyz68');
1077
                    $subfields_to_report = 'vxyz';
1078
                }
1079
                if ($subfields_to_report) {
1080
                    push @authorized, { heading => $field->as_string($subfields_to_report), field => $tag };
1076
                } else {
1081
                } else {
1077
                    push @authorized, $field->as_string();
1082
                    push @authorized, { heading => $field->as_string(), field => $tag };
1078
                }
1083
                }
1079
            } #See From
1084
            }
1080
            foreach my $field ($record->field('4..')) {
1085
            foreach my $field ($record->field('4..')) { #See From
1081
                my $type = 'seefrom';
1086
                my $type = 'seefrom';
1082
                $type = $marc21controlrefs{substr $field->subfield('w'), '0'} if ($field->subfield('w'));
1087
                $type = $marc21controlrefs{substr $field->subfield('w'), 0, 1} if ($field->subfield('w'));
1088
                if ($type eq 'notapplicable') {
1089
                     substr $field->subfield('w'), 2, 1;
1090
                     $type = 'earlier' if $type && $type ne 'n';
1091
                }
1083
                if ($type eq 'subfi') {
1092
                if ($type eq 'subfi') {
1084
                    push @seefrom, { heading => $field->as_string($marc21subfields), type => $field->subfield('i') };
1093
                    push @seefrom, { heading => $field->as_string($marc21subfields), type => $field->subfield('i'), field => $field->tag() };
1085
                } else {
1094
                } else {
1086
                    push @seefrom, { heading => $field->as_string($marc21subfields), type => $type };
1095
                    push @seefrom, { heading => $field->as_string($marc21subfields), type => $type, field => $field->tag() };
1087
                }
1096
                }
1088
            } #See Also
1097
            }
1089
            foreach my $field ($record->field('5..')) {
1098
            foreach my $field ($record->field('5..')) { #See Also
1090
                my $type = 'seealso';
1099
                my $type = 'seealso';
1091
                $type = $marc21controlrefs{substr $field->subfield('w'), '0'} if ($field->subfield('w'));
1100
                $type = $marc21controlrefs{substr $field->subfield('w'), 0, 1} if ($field->subfield('w'));
1101
                if ($type eq 'notapplicable') {
1102
                     substr $field->subfield('w'), 2, 1;
1103
                     $type = 'earlier' if $type && $type ne 'n';
1104
                }
1092
                if ($type eq 'subfi') {
1105
                if ($type eq 'subfi') {
1093
                    push @seealso, { heading => $field->as_string($marc21subfields), type => $field->subfield('i') };
1106
                    push @seealso, { heading => $field->as_string($marc21subfields), type => $field->subfield('i'), field => $field->tag() };
1094
                } else {
1107
                } else {
1095
                    push @seealso, { heading => $field->as_string($marc21subfields), type => $type };
1108
                    push @seealso, { heading => $field->as_string($marc21subfields), type => $type, field => $field->tag() };
1096
                }
1109
                }
1097
            }
1110
            }
1098
            foreach my $field ($record->field('6..')) {
1111
            foreach my $field ($record->field('6..')) {
1099
                push @notes, $field->as_string();
1112
                push @notes, { note => $field->as_string(), field => $field->tag() };
1113
            }
1114
            foreach my $field ($record->field('880')) {
1115
                my $linkage = $field->subfield('6');
1116
                my $category = substr $linkage, 0, 1;
1117
                if ($category eq '1') {
1118
                    $category = 'preferred';
1119
                } elsif ($category eq '4') {
1120
                    $category = 'seefrom';
1121
                } elsif ($category eq '5') {
1122
                    $category = 'seealso';
1123
                }
1124
                my $type;
1125
                if ($field->subfield('w')) {
1126
                    $type = $marc21controlrefs{substr $field->subfield('w'), '0'};
1127
                } else {
1128
                    $type = $category;
1129
                }
1130
                my $direction = $linkage =~ m#/r$# ? 'rtl' : 'ltr';
1131
                push @otherscript, { term => $field->as_string($subfields_to_report), category => $category, type => $type, direction => $direction, linkage => $linkage };
1100
            }
1132
            }
1101
        }
1133
        }
1134
        $summary{mainentry} = $authorized[0]->{heading};
1102
        $summary{authorized} = \@authorized;
1135
        $summary{authorized} = \@authorized;
1103
        $summary{notes} = \@notes;
1136
        $summary{notes} = \@notes;
1104
        $summary{seefrom} = \@seefrom;
1137
        $summary{seefrom} = \@seefrom;
(-)a/koha-tmpl/opac-tmpl/prog/en/css/opac.css (-1 / +12 lines)
Lines 2594-2602 ul.ui-tabs-nav li { Link Here
2594
}
2594
}
2595
2595
2596
.authref .label {
2596
.authref .label {
2597
 font-style: italic;
2597
    font-style: italic;
2598
}
2598
}
2599
2599
2600
.authstanza {
2601
    margin-top: 1em;
2602
}
2603
2604
.authstanzaheading {
2605
    font-weight: bold;
2606
}
2607
2608
.authstanza li {
2609
    margin-left: 0.5em;
2610
}
2600
2611
2601
/* jQuery UI Datepicker */
2612
/* jQuery UI Datepicker */
2602
.ui-datepicker-trigger {
2613
.ui-datepicker-trigger {
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-MARCdetail.tt (+2 lines)
Lines 35-40 function showChildren(mynumber) { Link Here
35
	<div class="yui-b"><div class="yui-g">
35
	<div class="yui-b"><div class="yui-g">
36
<div id="userauthdetails" class="container">
36
<div id="userauthdetails" class="container">
37
37
38
    <div id="views"><span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% authid %]">Normal view</a></span> <span class="view"><span id="MARCview">MARC view</span></span></div>
39
38
[% IF ( displayhierarchy ) %]
40
[% IF ( displayhierarchy ) %]
39
41
40
<div class="hierarchies">
42
<div class="hierarchies">
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-detail.tt (+173 lines)
Line 0 Link Here
1
[% BLOCK authtypelabel %]
2
    [% UNLESS ( type=='seefrom' || type=='seealso' || type=='' ) %]
3
        <span class="type">[% FILTER trim %][% SWITCH type %]
4
        [% CASE 'earlier' %]Earlier heading
5
        [% CASE 'later' %]Later heading
6
        [% CASE 'acronym' %]Acronym
7
        [% CASE 'musical' %]Musical composition
8
        [% CASE 'broader' %]Broader heading
9
        [% CASE 'narrower' %]Narrower heading
10
        [% CASE %][% type %]
11
        [% END %][% END %]</span>
12
    [% END %]
13
[% END %]
14
[% BLOCK otherscript %]
15
    [% FOREACH heading IN headings %]
16
        [% IF heading.category == wantcategory %]
17
            [% IF heading.direction == 'ltr' %]
18
                <div class="heading otherscript [% heading.category %]">
19
                <span class="[% heading.category %]">[% heading.term %]</span>
20
                </div>
21
            [% ELSIF heading.direction == 'rtl' %]
22
                <div class="heading otherscript [% heading.category %] rtl">
23
                <span class="[% heading.category %]">[% heading.term %]</span>
24
                </div>
25
            [% END %]
26
        [% END %]
27
    [% END %]
28
[% END %]
29
[% BLOCK authheadingdisplay %]
30
    [% IF authid %]<a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% authid %]">[% heading %]</a>
31
    [% ELSIF search %]<a href="/cgi-bin/koha/opac-authorities-home.pl?op=do_search&type=opac&operator=contains&marclist=mainentry&and_ora=and&orderby=HeadingAsc&value=[% search %]">[% heading %]</a>
32
    [% ELSE %][% heading %]
33
    [% END %]
34
[% END %]
35
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;  Entry
36
[% INCLUDE 'doc-head-close.inc' %]
37
[% IF ( displayhierarchy ) %]
38
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/hierarchy.css">
39
[% END %]
40
<script language="JavaScript" type="text/javascript">
41
$(document).ready(function() {
42
    $('#authdescriptions').tabs();
43
});
44
45
[% IF ( displayhierarchy ) %]
46
function showParents(mynumber) {
47
  var parents=document.getElementsByName(mynumber+'p')
48
  for(i=0;i<parents.length;i++){
49
    if (parents[i].style.display == "none") {
50
      parents[i].style.display ="block";
51
    } else {
52
      parents[i].style.display ="none";
53
    }
54
  }
55
}
56
function showChildren(mynumber) {
57
  var children=document.getElementsByName(mynumber+'c')
58
  for(i=0;i<children.length;i++){
59
    if (children[i].style.display == "none") {
60
      children[i].style.display = "block";
61
    } else {
62
      children[i].style.display = "none";
63
    }
64
  }
65
}
66
[% END %]
67
</script>
68
</head>
69
<body id="opac-authoritiesdetail">
70
71
<div id="doc3" class="yui-t1">
72
   <div id="bd">
73
[% INCLUDE 'masthead.inc' %]
74
    <div id="yui-main">
75
    <div class="yui-b"><div class="yui-g">
76
77
    <div id="views"><span class="view"><span id="Normalview">Normal view</span></span> <span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% authid %]&marc=1">MARC view</a></span></div>
78
79
<div id="userauthdetails" class="container">
80
81
[% IF ( displayhierarchy ) %]
82
83
<div class="hierarchies">
84
[% FOREACH loophierarchie IN loophierarchies %]
85
  <div class="hierarchy">
86
  [% FOREACH loopelemen IN loophierarchie.loopelement %]
87
    <div id="[% loopelemen.loopauthid %]" class="[% loopelemen.class %]">
88
    [% IF ( loopelemen.current_value ) %]
89
        [% loopelemen.value %]
90
    [% ELSE %]
91
        <a href="opac-authoritiesdetail.pl?authid=[% loopelemen.loopauthid %]" title="Term">[% loopelemen.value %]</a>
92
    [% END %]
93
    [% IF ( loopelemen.ifchildren ) %]
94
      <sub><a class="parents" title="Narrower terms" href="JavaScript:showChildren('[% loopelemen.loopauthid %]');">+</a></sub><br/>
95
      [% FOREACH loopchildre IN loopelemen.loopchildren %]
96
        <div name="[% loopchildre.loopauthid %]c" class="child"> <a href="opac-authoritiesdetail.pl?authid=[% loopchildre.childauthid %]">[% loopchildre.childvalue %]</a></div>
97
      [% END %]
98
    [% END %]
99
    </div>
100
  [% END %]
101
102
  </div>
103
[% END %]
104
</div>
105
[% END %]
106
<h1>[% summary.mainentry %] ([% authtypetext %])</h1>
107
<div class="usedin">Used in <a href="opac-search.pl?type=opac&amp;q=[% authid %]&amp;idx=an,phr">[% count %] records</a></div>
108
<div class="authstanza">
109
[% FOREACH authorize IN summary.authorized %]
110
<div class="heading authorized auth[% seefro.field %]"><span class="label">Preferred form: </span><span class="authorized">[% authorize.heading %]</span></div>
111
[% END %]
112
[% PROCESS otherscript headings=summary.otherscript wantcategory='preferred' %]
113
</div>
114
[% IF summary.seefrom %]
115
    <div class="authstanza seefrom">
116
    <div class="authstanzaheading">Used for/see from:</div>
117
    <ul class="seefrom">
118
    [% FOREACH seefro IN summary.seefrom %]
119
        <li class="heading seefrom auth[% seefro.field %]">
120
        [% IF seefro.type && seefro.type != 'seefrom' %]<span class="label">[% PROCESS authtypelabel type=seefro.type | trim %]:</span>[% END %]
121
        <span class="seefrom">[% PROCESS authheadingdisplay heading=seefro.heading search=seefrosearch authid=seefro.authid %]</span>
122
        </li>
123
    [% END %]
124
    [% PROCESS otherscript headings=summary.otherscript wantcategory='seefrom' %]
125
    </div>
126
[% END %]
127
[% IF summary.seealso %]
128
    <div class="authstanza seealso">
129
    <div class="authstanzaheading">See also:</div>
130
    <ul class="seelso">
131
    [% FOREACH seeals IN summary.seealso %]
132
        <li class="heading seealso auth[% seeals.field %]">[% IF seeals.type && seeals.type != 'seealso' %]<span class="label">[% PROCESS authtypelabel type=seeals.type | trim %]:</span>[% END %]
133
        <span class="seealso">[% PROCESS authheadingdisplay heading=seeals.heading search=seeals.search authid=seeals.authid %]</span>
134
        </li>
135
    [% END %]
136
    [% PROCESS otherscript headings=summary.otherscript wantcategory='seealso' %]
137
    </div>
138
[% END %]
139
[% IF marcflavour == 'UNIMARC' && summary.otherscript %]
140
    <div class="authstanza">
141
    [% FOREACH otherscrip IN summary.otherscript %]
142
        <div class="heading otherscript auth[% otherscrip.field %]"><span class="label">See also[% PROCESS language lang=otherscript.lang | trim %] term:</span>
143
        <span class="otherscript">[% otherscrip.term %]</span>
144
        </div>
145
    [% END %]
146
    </div>
147
[% END %]
148
<div id="authdescriptions" class="toptabs">
149
<ul>
150
    <li id="tab_descriptions" class="ui-tabs-selected"><a href="#descriptions">Notes</a></li>
151
</ul>
152
<div id="descriptions">
153
<div class="content_set">
154
[% FOREACH note IN summary.notes %]
155
<p class="note auth[% note.field %]">[% note.note %]</p>
156
[% END %]
157
</div>
158
</div>
159
</div>
160
</div>
161
</div>
162
163
</div>
164
</div>
165
</div>
166
[% IF ( OpacNav ) %]
167
<div class="yui-b">
168
<div id="leftmenus" class="container">
169
[% INCLUDE 'navigation.inc' %]
170
</div>
171
</div>[% END %]
172
</div>
173
[% INCLUDE 'opac-bottom.inc' %]
(-)a/opac/opac-authoritiesdetail.pl (-77 / +76 lines)
Lines 53-59 my $query = new CGI; Link Here
53
my $dbh = C4::Context->dbh;
53
my $dbh = C4::Context->dbh;
54
54
55
my $display_hierarchy = C4::Context->preference("AuthDisplayHierarchy");
55
my $display_hierarchy = C4::Context->preference("AuthDisplayHierarchy");
56
my $show_marc = $query->param('marc') || 1; # Currently only MARC view is available
56
my $show_marc = $query->param('marc');
57
57
58
# open template
58
# open template
59
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
59
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 68-75 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
68
68
69
my $authid       = $query->param('authid');
69
my $authid       = $query->param('authid');
70
my $authtypecode = &GetAuthTypeCode( $authid );
70
my $authtypecode = &GetAuthTypeCode( $authid );
71
my $tagslib      = &GetTagsLabels( 0, $authtypecode );
72
73
71
74
my $record;
72
my $record;
75
if ($display_hierarchy){
73
if ($display_hierarchy){
Lines 101-190 else { Link Here
101
}
99
}
102
my $count = CountUsage($authid);
100
my $count = CountUsage($authid);
103
101
104
# find the marc field/subfield used in biblio by this authority
102
105
my $sth =
103
my $authtypes     = getauthtypes();
106
  $dbh->prepare(
104
my @authtypesloop = ();
107
    "select distinct tagfield from marc_subfield_structure where authtypecode=?"
105
foreach my $thisauthtype ( keys %{$authtypes} ) {
108
  );
106
    push @authtypesloop,
109
$sth->execute($authtypecode);
107
         { value        => $thisauthtype,
110
my $biblio_fields;
108
           selected     => $thisauthtype eq $authtypecode,
111
while ( my ($tagfield) = $sth->fetchrow ) {
109
           authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
112
    $biblio_fields .= $tagfield . "9,";
110
         };
113
}
111
}
114
chop $biblio_fields;
112
$template->{VARS}->{'authtypesloop'} = \@authtypesloop;
113
$template->{VARS}->{'authtypetext'}  = $authtypes->{$authtypecode}{'authtypetext'};
114
$template->{VARS}->{'authid'}        = $authid;
115
$template->{VARS}->{'count'}         = $count;
116
117
# find the marc field/subfield used in biblio by this authority
118
if ($show_marc) {
119
    my $tagslib = &GetTagsLabels( 0, $authtypecode );
120
    my $sth =
121
        $dbh->prepare(
122
                "select distinct tagfield from marc_subfield_structure where authtypecode=?"
123
                );
124
    $sth->execute($authtypecode);
125
    my $biblio_fields;
126
    while ( my ($tagfield) = $sth->fetchrow ) {
127
        $biblio_fields .= $tagfield . "9,";
128
    }
129
    chop $biblio_fields;
115
130
116
# fill arrays
131
# fill arrays
117
my @loop_data = ();
132
    my @loop_data = ();
118
my $tag;
133
    my $tag;
119
134
120
# loop through each tab 0 through 9
121
# for (my $tabloop = 0; $tabloop<=10;$tabloop++) {
122
# loop through each tag
135
# loop through each tag
123
my @fields    = $record->fields();
136
    my @fields    = $record->fields();
124
foreach my $field (@fields) {
137
    foreach my $field (@fields) {
125
    my @subfields_data;
138
        my @subfields_data;
126
139
127
    # skip UNIMARC fields <200, they are useless for a patron
140
# skip UNIMARC fields <200, they are useless for a patron
128
    next if C4::Context->preference('MarcFlavour') eq 'UNIMARC' && $field->tag() <200;
141
        next if C4::Context->preference('MarcFlavour') eq 'UNIMARC' && $field->tag() <200;
129
142
130
    # if tag <10, there's no subfield, use the "@" trick
143
# if tag <10, there's no subfield, use the "@" trick
131
    if ( $field->tag() < 10 ) {
144
        if ( $field->tag() < 10 ) {
132
        next if ( $tagslib->{ $field->tag() }->{'@'}->{hidden} );
145
            next if ( $tagslib->{ $field->tag() }->{'@'}->{hidden} );
133
        my %subfield_data;
134
        $subfield_data{marc_lib}   = $tagslib->{ $field->tag() }->{'@'}->{lib};
135
        $subfield_data{marc_value} = $field->data();
136
        $subfield_data{marc_subfield} = '@';
137
        $subfield_data{marc_tag}      = $field->tag();
138
        push( @subfields_data, \%subfield_data );
139
    }
140
    else {
141
        my @subf = $field->subfields;
142
143
        # loop through each subfield
144
        for my $i ( 0 .. $#subf ) {
145
            $subf[$i][0] = "@" unless $subf[$i][0];
146
            next if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{hidden} );
147
            # skip useless subfields (for patrons)
148
            next if $subf[$i][0] =~ /7|8|9/;
149
            my %subfield_data;
146
            my %subfield_data;
150
            $subfield_data{marc_lib} =
147
            $subfield_data{marc_lib}   = $tagslib->{ $field->tag() }->{'@'}->{lib};
151
              $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{lib};
148
            $subfield_data{marc_value} = $field->data();
152
            $subfield_data{marc_subfield} = $subf[$i][0];
149
            $subfield_data{marc_subfield} = '@';
153
            $subfield_data{marc_tag}      = $field->tag();
150
            $subfield_data{marc_tag}      = $field->tag();
154
            $subfield_data{isurl} =  $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{isurl};
155
            $subfield_data{marc_value} = $subf[$i][1];
156
            push( @subfields_data, \%subfield_data );
151
            push( @subfields_data, \%subfield_data );
157
        }
152
        }
153
        else {
154
            my @subf = $field->subfields;
155
156
# loop through each subfield
157
            for my $i ( 0 .. $#subf ) {
158
                $subf[$i][0] = "@" unless $subf[$i][0];
159
                next if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{hidden} );
160
# skip useless subfields (for patrons)
161
                next if $subf[$i][0] =~ /7|8|9/;
162
                my %subfield_data;
163
                $subfield_data{marc_lib} =
164
                    $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{lib};
165
                $subfield_data{marc_subfield} = $subf[$i][0];
166
                $subfield_data{marc_tag}      = $field->tag();
167
                $subfield_data{isurl} =  $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{isurl};
168
                $subfield_data{marc_value} = $subf[$i][1];
169
                push( @subfields_data, \%subfield_data );
170
            }
171
        }
172
        if ( $#subfields_data >= 0 ) {
173
            my %tag_data;
174
            $tag_data{tag} =
175
                $field->tag()
176
                . ' '
177
                . C4::Koha::display_marc_indicators($field)
178
                . ' - ' . $tagslib->{ $field->tag() }->{lib};
179
            $tag_data{subfield} = \@subfields_data;
180
            push( @loop_data, \%tag_data );
181
        }
158
    }
182
    }
159
    if ( $#subfields_data >= 0 ) {
183
    $template->param( "Tab0XX" => \@loop_data );
160
        my %tag_data;
184
} else {
161
        $tag_data{tag} =
185
    my $summary = BuildSummary($record, $authid, $authtypecode);
162
          $field->tag() 
186
    $template->{VARS}->{'summary'} = $summary;
163
          . ' '
164
          . C4::Koha::display_marc_indicators($field)
165
          . ' - ' . $tagslib->{ $field->tag() }->{lib};
166
        $tag_data{subfield} = \@subfields_data;
167
        push( @loop_data, \%tag_data );
168
    }
169
}
170
$template->param( "Tab0XX" => \@loop_data );
171
172
my $authtypes     = getauthtypes();
173
my @authtypesloop = ();
174
foreach my $thisauthtype ( keys %{$authtypes} ) {
175
    push @authtypesloop,
176
      { value        => $thisauthtype,
177
        selected     => $thisauthtype eq $authtypecode,
178
        authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
179
      };
180
}
187
}
181
188
182
$template->param(
183
    authid               => $authid,
184
    count                => $count,
185
    biblio_fields        => $biblio_fields,
186
    authtypetext         => $authtypes->{$authtypecode}{'authtypetext'},
187
    authtypesloop        => \@authtypesloop,
188
);
189
output_html_with_http_headers $query, $cookie, $template->output;
189
output_html_with_http_headers $query, $cookie, $template->output;
190
190
191
- 

Return to bug 8204