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

(-)a/Koha/Holding.pm (-15 / +6 lines)
Lines 182-210 sub store { Link Here
182
        holding_id => $self->holding_id(),
182
        holding_id => $self->holding_id(),
183
        format     => 'marcxml',
183
        format     => 'marcxml',
184
        schema     => $marcflavour,
184
        schema     => $marcflavour,
185
        metadata   => $marc_record->as_xml_record($marcflavour),
185
    };
186
    };
186
    my $metadata_record = Koha::Holdings::Metadatas->find_or_create($metadata);
187
    Koha::Holdings::Metadatas->update_or_create($metadata);
187
    $metadata_record->metadata($marc_record->as_xml_record($marcflavour));
188
    $guard->commit() if defined $guard;
188
189
189
    # request that bib be reindexed so that any holdings-derived fields are updated
190
    # request that bib be reindexed so that any holdings-derived fields are updated
190
    unless ( $params->{skip_record_index} ){
191
    unless ( $params->{skip_record_index} ) {
191
        my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
192
        my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
192
        $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" );
193
        $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" );
193
    }
194
    }
194
195
195
    if ($result) {
196
    logaction('CATALOGUING', $action, $self->holding_id(), 'holding') if C4::Context->preference('CataloguingLog');
196
        $guard->commit() if defined $guard;
197
198
        # request that bib be reindexed so that any holdings-derived fields are updated
199
        unless ( $params->{skip_record_index} ) {
200
            my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
201
            $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" );
202
        }
203
197
204
        logaction('CATALOGUING', $action, $self->holding_id(), 'holding') if C4::Context->preference('CataloguingLog');
198
    return $self;
205
    }
206
207
    return $result;
208
}
199
}
209
200
210
=head3 delete
201
=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