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

(-)a/C4/Items.pm (-34 / +29 lines)
Lines 1206-1249 sub GetItemsLocationInfo { Link Here
1206
1206
1207
=head2 GetHostItemsInfo
1207
=head2 GetHostItemsInfo
1208
1208
1209
	$hostiteminfo = GetHostItemsInfo($hostfield);
1209
    $hostiteminfo = GetHostItemsInfo($hostfield);
1210
	Returns the iteminfo for items linked to records via a host field
1210
    Returns the iteminfo for items linked to records via a host field
1211
1211
1212
=cut
1212
=cut
1213
1213
1214
sub GetHostItemsInfo {
1214
sub GetHostItemsInfo {
1215
	my ($record) = @_;
1215
    my ($record) = @_;
1216
	my @returnitemsInfo;
1216
    my @returnitemsInfo;
1217
1218
	if (C4::Context->preference('marcflavour') eq 'MARC21' ||
1219
        C4::Context->preference('marcflavour') eq 'NORMARC'){
1220
	    foreach my $hostfield ( $record->field('773') ) {
1221
        	my $hostbiblionumber = $hostfield->subfield("0");
1222
	        my $linkeditemnumber = $hostfield->subfield("9");
1223
        	my @hostitemInfos = GetItemsInfo($hostbiblionumber);
1224
	        foreach my $hostitemInfo (@hostitemInfos){
1225
        	        if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){
1226
                	        push (@returnitemsInfo,$hostitemInfo);
1227
				last;
1228
                	}
1229
        	}
1230
	    }
1231
	} elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC'){
1232
	    foreach my $hostfield ( $record->field('461') ) {
1233
        	my $hostbiblionumber = $hostfield->subfield("0");
1234
	        my $linkeditemnumber = $hostfield->subfield("9");
1235
        	my @hostitemInfos = GetItemsInfo($hostbiblionumber);
1236
	        foreach my $hostitemInfo (@hostitemInfos){
1237
        	        if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){
1238
                	        push (@returnitemsInfo,$hostitemInfo);
1239
				last;
1240
                	}
1241
        	}
1242
	    }
1243
	}
1244
	return @returnitemsInfo;
1245
}
1246
1217
1218
    if( !C4::Context->preference('EasyAnalyticalRecords') ) {
1219
        return @returnitemsInfo;
1220
    }
1221
1222
    my @fields;
1223
    if( C4::Context->preference('marcflavour') eq 'MARC21' ||
1224
      C4::Context->preference('marcflavour') eq 'NORMARC') {
1225
        @fields = $record->field('773');
1226
    } elsif( C4::Context->preference('marcflavour') eq 'UNIMARC') {
1227
        @fields = $record->field('461');
1228
    }
1229
1230
    foreach my $hostfield ( @fields ) {
1231
        my $hostbiblionumber = $hostfield->subfield("0");
1232
        my $linkeditemnumber = $hostfield->subfield("9");
1233
        my @hostitemInfos = GetItemsInfo($hostbiblionumber);
1234
        foreach my $hostitemInfo (@hostitemInfos) {
1235
            if( $hostitemInfo->{itemnumber} eq $linkeditemnumber ) {
1236
                push @returnitemsInfo, $hostitemInfo;
1237
                last;
1238
            }
1239
        }
1240
    }
1241
    return @returnitemsInfo;
1242
}
1247
1243
1248
=head2 GetLastAcquisitions
1244
=head2 GetLastAcquisitions
1249
1245
1250
- 

Return to bug 20702