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

(-)a/Koha/Patron.pm (+21 lines)
Lines 2467-2472 sub to_api_mapping { Link Here
2467
    };
2467
    };
2468
}
2468
}
2469
2469
2470
=head3 strings_map
2471
2472
Returns a map of column name to string representations including the string.
2473
2474
=cut
2475
2476
sub strings_map {
2477
    my ( $self, $params ) = @_;
2478
2479
    return {
2480
        library_id => {
2481
            str => $self->library->branchname,
2482
            type => 'library',
2483
        },
2484
        category_id => {
2485
            str => $self->category->description,
2486
            type => 'patron_category',
2487
        }
2488
    };
2489
}
2490
2470
=head3 queue_notice
2491
=head3 queue_notice
2471
2492
2472
    Koha::Patrons->queue_notice({ letter_params => $letter_params, message_name => 'DUE'});
2493
    Koha::Patrons->queue_notice({ letter_params => $letter_params, message_name => 'DUE'});
(-)a/api/v1/swagger/definitions/patron.yaml (+5 lines)
Lines 378-383 properties: Link Here
378
    type:
378
    type:
379
      - boolean
379
      - boolean
380
    description: Protected status of the patron
380
    description: Protected status of the patron
381
  _strings:
382
    type:
383
      - object
384
      - "null"
385
    description: A list of stringified coded values
381
additionalProperties: false
386
additionalProperties: false
382
required:
387
required:
383
  - surname
388
  - surname
(-)a/api/v1/swagger/paths/patrons.yaml (+1 lines)
Lines 482-487 Link Here
482
        items:
482
        items:
483
          type: string
483
          type: string
484
          enum:
484
          enum:
485
            - +strings
485
            - extended_attributes
486
            - extended_attributes
486
        collectionFormat: csv
487
        collectionFormat: csv
487
    produces:
488
    produces:
(-)a/t/db_dependent/api/v1/patrons.t (-2 / +28 lines)
Lines 230-236 subtest 'list() tests' => sub { Link Here
230
230
231
subtest 'get() tests' => sub {
231
subtest 'get() tests' => sub {
232
232
233
    plan tests => 3;
233
    plan tests => 4;
234
234
235
    $schema->storage->txn_begin;
235
    $schema->storage->txn_begin;
236
    unauthorized_access_tests('GET', -1, undef);
236
    unauthorized_access_tests('GET', -1, undef);
Lines 315-320 subtest 'get() tests' => sub { Link Here
315
315
316
        $schema->storage->txn_rollback;
316
        $schema->storage->txn_rollback;
317
    };
317
    };
318
319
    subtest '+strings' => sub {
320
321
        plan tests => 4;
322
323
        $schema->storage->txn_begin;
324
325
        my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
326
327
        my $librarian = $builder->build_object(
328
            {
329
                class => 'Koha::Patrons',
330
                value => { flags => 2**4 }    # borrowers flag = 4
331
            }
332
        );
333
        my $password = 'thePassword123';
334
        $librarian->set_password( { password => $password, skip_validation => 1 } );
335
        my $userid = $librarian->userid;
336
337
        $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id => { "x-koha-embed" => "+strings" } )
338
            ->status_is(200)
339
            ->json_has( '/_strings/library_id' => { str => $patron->library->branchname, type => 'library' } )
340
            ->json_has(
341
            '/_strings/category_id' => { str => $patron->category->description, type => 'patron_category' } );
342
343
        $schema->storage->txn_rollback;
344
    };
318
};
345
};
319
346
320
subtest 'add() tests' => sub {
347
subtest 'add() tests' => sub {
321
- 

Return to bug 35744