[Koha-devel] code cleaning of Reserves.pm

Paul POULAIN paul.poulain at free.fr
Tue Apr 24 18:11:35 CEST 2007


* GlobalCancel : renammed to ModReserveCancelAll
* OtherReserves : renamed to GetOtherReserves
* MinusPriority : renamed to ModReserveMinusPriority and SQL 
improvement: 2 nested SQL read/update that could be done in 1 step
* SetWaitingStatus : renamed to ModReserveStatus
* GetReservations and FindReserves merged, API changed and resulting sub 
is GetReserves
* GetFirstReserveDateFromItem removed (mered into GetReserves improved 
to return the branchcode that was the only field missing)
* splitting GetReserves in 3 different sub : one for each parameter. 
Depending on the parameter (biblionumber / itemnumber / borrowernumber), 
the GetReserves sub returned differents things (2 var, 1 array ...) that 
is silly & hard to read. Splitting in 3 subs is not the most efficient, 
but it's more readable. Later, we could maybe merge them again by having 
a common returned result, but i'm not sure it would be possible
* CountReservesFromBorrower renamed to GetReserveCount
* CheckReserves : No change (see question below)
* CancelReserve : name unchanged (it's not a reserve deletion, so I 
think DelReserve is wrong)
* FillReserve renamed to ModReserveFill and variable names changed 
internally
* FixPriority renamed to _FixPriority (internal sub)
* WaitingReserves renamed to ModReserveAffect, POD & cleaned
* GetWaitingReserves : removed (merged in BetReservesFromBorrowernumber)
* CalcHLTReserveFee : removed (hardcoded specific rules for HLT. Don't 
ask me to reintroduce them, I will disagree : we can't have specific 
hardcoded code in Koha)
* GetNextAccountNumber : removed (unused)
* UpdateReserve : renamed to ModReserve
* findgroupreserve : renamed to _findgroupreserve (internal sub)
* CreateReserve : renamed to AddReserve (& opac-reserve call fixed : a 
undef parameter useless)
* CalcReserveFee : renamed to GetReserveFee
* GetReserveTitle : removed (useless)
* FindReservesInQueue : removed (copy of GetReservesFromBiblionumber)
* CheckReserves : removed $barcode parameter (never used)

QUESTION 1 : what is reservecontraint table done for ? does it work ? It 
seems that the table is filled only in Reserves.pm, CreateReserve, only 
if constraint='o' or 'e' (dunno what it means). In the code, contraint 
seems to be possibly 'a', but I don't know how it can occur.
QUESTION 2 : could someone explain exactly how reserves work 
(internally). I'm not sure i've got all cases.

CONCLUSION : i'm not fully happy with this cleaning. I think a second 
tour could/should be done, mainly in Modxxx sub, as I think we could 
have a fewer number of subs. But I won't do it.

-- 
Paul POULAIN et Henri Damien LAURENT
Consultants indépendants en logiciels libres et bibliothéconomie 
(http://www.koha-fr.org)
Tel : 04 91 31 45 19





More information about the Koha-devel mailing list