<<

NAME

C4::VirtualShelves - Functions for manipulating Koha virtual shelves

SYNOPSIS

  use C4::VirtualShelves;

DESCRIPTION

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

FUNCTIONS

GetShelves

  ($shelflist, $totshelves) = &GetShelves($category, $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 $category criteria. $category, $row_count, and $offset are required. $owner must be supplied when $category == 1. When $category is 2, supply undef as argument for $owner.

This function is used by shelfpage in VirtualShelves/Page.pm when listing all shelves for lists management in opac or staff client. Order is by shelfname.

$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.

GetAllShelves

    $shelflist = GetAllShelves($category, $owner)

This function returns a reference to an array of hashrefs containing all shelves sorted by the shelf name.

This function is intended to return a dataset reflecting all the shelves for the submitted parameters.

GetSomeShelfNames

Returns shelf names and numbers for Add to combo of search results and Lists button of OPAC header.

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

  $biblist = &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($hashref, $owner);

Creates a new virtual shelf. Params passed in a hash like ModShelf.

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

AddToShelf

  &AddToShelf($biblionumber, $shelfnumber, $borrower);

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

ModShelf

my $result= 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. Fields like shelfnumber or owner cannot be changed.

Returns 1 if the action seemed to be successful.

ShelfPossibleAction

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

$loggedinuser,$shelfnumber,$action

$action can be "view", "add", "delete", "manage", "new_public", "new_private". Note that add/delete here refers to adding/deleting entries from the list. Deleting the list itself falls under manage. new_public and new_private refers to creating a new public or private list. The distinction between deleting your own entries from the list or entries from others is made in DelFromShelf.

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

DelFromShelf

    $result= &DelFromShelf( $bibref, $shelfnumber, $user);

Removes biblionumbers in passed arrayref from shelf $shelfnumber. If the bib wasn't on that virtualshelves to begin with, nothing happens.

Returns 0 if no items have been deleted.

DelShelf

  $Number = DelShelf($shelfnumber);

This function deletes the shelf number, and all of it's content. Authorization to do so MUST have been checked before calling, while using ShelfPossibleAction with manage parameter.

GetBibliosShelves

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

ShelvesMax

    $howmany= ShelvesMax($context);

Tells how much shelves are shown in which context. POPUP refers to addbybiblionumber popup, MGRPAGE is managing page (in opac or staff), COMBO refers to the Add to-combo of search results. MASTHEAD is the main Koha toolbar with Lists button.

AUTHOR

Koha Development Team <http://koha-community.org/>

SEE ALSO

C4::Circulation::Circ2(3)

<<