Lines 1233-1258
sub searchResults {
Link Here
|
1233 |
if ( $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) { |
1233 |
if ( $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) { |
1234 |
my $summary = $itemtypes{ $oldbiblio->{itemtype} }->{summary}; |
1234 |
my $summary = $itemtypes{ $oldbiblio->{itemtype} }->{summary}; |
1235 |
my @fields = $marcrecord->fields(); |
1235 |
my @fields = $marcrecord->fields(); |
1236 |
foreach my $field (@fields) { |
1236 |
|
1237 |
my $tag = $field->tag(); |
1237 |
my $newsummary; |
1238 |
my $tagvalue = $field->as_string(); |
1238 |
foreach my $line ( "$summary\n" =~ /(.*)\n/g ){ |
1239 |
$summary =~ |
1239 |
my $tags = {}; |
1240 |
s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g; |
1240 |
foreach my $tag ( $line =~ /\[(\d{3}[\w|\d])\]/ ) { |
1241 |
unless ( $tag < 10 ) { |
1241 |
$tag =~ /(.{3})(.)/; |
1242 |
my @subf = $field->subfields; |
1242 |
if($marcrecord->field($1)){ |
1243 |
for my $i ( 0 .. $#subf ) { |
1243 |
my @abc = $marcrecord->field($1)->subfield($2); |
1244 |
my $subfieldcode = $subf[$i][0]; |
1244 |
$tags->{$tag} = $#abc + 1 ; |
1245 |
my $subfieldvalue = $subf[$i][1]; |
|
|
1246 |
my $tagsubf = $tag . $subfieldcode; |
1247 |
$summary =~ |
1248 |
s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g; |
1249 |
} |
1245 |
} |
1250 |
} |
1246 |
} |
|
|
1247 |
|
1248 |
# We catch how many times to repeat this line |
1249 |
my $max = 0; |
1250 |
foreach my $tag (keys(%$tags)){ |
1251 |
$max = $tags->{$tag} if($tags->{$tag} > $max); |
1252 |
} |
1253 |
|
1254 |
# we replace, and repeat each line |
1255 |
for (my $i = 0 ; $i < $max ; $i++){ |
1256 |
my $newline = $line; |
1257 |
|
1258 |
foreach my $tag ( $newline =~ /\[(\d{3}[\w|\d])\]/g ) { |
1259 |
$tag =~ /(.{3})(.)/; |
1260 |
|
1261 |
if($marcrecord->field($1)){ |
1262 |
my @repl = $marcrecord->field($1)->subfield($2); |
1263 |
my $subfieldvalue = $repl[$i]; |
1264 |
|
1265 |
if (! utf8::is_utf8($subfieldvalue)) { |
1266 |
utf8::decode($subfieldvalue); |
1267 |
} |
1268 |
|
1269 |
$newline =~ s/\[$tag\]/$subfieldvalue/g; |
1270 |
} |
1271 |
} |
1272 |
$newsummary .= "$newline\n"; |
1273 |
} |
1251 |
} |
1274 |
} |
1252 |
# FIXME: yuk |
1275 |
|
1253 |
$summary =~ s/\[(.*?)]//g; |
1276 |
$newsummary =~ s/\[(.*?)]//g; |
1254 |
$summary =~ s/\n/<br\/>/g; |
1277 |
$newsummary =~ s/\n/<br\/>/g; |
1255 |
$oldbiblio->{summary} = $summary; |
1278 |
$oldbiblio->{summary} = $newsummary; |
1256 |
} |
1279 |
} |
1257 |
|
1280 |
|
1258 |
# Pull out the items fields |
1281 |
# Pull out the items fields |
1259 |
- |
|
|