Bug 26635: Refined data structure and methods
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 28 Oct 2022 22:25:46 +0000 (19:25 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 9 Nov 2022 17:00:47 +0000 (14:00 -0300)
commit8dd24dab223375d49592f68b8c6ab01273e4e005
treeda6c350b98d16e4b36db0e5dd74603fb943beca2
parente4be0920543db3a8ded2890464db8792a129ac5b
Bug 26635: Refined data structure and methods

This patch makes the returned data structure be simpler:

_str => {
    attribute_1 => {
        category => 'some_category_name',
        str      => 'description',
        type     => 'av'
    },
    ...
}

The description is sensible to context, so if public => 1 is passed,
then lib_opac is passed, and lib is returned otherwise. Whenever we add
language to the combo, we will add it to the implementation.

Tests are adjusted accordingly, also to reflect the public => 1 use
case.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
3. Sign off :-D

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