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

(-)a/cataloguing/additem.pl (-21 / +24 lines)
Lines 545-571 my @fields = $temp->fields(); Link Here
545
545
546
546
547
my @hostitemnumbers;
547
my @hostitemnumbers;
548
my $analyticfield = '773';
548
if ( C4::Context->preference('EasyAnalyticalRecords') ) {
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
    }
565
}
567
}
566
568
567
569
568
569
foreach my $field (@fields) {
570
foreach my $field (@fields) {
570
    next if ( $field->tag() < 10 );
571
    next if ( $field->tag() < 10 );
571
572
Lines 596-613 foreach my $field (@fields) { Link Here
596
            }
597
            }
597
        }
598
        }
598
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
599
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
599
	foreach my $hostitemnumber (@hostitemnumbers){
600
601
	if ( C4::Context->preference('EasyAnalyticalRecords') ) {
602
	    foreach my $hostitemnumber (@hostitemnumbers){
600
		if ($this_row{itemnumber} eq $hostitemnumber){
603
		if ($this_row{itemnumber} eq $hostitemnumber){
601
			$this_row{hostitemflag} = 1;
604
			$this_row{hostitemflag} = 1;
602
			$this_row{hostbiblionumber}= GetBiblionumberFromItemnumber($hostitemnumber);
605
			$this_row{hostbiblionumber}= GetBiblionumberFromItemnumber($hostitemnumber);
603
			last;
606
			last;
604
		}
607
		}
605
	}
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