]> git.koha-community.org Git - koha.git/commit
Bug 22284: New methods in Koha::Library::Groups and Koha::Library
authorAgustin Moyano <agustinmoyano@theke.io>
Mon, 25 Mar 2019 02:00:36 +0000 (23:00 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 3 Jan 2020 12:58:03 +0000 (12:58 +0000)
commit13322855088ed073acce531742460e57e109ef0e
tree50097caaaa5b4ebbd653ce9da705053ef6ddbc31
parenta998ba5714c8dc1b78062e95bd78e2738112737d
Bug 22284: New methods in Koha::Library::Groups and Koha::Library

This patch adds new methods in Koha::Library::Groups and Koha::Library.
1) For Koha::Library::Groups adds get_root_ancestor that returns all root
groups for a given search parameters, for example
Koha::Library::Groups->get_root_ancestor( { id => $group_id } )
2) For Koha::Library adds
2.1) get_hold_libraries: returns all libraries (including self) that
belongs to the same holdgroups. If $self belongs to several holdgroups
it will return a distinct list of all libraries belonging to them.
2.2) validate_hold_sibling: Returns 1 if the given parameters matches any of the
libraries that belong to any of the holdgroups this library belongs. For example
$library->validate_hold_sibling( { branchcode => $branchcode } )

To test:
1) apply this patch
2) prove t/db_dependent/Koha/Libraries.t t/db_dependent/LibraryGroups.t
SUCCESS => green letters :-D
3) Sign off

Sponsored-by: VOKAL
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Library.pm
Koha/Library/Groups.pm
t/db_dependent/Koha/Libraries.t
t/db_dependent/LibraryGroups.t