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

(-)a/Koha/ERM/EHoldings/Title.pm (-3 / +71 lines)
Lines 59-69 sub store { Link Here
59
        } else {
59
        } else {
60
60
61
            # If it's not linked, we create a simple biblio and save the biblio id to the 'title'
61
            # If it's not linked, we create a simple biblio and save the biblio id to the 'title'
62
            my $marc_record = TransformKohaToMarc(
62
            my $marc_record =
63
                C4::Context->preference('marcflavour') eq 'MARC21'
64
                ? $self->_make_simple_marc21_record
65
                : TransformKohaToMarc(
63
                {
66
                {
64
                    'biblio.title' => $self->publication_title,
67
                    'biblio.title' => $self->publication_title,
65
                }
68
                }
66
            );
69
                );
67
            my ($biblio_id) = C4::Biblio::AddBiblio( $marc_record, '', { skip_record_index => 1 } );
70
            my ($biblio_id) = C4::Biblio::AddBiblio( $marc_record, '', { skip_record_index => 1 } );
68
            $self->biblio_id($biblio_id);
71
            $self->biblio_id($biblio_id);
69
        }
72
        }
Lines 102-107 sub resources { Link Here
102
105
103
=head2 Internal methods
106
=head2 Internal methods
104
107
108
109
=head3 _make_simple_marc21_record
110
111
=cut
112
113
sub _make_simple_marc21_record {
114
    my $self = shift;
115
116
    my $marc_record = MARC::Record->new;
117
    my @fields;
118
    $marc_record->insert_fields_ordered( MARC::Field->new( '245', '0', '0', a => $self->publication_title ) );
119
    if ( $self->print_identifier ) {
120
        my $standard_number = $self->print_identifier;
121
        my $tag             = $standard_number =~ s/\d/$&/g >= 10 ? '020' : '022';
122
        push @fields,
123
            MARC::Field->new( $tag, ' ', ' ', a => $self->print_identifier );
124
    }
125
    if ( $self->online_identifier ) {
126
        my $standard_number = $self->print_identifier;
127
        my $tag             = $standard_number =~ s/\d/$&/g >= 10 ? '020' : '022';
128
        push @fields,
129
            MARC::Field->new( $tag, ' ', ' ', a => $self->online_identifier );
130
    }
131
    my $dates_online = '';
132
    if ( $self->date_first_issue_online ) {
133
        $dates_online = $self->date_first_issue_online . '-';
134
    }
135
    if ( $self->date_last_issue_online ) {
136
        $dates_online .= '-' unless $dates_online;
137
        $dates_online .= $self->date_last_issue_online;
138
    }
139
    if ($dates_online) {
140
        push @fields, MARC::Field->new( '866', ' ', ' ', a => $dates_online );
141
142
    }
143
    my $volumes_online = '';
144
    if ( $self->num_first_vol_online ) {
145
        $volumes_online = $self->num_first_vol_online . '-';
146
    }
147
    if ( $self->num_last_vol_online ) {
148
        $volumes_online .= '-' unless $volumes_online;
149
        $volumes_online .= $self->num_last_vol_online;
150
    }
151
    if ($volumes_online) {
152
        push @fields, MARC::Field->new( '863', ' ', ' ', a => $volumes_online );
153
    }
154
    if ( $self->title_url ) {
155
        push @fields,
156
            MARC::Field->new( '856', '4', ' ', u => $self->title_url );
157
    }
158
    if ( $self->first_author ) {
159
        push @fields,
160
            MARC::Field->new( '100', '1', ' ', a => $self->first_author );
161
        $marc_record->field('245')->set_indicator( '1', '1' );
162
    }
163
    if ( $self->notes ) {
164
        push @fields, MARC::Field->new( '852', ' ', ' ', z => $self->notes );
165
    }
166
    if ( $self->publisher_name ) {
167
        push @fields,
168
            MARC::Field->new( '260', ' ', ' ', b => $self->publisher_name );
169
    }
170
    $marc_record->insert_fields_ordered(@fields);
171
    return $marc_record;
172
}
173
105
=head3 _type
174
=head3 _type
106
175
107
=cut
176
=cut
108
- 

Return to bug 35095