[Koha-bugs] [Bug 11960] GetMemberDetails is unnecessarily called in CanBookBeRenewed

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Mar 20 13:17:29 CET 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11960

M. Tompsett <mtompset at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #26459|0                           |1
        is obsolete|                            |

--- Comment #3 from M. Tompsett <mtompset at hotmail.com> ---
Created attachment 26479
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26479&action=edit
[SIGNED OFF] Bug 11960: GetMemberDetails is unnecessarily called in
CanBookBeRenewed

C4::Circulation::CanBookBeRenewed calls C4::Members::GetMemberDetails to
retrieve categorycode and branchcode.

- categorycode is used to retrieve the issuing rule
- the borrower information is passed to
  C4::Circulation::_GetCircControlBranch. Which only uses the branchcode
  parameter.

GetMemberDetails does a lot of useless calls/queries (patronflags,
account, etc.).

This call could be replaced with a call to C4::Members::GetMember.

Note: I presented this small optimisation during a quick introduction to
NYTProf (hackfest 14 in Marseille).

Test plan:
- launch member unit tests
- check the code

Checking the code resulted in the following:
CanBookBeRenewed builds a hash reference from the borrowernumber
(2482). Note it is only used in this function and not passed in.

_GetCircControlBranch (2485) requires that hashreference to
have a branchcode key. As stated above.

The following line (2486) requires it have a categorycode key.

As such, C4::Members::GetMemberDetails is confirmed to be
overkill, and C4::Members::GetMember is sufficient.

Testing Done
------------
0) Back up DB
1) Make sure MPL is in the list of libraries.
2) Apply the patch.
3) run the koha qa test tool
4) prove -v t/db_dependent/Circulation.t

Patch applies cleanly. QA Test tool was all OK. All tests ran successfully.

Signed-off-by: Mark Tompsett <mtompset at hotmail.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list