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 $leader = ' nam a22 5 4500'; |
118 |
my $serial_flag; |
119 |
my @fields; |
120 |
$marc_record->insert_fields_ordered( MARC::Field->new( '245', '0', '0', a => $self->publication_title ) ); |
121 |
if ( $self->print_identifier ) { |
122 |
my $standard_number = $self->print_identifier; |
123 |
my $tag = $standard_number =~ s/\d/$&/g >= 10 ? '020' : '022'; |
124 |
$serial_flag = 1 if $tag eq '022'; |
125 |
push @fields, |
126 |
MARC::Field->new( $tag, ' ', ' ', a => $self->print_identifier ); |
127 |
} |
128 |
if ( $self->online_identifier ) { |
129 |
my $standard_number = $self->print_identifier; |
130 |
my $tag = $standard_number =~ s/\d/$&/g >= 10 ? '020' : '022'; |
131 |
$serial_flag = 1 if $tag eq '022'; |
132 |
push @fields, |
133 |
MARC::Field->new( $tag, ' ', ' ', a => $self->online_identifier ); |
134 |
} |
135 |
my $dates_online = ''; |
136 |
if ( $self->date_first_issue_online ) { |
137 |
$dates_online = $self->date_first_issue_online . '-'; |
138 |
} |
139 |
if ( $self->date_last_issue_online ) { |
140 |
$dates_online .= '-' unless $dates_online; |
141 |
$dates_online .= $self->date_last_issue_online; |
142 |
} |
143 |
if ($dates_online) { |
144 |
push @fields, MARC::Field->new( '866', ' ', ' ', a => $dates_online ); |
145 |
|
146 |
} |
147 |
my $volumes_online = ''; |
148 |
if ( $self->num_first_vol_online ) { |
149 |
$volumes_online = $self->num_first_vol_online . '-'; |
150 |
} |
151 |
if ( $self->num_last_vol_online ) { |
152 |
$volumes_online .= '-' unless $volumes_online; |
153 |
$volumes_online .= $self->num_last_vol_online; |
154 |
} |
155 |
if ($volumes_online) { |
156 |
push @fields, MARC::Field->new( '863', ' ', ' ', a => $volumes_online ); |
157 |
} |
158 |
if ( $self->title_url ) { |
159 |
push @fields, |
160 |
MARC::Field->new( '856', '4', ' ', u => $self->title_url ); |
161 |
} |
162 |
if ( $self->first_author ) { |
163 |
push @fields, |
164 |
MARC::Field->new( '100', '1', ' ', a => $self->first_author ); |
165 |
$marc_record->field('245')->set_indicator( '1', '1' ); |
166 |
} |
167 |
if ( $self->notes ) { |
168 |
push @fields, MARC::Field->new( '852', ' ', ' ', z => $self->notes ); |
169 |
} |
170 |
if ( $self->publisher_name ) { |
171 |
push @fields, |
172 |
MARC::Field->new( '260', ' ', ' ', b => $self->publisher_name ); |
173 |
} |
174 |
$marc_record->insert_fields_ordered(@fields); |
175 |
if ($serial_flag) { |
176 |
substr( $leader, 7, 1 ) = 's'; |
177 |
} |
178 |
$marc_record->leader($leader); |
179 |
return $marc_record; |
180 |
} |
181 |
|
105 |
=head3 _type |
182 |
=head3 _type |
106 |
|
183 |
|
107 |
=cut |
184 |
=cut |
108 |
- |
|
|