Bug 21674: Prevent to insert twice the same library in a group
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 11 Dec 2019 11:51:23 +0000 (12:51 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 30 Jan 2020 15:36:25 +0000 (15:36 +0000)
commit812a863d86686350243725f5bbfd2718022eee2d
treeeb5ff4a0312173a6dcccf7041c191502a6cc2e78
parent09ac74baca826670e7d1229d1b596c2c11e5059a
Bug 21674: Prevent to insert twice the same library in a group

When you create hierarchical groups of libraries you are not allowed to add
several times the same library to a given group/subgroup. The libraries
that are part of the group is not displayed on the interface, to prevent
the user to select it.

However this restriction is only done template-side, the controller and
module does not handle it.

To prevent that this patchset enforces the constraint at DB level, and
display a message to the end user.

Test plan:
- Go to Home › Administration › Library groups
- Add a group
- Add a library
- reload the page several times
=> Without this patch the same library appears several times in the group
=> With this patch applied you will see a friendly error message

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
admin/library_groups.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt