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

(-)a/Koha/ILL/Request.pm (-3 / +32 lines)
Lines 277-288 sub library { Link Here
277
277
278
    my $extended_attributes = $request->extended_attributes;
278
    my $extended_attributes = $request->extended_attributes;
279
279
280
Returns the linked I<Koha::ILL::Request::Attributes> resultset object.
280
    my $extended_attributes = $request->extended_attributes([
281
        {
282
            type => 'type',
283
            value => 'type_value',
284
        },
285
        {
286
            type => 'type2',
287
            value => 'type2_value',
288
        },
289
    ]);
290
291
Getter or setter for extended attributes
292
293
Getter: Returns the linked I <Koha::ILL::Request::Attributes> resultset object.
294
295
Setter: Adds the supplied extended attributes to the request
281
296
282
=cut
297
=cut
283
298
284
sub extended_attributes {
299
sub extended_attributes {
285
    my ( $self ) = @_;
300
    my ( $self, $attributes ) = @_;
301
302
    if ($attributes) {
303
        my $schema = $self->_result->result_source->schema;
304
        $schema->txn_do(
305
            sub {
306
                for my $attribute (@$attributes) {
307
                    $attribute->{backend} = $self->backend;
308
                    eval { $self->_result->add_to_illrequestattributes($attribute); };
309
                    if ($@) {
310
                        warn "Error adding attribute $attribute->{type}: $@";
311
                    }
312
                }
313
            }
314
        );
315
    }
286
316
287
    my $rs = $self->_result->extended_attributes;
317
    my $rs = $self->_result->extended_attributes;
288
    # We call search to use the filters in Koha::ILL::Request::Attributes->search
318
    # We call search to use the filters in Koha::ILL::Request::Attributes->search
289
- 

Return to bug 38751