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

(-)a/cataloguing/additem.pl (-23 / +26 lines)
Lines 544-564 C4::Biblio::EmbedItemsInMarcBiblio($temp, $biblionumber); Link Here
544
my @fields = $temp->fields();
544
my @fields = $temp->fields();
545
545
546
546
547
my @hostitemnumbers;
547
if (C4::Context->preference('EasyAnalyticalRecords')) {
548
my $analyticfield = '773';
548
    my @hostitemnumbers;
549
if ($marcflavour  eq 'MARC21' || $marcflavour eq 'NORMARC') {
549
    my $analyticfield = '773';
550
    $analyticfield = '773';
550
    if ($marcflavour  eq 'MARC21' || $marcflavour eq 'NORMARC') {
551
} elsif ($marcflavour eq 'UNIMARC') {
551
        $analyticfield = '773';
552
    $analyticfield = '461';
552
    } elsif ($marcflavour eq 'UNIMARC') {
553
}
553
        $analyticfield = '461';
554
foreach my $hostfield ($temp->field($analyticfield)){
554
    }
555
    if ($hostfield->subfield('0')){
555
    foreach my $hostfield ($temp->field($analyticfield)){
556
        my $hostrecord = GetMarcBiblio($hostfield->subfield('0'), 1);
556
        if ($hostfield->subfield('0')){
557
        my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostfield->subfield('0')) );
557
            my $hostrecord = GetMarcBiblio($hostfield->subfield('0'), 1);
558
        foreach my $hostitem ($hostrecord->field($itemfield)){
558
            my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostfield->subfield('0')) );
559
            if ($hostitem->subfield('9') eq $hostfield->subfield('9')){
559
            foreach my $hostitem ($hostrecord->field($itemfield)){
560
                push (@fields, $hostitem);
560
                if ($hostitem->subfield('9') eq $hostfield->subfield('9')){
561
                push (@hostitemnumbers, $hostfield->subfield('9'));
561
                    push (@fields, $hostitem);
562
                    push (@hostitemnumbers, $hostfield->subfield('9'));
563
                }
562
            }
564
            }
563
        }
565
        }
564
    }
566
    }
Lines 596-613 foreach my $field (@fields) { Link Here
596
            }
598
            }
597
        }
599
        }
598
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
600
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
599
	foreach my $hostitemnumber (@hostitemnumbers){
601
        if (C4::Context->preference('EasyAnalyticalRecords')) {
600
		if ($this_row{itemnumber} eq $hostitemnumber){
602
            foreach my $hostitemnumber (@hostitemnumbers){
601
			$this_row{hostitemflag} = 1;
603
                if ($this_row{itemnumber} eq $hostitemnumber){
602
			$this_row{hostbiblionumber}= GetBiblionumberFromItemnumber($hostitemnumber);
604
                    $this_row{hostitemflag} = 1;
603
			last;
605
                    $this_row{hostbiblionumber}= GetBiblionumberFromItemnumber($hostitemnumber);
604
		}
606
                    last;
605
	}
607
                }
608
            }
606
609
607
#	my $countanalytics=GetAnalyticsCount($this_row{itemnumber});
610
#	my $countanalytics=GetAnalyticsCount($this_row{itemnumber});
608
#        if ($countanalytics > 0){
611
#        if ($countanalytics > 0){
609
#                $this_row{countanalytics} = $countanalytics;
612
#                $this_row{countanalytics} = $countanalytics;
610
#        }
613
#        }
614
        }
611
615
612
    }
616
    }
613
    if (%this_row) {
617
    if (%this_row) {
614
- 

Return to bug 7311