Bug 12133: Add requirements for guarantor and guarantee
authorEmmi Takkinen <emmi.takkinen@koha-suomi.fi>
Fri, 17 Feb 2023 11:15:17 +0000 (13:15 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 10 Nov 2023 13:59:40 +0000 (10:59 -0300)
commitd9a989eaf0ee3d10a4a39c6845247e456951d894
tree79e36e3da4fc0f2400cd5c70863ffa132e0888d2
parent2120e3d4c8d0fb7c230fbd36e54bfbd3c30937e2
Bug 12133: Add requirements for guarantor and guarantee

Add two requirements when registering a new patron:

- A child patron must have a guarantor. This is controlled by
  a new syspref ChildNeedsGuarantor.
- A guarantor cannot be a guarantee.

Test plan:
1. Add a child patron without guarantor or child patron with guarantee
as guarantor succesfully.
2. Apply this patch.
3. Add a child patron as a guarantor.
=> Error is raised.
4. Turn syspref "ChildNeedsGuarantor" ON.
5. Add a child patron without a guarantor and error "Child needs a
guarantor" is raised.
6. Add guarantor. Guarantor can either be existing patron or added with
"Contact" section.
=> Save without errors.

Also prove t/db_dependent/Koha/Patron.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Exceptions/Patron/Relationship.pm
Koha/Patron.pm
installer/data/mysql/atomicupdate/bug_12133.pl [new file with mode: 0755]
installer/data/mysql/mandatory/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
members/memberentry.pl
t/db_dependent/Koha/Patron.t