Lines 169-175
if ($op eq ""){
Link Here
|
169 |
my $c_price = shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour')); |
169 |
my $c_price = shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour')); |
170 |
|
170 |
|
171 |
# Insert the biblio, or find it through matcher |
171 |
# Insert the biblio, or find it through matcher |
172 |
unless ( $biblionumber ) { |
172 |
if ( $biblionumber ) { # If matched during staging we can continue |
|
|
173 |
$import_record->status('imported')->store; |
174 |
} else { # Otherwise we check for duplicates, and skip if they exist |
173 |
if ($matcher_id) { |
175 |
if ($matcher_id) { |
174 |
if ( $matcher_id eq '_TITLE_AUTHOR_' ) { |
176 |
if ( $matcher_id eq '_TITLE_AUTHOR_' ) { |
175 |
$duplifound = 1 if FindDuplicate($marcrecord); |
177 |
$duplifound = 1 if FindDuplicate($marcrecord); |
Lines 183-192
if ($op eq ""){
Link Here
|
183 |
$duplinbatch = $import_batch_id and next if $duplifound; |
185 |
$duplinbatch = $import_batch_id and next if $duplifound; |
184 |
} |
186 |
} |
185 |
|
187 |
|
186 |
# add the biblio |
188 |
# remove hyphens (-) from ISBN |
187 |
my $bibitemnum; |
189 |
# FIXME: This should probably be optional |
188 |
|
|
|
189 |
# remove ISBN - |
190 |
my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn' ); |
190 |
my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn' ); |
191 |
if ( $marcrecord->field($isbnfield) ) { |
191 |
if ( $marcrecord->field($isbnfield) ) { |
192 |
foreach my $field ( $marcrecord->field($isbnfield) ) { |
192 |
foreach my $field ( $marcrecord->field($isbnfield) ) { |
Lines 197-205
if ($op eq ""){
Link Here
|
197 |
} |
197 |
} |
198 |
} |
198 |
} |
199 |
} |
199 |
} |
200 |
( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); |
200 |
|
201 |
$import_record->status('imported')->store; |
201 |
# add the biblio |
202 |
} else { |
202 |
( $biblionumber, undef ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); |
203 |
$import_record->status('imported')->store; |
203 |
$import_record->status('imported')->store; |
204 |
} |
204 |
} |
205 |
|
205 |
|
Lines 334-363
if ($op eq ""){
Link Here
|
334 |
$orderinfo{listprice} = 0; |
334 |
$orderinfo{listprice} = 0; |
335 |
} |
335 |
} |
336 |
|
336 |
|
337 |
# remove uncertainprice flag if we have found a price in the MARC record |
337 |
# remove uncertainprice flag if we have found a price in the MARC record |
338 |
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; |
338 |
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; |
339 |
|
339 |
|
340 |
my $order = Koha::Acquisition::Order->new( \%orderinfo ); |
340 |
my $order = Koha::Acquisition::Order->new( \%orderinfo ); |
341 |
$order->populate_with_prices_for_ordering(); |
341 |
$order->populate_with_prices_for_ordering(); |
342 |
$order->populate_with_prices_for_receiving(); |
342 |
$order->populate_with_prices_for_receiving(); |
343 |
$order->store; |
343 |
$order->store; |
344 |
|
344 |
|
345 |
# 4th, add items if applicable |
345 |
# 4th, add items if applicable |
346 |
# parse the item sent by the form, and create an item just for the import_record_id we are dealing with |
346 |
# parse the item sent by the form, and create an item just for the import_record_id we are dealing with |
347 |
# this is not optimised, but it's working ! |
347 |
# this is not optimised, but it's working ! |
348 |
if ( $basket->effective_create_items eq 'ordering' && !$basket->is_standing ) { |
348 |
if ( $basket->effective_create_items eq 'ordering' && !$basket->is_standing ) { |
349 |
my @tags = $input->multi_param('tag'); |
349 |
my @tags = $input->multi_param('tag'); |
350 |
my @subfields = $input->multi_param('subfield'); |
350 |
my @subfields = $input->multi_param('subfield'); |
351 |
my @field_values = $input->multi_param('field_value'); |
351 |
my @field_values = $input->multi_param('field_value'); |
352 |
my @serials = $input->multi_param('serial'); |
352 |
my @serials = $input->multi_param('serial'); |
353 |
my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); |
353 |
my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); |
354 |
my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); |
354 |
my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); |
355 |
for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) { |
355 |
for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) { |
356 |
my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); |
356 |
my ( $biblionumber, undef, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); |
357 |
$order->add_item( $itemnumber ); |
357 |
$order->add_item( $itemnumber ); |
358 |
} |
358 |
} |
359 |
} else { |
|
|
360 |
$import_record->status( 'imported' )->store; |
361 |
} |
359 |
} |
362 |
} |
360 |
} |
363 |
$imported++; |
361 |
$imported++; |
364 |
- |
|
|