<<

NAME

C4::Reserves - Koha functions for dealing with reservation.

SYNOPSIS

  use C4::Reserves;

DESCRIPTION

  this modules provides somes functions to deal with reservations.
  
  Reserves are stored in reserves table.
  The following columns contains important values :
  - priority >0      : then the reserve is at 1st stage, and not yet affected to any item.
             =0      : then the reserve is being dealed
  - found : NULL       : means the patron requested the 1st available, and we haven't choosen the item
            W(aiting)  : the reserve has an itemnumber affected, and is on the way
            F(inished) : the reserve has been completed, and is done
  - itemnumber : empty : the reserve is still unaffected to an item
                 filled: the reserve is attached to an item
  The complete workflow is :
  ==== 1st use case ====
  patron request a document, 1st available :                      P >0, F=NULL, I=NULL
  a library having it run "transfertodo", and clic on the list    
         if there is no transfer to do, the reserve waiting
         patron can pick it up                                    P =0, F=W,    I=filled 
         if there is a transfer to do, write in branchtransfer    P =0, F=NULL, I=filled
           The pickup library recieve the book, it check in       P =0, F=W,    I=filled
  The patron borrow the book                                      P =0, F=F,    I=filled
  
  ==== 2nd use case ====
  patron requests a document, a given item,
    If pickup is holding branch                                   P =0, F=W,   I=filled
    If transfer needed, write in branchtransfer                   P =0, F=NULL, I=filled
        The pickup library recieve the book, it checks it in      P =0, F=W,    I=filled
  The patron borrow the book                                      P =0, F=F,    I=filled

FUNCTIONS

AddReserve
    AddReserve($branch,$borrowernumber,$biblionumber,$constraint,$bibitems,$priority,$notes,$title,$checkitem,$found)
GetReservesFromBiblionumber

@borrowerreserv=&GetReserves($biblionumber,$itemnumber,$borrowernumber);

this function get the list of reservation for an $biblionumber, $itemnumber or $borrowernumber given on input arg. Only 1 argument has to be passed.

GetReservesFromItemnumber
 ( $reservedate, $borrowernumber, $branchcode ) = GetReservesFromItemnumber($itemnumber);

   TODO :: Description here
GetReservesFromBorrowernumber
    $borrowerreserv = GetReservesFromBorrowernumber($borrowernumber,$tatus);
    
    TODO :: Descritpion
GetReserveCount

$number = &GetReserveCount($borrowernumber);

this function returns the number of reservation for a borrower given on input arg.

GetOtherReserves

($messages,$nextreservinfo)=$GetOtherReserves(itemnumber);

Check queued list of this document and check if this document must be transfered

GetReserveFee

$fee = GetReserveFee($borrowernumber,$biblionumber,$constraint,$biblionumber);

Calculate the fee for a reserve

GetReservesToBranch

@transreserv = GetReservesToBranch( $frombranch );

Get reserve list for a given branch

GetReservesForBranch

@transreserv = GetReservesForBranch($frombranch);

CheckReserves
  ($status, $reserve) = &CheckReserves($itemnumber);

Find a book in the reserves.

$itemnumber is the book's item number.

As I understand it, &CheckReserves looks for the given item in the reserves. If it is found, that's a match, and $status is set to Waiting.

Otherwise, it finds the most important item in the reserves with the same biblio number as this book (I'm not clear on this) and returns it with $status set to Reserved.

&CheckReserves returns a two-element list:

$status is either Waiting, Reserved (see above), or 0.

$reserve is the reserve item that matched. It is a reference-to-hash whose keys are mostly the fields of the reserves table in the Koha database.

CancelReserve
  &CancelReserve($biblionumber, $itemnumber, $borrowernumber);

Cancels a reserve.

Use either $biblionumber or $itemnumber to specify the item to cancel, but not both: if both are given, &CancelReserve does nothing.

$borrowernumber is the borrower number of the patron on whose behalf the book was reserved.

If $biblionumber was given, &CancelReserve also adjusts the priorities of the other people who are waiting on the book.

ModReserve

&ModReserve($rank,$biblio,$borrower,$branch)

ModReserveFill
  &ModReserveFill($reserve);

Fill a reserve. If I understand this correctly, this means that the reserved book has been found and given to the patron who reserved it.

$reserve specifies the reserve to fill. It is a reference-to-hash whose keys are fields from the reserves table in the Koha database.

ModReserveStatus

&ModReserveStatus($itemnumber, $newstatus);

Update the reserve status for the active (priority=0) reserve.

$itemnumber is the itemnumber the reserve is on

$newstatus is the new status.

ModReserveAffect

&ModReserveAffect($itemnumber,$borrowernumber,$diffBranchSend);

This function affect an item and a status for a given reserve The itemnumber parameter is used to find the biblionumber. with the biblionumber & the borrowernumber, we can affect the itemnumber to the correct reserve.

if $transferToDo is not set, then the status is set to "Waiting" as well. otherwise, a transfer is on the way, and the end of the transfer will take care of the waiting status

ModReserveCancelAll

($messages,$nextreservinfo) = &ModReserveCancelAll($itemnumber,$borrowernumber);

    function to cancel reserv,check other reserves, and transfer document if it's necessary
ModReserveMinusPriority

&ModReserveMinusPriority($itemnumber,$borrowernumber,$biblionumber)

Reduce the values of queuded list

_FixPriority

&_FixPriority($biblio,$borrowernumber,$rank);

 Only used internally (so don't export it)
 Changed how this functions works #
 Now just gets an array of reserves in the rank order and updates them with
 the array index (+1 as array starts from 0)
 and if $rank is supplied will splice item from the array and splice it back in again
 in new priority rank
_Findgroupreserve
  @results = &_Findgroupreserve($biblioitemnumber, $biblionumber);

****** FIXME ****** I don't know what this does, because I don't understand how reserve constraints work. I think the idea is that you reserve a particular biblio, and the constraint allows you to restrict it to a given biblioitem (e.g., if you want to borrow the audio book edition of "The Prophet", rather than the first available publication).

&_Findgroupreserve returns : @results is an array of references-to-hash whose keys are mostly fields from the reserves table of the Koha database, plus biblioitemnumber.

AUTHOR

Koha Developement team <info@koha.org>

<<