Bug 24830: Fix parse_prefetch recursion and +count cases
authorAgustin Moyano <agustinmoyano@theke.io>
Mon, 9 Mar 2020 15:05:03 +0000 (12:05 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 20 Mar 2020 15:18:40 +0000 (15:18 +0000)
commit32424eac2af05a1313f15e2821c5a5840780f949
treedd703b9c0219abed6c583ca5dfd1731f62340e1b
parent99dbf72b72ab9b47b78ea1531def40f269106ea2
Bug 24830: Fix parse_prefetch recursion and +count cases

When a child of a prefetched element wasn't found on element's
prefetch_whitelist, no prefetch element was returned.. including element
it self. Now we return element's name if no child was found.

Also, embeded keys that ended with +count where taken literaly. Now we
search the correct key by stripping _count of embedded element if it was
declared as "is_count"

To test:
1. Apply test patch but not this one
2. prove t/Koha/REST/Plugin/Query.t
CHECK => tests shoul fail
3. Apply this patch
4. prove t/Koha/REST/Plugin/Query.t
SUCCESS => tests pass
5. Sign off

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/Plugin/Query.pm