|
Lines 271-276
sub AddBiblio {
Link Here
|
| 271 |
# update MARC subfield that stores biblioitems.cn_sort |
271 |
# update MARC subfield that stores biblioitems.cn_sort |
| 272 |
_koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode ); |
272 |
_koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode ); |
| 273 |
|
273 |
|
|
|
274 |
# update the control number (001) in MARC |
| 275 |
if(C4::Context->preference('autoControlNumber') eq 'biblionumber'){ |
| 276 |
unless($record->field('001')){ |
| 277 |
$record->insert_fields_ordered(MARC::Field->new('001', $biblionumber)); |
| 278 |
}elsif($record->field('001')->data() eq 'biblionumber'){ |
| 279 |
$record->field('001')->update($biblionumber); |
| 280 |
} |
| 281 |
}elsif(C4::Context->preference('autoControlNumber') eq 'incremental'){ |
| 282 |
if(!defined($record->field('001')) or (defined($record->field('001')) and $record->field('001')->data() eq 'incremental')){ |
| 283 |
my $sth = $dbh->prepare(q{UPDATE systempreferences SET value = value+1 WHERE variable = 'incrementalControlNumber'}); |
| 284 |
$sth->execute(); |
| 285 |
$sth->finish(); |
| 286 |
my $incrementalCN=C4::Context->preference('incrementalControlNumber')-1; |
| 287 |
unless($record->field('001')){ |
| 288 |
$record->insert_fields_ordered(MARC::Field->new('001', $incrementalCN)); |
| 289 |
}else{ |
| 290 |
$record->field('001')->update($incrementalCN); |
| 291 |
} |
| 292 |
} |
| 293 |
} |
| 294 |
|
| 274 |
# now add the record |
295 |
# now add the record |
| 275 |
ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save; |
296 |
ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save; |
| 276 |
|
297 |
|
|
Lines 343-348
sub ModBiblio {
Link Here
|
| 343 |
|
364 |
|
| 344 |
# update MARC subfield that stores biblioitems.cn_sort |
365 |
# update MARC subfield that stores biblioitems.cn_sort |
| 345 |
_koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode ); |
366 |
_koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode ); |
|
|
367 |
|
| 368 |
# update the control number (001) in MARC |
| 369 |
if(C4::Context->preference('autoControlNumber') eq 'biblionumber'){ |
| 370 |
unless($record->field('001')){ |
| 371 |
$record->insert_fields_ordered(MARC::Field->new('001', $biblionumber)); |
| 372 |
}elsif($record->field('001')->data() eq 'biblionumber'){ |
| 373 |
$record->field('001')->update($biblionumber); |
| 374 |
} |
| 375 |
}elsif(C4::Context->preference('autoControlNumber') eq 'incremental'){ |
| 376 |
if(!defined($record->field('001')) or (defined($record->field('001')) and $record->field('001')->data() eq 'incremental')){ |
| 377 |
my $sth = $dbh->prepare(q{UPDATE systempreferences SET value = value+1 WHERE variable = 'incrementalControlNumber'}); |
| 378 |
$sth->execute(); |
| 379 |
$sth->finish(); |
| 380 |
my $incrementalCN=C4::Context->preference('incrementalControlNumber')-1; |
| 381 |
unless($record->field('001')){ |
| 382 |
$record->insert_fields_ordered(MARC::Field->new('001', $incrementalCN)); |
| 383 |
}else{ |
| 384 |
$record->field('001')->update($incrementalCN); |
| 385 |
} |
| 386 |
} |
| 387 |
} |
| 346 |
|
388 |
|
| 347 |
# update the MARC record (that now contains biblio and items) with the new record data |
389 |
# update the MARC record (that now contains biblio and items) with the new record data |
| 348 |
&ModBiblioMarc( $record, $biblionumber, $frameworkcode ); |
390 |
&ModBiblioMarc( $record, $biblionumber, $frameworkcode ); |