Improvement on C4::Reserves2 module

The following suggestions were made by Finlay (Katipo) in 2004.

Note added by Pierrick and Chris in may 2006: Finlay was working for Katipo until 2004 and he's not working on Koha anymore. We keep his comments in the wiki because it would be an interesting way to improve reserve module/API.

(Finlay speaking now) I am planning to totally reorganise both the api for this module and the database tables that it uses. I propose to replace it with an object oriented module.

Proposed API: Class methods:

my $reserves = Reserve::Find({
    itemnumber       => <itemnumber>,
    borrowernumber   => <borrowernumber>,
    biblionumber     => <biblionumber>,
    biblioitemnumber => <biblioitemnumber>
});

This method will replace FindReserves, CheckReserves and CheckWaiting. It will return a array ref to an array of Reserve objects.

my $res = Reserve::Create(.....)

Essentially the same as CreateReserve().

my $fee = Reserve::CalcFee(.....)

Essentially the same as CalcReserveFee()

my $res new Reserve(resnumber)

This recreates the reserve object from the unique resnumber (primary key). It can be used for passing reserve objects between cgi pages.

Object methods:

$res->cancel()

Should be obvious what this does.

$res->fill()

Only gets called when the reserved item is given to the borrower

$res->waiting($itemnumber)

Sets item with $itemnumber waiting for borrower

my $itemnumber = $res->is_waiting()

Returns itemnumber if reserve is waiting

The $res object will be a blessed hashref, as usual, and so it will have as attributes all the normal things like biblionumber, borrowernumber, various dates etc.

 
en/development/reserve_module_improvement.txt · Last modified: 2006/05/12 04:45 by pierrick
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki