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

(-)a/C4/Biblio.pm (-23 / +94 lines)
Lines 1108-1113 sub GetMarcSubfieldStructureFromKohaField { Link Here
1108
    return wantarray ? @{$mss->{$kohafield}} : $mss->{$kohafield}->[0];
1108
    return wantarray ? @{$mss->{$kohafield}} : $mss->{$kohafield}->[0];
1109
}
1109
}
1110
1110
1111
=head2 GetMarcBiblio
1112
1113
  my $record = GetMarcBiblio({
1114
      biblionumber => $biblionumber,
1115
      embed_items  => $embeditems,
1116
      opac         => $opac,
1117
      borcat       => $patron_category });
1118
1119
Returns MARC::Record representing a biblio record, or C<undef> if the
1120
biblionumber doesn't exist.
1121
1122
Both embed_items and opac are optional.
1123
If embed_items is passed and is 1, items are embedded.
1124
If opac is passed and is 1, the record is filtered as needed.
1125
1126
=over 4
1127
1128
=item C<$biblionumber>
1129
1130
the biblionumber
1131
1132
=item C<$embeditems>
1133
1134
set to true to include item information.
1135
1136
=item C<$opac>
1137
1138
set to true to make the result suited for OPAC view. This causes things like
1139
OpacHiddenItems to be applied.
1140
1141
=item C<$borcat>
1142
1143
If the OpacHiddenItemsExceptions system preference is set, this patron category
1144
can be used to make visible OPAC items which would be normally hidden.
1145
It only makes sense in combination both embed_items and opac values true.
1146
1147
=back
1148
1149
=cut
1111
1150
1112
sub GetMarcBiblio {
1151
sub GetMarcBiblio {
1113
    my ($params) = @_;
1152
    my ($params) = @_;
Lines 1128-1169 sub GetMarcBiblio { Link Here
1128
    return $biblio;
1167
    return $biblio;
1129
}
1168
}
1130
1169
1131
=head2 GetMarcBiblio
1170
=head2 GetMarcBiblios
1132
1171
1133
  my $record = GetMarcBiblio({
1172
  my $records = GetMarcBiblio({
1134
      biblionumber => $biblionumber,
1173
      biblionumbers => $biblionumbers,
1135
      embed_items  => $embeditems,
1174
      embed_items  => $embeditems,
1136
      opac         => $opac,
1175
      opac         => $opac,
1137
      borcat       => $patron_category });
1176
      borcat       => $patron_category });
1138
1177
1139
Returns MARC::Record representing a biblio record, or C<undef> if the
1178
Same as L</GetMarcBiblio> but accepts multiple C<biblionumbers>. Returns a
1140
biblionumber doesn't exist.
1179
hashref of C<MARC::Record>s keyed by biblionumbers in scalar context, or a
1180
list of C<MARC::Records> in list context, or C<undef> if non of the
1181
biblionumbers exist. Accepts the same arguments as C<GetMarcBiblio>
1182
but instead of a single C<biblionumber> takes multiple C<biblionumbers> and
1183
so that only database has to be performed to fetch biblios and biblio items
1184
respectively. This has a substatial performance gain when a large number of
1185
biblios is to be fetched.
1141
1186
1142
Both embed_items and opac are optional.
1187
For a more detailed explanation of arguments and behavior see
1143
If embed_items is passed and is 1, items are embedded.
1188
L</GetMarcBiblios>.
1144
If opac is passed and is 1, the record is filtered as needed.
1145
1189
1146
=over 4
1190
=over 4
1147
1191
1148
=item C<$biblionumber>
1192
=item C<$biblionumbers>
1149
1193
1150
the biblionumber
1194
The biblionumbers to be fetched.
1151
1195
1152
=item C<$embeditems>
1196
=item C<$embeditems>
1153
1197
1154
set to true to include item information.
1155
1156
=item C<$opac>
1198
=item C<$opac>
1157
1199
1158
set to true to make the result suited for OPAC view. This causes things like
1159
OpacHiddenItems to be applied.
1160
1161
=item C<$borcat>
1200
=item C<$borcat>
1162
1201
1163
If the OpacHiddenItemsExceptions system preference is set, this patron category
1164
can be used to make visible OPAC items which would be normally hidden.
1165
It only makes sense in combination both embed_items and opac values true.
1166
1167
=back
1202
=back
1168
1203
1169
=cut
1204
=cut
Lines 2798-2811 sub ModZebra { Link Here
2798
    }
2833
    }
2799
}
2834
}
2800
2835
2801
2802
=head2 EmbedItemsInMarcBiblio
2836
=head2 EmbedItemsInMarcBiblio
2803
2837
2804
    EmbedItemsInMarcBiblio({
2838
    $marc_with_item = EmbedItemsInMarcBiblio({
2805
        marc_record  => $marc,
2839
        marc_record  => $marc,
2806
        biblionumber => $biblionumber,
2840
        biblionumber => $biblionumber,
2807
        item_numbers => $itemnumbers,
2841
        item_numbers => $itemnumbers,
2808
        opac         => $opac });
2842
        opac         => $opac
2843
        borcat         => $borcat
2844
    });
2809
2845
2810
Given a MARC::Record object containing a bib record,
2846
Given a MARC::Record object containing a bib record,
2811
modify it to include the items attached to it as 9XX
2847
modify it to include the items attached to it as 9XX
Lines 2839-2847 sub EmbedItemsInMarcBiblio { Link Here
2839
    return $marc_with_items;
2875
    return $marc_with_items;
2840
}
2876
}
2841
2877
2878
=head2 EmbedItemsInMarcBiblios
2879
2880
    my $marc_records_with_items = EmbedItemsInMarcBiblio({
2881
        marc_records  => $marc_records,
2882
        item_numbers => $itemnumbers,
2883
        opac         => $opac
2884
        borcat       => $borcat
2885
    });
2886
2887
Same as L</EmbedItemsInMarcBiblio> but accepts multiple C<$marc_records>.
2888
2889
C<$marc_records> is a hashref of C<MARC::Record>s keyed by biblionumbers.
2890
2891
Returns a hashref on the same format with items embedded.
2892
2893
For a more detailed explanation of arguments and behaviour see
2894
L</EmbedItemsInMarcbiblio>.
2895
2896
=over 4
2897
2898
=item C<$marc_records>
2899
2900
A hashref of C<MARC::Record>s keyed by biblionumbers for which items should
2901
be embedded.
2902
2903
=item C<$itemnumbers>
2904
2905
=item C<$opac>
2906
2907
=item C<$borcat>
2908
2909
=back
2910
2911
=cut
2912
2842
sub EmbedItemsInMarcBiblios {
2913
sub EmbedItemsInMarcBiblios {
2843
    my ($params) = @_;
2914
    my ($params) = @_;
2844
    my ($marc_records, $biblionumber, $itemnumbers, $opac, $borcat);
2915
    my ($marc_records, $itemnumbers, $opac, $borcat);
2845
    $marc_records = $params->{marc_records};
2916
    $marc_records = $params->{marc_records};
2846
2917
2847
    $itemnumbers = $params->{item_numbers};
2918
    $itemnumbers = $params->{item_numbers};
(-)a/C4/Items.pm (-2 / +12 lines)
Lines 125-131 of C<C4::Items> Link Here
125
125
126
=head2 GetItem
126
=head2 GetItem
127
127
128
  $item = GetItem($itemnumber,$barcode,$serial);
128
  $item = GetItem($itemnumber, $barcode, $serial);
129
129
130
Return item information, for a given itemnumber or barcode.
130
Return item information, for a given itemnumber or barcode.
131
The return value is a hashref mapping item column
131
The return value is a hashref mapping item column
Lines 139-144 sub GetItem { Link Here
139
    return @{$items} ? $items->[0] : undef;
139
    return @{$items} ? $items->[0] : undef;
140
}
140
}
141
141
142
=head2 GetItem
143
144
  $items = GetItem($itemnumbers, $barcode, $serial);
145
146
Same as L</GetItem> but accepts multiple C<$itemnumbers>.
147
148
For a more detailed explanation of arguments and behavior see
149
L</GetItem>.
150
151
=cut
152
142
=head2 GetItems
153
=head2 GetItems
143
154
144
  $item = GetItems($itemnumber,$barcode,$serial);
155
  $item = GetItems($itemnumber,$barcode,$serial);
145
- 

Return to bug 19884