From d586ef5392f4232a26abd8bcd46b3a7c041e8a45 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 17 Apr 2024 16:28:06 +0000 Subject: [PATCH] Bug 36627: Embed patron record for display Signed-off-by: Pedro Amorim --- Koha/ERM/EUsage/CounterLog.pm | 15 +++++++++++++++ api/v1/swagger/definitions/erm_counter_log.yaml | 5 +++-- api/v1/swagger/paths/erm_counter_logs.yaml | 9 +++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Koha/ERM/EUsage/CounterLog.pm b/Koha/ERM/EUsage/CounterLog.pm index f9e2e4f1e6d..c494fda0e06 100644 --- a/Koha/ERM/EUsage/CounterLog.pm +++ b/Koha/ERM/EUsage/CounterLog.pm @@ -31,6 +31,21 @@ Koha::ERM::EUsage::CounterLog - Koha ErmCounterLog Object class =cut + +=head3 borrowernumber + +Return the borrower for this counter_file + +=cut + +sub borrowernumber { + my ($self) = @_; + my $borrowers_rs = $self->_result->borrowernumber; + return unless $borrowers_rs; + return Koha::Patron->_new_from_dbic($borrowers_rs); +} + + =head2 Internal methods =head3 _type diff --git a/api/v1/swagger/definitions/erm_counter_log.yaml b/api/v1/swagger/definitions/erm_counter_log.yaml index 2eb130181c3..097b08d934c 100644 --- a/api/v1/swagger/definitions/erm_counter_log.yaml +++ b/api/v1/swagger/definitions/erm_counter_log.yaml @@ -11,9 +11,10 @@ properties: - integer - "null" borrowernumber: - description: borrowernumber of the counter_log + type: object + description: patron object type: - - integer + - object - "null" importdate: type: string diff --git a/api/v1/swagger/paths/erm_counter_logs.yaml b/api/v1/swagger/paths/erm_counter_logs.yaml index 01c18ace3fe..cb9a9f3b8db 100644 --- a/api/v1/swagger/paths/erm_counter_logs.yaml +++ b/api/v1/swagger/paths/erm_counter_logs.yaml @@ -13,6 +13,15 @@ name: usage_data_provider_id required: false type: integer + - name: x-koha-embed + in: header + required: false + description: Embed list sent as a request header + type: array + items: + type: string + enum: + - borrowernumber - $ref: "../swagger.yaml#/parameters/match" - $ref: "../swagger.yaml#/parameters/order_by" - $ref: "../swagger.yaml#/parameters/page" -- 2.39.2