C4::Acquisition - Koha functions for dealing with orders and acquisitions
use C4::Acquisition;
The functions in this module deal with acquisitions, managing book orders, basket and parcels.
$aqbasket = &GetBasket($basketnumber);
get all basket informations in aqbasket for a given basket
return : informations for a given basket returned as a hashref.
$basket = &NewBasket();
Create a new basket in aqbasket table
&CloseBasket($basketno);
close a basket (becomes unmodifiable,except for recieves)
$orders = &GetPendingOrders($booksellerid, $grouped);
Finds pending orders from the bookseller with the given ID. Ignores completed and cancelled orders.
$orders
is a reference-to-array; each element is a reference-to-hash with the following fields:$grouped
is a boolean that, if set to 1 will group all order lines of the same basket in a single result line
authorizedby
entrydate
basketno
These give the value of the corresponding field in the aqorders table of the Koha database.
Results are ordered from most to least recent.
@orders = &GetOrders($basketnumber, $orderby);
Looks up the pending (non-cancelled) orders with the given basket number. If
$booksellerID
is non-empty, only orders from that seller are returned.return :
&basket
returns a two-element array.@orders
is an array of references-to-hash, whose keys are the fields from the aqorders, biblio, and biblioitems tables in the Koha database.
$ordernumber = &GetOrderNumber($biblioitemnumber, $biblionumber);
Looks up the ordernumber with the given biblionumber and biblioitemnumber.
Returns the number of this order.
$ordernumber
is the order number.$order = &GetOrder($ordernumber);
Looks up an order by order number.
Returns a reference-to-hash describing the order. The keys of
$order
are fields from the biblio, biblioitems, aqorders, and aqorderbreakdown tables of the Koha database.
&NewOrder($basket, $biblionumber, $title, $quantity, $listprice, $booksellerid, $who, $notes, $bookfund, $biblioitemnumber, $rrp, $ecost, $gst, $budget, $unitprice, $subscription, $booksellerinvoicenumber, $purchaseorder, $branchcode);Adds a new order to the database. Any argument that isn't described below is the new value of the field with the same name in the aqorders table of the Koha database.
$ordnum
is a "minimum order number." After adding the new entry to the aqorders table,&neworder
finds the first entry in aqorders with order number greater than or equal to$ordnum
, and adds an entry to the aqorderbreakdown table, with the order number just found, and the book fund ID of the newly-added order.
$budget
is effectively ignored. If it's undef (anything false) or the string 'now', the current day is used. Else, the upcoming July 1st is used.
$subscription
may be either "yes", or anything else for "no".
&ModOrder($title, $ordernumber, $quantity, $listprice, $biblionumber, $basketno, $supplier, $who, $notes, $bookfundid, $bibitemnum, $rrp, $ecost, $gst, $budget, $unitprice, $booksellerinvoicenumber, $branchcode);
Modifies an existing order. Updates the order with order number
$ordernumber
and biblionumber$biblionumber
. All other arguments update the fields with the same name in the aqorders table of the Koha database.Entries with order number
$ordernumber
in the aqorderbreakdown table are also updated to the new book fund ID or branchcode.
&ModOrderBiblioNumber($biblioitemnumber,$ordnum, $biblionumber);
Modifies the biblioitemnumber for an existing order. Updates the order with order number
$ordernum
and biblionumber$biblionumber
.
&ModReceiveOrder($biblionumber, $ordernumber, $quantityreceived, $user, $unitprice, $booksellerinvoicenumber, $biblioitemnumber, $freight, $bookfund, $rrp);
Updates an order, to reflect the fact that it was received, at least in part. All arguments not mentioned below update the fields with the same name in the aqorders table of the Koha database.
If a partial order is received, splits the order into two. The received portion must have a booksellerinvoicenumber.
Updates the order with bibilionumber
$biblionumber
and ordernumber$ordernumber
.Also updates the book fund ID in the aqorderbreakdown table.
@results = &SearchOrder($search, $biblionumber, $complete);
Searches for orders.
$search
may take one of several forms: if it is an ISBN, &ordersearch
returns orders with that ISBN. If $search
is an order number, &ordersearch
returns orders with that order number and biblionumber $biblionumber
. Otherwise, $search
is considered to be a space-separated list of search terms; in this case, all of the terms must appear in the title (matching the beginning of title words).
If $complete
is yes
, the results will include only completed orders. In any case, &ordersearch
ignores cancelled orders.
&ordersearch
returns an array. @results
is an array of references-to-hash with the following keys:
author
seriestitle
branchcode
bookfundid
&DelOrder($biblionumber, $ordernumber);
Cancel the order with the given order and biblio numbers. It does not delete any entries in the aqorders table, it merely marks them as cancelled.
@results = &GetParcel($booksellerid, $code, $date);
Looks up all of the received items from the supplier with the given bookseller ID at the given date, for the given code (bookseller Invoice number). Ignores cancelled and completed orders.
@results
is an array of references-to-hash. The keys of each element are fields from the aqorders, biblio, and biblioitems tables of the Koha database.
@results
is sorted alphabetically by book title.
$results = &GetParcels($bookseller, $order, $code, $datefrom, $dateto); get a lists of parcels.
* Input arg :
* return: a pointer on a hash list containing parcel informations as such :
@results = &GetLateOrders;
Searches for bookseller with late orders.
return: the table of supplier with late issues. This table is full of hashref.
(\@order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( $title, $author, $name, $from_placed_on, $to_placed_on );
Retreives some acquisition history information returns: $order_loop is a list of hashrefs that each look like this: { 'author' => 'Twain, Mark', 'basketno' => '1', 'biblionumber' => '215', 'count' => 1, 'creationdate' => 'MM/DD/YYYY', 'datereceived' => undef, 'ecost' => '1.00', 'id' => '1', 'invoicenumber' => undef, 'name' => '', 'ordernumber' => '1', 'quantity' => 1, 'quantityreceived' => undef, 'title' => 'The Adventures of Huckleberry Finn' } $total_qty is the sum of all of the quantities in $order_loop $total_price is the cost of each in $order_loop times the quantity $total_qtyreceived is the sum of all of the quantityreceived entries in $order_loop
$results = GetRecentAcqui($days); C<$results> is a ref to a table which containts hashref
Koha Developement team <info@koha.org>