Adding not issued and delete state to state collection
And display the three latest numbers of every subscription received or lacked in opac.
This commit is contained in:
parent
9f93e7cb15
commit
2bca25dc4c
58
C4/Bull.pm
58
C4/Bull.pm
|
|
@ -48,7 +48,7 @@ Give all XYZ functions
|
|||
&getsubscriptionfrombiblionumber &get_subscription_list_from_biblionumber
|
||||
&get_full_subscription_list_from_biblionumber
|
||||
&modsubscriptionhistory &newissue
|
||||
&getserials &serialchangestatus
|
||||
&getserials &getlatestserials &serialchangestatus
|
||||
&Find_Next_Date, &Get_Next_Seq
|
||||
&hassubscriptionexpired &subscriptionexpirationdate &subscriptionrenew
|
||||
&getSupplierListWithLateIssues &GetLateIssues);
|
||||
|
|
@ -347,7 +347,7 @@ sub getserials {
|
|||
my ($subscriptionid) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
# status = 2 is "arrived"
|
||||
my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate from serial where subscriptionid = ? and status <>2 and status <>4");
|
||||
my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate from serial where subscriptionid = ? and status <>2 and status <>4 and status <>5");
|
||||
$sth->execute($subscriptionid);
|
||||
my @serials;
|
||||
while(my $line = $sth->fetchrow_hashref) {
|
||||
|
|
@ -361,6 +361,26 @@ sub getserials {
|
|||
return ($totalissues,@serials);
|
||||
}
|
||||
|
||||
# get the $limit's latest serials arrived or missing for a given subscription
|
||||
sub getlatestserials{
|
||||
my ($subscriptionid,$limit) =@_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
# status = 2 is "arrived"
|
||||
my $strsth="select serialid,serialseq, status, planneddate from serial where subscriptionid = ? and (status =2 or status=4) order by planneddate DESC LIMIT 0,$limit";
|
||||
my $sth=$dbh->prepare($strsth);
|
||||
$sth->execute($subscriptionid);
|
||||
my @serials;
|
||||
while(my $line = $sth->fetchrow_hashref) {
|
||||
$line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list
|
||||
$line->{"planneddate"} = format_date($line->{"planneddate"});
|
||||
push @serials,$line;
|
||||
}
|
||||
$sth=$dbh->prepare("select count(*) from serial where subscriptionid=?");
|
||||
$sth->execute($subscriptionid);
|
||||
my ($totalissues) = $sth->fetchrow;
|
||||
return \@serials;
|
||||
}
|
||||
|
||||
sub serialchangestatus {
|
||||
my ($serialid,$serialseq,$planneddate,$status)=@_;
|
||||
# warn "($serialid,$serialseq,$planneddate,$status)";
|
||||
|
|
@ -370,19 +390,22 @@ sub serialchangestatus {
|
|||
$sth->execute($serialid);
|
||||
my ($subscriptionid,$oldstatus) = $sth->fetchrow;
|
||||
# change status & update subscriptionhistory
|
||||
$sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=? where serialid = ?");
|
||||
$sth->execute($serialseq,$planneddate,$status,$serialid);
|
||||
$sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?");
|
||||
$sth->execute($subscriptionid);
|
||||
my ($missinglist,$recievedlist) = $sth->fetchrow;
|
||||
if ($status eq 2) {
|
||||
$recievedlist .= ",$serialseq";
|
||||
if ($status eq 6){
|
||||
delissue($serialseq, $subscriptionid)
|
||||
}else{
|
||||
$sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=? where serialid = ?");
|
||||
$sth->execute($serialseq,$planneddate,$status,$serialid);
|
||||
$sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?");
|
||||
$sth->execute($subscriptionid);
|
||||
my ($missinglist,$recievedlist) = $sth->fetchrow;
|
||||
if ($status eq 2) {
|
||||
$recievedlist .= ",$serialseq";
|
||||
}
|
||||
$missinglist .= ",$serialseq" if ($status eq 4) ;
|
||||
$missinglist .= ",not issued $serialseq" if ($status eq 5);
|
||||
$sth=$dbh->prepare("update subscriptionhistory set recievedlist=?, missinglist=? where subscriptionid=?");
|
||||
$sth->execute($recievedlist,$missinglist,$subscriptionid);
|
||||
}
|
||||
if ($status eq 4) {
|
||||
$missinglist .= ",$serialseq";
|
||||
}
|
||||
$sth=$dbh->prepare("update subscriptionhistory set recievedlist=?, missinglist=? where subscriptionid=?");
|
||||
$sth->execute($recievedlist,$missinglist,$subscriptionid);
|
||||
# create new waited entry if needed (ie : was a "waited" and has changed)
|
||||
if ($oldstatus eq 1 && $status ne 1) {
|
||||
$sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
|
||||
|
|
@ -418,6 +441,13 @@ sub newissue {
|
|||
$sth->execute($recievedlist,$missinglist,$subscriptionid);
|
||||
}
|
||||
|
||||
sub delissue {
|
||||
my ($serialseq,$subscriptionid) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare("delete from serial where serialseq= ? and subscriptionid= ? ");
|
||||
$sth->execute($serialseq,$subscriptionid);
|
||||
}
|
||||
|
||||
sub Get_Next_Date(@) {
|
||||
my ($planneddate,$subscription) = @_;
|
||||
my $resultdate;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,16 @@
|
|||
<!-- TMPL_ELSE -->
|
||||
<option value="4">Missing</option>
|
||||
<!-- /TMPL_IF -->
|
||||
<!--TMPL_IF name="status5" -->
|
||||
<option value="5" selected>Not issued</option>
|
||||
<!-- TMPL_ELSE -->
|
||||
<option value="5">Not issued</option>
|
||||
<!-- /TMPL_IF -->
|
||||
<!--TMPL_IF name="status6" -->
|
||||
<option value="6" selected>Delete</option>
|
||||
<!-- TMPL_ELSE -->
|
||||
<option value="6">Delete</option>
|
||||
<!-- /TMPL_IF -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -157,15 +157,49 @@
|
|||
<td><!-- TMPL_VAR NAME="url" --></td>
|
||||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
|
||||
</table>
|
||||
<!-- TMPL_IF name="subscriptionsnumber" -->
|
||||
<p>
|
||||
This is a serial subscription (we have <!-- TMPL_VAR name="subscriptionsnumber" --> subscriptions). You can see which
|
||||
<a href="opac-serial-issues.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" class="button catalogue" title="Serial issues">
|
||||
Issues
|
||||
</a> we have and don't have
|
||||
</p>
|
||||
<!-- /TMPL_IF -->
|
||||
<div id="bloc25">
|
||||
<p>This is a serial subscription (There are <!-- TMPL_VAR name="subscriptionsnumber" --> subscriptions associated with this title).</p>
|
||||
<!-- TMPL_LOOP Name="subscriptions" -->
|
||||
<b class="catalogue"> Subscription #<!--TMPL_VAR Name="subscriptionid"--> </b>
|
||||
<p><!--TMPL_VAR Name="subscriptionnotes"--> </p>
|
||||
<!--TMPL_IF Name="latestserials"-->
|
||||
<p> Here comes a list of the three latest issues related to this subscription :</p>
|
||||
<table>
|
||||
<!--TMPL_LOOP Name="latestserials"-->
|
||||
<tr>
|
||||
<td>
|
||||
<!--TMPL_VAR Name="serialseq"-->
|
||||
</td>
|
||||
<td>
|
||||
<!--TMPL_VAR Name="planneddate"-->
|
||||
</td>
|
||||
<td>
|
||||
<!--TMPL_IF Name="status1"-->Waited
|
||||
<!--TMPL_ELSE -->
|
||||
<!-- TMPL_IF Name="status2"-->Arrived
|
||||
<!--TMPL_ELSE -->
|
||||
<!-- TMPL_IF Name="status3"-->Late
|
||||
<!--TMPL_ELSE -->
|
||||
<!-- TMPL_IF Name="status4"-->Missing
|
||||
<!--TMPL_ELSE -->
|
||||
<!-- TMPL_IF Name="status5"-->Not Issued
|
||||
<!--/TMPL_IF-->
|
||||
<!--/TMPL_IF-->
|
||||
<!--/TMPL_IF-->
|
||||
<!--/TMPL_IF-->
|
||||
<!--/TMPL_IF-->
|
||||
</td>
|
||||
</tr>
|
||||
<!--/TMPL_LOOP -->
|
||||
</table>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
<p> For more information :Click <a href="/cgi-bin/koha/opac-serial-issues.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" title="Serial issues"> here to look for Issues</a> we have or don't have</p>
|
||||
</div>
|
||||
<!-- /TMPL_IF -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
|
||||
|
|
|
|||
|
|
@ -29,8 +29,21 @@ my $dat = &bibdata($biblionumber);
|
|||
my ($authorcount, $addauthor) = &addauthor($biblionumber);
|
||||
my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber);
|
||||
my ($websitecount, @websites) = &getwebsites($biblionumber);
|
||||
my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber);
|
||||
|
||||
#coping with subscriptions
|
||||
my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber);
|
||||
my @subscriptions = getsubscriptions($dat->{title},$dat->{issn},$biblionumber);
|
||||
my @subs;
|
||||
foreach my $subscription (@subscriptions){
|
||||
warn "subsid :".$subscription->{subscriptionid};
|
||||
my %cell;
|
||||
$cell{subscriptionid}= $subscription->{subscriptionid};
|
||||
$cell{subscriptionnotes}= $subscription->{notes};
|
||||
#get the three latest serials.
|
||||
$cell{latestserials}=getlatestserials($subscription->{subscriptionid},3);
|
||||
push @subs, \%cell;
|
||||
}
|
||||
|
||||
$dat->{'count'}=@items;
|
||||
|
||||
$dat->{'additional'}=$addauthor->[0]->{'author'};
|
||||
|
|
@ -70,6 +83,7 @@ $template->param(BIBLIO_RESULTS => $resultsarray,
|
|||
ITEM_RESULTS => $itemsarray,
|
||||
WEB_RESULTS => $webarray,
|
||||
SITE_RESULTS => $sitearray,
|
||||
subscriptions => \@subs,
|
||||
subscriptionsnumber => $subscriptionsnumber,
|
||||
LibraryName => C4::Context->preference("LibraryName"),
|
||||
suggestion => C4::Context->preference("suggestion"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue