[Koha-bugs] [Bug 6875] de-nesting C4 packages

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Sep 21 17:23:55 CEST 2011


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

--- Comment #12 from Paul Poulain <paul.poulain at biblibre.com> 2011-09-21 15:23:55 UTC ---
Created attachment 5505
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=5505
bug 6875 de-nesting C4::Member

* working on GetMemberDetails.
This sub must be optimized, as it is called on each page by C4::Auth.
The sub call everytime patronflags, that need to load Reserves and Overdues.
The patronflag returns a hash with various flags (overdues, fines, ...). It's
not related to permissionflags, that are loaded elsewhere. Most of the time, we
do nothing with those flags.
The strategy is to split the GetMemberDetails in 2 subs :
* GetMemberDetails, same as previously, without the flags
* GetMemberFlags, that will return just the flags when needed (and will load
when needed Reserves package)
The following scripts call GetMemberDetails :
  * admin/aqbudget.pl = no use is done with flags, the splitting changes
nothing
  * C4/SIP/ILS/Patron.pm = the flags are used later, so we call GetMemberFlags
as well
  * C4/SIP/interactive_members_dump.pl = nothing is done with the flags, we
change nothing
  * C4/Print.pm = used by printslip, that don't do anything with flags, we
change nothing
  * C4/VirtualShelves = used to check permission to access to a virtualshelf,
nothing done with flags, we change nothing
  * C4/Reserves = used in CheckReserves. With the result, we call
_GetCircControlBranch only, that does nothing with flags, we change nothing
  * C4/Auth = used in get_template_and_user. The return from GetMemberDetails
is stored in the session, I don't see any change, flags are useless
  * C4/Circulation.pm = used many times
    * in CanBookBeIssued, just to retrieve the name/cardnumber/borrowernumber
of a book already issued to someone else
    * in CanBookBeIssued, just to retrieve the name/cardnumber/borrowernumber
of a book already reserved by someone else
    * in AddReturn, the result of GetMemberDetails is returned. It's then used
in return.pl, to display patron flags. Retrieving flags with GetMemberFlags in
return.pl
    * in AddRenewal, to retrieve some information, nothing done with flags, we
change nothing
    * in GetRenewCount, to retrieve name & categorycode, nothing done with
flags, we change nothing
  * in ILSDI/Services.pm, GetMemberDetails is called many times. Only once we
check for charges, that is in the flags, so retrieving flags with
GetMemberFlags
  * in catalogue/detail.pl, GetMemberDetails is called to retrieve the name of
a patron that has placed a hold on a book, we change nothing
  * in circ/transferstoreceive, GetMemberDetails is called to retrieve the name
of a patron, (and address), we change nothing
  * in circ/circulation.pl, we must retrieve the flags to display them (like
for return.pl)
  * in circ/waitingreserves.pl, GetMemberDetails is called to retrieve the name
of the patron, nothing to change
  * in members/moremember.pl, GetMemberDetails is called to retrieve name,
surname, borrowernumber, we change nothing
  * in members/deletemem.pl, GetMemberDetails is followed by a $flag =
$bor->{flags}, replacing by a call to GetMemberDetails
  * in members/messaging.pl, GetMemberDetails is called to retrieve name,
category, nothing to change
  * members/member-flags.pl is here for permissions, nothing to deal with
patron flags, nothing to change
  * opac/opac-passwd.pl, nothing related to flags, nothing to change
  * opac/opac-ics.pl,  nothing related to flags, nothing to change
  * opac/opac-renew.pl, used to retrieve only branchcode, nothing to change
  * opac/opac-account.pl, nothing to change, the core part of this script is to
display fines that are retrieved by GetMemberAccountRecords
  * opac/opac-reserve.pl, nothing related to flags, nothing to change
  * opac/opac-userdetail.pl, script that retrieve only a few dates and other
infos from GetMemberDetails, nothing to change
  * opac/opac-showreviews.pl, retrieve only name & email from GetMemberDetails,
nothing to change
  * opac/SCO/sco-main.pl, calls canbookbeissued, that need flags, so retrieving
them
  * opac/opac-readingrecord.pl, use GetMemberDetails to retrieve patron name,
address... nothing to change
  * opac/opac-messaging.pl, use GetMemberDetails to retrieve sms informations,
nothing to change
  * opac/opac-userupdate.pl, use GetMemberDetails to display member information
that can be updated by the patron, nothing related to flags, nothing to change
  * opac/opac-privacy.pl, loaded just to retrieve name & privacy flag info,
nothing to change
  * opac/opac-user.pl, use GetMemberDetails to display patron information, but
not flags one, nothing to change
  * opac/opac-suggestion.pl use GetMemberDetails to retrieve the branchcode,
nothing to change
  * reserve/request.pl use GetMemberDetails to retrieve many informations
displayed (name, branchcode,...), but none related to flags. Nothing to change

GetMemberDetails also launches 2 SQL queries, the 2nd being superfluous : the
enrolmentperiod is already available in the 1st query, just return it !
=> C4::Reserves & C4::Overdues are now used only in GetMemberFlags sub, that is
not always called, so switching from a use to a require inside the sub

C4::Accounts is used only in AddMember and ExtendMemberSubscriptionTo, and only
if there is a fee for subscription, switching from use to require

sub GetMemberAccountRecords the SQL query has been completed. With a LEFT JOIN,
we retrieve directly the title & biblionumber. Thus the call to
GetBiblioByItemNumber is now useless and the use C4::Biblio can be removed

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.


More information about the Koha-bugs mailing list