<<

FUNCTIONS

TransportCostMatrix

  TransportCostMatrix();

Returns Transport Cost Matrix as a hashref <to branch code> => <from branch code> => cost

UpdateTransportCostMatrix

  UpdateTransportCostMatrix($records);

Updates full Transport Cost Matrix table. $records is an arrayref of records. Records: { frombranch => <code>, tobranch => <code>, cost => <figure>, disable_transfer => <0,1> }

GetHoldsQueueItems

  GetHoldsQueueItems({ branchlimit => $branch, itemtypeslimit =>  $itype, ccodeslimit => $ccode, locationslimit => $location );

Returns hold queue for a holding branch. If branch is omitted, then whole queue is returned

CreateQueue

  CreateQueue();

Top level function that turns reserves into tmp_holdsqueue and hold_fill_targets.

GetBibsWithPendingHoldRequests

  my $biblionumber_aref = GetBibsWithPendingHoldRequests();

Return an arrayref of the biblionumbers of all bibs that have one or more unfilled hold requests.

GetPendingHoldRequestsForBib

  my $requests = GetPendingHoldRequestsForBib($biblionumber);

Returns an arrayref of hashrefs to pending, unfilled hold requests on the bib identified by $biblionumber. The following keys are present in each hashref:

    biblionumber
    borrowernumber
    itemnumber
    priority
    branchcode
    reservedate
    reservenotes
    borrowerbranch

The arrayref is sorted in order of increasing priority.

GetItemsAvailableToFillHoldRequestsForBib

  my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber, $branches_ar);

Returns an arrayref of items available to fill hold requests for the bib identified by $biblionumber. An item is available to fill a hold request if and only if:

    * it is not on loan
    * it is not withdrawn
    * it is not marked notforloan
    * it is not currently in transit
    * it is not lost
    * it is not sitting on the hold shelf
    * it is not damaged (unless AllowHoldsOnDamagedItems is on)

_checkHoldPolicy

    _checkHoldPolicy($item, $request)

    check if item agrees with hold policies

MapItemsToHoldRequests

  my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, $branches, $transport_cost_matrix)

  Parameters:
  $hold_requests is a hash containing hold information built by GetPendingHoldRequestsForBib
  $available_items is a hash containing item information built by GetItemsAvailableToFillHoldRequestsForBib
  $branches is an arrayref to a list of branches filled by load_branches_to_pull_from
  $transport_cost_matrix is a hash of hashes with branchcodes as keys, listing the cost to transfer from that branch to another

  Returns a hash of hashes with itemnumbers as keys, each itemnumber containing a hash with the information
  about the hold it has been mapped to.

  This routine attempts to match the holds in the following priority
  1 - If local holds priority is enabled we check all requests to see if local matches can be found
  2 - We check for item level matches and fill those
  3 - We now loop the remaining requests in priority order attempting to fill with
      a - Items where HoldsQueuePrioritizeBranch matches either from items held at the pickup branch, or at the least cost branch (if Transport Cost Matrix is being used)
      b - Items where the homebranch of the item and the pickup library match
      c - Items from the least cost branch (or items at the pickup location if available)
      d - Any item that can fill the hold

_can_item_fill_request

  my $bool = _can_item_fill_request( $item, $request, $libraries );

  This is an internal function of MapItemsToHoldRequests for checking an item against a hold. It uses the custom hashes for item and hold information
  used by that routine

CreatePickListFromItemMap

AddToHoldTargetMap

update_queue_for_biblio

    my $result = update_queue_for_biblio(
        {
            biblio_id             => $biblio_id,
          [ branches_to_use       => $branches_to_use,
            transport_cost_matrix => $transport_cost_matrix,
            delete                => $delete, ]
        }
    );

Given a biblio_id, this method calculates and sets the holds queue entries for the biblio's holds, and the hold fill targets (items).

Return value

It return a hashref containing:

requests: the pending holds count for the biblio.
available_items the count of items that are available to fill holds for the biblio.
mapped_items the total items that got mapped.

Optional parameters

branches_to_use a list of branchcodes to be used to restrict which items can be used.
transport_cost_matrix is the output of TransportCostMatrix.
delete tells the method to delete prior entries on the related tables for the biblio_id.

Note: All the optional parameters will be calculated in the method if omitted. They are allowed to be passed to avoid calculating them many times inside loops.

<<