Enable warnings in serial scripts
Remove some superfluous variables Simplify some loops over lists Fix generated warnings Strip whitespace from line endings Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
parent
b04f3c9bb8
commit
c9f3ede161
|
|
@ -40,6 +40,7 @@ acqui-search-result.pl
|
|||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use C4::Auth;
|
||||
use C4::Biblio;
|
||||
use C4::Output;
|
||||
|
|
@ -60,33 +61,33 @@ my ($template, $loggedinuser, $cookie)
|
|||
|
||||
my $supplier=$query->param('supplier');
|
||||
my @suppliers = GetBookSeller($supplier);
|
||||
my $count = scalar @suppliers;
|
||||
#my $count = scalar @suppliers;
|
||||
|
||||
#build result page
|
||||
my @loop_suppliers;
|
||||
for (my $i=0; $i<$count; $i++) {
|
||||
my $orders = GetPendingOrders($suppliers[$i]->{'id'});
|
||||
my $ordcount = scalar @$orders;
|
||||
my $loop_suppliers = [];
|
||||
for my $s (@suppliers) {
|
||||
my $orders = GetPendingOrders($s->{'id'});
|
||||
|
||||
my %line;
|
||||
$line{aqbooksellerid} =$suppliers[$i]->{'id'};
|
||||
$line{name} = $suppliers[$i]->{'name'};
|
||||
$line{active} = $suppliers[$i]->{'active'};
|
||||
my @loop_basket;
|
||||
for (my $i2=0;$i2<$ordcount;$i2++){
|
||||
my %inner_line;
|
||||
$inner_line{basketno} =$orders->[$i2]->{'basketno'};
|
||||
$inner_line{total} =$orders->[$i2]->{'count(*)'};
|
||||
$inner_line{authorisedby} = $orders->[$i2]->{'authorisedby'};
|
||||
$inner_line{creationdate} = format_date($orders->[$i2]->{'creationdate'});
|
||||
$inner_line{closedate} = format_date($orders->[$i2]->{'closedate'});
|
||||
push @loop_basket, \%inner_line;
|
||||
my $loop_basket = [];
|
||||
for my $ord ( @{$orders} ) {
|
||||
push @{$loop_basket}, {
|
||||
basketno => $ord->{'basketno'},
|
||||
total => $ord->{'count(*)'},
|
||||
authorisedby => $ord->{'authorisedby'},
|
||||
creationdate => format_date($ord->{'creationdate'}),
|
||||
closedate => format_date($ord->{'closedate'}),
|
||||
};
|
||||
}
|
||||
$line{loop_basket} = \@loop_basket;
|
||||
push @loop_suppliers, \%line;
|
||||
push @{$loop_suppliers}, {
|
||||
loop_basket => $loop_basket,
|
||||
aqbooksellerid => $s->{'id'},
|
||||
name => $s->{'name'},
|
||||
active => $s->{'active'},
|
||||
};
|
||||
}
|
||||
$template->param(loop_suppliers => \@loop_suppliers,
|
||||
|
||||
$template->param(loop_suppliers => $loop_suppliers,
|
||||
supplier => $supplier,
|
||||
count => $count);
|
||||
count => scalar @suppliers);
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Output;
|
||||
|
|
@ -53,18 +54,18 @@ my $totspent = 0;
|
|||
my $totcomtd = 0;
|
||||
my $totavail = 0;
|
||||
my @loop_budget = ();
|
||||
for ( my $i = 0 ; $i < $count ; $i++ ) {
|
||||
for my $r (@results) {
|
||||
my ( $spent, $comtd ) =
|
||||
GetBookFundBreakdown( $results[$i]->{'bookfundid'} );
|
||||
my $avail = $results[$i]->{'budgetamount'} - ( $spent + $comtd );
|
||||
GetBookFundBreakdown( $r->{'bookfundid'} );
|
||||
my $avail = $r->{'budgetamount'} - ( $spent + $comtd );
|
||||
my %line;
|
||||
$line{bookfundname} = $results[$i]->{'bookfundname'};
|
||||
$line{budgetamount} = $results[$i]->{'budgetamount'};
|
||||
$line{bookfundname} = $r->{'bookfundname'};
|
||||
$line{budgetamount} = $r->{'budgetamount'};
|
||||
$line{spent} = sprintf( "%.2f", $spent );
|
||||
$line{comtd} = sprintf( "%.2f", $comtd );
|
||||
$line{avail} = sprintf( "%.2f", $avail );
|
||||
push @loop_budget, \%line;
|
||||
$total += $results[$i]->{'budgetamount'};
|
||||
$total += $r->{'budgetamount'};
|
||||
$totspent += $spent;
|
||||
$totcomtd += $comtd;
|
||||
$totavail += $avail;
|
||||
|
|
@ -72,20 +73,19 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
|
|||
|
||||
#currencies
|
||||
my @rates = GetCurrencies();
|
||||
$count = scalar @rates;
|
||||
|
||||
my @loop_currency = ();
|
||||
for ( my $i = 0 ; $i < $count ; $i++ ) {
|
||||
my %line;
|
||||
$line{currency} = $rates[$i]->{'currency'};
|
||||
$line{rate} = $rates[$i]->{'rate'};
|
||||
push @loop_currency, \%line;
|
||||
my $loop_currency = [];
|
||||
for my $r (@rates) {
|
||||
push @{$loop_currency}, {
|
||||
currency => $r->{'currency'},
|
||||
rate => $r->{'rate'},
|
||||
};
|
||||
}
|
||||
$template->param(
|
||||
classlist => $classlist,
|
||||
type => 'intranet',
|
||||
loop_budget => \@loop_budget,
|
||||
loop_currency => \@loop_currency,
|
||||
loop_currency => $loop_currency,
|
||||
total => sprintf( "%.2f", $total ),
|
||||
totspent => sprintf( "%.2f", $totspent ),
|
||||
totcomtd => sprintf( "%.2f", $totcomtd ),
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ The date to filter on.
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Serials; # GetExpirationDate
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Serials;
|
||||
|
|
@ -44,7 +45,10 @@ foreach (keys %$letters){
|
|||
}
|
||||
|
||||
my $letter=((scalar(@letters)>1) || ($letters[0]->{name}||$letters[0]->{code}));
|
||||
my ($count2, @missingissues) = GetLateOrMissingIssues($supplierid,$serialid,$order) if $supplierid;
|
||||
my ($count2, @missingissues);
|
||||
if ($supplierid) {
|
||||
($count2, @missingissues) = GetLateOrMissingIssues($supplierid,$serialid,$order);
|
||||
}
|
||||
|
||||
my $CGIsupplier=CGI::scrolling_list( -name => 'supplierid',
|
||||
-id => 'supplierid',
|
||||
|
|
@ -58,13 +62,13 @@ my ($singlesupplier,@supplierinfo);
|
|||
if($supplierid){
|
||||
(@supplierinfo)=GetBookSeller($supplierid);
|
||||
} else { # set up supplierid for the claim links out of main table if all suppliers is chosen
|
||||
for(my $i=0; $i<@missingissues;$i++){
|
||||
$missingissues[$i]->{'supplierid'} = getsupplierbyserialid($missingissues[$i]->{'serialid'});
|
||||
for my $mi (@missingissues){
|
||||
$mi->{supplierid} = getsupplierbyserialid($mi->{serialid});
|
||||
}
|
||||
}
|
||||
|
||||
my $preview=0;
|
||||
if($op eq 'preview'){
|
||||
if($op && $op eq 'preview'){
|
||||
$preview = 1;
|
||||
} else {
|
||||
my @serialnums=$input->param('serialid');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Serials;
|
||||
|
|
@ -28,7 +29,7 @@ my $csv = Text::CSV_XS->new(
|
|||
my $query = new CGI;
|
||||
my $supplierid = $query->param('supplierid');
|
||||
my @serialid = $query->param('serialid');
|
||||
my $op = $query->param('op');
|
||||
my $op = $query->param('op') || q{};
|
||||
my $serialidcount = @serialid;
|
||||
|
||||
my %supplierlist = GetSuppliersWithLateIssues;
|
||||
|
|
@ -38,13 +39,9 @@ my @loop1;
|
|||
my ($count, @lateissues);
|
||||
if($op ne 'claims'){
|
||||
($count, @lateissues) = GetLateIssues($supplierid);
|
||||
for (my $i=0;$i<@lateissues;$i++){
|
||||
my @rows1 = ($lateissues[$i]->{'name'}, # lets build up a row
|
||||
$lateissues[$i]->{'title'},
|
||||
$lateissues[$i]->{'serialseq'},
|
||||
$lateissues[$i]->{'planneddate'},
|
||||
);
|
||||
push (@loop1, \@rows1);
|
||||
for my $issue (@lateissues){
|
||||
push @loop1,
|
||||
[ $issue->{'name'}, $issue->{'title'}, $issue->{'serialseq'}, $issue->{'planneddate'},];
|
||||
}
|
||||
}
|
||||
my $totalcount2 = 0;
|
||||
|
|
@ -55,7 +52,7 @@ for (my $k=0;$k<@serialid;$k++){
|
|||
|
||||
for (my $j=0;$j<@missingissues;$j++){
|
||||
my @rows2 = ($missingissues[$j]->{'name'}, # lets build up a row
|
||||
$missingissues[$j]->{'title'},
|
||||
$missingissues[$j]->{'title'},
|
||||
$missingissues[$j]->{'serialseq'},
|
||||
$missingissues[$j]->{'planneddate'},
|
||||
);
|
||||
|
|
@ -72,7 +69,7 @@ if($supplierid){
|
|||
if($missingissues[0]->{'name'}){ # if exists display supplier name in heading for neatness
|
||||
# not necessarily needed as the name will appear in supplier column also
|
||||
$heading = "FOR $missingissues[0]->{'name'}";
|
||||
$filename = "_$missingissues[0]->{'name'}";
|
||||
$filename = "_$missingissues[0]->{'name'}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +83,7 @@ if($op ne 'claims'){
|
|||
print "SUPPLIER,TITLE,ISSUE NUMBER,LATE SINCE\n";
|
||||
|
||||
for my $row ( @loop1 ) {
|
||||
|
||||
|
||||
$csv->combine(@$row);
|
||||
my $string = $csv->string;
|
||||
print $string, "\n";
|
||||
|
|
@ -102,7 +99,7 @@ if($serialidcount == 1){
|
|||
print "SUPPLIER,TITLE,ISSUE NUMBER,LATE SINCE\n";
|
||||
|
||||
for my $row ( @loop2 ) {
|
||||
|
||||
|
||||
$csv->combine(@$row);
|
||||
my $string = $csv->string;
|
||||
print $string, "\n";
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@
|
|||
=head1 member-search.pl
|
||||
|
||||
Member Search.pl script used to search for members to add to a routing list
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth; # get_template_and_user
|
||||
use C4::Output;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
# lets one print out routing slip and create (in this instance) the heirarchy
|
||||
# of reserves for the serial
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Koha;
|
||||
use C4::Auth;
|
||||
|
|
@ -31,14 +32,14 @@ my $dbh = C4::Context->dbh;
|
|||
if($delete){
|
||||
delroutingmember($routingid,$subscriptionid);
|
||||
my $sth = $dbh->prepare("UPDATE serial SET routingnotes = NULL WHERE subscriptionid = ?");
|
||||
$sth->execute($subscriptionid);
|
||||
print $query->redirect("routing.pl?subscriptionid=$subscriptionid&op=new");
|
||||
$sth->execute($subscriptionid);
|
||||
print $query->redirect("routing.pl?subscriptionid=$subscriptionid&op=new");
|
||||
}
|
||||
|
||||
if($edit){
|
||||
print $query->redirect("routing.pl?subscriptionid=$subscriptionid");
|
||||
}
|
||||
|
||||
|
||||
my ($routing, @routinglist) = getroutinglist($subscriptionid);
|
||||
my $subs = GetSubscription($subscriptionid);
|
||||
my ($count,@serials) = GetSerials($subscriptionid);
|
||||
|
|
@ -47,7 +48,7 @@ my ($template, $loggedinuser, $cookie);
|
|||
if($ok){
|
||||
# get biblio information....
|
||||
my $biblio = $subs->{'biblionumber'};
|
||||
|
||||
|
||||
# get existing reserves .....
|
||||
my ($count,$reserves) = GetReservesFromBiblionumber($biblio);
|
||||
my $totalcount = $count;
|
||||
|
|
@ -74,8 +75,8 @@ if($ok){
|
|||
AddReserve($branch,$routinglist[$i]->{'borrowernumber'},$biblio,$const,\@bibitems,$routinglist[$i]->{'ranking'},'',$notes,$title);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "serials/routing-preview-slip.tmpl",
|
||||
query => $query,
|
||||
|
|
@ -94,9 +95,8 @@ if($ok){
|
|||
flagsrequired => {serials => 1},
|
||||
debug => 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
# my $firstdate = "$serials[0]->{'serialseq'} ($serials[0]->{'planneddate'})";
|
||||
my @results;
|
||||
my $data;
|
||||
for(my $i=0;$i<$routing;$i++){
|
||||
|
|
@ -110,13 +110,13 @@ for(my $i=0;$i<$routing;$i++){
|
|||
|
||||
my $routingnotes = $serials[0]->{'routingnotes'};
|
||||
$routingnotes =~ s/\n/\<br \/\>/g;
|
||||
|
||||
|
||||
$template->param(
|
||||
title => $subs->{'bibliotitle'},
|
||||
issue => $issue,
|
||||
issue_escaped => URI::Escape::uri_escape($issue),
|
||||
subscriptionid => $subscriptionid,
|
||||
memberloop => \@results,
|
||||
memberloop => \@results,
|
||||
routingnotes => $routingnotes,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ printed out
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Koha;
|
||||
use C4::Auth;
|
||||
|
|
@ -46,7 +47,7 @@ my $serialseq = $query->param('serialseq');
|
|||
my $routingid = $query->param('routingid');
|
||||
my $borrowernumber = $query->param('borrowernumber');
|
||||
my $notes = $query->param('notes');
|
||||
my $op = $query->param('op');
|
||||
my $op = $query->param('op') || q{};
|
||||
my $date_selected = $query->param('date_selected');
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
|
|
@ -63,7 +64,7 @@ if($op eq 'save'){
|
|||
my $urldate = URI::Escape::uri_escape($date_selected);
|
||||
print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$urldate");
|
||||
}
|
||||
|
||||
|
||||
my ($routing, @routinglist) = getroutinglist($subscriptionid);
|
||||
my $subs = GetSubscription($subscriptionid);
|
||||
my ($count,@serials) = GetSerials($subscriptionid);
|
||||
|
|
@ -104,26 +105,38 @@ my ($template, $loggedinuser, $cookie)
|
|||
# }
|
||||
|
||||
# my $issue = "$serialseq ($date)";
|
||||
|
||||
|
||||
my @results;
|
||||
my $data;
|
||||
for(my $i=0;$i<$routing;$i++){
|
||||
$data=GetMember($routinglist[$i]->{'borrowernumber'},'borrowernumber');
|
||||
$data->{'location'}=$data->{'branchcode'};
|
||||
$data->{'name'}="$data->{'firstname'} $data->{'surname'}";
|
||||
if ($data->{firstname} ) {
|
||||
$data->{name} = $data->{firstname} . q| |;
|
||||
}
|
||||
else {
|
||||
$data->{name} = q{};
|
||||
}
|
||||
if ($data->{surname} ) {
|
||||
$data->{name} .= $data->{surname};
|
||||
}
|
||||
$data->{'routingid'}=$routinglist[$i]->{'routingid'};
|
||||
$data->{'subscriptionid'}=$subscriptionid;
|
||||
my $rankingbox = '<select name="itemrank" onchange="reorder_item('.$subscriptionid.','.$routinglist[$i]->{'routingid'}.',this.options[this.selectedIndex].value)">';
|
||||
if (! $routinglist[$i]->{routingid} ) {
|
||||
$routinglist[$i]->{routingid} = q||;
|
||||
}
|
||||
my $rankingbox = '<select name="itemrank" onchange="reorder_item('
|
||||
. $subscriptionid . ',' .$routinglist[$i]->{'routingid'} . ',this.options[this.selectedIndex].value)">';
|
||||
for(my $j=1; $j <= $routing; $j++) {
|
||||
$rankingbox .= "<option ";
|
||||
if($routinglist[$i]->{'ranking'} == $j){
|
||||
if($routinglist[$i]->{ranking} && $routinglist[$i]->{ranking} == $j){
|
||||
$rankingbox .= " selected=\"selected\"";
|
||||
}
|
||||
$rankingbox .= " value=\"$j\">$j</option>";
|
||||
}
|
||||
$rankingbox .= "</select>";
|
||||
$data->{'routingbox'} = $rankingbox;
|
||||
|
||||
|
||||
push(@results, $data);
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +152,7 @@ if ($op eq 'new') {
|
|||
$template->param(
|
||||
title => $subs->{'bibliotitle'},
|
||||
subscriptionid => $subscriptionid,
|
||||
memberloop => \@results,
|
||||
memberloop => \@results,
|
||||
op => $new,
|
||||
dates => \@dates,
|
||||
routingnotes => $serials[0]->{'routingnotes'},
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ the biblionumber this script has to give more infos.
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Koha;
|
||||
|
|
@ -57,7 +58,6 @@ my $selectview = $query->param('selectview');
|
|||
$selectview = C4::Context->preference("SubscriptionHistory") unless $selectview;
|
||||
|
||||
my $sth;
|
||||
# my $id;
|
||||
my ($template, $loggedinuser, $cookie);
|
||||
my $biblionumber = $query->param('biblionumber');
|
||||
if ($selectview eq "full"){
|
||||
|
|
@ -75,10 +75,10 @@ if ($selectview eq "full"){
|
|||
flagsrequired => {serials => 1},
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
|
||||
# replace CR by <br> in librarian note
|
||||
# $subscription->{opacnote} =~ s/\n/\<br\/\>/g;
|
||||
|
||||
|
||||
$template->param(
|
||||
biblionumber => $query->param('biblionumber'),
|
||||
years => $subscriptions,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Koha;
|
||||
|
|
@ -50,8 +51,9 @@ my @subscriptionid = $query->param('subscriptionid');
|
|||
my $subscriptiondescs ;
|
||||
my $subscriptions;
|
||||
|
||||
if($op eq "gennext" && @subscriptionid){
|
||||
my $subscriptionid = @subscriptionid[0];
|
||||
$op ||= q{};
|
||||
if($op eq 'gennext' && @subscriptionid){
|
||||
my $subscriptionid = $subscriptionid[0];
|
||||
my $subscription = GetSubscription($subscriptionid);
|
||||
|
||||
my $sth = $dbh->prepare("SELECT publisheddate, serialid, serialseq, planneddate
|
||||
|
|
@ -69,13 +71,13 @@ if($op eq "gennext" && @subscriptionid){
|
|||
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3,
|
||||
$newinnerloop1, $newinnerloop2, $newinnerloop3
|
||||
) = GetNextSeq($subscription);
|
||||
|
||||
|
||||
## We generate the next publication date
|
||||
my $nextpublisheddate = GetNextDate( $expected->{planneddate}->output('iso'), $subscription );
|
||||
## Creating the new issue
|
||||
NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'},
|
||||
1, $nextpublisheddate, $nextpublisheddate );
|
||||
|
||||
|
||||
## Updating the subscription seq status
|
||||
my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
|
||||
WHERE subscriptionid = ?";
|
||||
|
|
@ -103,7 +105,7 @@ if (@subscriptionid){
|
|||
$subs->{ "status" . $subs->{'status'} } = 1;
|
||||
$subs->{startdate} = format_date( $subs->{startdate} );
|
||||
$subs->{histstartdate} = format_date( $subs->{histstartdate} );
|
||||
if ( $subs->{enddate} eq '0000-00-00' ) {
|
||||
if ( !defined $subs->{enddate} || $subs->{enddate} eq '0000-00-00' ) {
|
||||
$subs->{enddate} = '';
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ serials-recieve.pl
|
|||
|
||||
=item op
|
||||
op can be :
|
||||
* modsubscriptionhistory :to modify the subscription history
|
||||
* modsubscriptionhistory :to modify the subscription history
|
||||
* serialchangestatus :to modify the status of this subscription
|
||||
|
||||
=item subscriptionid
|
||||
|
|
@ -63,6 +63,7 @@ op can be :
|
|||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Dates qw/format_date format_date_in_iso/;
|
||||
|
|
@ -90,7 +91,6 @@ if (scalar(@subscriptionids)==1 && index($subscriptionids[0],",")>0){
|
|||
}
|
||||
my @errors;
|
||||
my @errseq;
|
||||
my $redirectstring;
|
||||
# If user comes from subscription details
|
||||
unless (@serialids){
|
||||
foreach my $subscriptionid (@subscriptionids){
|
||||
|
|
@ -107,7 +107,7 @@ unless (@serialids){
|
|||
unless (scalar(@serialids)){
|
||||
my $string="serials-collection.pl?subscriptionid=".join(",",@subscriptionids);
|
||||
$string=~s/,$//;
|
||||
# warn $string;
|
||||
# warn $string;
|
||||
print $query->redirect($string);
|
||||
}
|
||||
my ($template, $loggedinuser, $cookie)
|
||||
|
|
@ -130,7 +130,7 @@ foreach my $tmpserialid (@serialids){
|
|||
$data->{planneddate}=format_date($data->{planneddate});
|
||||
$data->{'editdisable'}=((HasSubscriptionExpired($data->{subscriptionid})&& $data->{'status1'})||$data->{'cannotedit'});
|
||||
push @serialdatalist,$data;
|
||||
$processedserialid{$tmpserialid}=1;
|
||||
$processedserialid{$tmpserialid}=1;
|
||||
}
|
||||
my $bibdata=GetBiblioData($serialdatalist[0]->{'biblionumber'});
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ foreach my $subscriptionid (@subscriptionids){
|
|||
next unless (defined($subscriptionid) && !$processedsubscriptionid{$subscriptionid});
|
||||
my $cell;
|
||||
if ($serialdatalist[0]->{'serialsadditems'}){
|
||||
#Create New empty item
|
||||
#Create New empty item
|
||||
$cell =
|
||||
PrepareItemrecordDisplay( $serialdatalist[0]->{'biblionumber'},'', GetSubscription($subscriptionid));
|
||||
$cell->{serialsadditems} = 1;
|
||||
|
|
@ -157,12 +157,12 @@ foreach my $subscriptionid (@subscriptionids){
|
|||
'abouttoexpire'=>abouttoexpire($subscriptionid),
|
||||
'subscriptionexpired'=>HasSubscriptionExpired($subscriptionid),
|
||||
};
|
||||
$processedsubscriptionid{$subscriptionid}=1;
|
||||
$processedsubscriptionid{$subscriptionid}=1;
|
||||
}
|
||||
$template->param(newserialloop=>\@newserialloop);
|
||||
$template->param(subscriptions=>\@subscriptionloop);
|
||||
|
||||
if ($op eq 'serialchangestatus') {
|
||||
if ($op and $op eq 'serialchangestatus') {
|
||||
# my $sth = $dbh->prepare("select status from serial where serialid=?");
|
||||
my $newserial;
|
||||
for (my $i=0;$i<=$#serialids;$i++) {
|
||||
|
|
@ -247,15 +247,18 @@ if ($op eq 'serialchangestatus') {
|
|||
}
|
||||
}
|
||||
# check for item barcode # being unique
|
||||
my $exists = GetItemnumberFromBarcode($record->subfield($barcodetagfield,$barcodetagsubfield)) if ($record->subfield($barcodetagfield,$barcodetagsubfield));
|
||||
# push @errors,"barcode_not_unique" if($exists);
|
||||
my $exists;
|
||||
if ($record->subfield($barcodetagfield,$barcodetagsubfield)) {
|
||||
$exists = GetItemnumberFromBarcode($record->subfield($barcodetagfield,$barcodetagsubfield));
|
||||
}
|
||||
# push @errors,"barcode_not_unique" if($exists);
|
||||
# if barcode exists, don't create, but report The problem.
|
||||
if ($exists){
|
||||
push @errors,"barcode_not_unique" if($exists);
|
||||
push @errseq,{"serialseq"=>$serialseqs[$index]};
|
||||
if ($exists){
|
||||
push @errors,"barcode_not_unique" if($exists);
|
||||
push @errseq,{"serialseq"=>$serialseqs[$index]};
|
||||
} else {
|
||||
my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$itemhash{$item}->{'bibnum'});
|
||||
AddItem2Serial($itemhash{$item}->{'serial'},$itemnumber);
|
||||
my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$itemhash{$item}->{'bibnum'});
|
||||
AddItem2Serial($itemhash{$item}->{'serial'},$itemnumber);
|
||||
}
|
||||
} else {
|
||||
#modify item
|
||||
|
|
@ -264,7 +267,7 @@ if ($op eq 'serialchangestatus') {
|
|||
}
|
||||
}
|
||||
}
|
||||
# ### FIXME this part of code is not very pretty. Nor is it very efficient... There MUST be a more perlish way to write it. But it works.
|
||||
# ### FIXME this part of code is not very pretty. Nor is it very efficient... There MUST be a more perlish way to write it. But it works.
|
||||
# my $redirect ="serials-home.pl?";
|
||||
# $redirect.=join("&",map{"serialseq=".$_} @serialseqs);
|
||||
# $redirect.="&".join("&",map{"planneddate=".$_} @planneddates);
|
||||
|
|
@ -276,9 +279,9 @@ if ($op eq 'serialchangestatus') {
|
|||
$template->param("Errors" => 1);
|
||||
if (scalar(@errseq)>0){
|
||||
$template->param("barcode_not_unique" => 1);
|
||||
$template->param('errseq'=>\@errseq);
|
||||
}
|
||||
} else {
|
||||
$template->param('errseq'=>\@errseq);
|
||||
}
|
||||
} else {
|
||||
my $redirect ="serials-collection.pl?";
|
||||
my %hashsubscription;
|
||||
foreach (@subscriptionids) {
|
||||
|
|
@ -286,7 +289,7 @@ if ($op eq 'serialchangestatus') {
|
|||
}
|
||||
$redirect.=join("&",map{"subscriptionid=".$_} sort keys %hashsubscription);
|
||||
print $query->redirect("$redirect");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$template->param(
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ this script is the main page for serials/
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Serials;
|
||||
|
|
@ -79,14 +80,14 @@ if (@serialseqs){
|
|||
### FIXME This limitation that a serial must be given a title may not be very efficient for some library who do not update serials titles.
|
||||
push @information,
|
||||
{ serialseq=>$seq,
|
||||
publisheddate=>$publisheddates[$index],
|
||||
planneddate=>$planneddates[$index],
|
||||
notes=>$notes[$index],
|
||||
publisheddate=>$publisheddates[$index],
|
||||
planneddate=>$planneddates[$index],
|
||||
notes=>$notes[$index],
|
||||
status=>$status[$index]
|
||||
}
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$template->param('information'=>\@information);
|
||||
}
|
||||
my @subscriptions;
|
||||
|
|
@ -96,10 +97,8 @@ if ($searched){
|
|||
|
||||
# to toggle between create or edit routing list options
|
||||
if ($routing) {
|
||||
for ( my $i = 0 ; $i < @subscriptions ; $i++ ) {
|
||||
my $checkrouting =
|
||||
check_routing( $subscriptions[$i]->{'subscriptionid'} );
|
||||
$subscriptions[$i]->{'routingedit'} = $checkrouting;
|
||||
for my $subscription ( @subscriptions) {
|
||||
$subscription->{routingedit} = check_routing( $subscription->{subscriptionid} );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ my ($subscriptionid,$auser,$branchcode,$librarian,$cost,$aqbooksellerid, $aqbook
|
|||
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
|
||||
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
|
||||
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
|
||||
$numberingmethod, $status, $biblionumber,
|
||||
$numberingmethod, $status, $biblionumber,
|
||||
$bibliotitle, $callnumber, $notes, $hemisphere, $letter, $manualhistory,$serialsadditems, $location);
|
||||
|
||||
my @budgets;
|
||||
|
|
@ -59,7 +59,7 @@ my ($template, $loggedinuser, $cookie)
|
|||
my $sub_on;
|
||||
my @subscription_types = (
|
||||
'issues', 'weeks', 'months'
|
||||
);
|
||||
);
|
||||
my @sub_type_data;
|
||||
|
||||
my $subs;
|
||||
|
|
@ -74,7 +74,7 @@ if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
|
|||
if ($subs->{'cannotedit'} && $op eq 'mod'){
|
||||
warn "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
|
||||
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
|
||||
}
|
||||
}
|
||||
$firstissuedate = $subs->{firstacquidate}; # in iso format.
|
||||
for (qw(startdate firstacquidate histstartdate enddate histenddate)) {
|
||||
next unless defined $subs->{$_};
|
||||
|
|
@ -82,7 +82,7 @@ if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
|
|||
if ($subs->{$_} eq '0000-00-00') {
|
||||
$subs->{$_} = ''
|
||||
} else {
|
||||
$subs->{$_} = format_date($subs->{$_});
|
||||
$subs->{$_} = format_date($subs->{$_});
|
||||
}
|
||||
}
|
||||
$subs->{'letter'}='' unless($subs->{'letter'});
|
||||
|
|
@ -100,7 +100,7 @@ if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
|
|||
last;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$template->param($subs);
|
||||
$template->param("dow".$subs->{'dow'} => 1) if defined $subs->{'dow'};
|
||||
$template->param(
|
||||
|
|
@ -115,9 +115,9 @@ if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
|
|||
}
|
||||
}
|
||||
|
||||
my $onlymine=C4::Context->preference('IndependantBranches') &&
|
||||
C4::Context->userenv &&
|
||||
C4::Context->userenv->{flags} % 2 !=1 &&
|
||||
my $onlymine=C4::Context->preference('IndependantBranches') &&
|
||||
C4::Context->userenv &&
|
||||
C4::Context->userenv->{flags} % 2 !=1 &&
|
||||
C4::Context->userenv->{branch};
|
||||
my $branches = GetBranches($onlymine);
|
||||
my @branchloop;
|
||||
|
|
@ -144,9 +144,9 @@ if ($op eq 'addsubscription') {
|
|||
my $branchcode = $query->param('branchcode');
|
||||
my $aqbooksellerid = $query->param('aqbooksellerid');
|
||||
my $cost = $query->param('cost');
|
||||
my $aqbudgetid = $query->param('aqbudgetid');
|
||||
my $aqbudgetid = $query->param('aqbudgetid');
|
||||
my $startdate = $query->param('startdate');
|
||||
my $firstacquidate = $query->param('firstacquidate');
|
||||
my $firstacquidate = $query->param('firstacquidate');
|
||||
my $periodicity = $query->param('periodicity');
|
||||
my $dow = $query->param('dow');
|
||||
my @irregularity = $query->param('irregularity_select');
|
||||
|
|
@ -281,7 +281,7 @@ if ($op eq 'addsubscription') {
|
|||
# if we have not received any issues yet, then we also must change the firstacquidate for the subs.
|
||||
$firstissuedate = $nextacquidate if($nextexpected->{isfirstissue});
|
||||
}
|
||||
|
||||
|
||||
if ($history_only) {
|
||||
ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
|
||||
} else {
|
||||
|
|
@ -311,7 +311,7 @@ if ($op eq 'addsubscription') {
|
|||
$row{'selected'} = '';
|
||||
}
|
||||
push( @sub_type_data, \%row );
|
||||
}
|
||||
}
|
||||
$template->param(subtype => \@sub_type_data,
|
||||
);
|
||||
|
||||
|
|
@ -339,5 +339,5 @@ sub letter_loop {
|
|||
};
|
||||
}
|
||||
$template->param(letterloop => \@letterloop) if @letterloop;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ to multipage gestion.
|
|||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use CGI;
|
||||
use C4::Koha;
|
||||
|
|
@ -77,7 +78,7 @@ if ($op eq "do_search" && $query) {
|
|||
my $index = C4::Context->preference("item-level_itypes") ? 'itype' : 'itemtype';
|
||||
$query .= " AND $index=$itemtypelimit";
|
||||
}
|
||||
|
||||
|
||||
$resultsperpage= $input->param('resultsperpage');
|
||||
$resultsperpage = 20 if(!defined $resultsperpage);
|
||||
|
||||
|
|
@ -91,7 +92,7 @@ if ($op eq "do_search" && $query) {
|
|||
exit;
|
||||
}
|
||||
my @results;
|
||||
|
||||
|
||||
for(my $i=0;$i<$total;$i++) {
|
||||
my %resultsloop;
|
||||
my $marcrecord = MARC::File::USMARC::decode($marcrecords->[$i]);
|
||||
|
|
@ -108,7 +109,7 @@ if ($op eq "do_search" && $query) {
|
|||
|
||||
push @results, \%resultsloop;
|
||||
}
|
||||
|
||||
|
||||
($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "serials/result.tmpl",
|
||||
query => $input,
|
||||
|
|
@ -144,7 +145,7 @@ if ($op eq "do_search" && $query) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $from = 0;
|
||||
$from = $startfrom*$resultsperpage+1 if($total_hits > 0);
|
||||
my $to;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
# Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Koha;
|
||||
|
|
@ -24,25 +25,23 @@ use C4::Serials;
|
|||
use C4::Output;
|
||||
use C4::Context;
|
||||
use Date::Calc qw/Today Day_of_Year Week_of_Year Add_Delta_Days/;
|
||||
#use Date::Manip;
|
||||
use Carp;
|
||||
|
||||
my $query = new CGI;
|
||||
my $op = $query->param('op');
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth;
|
||||
# my $id;
|
||||
my ($template, $loggedinuser, $cookie, $hemisphere);
|
||||
my $subscriptionid = $query->param('subscriptionid');
|
||||
my $subs = &GetSubscription($subscriptionid);
|
||||
my $subs = GetSubscription($subscriptionid);
|
||||
|
||||
$subs->{enddate} = GetExpirationDate($subscriptionid);
|
||||
|
||||
if ($op eq 'del') {
|
||||
if ($op && $op eq 'del') {
|
||||
if ($subs->{'cannotedit'}){
|
||||
warn "Attempt to delete subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
|
||||
carp "Attempt to delete subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
|
||||
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
|
||||
}
|
||||
&DelSubscription($subscriptionid);
|
||||
}
|
||||
DelSubscription($subscriptionid);
|
||||
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=serials-home.pl\"></html>";
|
||||
exit;
|
||||
}
|
||||
|
|
@ -75,24 +74,34 @@ $subs->{abouttoexpire} = abouttoexpire($subs->{subscriptionid});
|
|||
|
||||
$template->param($subs);
|
||||
$template->param(biblionumber_for_new_subscription => $subs->{bibnum});
|
||||
my @irregular_issues = split /,/, $subs->{irregularity};
|
||||
|
||||
if (! $subs->{numberpattern}) {
|
||||
$subs->{numberpattern} = q{};
|
||||
}
|
||||
if (! $subs->{dow}) {
|
||||
$subs->{dow} = q{};
|
||||
}
|
||||
if (! $subs->{periodicity}) {
|
||||
$subs->{periodicity} = '0';
|
||||
}
|
||||
$template->param(
|
||||
subscriptionid => $subscriptionid,
|
||||
routing => $routing,
|
||||
serialslist => \@serialslist,
|
||||
totalissues => $totalissues,
|
||||
hemisphere => $hemisphere,
|
||||
cannotedit =>(C4::Context->preference('IndependantBranches') &&
|
||||
C4::Context->userenv &&
|
||||
C4::Context->userenv->{flags} % 2 !=1 &&
|
||||
cannotedit =>(C4::Context->preference('IndependantBranches') &&
|
||||
C4::Context->userenv &&
|
||||
C4::Context->userenv->{flags} % 2 !=1 &&
|
||||
C4::Context->userenv->{branch} && $subs->{branchcode} &&
|
||||
(C4::Context->userenv->{branch} ne $subs->{branchcode})),
|
||||
"periodicity".($subs->{periodicity}?$subs->{periodicity}:'0') => 1,
|
||||
"arrival".$subs->{dow} => 1,
|
||||
"numberpattern".$subs->{numberpattern} => 1,
|
||||
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
|
||||
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
|
||||
irregular_issues => scalar(split(/,/,$subs->{irregularity})),
|
||||
'periodicity' . $subs->{periodicity} => 1,
|
||||
'arrival' . $subs->{dow} => 1,
|
||||
'numberpattern' . $subs->{numberpattern} => 1,
|
||||
intranetstylesheet => C4::Context->preference('intranetstylesheet'),
|
||||
intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
|
||||
irregular_issues => scalar @irregular_issues,
|
||||
);
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/perl
|
||||
# WARNING: 4-character tab stops here
|
||||
|
||||
# Copyright 2000-2002 Katipo Communications
|
||||
#
|
||||
|
|
@ -45,6 +44,7 @@ Id of the subscription this script has to renew
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use CGI;
|
||||
use C4::Koha;
|
||||
|
|
@ -79,14 +79,14 @@ if ( $op eq "renew" ) {
|
|||
$query->param('startdate'), $query->param('numberlength'),
|
||||
$query->param('weeklength'), $query->param('monthlength'),
|
||||
$query->param('note')
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
my $subscription = GetSubscription($subscriptionid);
|
||||
if ($subscription->{'cannotedit'}){
|
||||
warn "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
|
||||
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
|
||||
}
|
||||
}
|
||||
|
||||
$template->param(
|
||||
startdate => format_date(
|
||||
|
|
@ -99,12 +99,8 @@ $template->param(
|
|||
subscriptionid => $subscriptionid,
|
||||
bibliotitle => $subscription->{bibliotitle},
|
||||
$op => 1,
|
||||
popup => ($query->param('mode')eq "popup"),
|
||||
popup => ($query->param('mode')eq "popup"),
|
||||
);
|
||||
|
||||
# Print the page
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 4
|
||||
# End:
|
||||
|
|
|
|||
Loading…
Reference in New Issue