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

(-)a/C4/Biblio.pm (+36 lines)
Lines 136-141 BEGIN { Link Here
136
      &TransformHtmlToMarc
136
      &TransformHtmlToMarc
137
      &TransformHtmlToXml
137
      &TransformHtmlToXml
138
      prepare_host_field
138
      prepare_host_field
139
      &RemoveItemsAndAuthidsFromRecord
139
    );
140
    );
140
}
141
}
141
142
Lines 2777-2782 sub get_koha_field_from_marc { Link Here
2777
    return $kohafield;
2778
    return $kohafield;
2778
}
2779
}
2779
2780
2781
=head2 RemoveItemsAndAuthidsFromRecord
2782
2783
  RemoveItemsAndAuthidsFromRecord($record);
2784
2785
  Remove all items (952) from the record.
2786
  Also removes all authids (subfield 9 in headings)
2787
2788
=cut
2789
2790
sub RemoveItemsAndAuthidsFromRecord {
2791
    my $record = shift;
2792
    my $frameworkcode = shift || '';
2793
2794
    my $marcflavour = C4::Context->preference("marcflavour");
2795
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
2796
2797
    # Remove all the items from the record
2798
    foreach my $item ($record->field($itemtag)) {
2799
        $record->delete_field($item);
2800
    }
2801
2802
    # Remove all authid links ($9) in the record
2803
    if ( $marcflavour eq "MARC21" ) {
2804
        my @heading = qw(100 110 111 130 440 600 610 611 630 648 650 651 655 700 710 711 730 800 810 811 830);
2805
        foreach (@heading) {
2806
            foreach my $field ($record->field($_)) {
2807
                $field->delete_subfield(code => '9');
2808
                unless($field->subfields()) {
2809
                    $record->delete_field($field);
2810
                }
2811
            }
2812
        }
2813
    }
2814
}
2815
2780
=head2 TransformMarcToKohaOneField
2816
=head2 TransformMarcToKohaOneField
2781
2817
2782
  $result = TransformMarcToKohaOneField( $kohatable, $kohafield, $record, $result, $frameworkcode )
2818
  $result = TransformMarcToKohaOneField( $kohatable, $kohafield, $record, $result, $frameworkcode )
(-)a/acqui/neworderempty.pl (-4 / +2 lines)
Lines 145-154 if ( $ordernumber eq '' and defined $params->{'breedingid'}){ Link Here
145
    my ($marcrecord, $encoding) = MARCfindbreeding($params->{'breedingid'});
145
    my ($marcrecord, $encoding) = MARCfindbreeding($params->{'breedingid'});
146
    die("Could not find the selected record in the reservoir, bailing") unless $marcrecord;
146
    die("Could not find the selected record in the reservoir, bailing") unless $marcrecord;
147
147
148
    # Remove all the items (952) from the imported record
148
    # Do a cleanup on the imported record
149
    foreach my $item ($marcrecord->field('952')) {
149
    RemoveItemsAndAuthidsFromRecord($marcrecord, $params->{'frameworkcode'});
150
        $marcrecord->delete_field($item);
151
    }
152
150
153
    my $duplicatetitle;
151
    my $duplicatetitle;
154
#look for duplicates
152
#look for duplicates
(-)a/cataloguing/addbiblio.pl (-2 / +2 lines)
Lines 795-801 if (($biblionumber) && !($breedingid)){ Link Here
795
	$record = GetMarcBiblio($biblionumber);
795
	$record = GetMarcBiblio($biblionumber);
796
}
796
}
797
if ($breedingid) {
797
if ($breedingid) {
798
    ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
798
    ( $record, $encoding ) = MARCfindbreeding( $breedingid );
799
    RemoveItemsAndAuthidsFromRecord($record, $frameworkcode) if $record;
799
}
800
}
800
801
801
#populate hostfield if hostbiblionumber is available
802
#populate hostfield if hostbiblionumber is available
802
- 

Return to bug 6681