Bugzilla – Attachment 123070 Details for
Bug 28744
Class with empty/no to_api_mapping should generate an empty from_api_mapping
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28744: Better handling of undefined to_api_mapping
Bug-28744-Better-handling-of-undefined-toapimappin.patch (text/plain), 1.48 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-07-23 03:41:51 UTC
(
hide
)
Description:
Bug 28744: Better handling of undefined to_api_mapping
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-07-23 03:41:51 UTC
Size:
1.48 KB
patch
obsolete
>From 1951e5f1aa8ddbd39053af1d9fb009d6762020c1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 23 Jul 2021 00:39:16 -0300 >Subject: [PATCH] Bug 28744: Better handling of undefined to_api_mapping > >We always had some mapping because of the DB vs. API object definition discrepancies. But bug 25260 revamps the reserves table, and it is a perfect match. It highlights this edge case: if no mapping defined, then and undef from_api_mapping is generated (as opposed to an empty hashref) and this leads to errors in the query translation from the API. > >This patch makes a small change so this method always returns an empty >hashref. > >To test: >1. Apply the regression tests >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Object.t >=> FAIL: Test fail! >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Object.pm | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index 08602da67f..6f55c3b486 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -638,7 +638,8 @@ sub from_api_mapping { > > my $to_api_mapping = $self->to_api_mapping; > >- unless ( $self->{_from_api_mapping} ) { >+ unless ( defined $self->{_from_api_mapping} ) { >+ $self->{_from_api_mapping} = {}; > while (my ($key, $value) = each %{ $to_api_mapping } ) { > $self->{_from_api_mapping}->{$value} = $key > if defined $value; >-- >2.32.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28744
:
123069
|
123070
|
123152
|
123153
|
124162
|
124163
|
124189
|
124190
|
124238
|
124239