Lines 257-263
sub AddBiblio {
Link Here
|
257 |
_koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode ); |
257 |
_koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode ); |
258 |
|
258 |
|
259 |
# now add the record |
259 |
# now add the record |
260 |
ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save; |
260 |
ModBiblioMarc( $record, $biblionumber, $biblioitemnumber, $frameworkcode ) unless $defer_marc_save; |
261 |
|
261 |
|
262 |
# update OAI-PMH sets |
262 |
# update OAI-PMH sets |
263 |
if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { |
263 |
if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { |
Lines 335-341
sub ModBiblio {
Link Here
|
335 |
_koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode ); |
335 |
_koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode ); |
336 |
|
336 |
|
337 |
# update the MARC record (that now contains biblio and items) with the new record data |
337 |
# update the MARC record (that now contains biblio and items) with the new record data |
338 |
&ModBiblioMarc( $record, $biblionumber, $frameworkcode ); |
338 |
&ModBiblioMarc( $record, $biblionumber, $biblioitemnumber, $frameworkcode ); |
339 |
|
339 |
|
340 |
# modify the other koha tables |
340 |
# modify the other koha tables |
341 |
_koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode ); |
341 |
_koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode ); |
Lines 429-434
sub DelBiblio {
Link Here
|
429 |
# delete this biblioitem |
429 |
# delete this biblioitem |
430 |
$error = _koha_delete_biblioitems( $dbh, $biblioitemnumber ); |
430 |
$error = _koha_delete_biblioitems( $dbh, $biblioitemnumber ); |
431 |
return $error if $error; |
431 |
return $error if $error; |
|
|
432 |
|
433 |
$error = _koha_delete_biblio_metadata( $dbh, $biblioitemnumber, $biblionumber ); |
434 |
return $error if $error; |
432 |
} |
435 |
} |
433 |
|
436 |
|
434 |
# delete biblio from Koha tables and save in deletedbiblio |
437 |
# delete biblio from Koha tables and save in deletedbiblio |
Lines 436-441
sub DelBiblio {
Link Here
|
436 |
# delete cascade will prevent deletedbiblioitems rows |
439 |
# delete cascade will prevent deletedbiblioitems rows |
437 |
# from being generated by _koha_delete_biblioitems |
440 |
# from being generated by _koha_delete_biblioitems |
438 |
$error = _koha_delete_biblio( $dbh, $biblionumber ); |
441 |
$error = _koha_delete_biblio( $dbh, $biblionumber ); |
|
|
442 |
return $error if $error; |
439 |
|
443 |
|
440 |
logaction( "CATALOGUING", "DELETE", $biblionumber, "biblio" ) if C4::Context->preference("CataloguingLog"); |
444 |
logaction( "CATALOGUING", "DELETE", $biblionumber, "biblio" ) if C4::Context->preference("CataloguingLog"); |
441 |
|
445 |
|
Lines 3438-3448
sub _koha_delete_biblioitems {
Link Here
|
3438 |
return; |
3442 |
return; |
3439 |
} |
3443 |
} |
3440 |
|
3444 |
|
|
|
3445 |
=head2 _koha_delete_biblio_metadata |
3446 |
|
3447 |
$error = _koha_delete_biblio_metadata($dbh, $biblioitemnumber, $biblionumber); |
3448 |
|
3449 |
Internal sub for deleting from biblio_metadata table -- also saves to deletedbiblio_metadata |
3450 |
|
3451 |
C<$dbh> - the database handle |
3452 |
C<$biblioitemnumber> - the biblioitemnumber of the biblio_metadata to be deleted |
3453 |
|
3454 |
=cut |
3455 |
|
3456 |
# FIXME: add error handling |
3457 |
|
3458 |
sub _koha_delete_biblio_metadata { |
3459 |
my ( $dbh, $biblioitemnumber ) = @_; |
3460 |
|
3461 |
my $m = Koha::Biblio::Metadatas->find({biblioitemnumber => $biblioitemnumber}); |
3462 |
die "_koha_delete_biblio_metadata($biblioitemnumber):> No biblio_metadata-row!" unless $m; |
3463 |
|
3464 |
my $dm = Koha::Biblio::DeletedMetadatas->new( $m->_result->{_column_data} ); |
3465 |
$dm->store; |
3466 |
$m->delete(); |
3467 |
} |
3468 |
|
3441 |
=head1 UNEXPORTED FUNCTIONS |
3469 |
=head1 UNEXPORTED FUNCTIONS |
3442 |
|
3470 |
|
3443 |
=head2 ModBiblioMarc |
3471 |
=head2 ModBiblioMarc |
3444 |
|
3472 |
|
3445 |
&ModBiblioMarc($newrec,$biblionumber,$frameworkcode); |
3473 |
&ModBiblioMarc($newrec,$biblionumber,$biblioitemnumber,$frameworkcode); |
3446 |
|
3474 |
|
3447 |
Add MARC XML data for a biblio to koha |
3475 |
Add MARC XML data for a biblio to koha |
3448 |
|
3476 |
|
Lines 3453-3459
Function exported, but should NOT be used, unless you really know what you're do
Link Here
|
3453 |
sub ModBiblioMarc { |
3481 |
sub ModBiblioMarc { |
3454 |
# pass the MARC::Record to this function, and it will create the records in |
3482 |
# pass the MARC::Record to this function, and it will create the records in |
3455 |
# the marcxml field |
3483 |
# the marcxml field |
3456 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
3484 |
my ( $record, $biblionumber, $biblioitemnumber, $frameworkcode ) = @_; |
3457 |
if ( !$record ) { |
3485 |
if ( !$record ) { |
3458 |
carp 'ModBiblioMarc passed an undefined record'; |
3486 |
carp 'ModBiblioMarc passed an undefined record'; |
3459 |
return; |
3487 |
return; |
Lines 3500-3505
sub ModBiblioMarc {
Link Here
|
3500 |
} |
3528 |
} |
3501 |
|
3529 |
|
3502 |
my $metadata = { |
3530 |
my $metadata = { |
|
|
3531 |
biblioitemnumber => $biblioitemnumber, |
3503 |
biblionumber => $biblionumber, |
3532 |
biblionumber => $biblionumber, |
3504 |
format => 'marcxml', |
3533 |
format => 'marcxml', |
3505 |
marcflavour => C4::Context->preference('marcflavour'), |
3534 |
marcflavour => C4::Context->preference('marcflavour'), |