https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17835

Jonathan Druart <jonathan.dru...@bugs.koha-community.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #60048|0                           |1
        is obsolete|                            |
  Attachment #60049|0                           |1
        is obsolete|                            |
  Attachment #60914|0                           |1
        is obsolete|                            |
  Attachment #60915|0                           |1
        is obsolete|                            |
  Attachment #60916|0                           |1
        is obsolete|                            |
  Attachment #60917|0                           |1
        is obsolete|                            |

--- Comment #26 from Jonathan Druart <jonathan.dru...@bugs.koha-community.org> 
---
Created attachment 61695
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=61695&action=edit
Bug 17835: Create a ItemtypeLocalization view

To properly move C4::Koha::GetItemTypes to Koha::ItemTypes we need
DBIx::Class to make a join on the localization table to retrieve the
possible translated description of the item types.
To do so there are 2 possibilities. The first one would have been to
rename the localization table to something like itemtype_localization.
That way we could have had a relationship between
itemtype_localization.code and itemtypes.itemtype
That would have meant to create one table per "entity" (here an entity
is itemtype) we allow the translability. There are pros and cons for
this choice, so I opt for another solution.
The other solution is to create a view on top of this localization
table. With this new view we can define the missing relationship.

That sounds like a quite clean solution and easy to implement.
Once we have this relationship, the
Koha::ItemTypes->search_with_localization will join on this view an
return the same result as GetItemTypes( style => 'array' ).
To replace
    GetItemtypes( style => 'hash' )
which is the default behavior of this subroutine, we can do something like:
    my $itemtypes = Koha::ItemTypes->search_with_localization;
    my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed };

This patchset must not introduce big changes but it changes certain
behaviors (which were wrong) in some scripts. Indeed sometimes the
descriptions of the item types were not the translated ones. Moreover it
happens that the item types displayed in a dropdown list were not
ordered by translated description, but by description of code
(itemtypes.itemtype value). These 2 behaviors are what we expect.

Test plan:
Bugs will be hard to catch since these patches change a lot of file, it
will be easier to read the diff and catch possible typos or logic
errors.
However signoffers can focus on modified files and the item types
values.

Signed-off-by: Josef Moravec <josef.mora...@gmail.com>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to