adding "show me late issues" screen
This commit is contained in:
parent
25bf4e04a3
commit
2db99e1dd5
58
C4/Bull.pm
58
C4/Bull.pm
|
|
@ -48,8 +48,57 @@ Give all XYZ functions
|
|||
&modsubscriptionhistory
|
||||
&getserials &serialchangestatus
|
||||
&Find_Next_Date, &Get_Next_Seq
|
||||
&hassubscriptionexpired &subscriptionexpirationdate &subscriptionrenew);
|
||||
&hassubscriptionexpired &subscriptionexpirationdate &subscriptionrenew
|
||||
&getSupplierListWithLateIssues &GetLateIssues);
|
||||
|
||||
sub getSupplierListWithLateIssues {
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare("SELECT DISTINCT id, name
|
||||
FROM subscription, serial
|
||||
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
|
||||
WHERE subscription.subscriptionid = serial.subscriptionid AND
|
||||
(planneddate < now( ) OR serial.STATUS = 3)
|
||||
");
|
||||
$sth->execute;
|
||||
my %supplierlist;
|
||||
while (my ($id,$name) = $sth->fetchrow) {
|
||||
$supplierlist{$id} = $name;
|
||||
}
|
||||
return %supplierlist;
|
||||
}
|
||||
sub GetLateIssues {
|
||||
my ($supplierid) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth;
|
||||
if ($supplierid) {
|
||||
$sth = $dbh->prepare("SELECT name,title,planneddate,serialseq,serial.subscriptionid
|
||||
FROM subscription, serial, biblio
|
||||
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
|
||||
WHERE subscription.subscriptionid = serial.subscriptionid AND
|
||||
((planneddate < now() and serial.STATUS =1) OR serial.STATUS = 3) and
|
||||
subscription.aqbooksellerid=$supplierid and
|
||||
biblio.biblionumber = subscription.biblionumber
|
||||
");
|
||||
} else {
|
||||
$sth = $dbh->prepare("SELECT name,title,planneddate,serialseq,serial.subscriptionid
|
||||
FROM subscription, serial, biblio
|
||||
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
|
||||
WHERE subscription.subscriptionid = serial.subscriptionid AND
|
||||
((planneddate < now() and serial.STATUS <=3) OR serial.STATUS = 3) and
|
||||
biblio.biblionumber = subscription.biblionumber
|
||||
");
|
||||
}
|
||||
$sth->execute;
|
||||
my @issuelist;
|
||||
my $last_title;
|
||||
while (my $line = $sth->fetchrow_hashref) {
|
||||
$line->{title} = "" if $line->{title} eq $last_title;
|
||||
$last_title = $line->{title} if ($line->{title});
|
||||
$line->{planneddate} = format_date($line->{planneddate});
|
||||
push @issuelist,$line;
|
||||
}
|
||||
return @issuelist;
|
||||
}
|
||||
sub newsubscription {
|
||||
my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
|
||||
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
|
||||
|
|
@ -77,7 +126,7 @@ sub newsubscription {
|
|||
#then create the 1st waited number
|
||||
my $subscriptionid = $dbh->{'mysql_insertid'};
|
||||
$sth = $dbh->prepare("insert into subscriptionhistory (biblionumber, subscriptionid, histstartdate, enddate, missinglist, recievedlist, opacnote, librariannote) values (?,?,?,?,?,?,?,?)");
|
||||
$sth->execute($biblionumber, $subscriptionid, format_date_in_iso($startdate), 0, "", "", 0, $notes);
|
||||
$sth->execute($biblionumber, $subscriptionid, format_date_in_iso($startdate), 0, "", "", "", $notes);
|
||||
# reread subscription to get a hash (for calculation of the 1st issue number)
|
||||
$sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
|
||||
$sth->execute($subscriptionid);
|
||||
|
|
@ -149,6 +198,7 @@ sub modsubscription {
|
|||
|
||||
sub getsubscriptions {
|
||||
my ($title,$ISSN) = @_;
|
||||
return unless $title or $ISSN;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth;
|
||||
$sth = $dbh->prepare("select subscription.subscriptionid,biblio.title,biblioitems.issn from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and (biblio.title like ? or biblioitems.issn = ? )");
|
||||
|
|
@ -247,7 +297,7 @@ sub Get_Next_Date(@) {
|
|||
$resultdate=DateCalc($planneddate,"3 months");
|
||||
}
|
||||
if ($subscription->{periodicity} == 8) {
|
||||
$resultdate=DateCalc($planneddate,"1 quarter");
|
||||
$resultdate=DateCalc($planneddate,"3 months");
|
||||
}
|
||||
if ($subscription->{periodicity} == 9) {
|
||||
$resultdate=DateCalc($planneddate,"2 weeks");
|
||||
|
|
@ -312,7 +362,7 @@ sub hassubscriptionexpired {
|
|||
# we don't do the same test if the subscription is based on X numbers or on X weeks/months
|
||||
if ($subscription->{numberlength}) {
|
||||
my $sth = $dbh->prepare("select count(*) from serial where subscriptionid=? and planneddate>=?");
|
||||
$sth->execute($subscriptionid,$subscription->{planneddate});
|
||||
$sth->execute($subscriptionid,$subscription->{startdate});
|
||||
my $res = $sth->fetchrow;
|
||||
if ($subscription->{numberlength}>=$res) {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Bull;
|
||||
use C4::Output;
|
||||
use C4::Interface::CGI::Output;
|
||||
use C4::Context;
|
||||
use HTML::Template;
|
||||
|
||||
my $query = new CGI;
|
||||
# my $title = $query->param('title');
|
||||
# my $ISSN = $query->param('ISSN');
|
||||
# my @subscriptions = getsubscriptions($title,$ISSN);
|
||||
|
||||
my $supplierid = $query->param('supplierid');
|
||||
my %supplierlist = getSupplierListWithLateIssues;
|
||||
my @select_supplier;
|
||||
push @select_supplier,"";
|
||||
foreach my $supplierid (keys %supplierlist){
|
||||
push @select_supplier, $supplierid
|
||||
}
|
||||
my $CGIsupplier=CGI::scrolling_list( -name => 'supplierid',
|
||||
-values => \@select_supplier,
|
||||
-default => $supplierid,
|
||||
-labels => \%supplierlist,
|
||||
-size => 1,
|
||||
-multiple => 0 );
|
||||
|
||||
my @lateissues;
|
||||
@lateissues = GetLateIssues($supplierid) if $supplierid;
|
||||
my ($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "bull/lateissues.tmpl",
|
||||
query => $query,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {catalogue => 1},
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
$template->param(
|
||||
CGIsupplier => $CGIsupplier,
|
||||
lateissues => \@lateissues
|
||||
);
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<!-- TMPL_INCLUDE NAME="bull-top.inc" -->
|
||||
<!--------------------------MAIN BODY OF PAGE-------------------------->
|
||||
<div id="mainbloc">
|
||||
<h1 class="bull">Late issues</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th class="bull">Supplier</th>
|
||||
<th class="bull">Title</th>
|
||||
<th class="bull">Issue number</th>
|
||||
<th class="bull">Late since</th>
|
||||
<th class="bull" colspan=2> </th>
|
||||
</tr>
|
||||
<tr>
|
||||
<form action="lateissues.pl" method="post">
|
||||
<td>
|
||||
<!-- TMPL_VAR name="CGIsupplier" -->
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<input type="submit" value="filter" class="button bull">
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
<!-- TMPL_LOOP name="lateissues" -->
|
||||
<tr>
|
||||
<td>
|
||||
<!-- TMPL_VAR name="name" -->
|
||||
</td>
|
||||
<td>
|
||||
<!-- TMPL_VAR name="Title" -->
|
||||
</td>
|
||||
<td>
|
||||
<!-- TMPL_VAR name="serialseq" -->
|
||||
</td>
|
||||
<td>
|
||||
<!-- TMPL_VAR name="planneddate" -->
|
||||
</td>
|
||||
<td>
|
||||
<a href="subscription-detail.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->" class="button bull">Detail</a>
|
||||
<a href="statecollection.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->" class="button bull">Recieve</a>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</table>
|
||||
</div>
|
||||
<!-- TMPL_INCLUDE NAME="bull-bottom.inc" -->
|
||||
|
||||
Loading…
Reference in New Issue