<<

NAME

C4::VirtualShelves - Functions for manipulating Koha virtual virtualshelves

SYNOPSIS

  use C4::VirtualShelves;

DESCRIPTION

This module provides functions for manipulating virtual virtualshelves, including creating and deleting virtualshelves, and adding and removing items to and from virtualshelves.

FUNCTIONS

GetShelves
  ($shelflist, $totshelves) = &GetShelves($mincategory, $row_count, $offset, $owner);
  ($shelfnumber, $shelfhash) = each %{$shelflist};

Returns the number of shelves specified by $row_count and $offset as well as the total number of shelves that meet the $owner and $mincategory criteria. $mincategory, $row_count, and $offset are required. $owner must be supplied when $mincategory == 1. When $mincategory is 2 or 3, supply undef as argument for $owner. $shelflistis a reference-to-hash. The keys are the virtualshelves numbers ($shelfnumber, above), and the values ($shelfhash, above) are themselves references-to-hash, with the following keys:

$shelfhash->{shelfname}

A string. The name of the shelf.

$shelfhash->{count}

The number of virtuals on that virtualshelves.

GetShelvesSummary
        ($shelves, $total) = GetShelvesSummary($mincategory, $row_count, $offset, $owner)

Returns the number of shelves specified by $row_count and $offset as well as the total number of shelves that meet the $owner and/or $mincategory criteria. $mincategory, $row_count, and $offset are required. $owner must be supplied when $mincategory == 1. When $mincategory is 2 or 3, supply undef as argument for $owner.

GetRecentShelves
        ($shelflist) = GetRecentShelves(1, $limit, $owner)

This function returns a references to an array of hashrefs containing specified shelves sorted by the date the shelf was last modified in descending order limited to the number of records specified by $row_count. If calling with $mincategory other than 1, use undef as $owner.

This function is intended to return a dataset reflecting the most recently active shelves for the submitted parameters.

GetShelf
  (shelfnumber,shelfname,owner,category,sortfield) = &GetShelf($shelfnumber);

Looks up information about the contents of virtual virtualshelves number $shelfnumber

Returns the database's information on 'virtualshelves' table.

GetShelfContents
  $itemlist = &GetShelfContents($shelfnumber);

Looks up information about the contents of virtual virtualshelves number $shelfnumber. Sorted by a field in the biblio table. copyrightdate gives a desc sort.

Returns a reference-to-array, whose elements are references-to-hash, as returned by C4::Biblio::GetBiblioFromItemNumber.

Note: the notforloan status comes from the itemtype, and where it equals 0 it does not ensure that related items.notforloan status is likewise 0. The caller has to check any items on their own, possibly with CanBookBeIssued from C4::Circulation.

AddShelf
  $shelfnumber = &AddShelf( $shelfname, $owner, $category);

Creates a new virtual virtualshelves with name $shelfname, owner $owner and category $category.

Returns a code to know what's happen. * -1 : if this virtualshelves already exist. * $shelfnumber : if success.

AddToShelf
  &AddToShelf($biblionumber, $shelfnumber);

Adds item number $biblionumber to virtual virtualshelves number $shelfnumber, unless that item is already on that shelf.

AddToShelfFromBiblio
    &AddToShelfFromBiblio($biblionumber, $shelfnumber)

    this function allow to add a virtual into the shelf number $shelfnumber
    from biblionumber.
ModShelf

ModShelf($shelfnumber, $hashref)

Where $hashref->{column} = param

Modify the value into virtualshelves table with values given from hashref, which each key of the hashref should be the name of a column of virtualshelves.

ShelfPossibleAction

ShelfPossibleAction($loggedinuser, $shelfnumber, $action);

$loggedinuser,$shelfnumber,$action

$action can be "view" or "manage".

Returns 1 if the user can do the $action in the $shelfnumber shelf. Returns 0 otherwise.

DelFromShelf
  &DelFromShelf( $biblionumber, $shelfnumber);

Removes item number $biblionumber from virtual virtualshelves number $shelfnumber. If the item wasn't on that virtualshelves to begin with, nothing happens.

DelShelf (old version)
  ($status, $msg) = &DelShelf($shelfnumber);

Deletes virtual virtualshelves number $shelfnumber. The virtualshelves must be empty.

Returns a two-element array, where $status is 0 if the operation was successful, or non-zero otherwise. $msg is "Done" in case of success, or an error message giving the reason for failure.

DelShelf (current version)
  $Number = DelShelf($shelfnumber);

This function deletes the shelf number, and all of it's content.

GetBibShelves

This finds all the public lists that this bib record is in.

RefreshShelvesSummary
        ($total, $pubshelves, $barshelves) = RefreshShelvesSummary($sessionID, $loggedinuser, $row_count);

Updates the current session and userenv with the most recent shelves

Returns the total number of shelves stored in the session/userenv along with two references each to an array of hashes, one containing the $loggedinuser's private shelves and one containing all public/open shelves.

This function is used in conjunction with the 'Lists' button in masthead.inc.

AUTHOR

Koha Developement team <info@koha.org>

SEE ALSO

C4::Circulation::Circ2(3)

<<