Bugzilla – Attachment 124239 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.63 KB, created by
Jonathan Druart
on 2021-08-30 12:31:20 UTC
(
hide
)
Description:
Bug 28744: Better handling of undefined to_api_mapping
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-08-30 12:31:20 UTC
Size:
1.63 KB
patch
obsolete
>From 5a53e4ef5ac4ac01bb934529f7deaec6e7cc03ae 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> > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >JD amended patch: remove uneeded commented lines >--- > Koha/Object.pm | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index 08602da67f9..6f55c3b4861 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.25.1
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