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.
Created attachment 123069 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 123070 [details] [review] 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>
Created attachment 123152 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com>
Created attachment 123153 [details] [review] 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>
Created attachment 124162 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( 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>
Created attachment 124163 [details] [review] 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>
Created attachment 124189 [details] [review] 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
Created attachment 124190 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( 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
Created attachment 124238 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( 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
Created attachment 124239 [details] [review] 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
Pushed to master for 21.11, thanks to everybody involved!
Pushed to 21.05.x for 21.05.04
Pushed to 20.11.x for 20.11.10
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.