From 0f817f4da9439255850f583ba80cb1f0876967a0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 18 May 2020 14:14:42 -0400 Subject: [PATCH] Bug 25535: Hold API mapping maps cancellationdate to cancelation_date, but it should be cancellation_date Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson (cherry picked from commit df41ff4a9c54c0e958bbdb49acec671c024ec29e) Signed-off-by: Victor Grousset/tuxayo --- Koha/Hold.pm | 34 +++++++++++++++++++++++++++- api/v1/swagger/definitions/hold.json | 2 +- api/v1/swagger/paths/holds.json | 2 +- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Koha/Hold.pm b/Koha/Hold.pm index bfd3434026..93fbb74702 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -400,7 +400,39 @@ sub _move_to_old { return Koha::Old::Hold->new( $hold_infos )->store; } -=head3 type +=head3 to_api_mapping + +This method returns the mapping for representing a Koha::Hold object +on the API. + +=cut + +sub to_api_mapping { + return { + reserve_id => 'hold_id', + borrowernumber => 'patron_id', + reservedate => 'hold_date', + biblionumber => 'biblio_id', + branchcode => 'pickup_library_id', + notificationdate => undef, + reminderdate => undef, + cancellationdate => 'cancellation_date', + reservenotes => 'notes', + found => 'status', + itemnumber => 'item_id', + waitingdate => 'waiting_date', + expirationdate => 'expiration_date', + lowestPriority => 'lowest_priority', + suspend => 'suspended', + suspend_until => 'suspended_until', + itemtype => 'item_type', + item_level_hold => 'item_level', + }; +} + +=head2 Internal methods + +=head3 _type =cut diff --git a/api/v1/swagger/definitions/hold.json b/api/v1/swagger/definitions/hold.json index df8289823b..1118bce6c4 100644 --- a/api/v1/swagger/definitions/hold.json +++ b/api/v1/swagger/definitions/hold.json @@ -22,7 +22,7 @@ "type": ["string", "null"], "description": "Internal library identifier for the pickup library" }, - "cancelation_date": { + "cancellation_date": { "type": ["string", "null"], "format": "date", "description": "The date the hold was cancelled" diff --git a/api/v1/swagger/paths/holds.json b/api/v1/swagger/paths/holds.json index 14d29b352d..a2e3901264 100644 --- a/api/v1/swagger/paths/holds.json +++ b/api/v1/swagger/paths/holds.json @@ -37,7 +37,7 @@ "type": "string" }, { - "name": "cancelation_date", + "name": "cancellation_date", "in": "query", "description": "The date the hold was cancelled", "type": "string", -- 2.39.5