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

(-)a/Koha/Holding.pm (-12 / +7 lines)
Lines 175-196 sub store { Link Here
175
        holding_id => $self->holding_id(),
175
        holding_id => $self->holding_id(),
176
        format     => 'marcxml',
176
        format     => 'marcxml',
177
        schema     => $marcflavour,
177
        schema     => $marcflavour,
178
        metadata   => $marc_record->as_xml_record($marcflavour),
178
    };
179
    };
179
    my $metadata_record = Koha::Holdings::Metadatas->find_or_create($metadata);
180
    Koha::Holdings::Metadatas->update_or_create($metadata);
180
    $metadata_record->metadata($marc_record->as_xml_record($marcflavour));
181
    $guard->commit() if defined $guard;
181
182
    $result = $metadata_record->store() ? $self : undef;
183
184
    if ($result) {
185
        $guard->commit() if defined $guard;
186
182
187
        # request that bib be reindexed so that any holdings-derived fields are updated
183
    # request that bib be reindexed so that any holdings-derived fields are updated
188
        C4::Biblio::ModZebra( $self->biblionumber(), 'specialUpdate', 'biblioserver' );
184
    C4::Biblio::ModZebra( $self->biblionumber(), 'specialUpdate', 'biblioserver' );
189
185
190
        logaction('CATALOGUING', $action, $self->holding_id(), 'holding') if C4::Context->preference('CataloguingLog');
186
    logaction('CATALOGUING', $action, $self->holding_id(), 'holding') if C4::Context->preference('CataloguingLog');
191
    }
192
187
193
    return $result;
188
    return $self;
194
}
189
}
195
190
196
=head3 delete
191
=head3 delete
(-)a/Koha/Objects.pm (-1 / +18 lines)
Lines 102-107 sub find { Link Here
102
    return $object;
102
    return $object;
103
}
103
}
104
104
105
=head3 Koha::Objects->update_or_create();
106
107
my $object = Koha::Objects->update_or_create( $attrs );
108
109
=cut
110
111
sub update_or_create {
112
    my ( $self, $params ) = @_;
113
114
    my $result = $self->_resultset->update_or_create($params);
115
116
    return unless $result;
117
118
    my $object = $self->object_class->_new_from_dbic($result);
119
120
    return $object;
121
}
122
105
=head3 Koha::Objects->find_or_create();
123
=head3 Koha::Objects->find_or_create();
106
124
107
my $object = Koha::Objects->find_or_create( $attrs );
125
my $object = Koha::Objects->find_or_create( $attrs );
108
- 

Return to bug 20447