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

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