From bb1bf2c92971f7e637b648f332bcce3a862131f9 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 26 Jan 2021 11:36:25 +0000 Subject: [PATCH] Bug 26274: Allow embedding summary --- Koha/Cash/Register/Cashup.pm | 6 ++++++ Koha/REST/V1/CashRegisters/Cashups.pm | 6 +++++- api/v1/swagger/definitions/cashup.json | 4 ++++ api/v1/swagger/paths/cash_registers.json | 5 ++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Koha/Cash/Register/Cashup.pm b/Koha/Cash/Register/Cashup.pm index 3732763a4a..025c4c7090 100644 --- a/Koha/Cash/Register/Cashup.pm +++ b/Koha/Cash/Register/Cashup.pm @@ -164,3 +164,9 @@ sub to_api_mapping { } 1; + +=head1 AUTHORS + +Martin Renvoize + +=cut diff --git a/Koha/REST/V1/CashRegisters/Cashups.pm b/Koha/REST/V1/CashRegisters/Cashups.pm index 11ccd302bc..647a1921c0 100644 --- a/Koha/REST/V1/CashRegisters/Cashups.pm +++ b/Koha/REST/V1/CashRegisters/Cashups.pm @@ -65,7 +65,11 @@ sub get { openapi => { error => "Cashup not found" } ); } - return $c->render( status => 200, openapi => $cashup->to_api ); + my $embed = $c->stash('koha.embed'); + return $c->render( + status => 200, + openapi => $cashup->to_api( { embed => $embed } ) + ); } catch { $c->unhandled_exception($_); diff --git a/api/v1/swagger/definitions/cashup.json b/api/v1/swagger/definitions/cashup.json index ffcaa1c0a8..e643a9c493 100644 --- a/api/v1/swagger/definitions/cashup.json +++ b/api/v1/swagger/definitions/cashup.json @@ -21,6 +21,10 @@ "type": "string", "format": "date-time", "description": "Timestamp for the latest line update" + }, + "summary": { + "type": "object", + "description": "A summary of the cashup action" } } } diff --git a/api/v1/swagger/paths/cash_registers.json b/api/v1/swagger/paths/cash_registers.json index b730c4afcc..837f1ad35b 100644 --- a/api/v1/swagger/paths/cash_registers.json +++ b/api/v1/swagger/paths/cash_registers.json @@ -95,7 +95,10 @@ "permissions": { "cash_management": "cashup" } - } + }, + "x-koha-embed": [ + "summary" + ] } } } -- 2.20.1