Bug 28031: (follow-up) Retrieve type only once
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 25 Mar 2021 13:02:22 +0000 (10:02 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 9 Apr 2021 13:43:34 +0000 (15:43 +0200)
commita48cad0f625dedc9fd881b65a1d40578e4ed80c9
tree517573032e3f8846b853c3cb86736cf8c410edb9
parent9489054527badf8713d198cf08521a5b0804902d
Bug 28031: (follow-up) Retrieve type only once

The current implementation of store+check_repeatable+check_unique_id
notably retrieves the related Koha::Patron::Attribute::Type object three
times.

This can be easily solved by retrieving it once and reusing. This patch
does that.

This changes the signature for the helper methods.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron/Attribute.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Verify the old _check_repeatable method is not used anywhere
   $ git grep _check_repeatable
=> SUCCESS: It is not!
5. Verify check_unique_id is not used anywhere, so no risk changing the
   signature
   $ git grep check_unique_id
=> SUCCESS: It is safe to update it!
6. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Patron/Attribute.pm