<<

NAME

C4::Serials - Serials Module Functions

SYNOPSIS

  use C4::Serials;

DESCRIPTION

Functions for handling subscriptions, claims routing etc.

SUBROUTINES

GetSuppliersWithLateIssues

$supplierlist = GetSuppliersWithLateIssues()

this function get all suppliers with late issues.

return : an array_ref of suppliers each entry is a hash_ref containing id and name the array is in name order

GetLateIssues

@issuelist = GetLateIssues($supplierid)

this function selects late issues from the database

return : the issuelist as an array. Each element of this array contains a hashi_ref containing name,title,planneddate,serialseq,serial.subscriptionid from tables : subscription, serial & biblio

GetSubscriptionHistoryFromSubscriptionId

$history = GetSubscriptionHistoryFromSubscriptionId($subscriptionid);

This function returns the subscription history as a hashref

GetSerialStatusFromSerialId

$sth = GetSerialStatusFromSerialId(); this function returns a statement handle After this function, don't forget to execute it by using $sth->execute($serialid) return : $sth = $dbh->prepare($query).

GetSerialInformation

$data = GetSerialInformation($serialid); returns a hash_ref containing : items : items marcrecord (can be an array) serial table field subscription table field + information about subscription expiration

AddItem2Serial

$rows = AddItem2Serial($serialid,$itemnumber); Adds an itemnumber to Serial record returns the number of rows affected

UpdateClaimdateIssues

UpdateClaimdateIssues($serialids,[$date]);

Update Claimdate for issues in @$serialids list with date $date (Take Today if none)

GetSubscription

$subs = GetSubscription($subscriptionid) this function returns the subscription which has $subscriptionid as id. return : a hashref. This hash containts subscription, subscriptionhistory, aqbooksellers.name, biblio.title

GetFullSubscription

   $array_ref = GetFullSubscription($subscriptionid)
   this function reads the serial table.

PrepareSerialsData

   $array_ref = PrepareSerialsData($serialinfomation)
   where serialinformation is a hashref array

GetSubscriptionsFromBiblionumber

$array_ref = GetSubscriptionsFromBiblionumber($biblionumber) this function get the subscription list. it reads the subscription table. return : reference to an array of subscriptions which have the biblionumber given on input arg. each element of this array is a hashref containing startdate, histstartdate,opacnote,missinglist,recievedlist,periodicity,status & enddate

GetFullSubscriptionsFromBiblionumber

   $array_ref = GetFullSubscriptionsFromBiblionumber($biblionumber)
   this function reads the serial table.

GetSubscriptions

@results = GetSubscriptions($title,$ISSN,$ean,$biblionumber); this function gets all subscriptions which have title like $title,ISSN like $ISSN,EAN like $ean and biblionumber like $biblionumber. return: a table of hashref. Each hash containt the subscription.

SearchSubscriptions

@results = SearchSubscriptions($args); $args is a hashref. Its keys can be contained: title, issn, ean, publisher, bookseller and branchcode

this function gets all subscriptions which have title like $title, ISSN like $issn, EAN like $ean, publisher like $publisher, bookseller like $bookseller AND branchcode eq $branch.

return: a table of hashref. Each hash containt the subscription.

GetSerials

($totalissues,@serials) = GetSerials($subscriptionid); this function gets every serial not arrived for a given subscription as well as the number of issues registered in the database (all types) this number is used to see if a subscription can be deleted (=it must have only 1 issue)

FIXME: We should return \@serials.

GetSerials2

@serials = GetSerials2($subscriptionid,$status); this function returns every serial waited for a given subscription as well as the number of issues registered in the database (all types) this number is used to see if a subscription can be deleted (=it must have only 1 issue)

GetLatestSerials

\@serials = GetLatestSerials($subscriptionid,$limit) get the $limit's latest serials arrived or missing for a given subscription return : a ref to an array which contains all of the latest serials stored into a hash.

GetDistributedTo

$distributedto=GetDistributedTo($subscriptionid) This function returns the field distributedto for the subscription matching subscriptionid

GetNextSeq

    my (
        $nextseq,       $newlastvalue1, $newlastvalue2, $newlastvalue3,
        $newinnerloop1, $newinnerloop2, $newinnerloop3
    ) = GetNextSeq( $subscription, $pattern, $planneddate );

$subscription is a hashref containing all the attributes of the table 'subscription'. $pattern is a hashref containing all the attributes of the table 'subscription_numberpatterns'. $planneddate is a C4::Dates object. This function get the next issue for the subscription given on input arg

GetSeq

$calculated = GetSeq($subscription, $pattern) $subscription is a hashref containing all the attributes of the table 'subscription' $pattern is a hashref containing all the attributes of the table 'subscription_numberpatterns' this function transforms {X},{Y},{Z} to 150,0,0 for example. return: the sequence in string format

GetExpirationDate

$enddate = GetExpirationDate($subscriptionid, [$startdate])

this function return the next expiration date for a subscription given on input args.

return the enddate or undef

CountSubscriptionFromBiblionumber

$subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber) this returns a count of the subscriptions for a given biblionumber return : the number of subscriptions

ModSubscriptionHistory

ModSubscriptionHistory($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote);

this function modifies the history of a subscription. Put your new values on input arg. returns the number of rows affected

ModSerialStatus

ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)

This function modify the serial status. Serial status is a number.(eg 2 is "arrived") Note : if we change from "waited" to something else,then we will have to create a new "waited" entry

GetNextExpected

$nextexpected = GetNextExpected($subscriptionid)

Get the planneddate for the current expected issue of the subscription.

returns a hashref:

$nextexepected = { serialid => int planneddate => ISO date }

ModNextExpected

ModNextExpected($subscriptionid,$date)

Update the planneddate for the current expected issue of the subscription. This will modify all future prediction results.

$date is an ISO date.

returns 0

GetSubscriptionIrregularities

@irreg = &GetSubscriptionIrregularities($subscriptionid); get the list of irregularities for a subscription

ModSubscription

this function modifies a subscription. Put all new values on input args. returns the number of rows affected

NewSubscription

$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, $startdate,$periodicity,$numberlength,$weeklength,$monthlength, $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, $callnumber, $hemisphere, $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq);

Create a new subscription with value given on input args.

return : the id of this new subscription

ReNewSubscription

ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)

this function renew a subscription with values given on input args.

NewIssue

NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes)

Create a new issue stored on the database. Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. returns the serial id

ItemizeSerials

ItemizeSerials($serialid, $info); $info is a hashref containing barcode branch, itemcallnumber, status, location $serialid the serialid return : 1 if the itemize is a succes. 0 and @error otherwise. @error containts the list of errors found.

HasSubscriptionStrictlyExpired

1 or 0 = HasSubscriptionStrictlyExpired($subscriptionid)

the subscription has stricly expired when today > the end subscription date

return : 1 if true, 0 if false, -1 if the expiration date is not set.

HasSubscriptionExpired

$has_expired = HasSubscriptionExpired($subscriptionid)

the subscription has expired when the next issue to arrive is out of subscription limit.

return : 0 if the subscription has not expired 1 if the subscription has expired 2 if has subscription does not have a valid expiration date set

SetDistributedto

SetDistributedto($distributedto,$subscriptionid); This function update the value of distributedto for a subscription given on input arg.

DelSubscription

DelSubscription($subscriptionid) this function deletes subscription which has $subscriptionid as id.

DelIssue

DelIssue($serialseq,$subscriptionid) this function deletes an issue which has $serialseq and $subscriptionid given on input arg.

returns the number of rows affected

GetLateOrMissingIssues

@issuelist = GetLateMissingIssues($supplierid,$serialid)

this function selects missing issues on database - where serial.status = 4 or serial.status=3 or planneddate<now

return : the issuelist as an array of hash refs. Each element of this array contains name,title,planneddate,serialseq,serial.subscriptionid from tables : subscription, serial & biblio

removeMissingIssue

removeMissingIssue($subscriptionid)

this function removes an issue from being part of the missing string in subscriptionlist.missinglist column

called when a missing issue is found from the serials-recieve.pl file

updateClaim

&updateClaim($serialid)

this function updates the time when a claim is issued for late/missing items

called from claims.pl file

getsupplierbyserialid

$result = getsupplierbyserialid($serialid)

this function is used to find the supplier id given a serial id

return : hashref containing serialid, subscriptionid, and aqbooksellerid

check_routing

$result = &check_routing($subscriptionid)

this function checks to see if a serial has a routing list and returns the count of routingid used to show either an 'add' or 'edit' link

addroutingmember

addroutingmember($borrowernumber,$subscriptionid)

this function takes a borrowernumber and subscriptionid and adds the member to the routing list for that serial subscription and gives them a rank on the list of either 1 or highest current rank + 1

reorder_members

reorder_members($subscriptionid,$routingid,$rank)

this function is used to reorder the routing list

it takes the routingid of the member one wants to re-rank and the rank it is to move to - it gets all members on list puts their routingid's into an array - removes the one in the array that is $routingid - then reinjects $routingid at point indicated by $rank - then update the database with the routingids in the new order

delroutingmember

delroutingmember($routingid,$subscriptionid)

this function either deletes one member from routing list if $routingid exists otherwise deletes all members from the routing list

getroutinglist

@routinglist = getroutinglist($subscriptionid)

this gets the info from the subscriptionroutinglist for $subscriptionid

return : the routinglist as an array. Each element of the array contains a hash_ref containing routingid - a unique id, borrowernumber, ranking, and biblionumber of subscription

countissuesfrom

$result = countissuesfrom($subscriptionid,$startdate)

Returns a count of serial rows matching the given subsctiptionid with published date greater than startdate

CountIssues

$result = CountIssues($subscriptionid)

Returns a count of serial rows matching the given subsctiptionid

HasItems

$result = HasItems($subscriptionid)

returns a count of items from serial matching the subscriptionid

abouttoexpire

$result = abouttoexpire($subscriptionid)

this function alerts you to the penultimate issue for a serial subscription

returns 1 - if this is the penultimate issue returns 0 - if not

GetSubscriptionsFromBorrower

($count,@routinglist) = GetSubscriptionsFromBorrower($borrowernumber)

this gets the info from subscriptionroutinglist for each $subscriptionid

return : a count of the serial subscription routing lists to which a patron belongs, with the titles of those serial subscriptions as an array. Each element of the array contains a hash_ref with subscriptionID and title of subscription.

GetFictiveIssueNumber

$issueno = GetFictiveIssueNumber($subscription, $publishedate);

Get the position of the issue published at $publisheddate, considering the first issue (at firstacquidate) is at position 1, the next is at position 2, etc... This issuenumber doesn't take into account irregularities, so, for instance, if the 3rd issue is declared as 'irregular' (will be skipped at receipt), the next issue number will be 4, not 3. It's why it is called 'fictive'. It is NOT a serial seq, and is not depending on how many rows are in serial table. The issue number calculation is based on subscription frequency, first acquisition date, and $publisheddate.

GetNextDate

$resultdate = GetNextDate($publisheddate,$subscription)

this function it takes the publisheddate and will return the next issue's date and will skip dates if there exists an irregularity. $publisheddate has to be an ISO date $subscription is a hashref containing at least 'periodicity', 'firstacquidate', 'irregularity', and 'countissuesperunit' $updatecount is a boolean value which, when set to true, update the 'countissuesperunit' in database - eg if periodicity is monthly and $publisheddate is 2007-02-10 but if March and April is to be skipped then the returned date will be 2007-05-10

return : $resultdate - then next date in the sequence (ISO date)

Return $publisheddate if subscription is irregular

_numeration

  $string = &_numeration($value,$num_type,$locale);

_numeration returns the string corresponding to $value in the num_type num_type can take : -dayname -monthname -season

is_barcode_in_use

Returns number of occurence of the barcode in the items table Can be used as a boolean test of whether the barcode has been deployed as yet

CloseSubscription Close a subscription given a subscriptionid

ReopenSubscription Reopen a subscription given a subscriptionid

subscriptionCurrentlyOnOrder

    $bool = subscriptionCurrentlyOnOrder( $subscriptionid );

Return 1 if subscription is currently on order else 0.

can_edit_subscription

    $can = can_edit_subscription( $subscriptionid[, $userid] );

Return 1 if the subscription is editable by the current logged user (or a given $userid), else 0.

AUTHOR

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

<<