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

(-)a/Koha/ERM/EHoldings/Resource.pm (-7 / +14 lines)
Lines 21-26 use MARC::Record; Link Here
21
21
22
use Koha::Database;
22
use Koha::Database;
23
23
24
use C4::Biblio qw( AddBiblio TransformKohaToMarc );
24
use Koha::Acquisition::Booksellers;
25
use Koha::Acquisition::Booksellers;
25
use Koha::Biblios;
26
use Koha::Biblios;
26
use Koha::ERM::EHoldings::Titles;
27
use Koha::ERM::EHoldings::Titles;
Lines 47-62 sub store { Link Here
47
48
48
    # FIXME This is terrible and ugly, we need to:
49
    # FIXME This is terrible and ugly, we need to:
49
    # * Provide a mapping for each attribute of title
50
    # * Provide a mapping for each attribute of title
50
    # * Deal with marcflavour
51
    # * Create a txn
51
    # * Create a txn
52
    my $title = $self->title;
52
    my $title = $self->title;
53
    my $biblio = $title->biblio_id ? Koha::Biblios->find($title->biblio_id) : undef;
53
    my $biblio =
54
    my $marc_record = $biblio ? $biblio->metadata->record : MARC::Record->new;
54
      $title->biblio_id
55
    eval {$marc_record->field('245')->delete_subfield('a');};
55
      ? Koha::Biblios->find( $title->biblio_id )->unblessed
56
    $marc_record->add_fields(MARC::Field->new(245, '', '', a => $title->publication_title));
56
      : {};
57
58
    my $marc_record = TransformKohaToMarc(
59
        {
60
            %$biblio,
61
            'biblio.title' => $title->publication_title,
62
63
        }
64
    );
57
65
58
    my $biblio_id;
66
    my $biblio_id;
59
    if ( $biblio ) {
67
    if ( %$biblio ) {
60
        $biblio_id = $title->biblio_id;
68
        $biblio_id = $title->biblio_id;
61
        C4::Biblio::ModBiblio($marc_record, $title->biblio_id, '');
69
        C4::Biblio::ModBiblio($marc_record, $title->biblio_id, '');
62
    } else {
70
    } else {
63
- 

Return to bug 32782