]> git.koha-community.org Git - koha.git/commit
Bug 17828: Overload Koha::Patron::Attribute->store to check for unique_id and repeatable
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 30 Dec 2016 14:12:32 +0000 (11:12 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 31 Mar 2017 14:36:47 +0000 (14:36 +0000)
commitd777df6b6f51dc65e6963c4e9ab0ed54b811813a
tree43bee68c1d3396cfbc3b221f1e18a8f41ccf25bf
parent46291a0c9f924f5f73824c18b1ee06c206ae9fb4
Bug 17828: Overload Koha::Patron::Attribute->store to check for unique_id and repeatable

This patch introduces a Koha::Patron::Attribute->store method that does
the required check for the corresponding Koha::Patron::Attribute::Type
and raises an exception if trying to store more than one unique
attribute code/value combination, and another exception for
non-repeatable attribute types being stored while already existing on
the DB.

This patch introduces exception definitions for that purpose.

To test:
- Apply the unit tests patches
- Run:
  $ prove t/db_dependent/Koha/Patron/Attributes.t
=> FAIL: Tests fail
- Apply this patch
- Run:
  $ prove t/db_dependent/Koha/Patron/Attributes.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Exceptions/Patron/Attribute.pm [new file with mode: 0644]
Koha/Patron/Attribute.pm