Bug 19841: Make AddMember raise an exception if categorycode is invalid
commit14e2185f9408f89d14ee5b8fabf7cc2abdd632f8
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 20 Dec 2017 19:19:18 +0000 (20 16:19 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 26 Dec 2017 15:52:34 +0000 (26 12:52 -0300)
tree4a1f8487af3cb3d243af6fc8f4a9c54d15871d6d
parentbfe025688355eb714c24bd608726bc61f3224cbd
Bug 19841: Make AddMember raise an exception if categorycode is invalid

This patch makes C4::Members::AddMember raise a Koha::Exceptions::BadParameter
exception. The current behaviour is to just explode. Code calling
AddReturn should work as expected, unless they are looking for a
specific failure message.

It is just explodes in a way we know what happened, in the case the
categorycode is invalid.

To test:
- Apply the Unit tests patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Members.t
=> FAIL: Tests fail because AddReturn doesn't raise an exception
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Members.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Dominic Pichette <dominic.pichette@inlibro.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Members.pm