opac subdir - Dates.pm integration and warnings fixes.
Signed-off-by: Chris Cormack <crc@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
63dd9232e8
commit
093e3f5215
|
|
@ -24,7 +24,7 @@ use C4::Members;
|
|||
use C4::Circulation;
|
||||
use C4::Auth;
|
||||
use C4::Output;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
|
||||
my $query = new CGI;
|
||||
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
||||
|
|
@ -40,7 +40,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
|||
|
||||
# get borrower information ....
|
||||
my $borr = GetMemberDetails( $borrowernumber );
|
||||
|
||||
my @bordat;
|
||||
$bordat[0] = $borr;
|
||||
|
||||
|
|
@ -63,7 +62,7 @@ for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
|
|||
if ( $accts->[$i]{'accounttype'} ne 'F'
|
||||
&& $accts->[$i]{'accounttype'} ne 'FU' )
|
||||
{
|
||||
$accts->[$i]{'print_title'};
|
||||
$accts->[$i]{'print_title'}; # FIXME: Useless use of hash element in void context
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
use strict;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
use C4::Output;
|
||||
use C4::Context;
|
||||
use C4::Koha;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use CGI;
|
|||
use C4::Biblio;
|
||||
use C4::Auth;
|
||||
use C4::Output;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
|
||||
my $query = new CGI;
|
||||
my $type = $query->param('type');
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use C4::Auth;
|
|||
use C4::Koha;
|
||||
use C4::Circulation;
|
||||
use C4::Members;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
|
||||
my $query = new CGI;
|
||||
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ my $query=new CGI;
|
|||
|
||||
my $sessionID=$query->cookie('sessionID');
|
||||
|
||||
|
||||
if ($ENV{'REMOTE_USER'}) {
|
||||
print $query->header();
|
||||
print startpage();
|
||||
|
|
@ -53,23 +52,26 @@ while (my ($sid, $u, $lasttime) = split(/:/, <S>)) {
|
|||
$sessions->{$sid}->{'userid'}=$u;
|
||||
$sessions->{$sid}->{'lasttime'}=$lasttime;
|
||||
}
|
||||
close S;
|
||||
open (S, ">/tmp/sessions");
|
||||
foreach (keys %$sessions) {
|
||||
my $userid=$sessions->{$_}->{'userid'};
|
||||
my $userid=$sessions->{$_}->{'userid'};
|
||||
my $lasttime=$sessions->{$_}->{'lasttime'};
|
||||
print S "$_:$userid:$lasttime\n";
|
||||
}
|
||||
close S;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
# Check that this is the ip that created the session before deleting it
|
||||
# This script and function are apparently unfinished. --atz (Dec 4 2007)
|
||||
my $session = get_session($sessionID);
|
||||
$session->flush;
|
||||
$session->delete;
|
||||
my $sth=$dbh->prepare("delete from sessions where sessionID=?");
|
||||
$sth->execute($sessionID);
|
||||
open L, ">>/tmp/sessionlog";
|
||||
my $time=localtime(time());
|
||||
printf L "%20s from %16s logged out at %30s (manual log out).\n", $userid, $ip, $time;
|
||||
printf L "%20s from %16s logged out at %30s (manual log out).\n", $userid, $ip, localtime;
|
||||
# where is $ip is coming from??
|
||||
close L;
|
||||
|
||||
my $cookie=$query->cookie(-name => 'sessionID',
|
||||
|
|
@ -77,10 +79,6 @@ my $cookie=$query->cookie(-name => 'sessionID',
|
|||
-expires => '+1y');
|
||||
|
||||
# Should redirect to opac home page after logging out
|
||||
|
||||
print $query->redirect("/cgi-bin/koha/opac-main.pl");
|
||||
|
||||
exit;
|
||||
#
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use CGI;
|
|||
use C4::Auth;
|
||||
use C4::Koha;
|
||||
use C4::Circulation;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
use C4::Members;
|
||||
|
||||
use C4::Output;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use C4::Koha;
|
|||
use C4::Circulation;
|
||||
use C4::Reserves;
|
||||
use C4::Output;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
use C4::Context;
|
||||
use C4::Members;
|
||||
use C4::Branch; # GetBranches
|
||||
|
|
|
|||
|
|
@ -362,20 +362,19 @@ my @operators;
|
|||
|
||||
# indexes are query qualifiers, like 'title', 'author', etc. They
|
||||
# can be single or multiple parameters separated by comma: kw,right-Truncation
|
||||
my @indexes;
|
||||
@indexes = split("\0",$params->{'idx'});
|
||||
my @indexes = split("\0",$params->{'idx'});
|
||||
|
||||
# if a simple index (only one) display the index used in the top search box
|
||||
if (@indexes[0] && !@indexes[1]) {
|
||||
$template->param("ms_".@indexes[0] => 1);
|
||||
if ($indexes[0] && !$indexes[1]) {
|
||||
$template->param("ms_".$indexes[0] => 1);
|
||||
}
|
||||
# an operand can be a single term, a phrase, or a complete ccl query
|
||||
my @operands;
|
||||
@operands = split("\0",$params->{'q'}) if $params->{'q'};
|
||||
|
||||
# if a simple search, display the value in the search box
|
||||
if (@operands[0] && !@operands[1]) {
|
||||
$template->param(ms_value => @operands[0]);
|
||||
if ($operands[0] && !$operands[1]) {
|
||||
$template->param(ms_value => $operands[0]);
|
||||
}
|
||||
|
||||
# limits are use to limit to results to a pre-defined category such as branch or language
|
||||
|
|
@ -408,35 +407,31 @@ my $hits;
|
|||
my $expanded_facet = $params->{'expand'};
|
||||
|
||||
# Define some global variables
|
||||
my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
|
||||
my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
|
||||
|
||||
my @results;
|
||||
|
||||
## I. BUILD THE QUERY
|
||||
( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by);
|
||||
|
||||
## parse the query_cgi string and put it into a form suitable for <input>s
|
||||
my @query_inputs;
|
||||
for my $this_cgi ( split('&',$query_cgi) ) {
|
||||
next unless $this_cgi;
|
||||
$this_cgi =~ m/(.*=)(.*)/;
|
||||
my $input_name = $1;
|
||||
my $input_value = $2;
|
||||
$input_name =~ s/=$//;
|
||||
push @query_inputs, { input_name => $input_name, input_value => $input_value };
|
||||
sub _input_cgi_parse ($) {
|
||||
my @elements;
|
||||
for my $this_cgi ( split('&',shift) ) {
|
||||
next unless $this_cgi;
|
||||
$this_cgi =~ /(.*)=(.*)/;
|
||||
my $input_name = $1;
|
||||
my $input_value = $2;
|
||||
push @elements, { input_name => $input_name, input_value => $input_value };
|
||||
}
|
||||
return @elements;
|
||||
}
|
||||
|
||||
## parse the query_cgi string and put it into a form suitable for <input>s
|
||||
my @query_inputs = _input_cgi_parse($query_cgi);
|
||||
$template->param ( QUERY_INPUTS => \@query_inputs );
|
||||
|
||||
## parse the limit_cgi string and put it into a form suitable for <input>s
|
||||
my @limit_inputs;
|
||||
for my $this_cgi ( split('&',$limit_cgi) ) {
|
||||
next unless $this_cgi;
|
||||
$this_cgi =~ m/(.*=)(.*)/;
|
||||
my $input_name = $1;
|
||||
my $input_value = $2;
|
||||
$input_name =~ s/=$//;
|
||||
push @limit_inputs, { input_name => $input_name, input_value => $input_value };
|
||||
}
|
||||
my @limit_inputs = _input_cgi_parse($query_cgi);
|
||||
|
||||
# add OPAC 'hidelostitems'
|
||||
# not items with
|
||||
|
|
@ -467,7 +462,6 @@ if (C4::Context->preference('NoZebra')) {
|
|||
}
|
||||
if ($@ || $error) {
|
||||
$template->param(query_error => $error.$@);
|
||||
|
||||
output_html_with_http_headers $cgi, $cookie, $template->output;
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use strict;
|
|||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Koha;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
use C4::Serials;
|
||||
use C4::Letters;
|
||||
use C4::Output;
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ $template->param(do_it => 1,
|
|||
results_loop => \@results,
|
||||
);
|
||||
|
||||
# load the branches
|
||||
my $branches = GetBranches();
|
||||
# load the branches ## again??
|
||||
$branches = GetBranches();
|
||||
my @branch_loop;
|
||||
for my $branch_hash (sort keys %$branches ) {
|
||||
my $selected=(C4::Context->userenv && ($branch_hash eq C4::Context->userenv->{branch})) if (C4::Context->preference('SearchMyLibraryFirst'));
|
||||
|
|
@ -109,7 +109,7 @@ for my $branch_hash (sort keys %$branches ) {
|
|||
$template->param( branchloop => \@branch_loop, "mylibraryfirst"=>C4::Context->preference("SearchMyLibraryFirst"));
|
||||
|
||||
#doctype
|
||||
my $itemtypes = GetItemTypes;
|
||||
$itemtypes = GetItemTypes;
|
||||
my @itemtypeloop;
|
||||
foreach my $thisitemtype (keys %$itemtypes) {
|
||||
my %row =(value => $thisitemtype,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use C4::Reserves;
|
|||
use C4::Members;
|
||||
use C4::Output;
|
||||
use C4::Biblio;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
use C4::Letters;
|
||||
use C4::Branch; # GetBranches
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use C4::Koha;
|
|||
use C4::Circulation;
|
||||
|
||||
use C4::Output;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
use C4::Members;
|
||||
|
||||
my $query = new CGI;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use C4::Context;
|
|||
use C4::Koha;
|
||||
use C4::Circulation;
|
||||
use C4::Output;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
use C4::Members;
|
||||
|
||||
my $query = new CGI;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ use C4::Authsco;
|
|||
use C4::Output;
|
||||
use C4::Koha;
|
||||
use HTML::Template::Pro;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
|
||||
my $query=new CGI;
|
||||
#my ($loggedinuser, $sessioncookie, $sessionID) = checkauth
|
||||
|
|
@ -70,7 +70,7 @@ my $printer = getprinter($query, $printers);
|
|||
my $branchcookie;
|
||||
my $printercookie;
|
||||
if ($query->param('setcookies')) {
|
||||
$branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y');
|
||||
$branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y');
|
||||
$printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
|
||||
}
|
||||
|
||||
|
|
@ -91,9 +91,6 @@ my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf (
|
|||
|
||||
#$template->param(BORROWER_INFO => \@bordat);
|
||||
|
||||
|
||||
|
||||
|
||||
######################End code modified by christina Lee############################
|
||||
|
||||
my $message;
|
||||
|
|
@ -148,27 +145,23 @@ if (my $qnumber = $query->param('questionnumber')) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer);
|
||||
#Begin code edited by Christina Lee
|
||||
#my $barc = 123456789;
|
||||
my $barc = cuecatbarcodedecode($barcode);
|
||||
|
||||
|
||||
(my $year, my $month, my $day) = set_duedate($barc);
|
||||
#End code edited by Christina Lee
|
||||
|
||||
# if the barcode is set
|
||||
if ($barcode) {
|
||||
$barcode = cuecatbarcodedecode($barcode);
|
||||
|
||||
|
||||
|
||||
#note: edit code here --Christina Lee
|
||||
my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
|
||||
unless ($invalidduedate) {
|
||||
$env{'datedue'}=$datedue;
|
||||
my @time=localtime(time);
|
||||
my @time=localtime();
|
||||
my $date= (1900+$time[5])."-".($time[4]+1)."-".$time[3];
|
||||
($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer, $message)
|
||||
= issuebook(\%env, $borr, $barcode, \%responses, $date);
|
||||
|
|
@ -217,7 +210,7 @@ for (my $i=1; $i<32; $i++) {
|
|||
foreach (('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')) {
|
||||
my $selected='';
|
||||
if (($query->param('stickyduedate')) && ($month==$counter)) {
|
||||
$selected='selected';
|
||||
$selected='selected';
|
||||
}
|
||||
$monthoptions.="<option value=$counter $selected>$_";
|
||||
$counter++;
|
||||
|
|
@ -225,7 +218,7 @@ foreach (('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
|
|||
for (my $i=$datearr[5]+1900; $i<$datearr[5]+1905; $i++) {
|
||||
my $selected='';
|
||||
if (($query->param('stickyduedate')) && ($year==$i)) {
|
||||
$selected='selected';
|
||||
$selected='selected';
|
||||
}
|
||||
$yearoptions.="<option value=$i $selected>$i";
|
||||
}
|
||||
|
|
@ -263,8 +256,7 @@ if ($borr) {
|
|||
my $pcolor = '';
|
||||
my $od = '';
|
||||
foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} @todaysissues){
|
||||
my $dd = $book->{'date_due'};
|
||||
|
||||
my $dd = $book->{'date_due'};
|
||||
my $datedue = $book->{'date_due'};
|
||||
$dd=format_date($dd);
|
||||
$datedue=~s/-//g;
|
||||
|
|
@ -272,13 +264,13 @@ if ($borr) {
|
|||
$od = 'true';
|
||||
$dd="$dd\n";
|
||||
}
|
||||
($tcolor eq $linecolor1) ? ($tcolor=$linecolor2) : ($tcolor=$linecolor1);
|
||||
$tcolor = ($tcolor eq $linecolor1) ? $linecolor2 : $linecolor1;
|
||||
$book->{'od'}=$od;
|
||||
$book->{'dd'}=$dd;
|
||||
$book->{'tcolor'}=$tcolor;
|
||||
if ($book->{'author'} eq ''){
|
||||
$book->{'author'}=' ';
|
||||
}
|
||||
}
|
||||
push @realtodayissues,$book;
|
||||
}
|
||||
|
||||
|
|
@ -292,27 +284,25 @@ if ($borr) {
|
|||
# template
|
||||
|
||||
foreach my $book (sort {$a->{'date_due'} cmp $b->{'date_due'}} @previousissues){
|
||||
my $dd = $book->{'date_due'};
|
||||
|
||||
|
||||
my $datedue = $book->{'date_due'};
|
||||
$dd=format_date($dd);
|
||||
my $pcolor = '';
|
||||
my $od = '';
|
||||
$datedue=~s/-//g;
|
||||
if ($datedue < $todaysdate) {
|
||||
$od = 'true';
|
||||
$dd="$dd\n";
|
||||
my $dd = $book->{'date_due'};
|
||||
my $datedue = $book->{'date_due'};
|
||||
$dd=format_date($dd);
|
||||
my $pcolor = '';
|
||||
my $od = '';
|
||||
$datedue=~s/-//g;
|
||||
if ($datedue < $todaysdate) {
|
||||
$od = 'true';
|
||||
$dd="$dd\n";
|
||||
}
|
||||
$pcolor = ($pcolor eq $linecolor1) ? $linecolor2 : $linecolor1;
|
||||
$book->{'dd'}=$dd;
|
||||
$book->{'od'}=$od;
|
||||
$book->{'tcolor'}=$pcolor;
|
||||
if ($book->{'author'} eq ''){
|
||||
$book->{'author'}=' ';
|
||||
}
|
||||
push @realprevissues,$book
|
||||
}
|
||||
($pcolor eq $linecolor1) ? ($pcolor=$linecolor2) : ($pcolor=$linecolor1);
|
||||
$book->{'dd'}=$dd;
|
||||
$book->{'od'}=$od;
|
||||
$book->{'tcolor'}=$pcolor;
|
||||
if ($book->{'author'} eq ''){
|
||||
$book->{'author'}=' ';
|
||||
}
|
||||
push @realprevissues,$book
|
||||
}
|
||||
}
|
||||
|
||||
my @values;
|
||||
|
|
@ -371,11 +361,10 @@ $template->param(
|
|||
todayissues => \@realtodayissues,
|
||||
previssues => \@realprevissues,
|
||||
responseloop => \@responsearray,
|
||||
month=>$month,
|
||||
day=>$day,
|
||||
year=>$year
|
||||
|
||||
);
|
||||
month=>$month,
|
||||
day=>$day,
|
||||
year=>$year
|
||||
);
|
||||
|
||||
if ($branchcookie) {
|
||||
$cookie=[$cookie, $branchcookie, $printercookie];
|
||||
|
|
@ -392,19 +381,18 @@ sub cuecatbarcodedecode {
|
|||
my @fields = split(/\./,$barcode);
|
||||
my @results = map(decode($_), @fields[1..$#fields]);
|
||||
if ($#results == 2){
|
||||
return $results[2];
|
||||
return $results[2];
|
||||
} else {
|
||||
return $barcode;
|
||||
return $barcode;
|
||||
}
|
||||
}
|
||||
|
||||
sub fixdate {
|
||||
my ($year, $month, $day) = @_;
|
||||
my $invalidduedate;
|
||||
my $date;
|
||||
if (($year eq 0) && ($month eq 0) && ($year eq 0)) {
|
||||
$env{'datedue'}='';
|
||||
} else {
|
||||
$env{'datedue'}='';
|
||||
return(undef,undef);
|
||||
}
|
||||
|
||||
# FIXME - Can we set two flags here, one that says 'invalidduedate', so that
|
||||
# the template can check for it, and then one for a particular message?
|
||||
|
|
@ -412,20 +400,21 @@ sub fixdate {
|
|||
# Invalid Due Date Specified. Book was not issued. Never that many days
|
||||
# in February! </TMPL_IF> </TMPL_IF>
|
||||
|
||||
my ($date);
|
||||
my ($invalidduedate) = "Invalid Due Date Specified. Book was not issued. ";
|
||||
if (($year eq 0) || ($month eq 0) || ($year eq 0)) {
|
||||
$invalidduedate="Invalid Due Date Specified. Book was not issued.<p>\n";
|
||||
$invalidduedate .= "<p>\n";
|
||||
} else {
|
||||
if (($day>30) && (($month==4) || ($month==6) || ($month==9) || ($month==11))) {
|
||||
$invalidduedate = "Invalid Due Date Specified. Book was not issued. Only 30 days in $month month.<p>\n";
|
||||
$invalidduedate .= "Only 30 days in $month month.<p>\n";
|
||||
} elsif (($day > 29) && ($month == 2)) {
|
||||
$invalidduedate="Invalid Due Date Specified. Book was not issued. Never that many days in February!<p>\n";
|
||||
$invalidduedate .= "Never that many days in February!<p>\n";
|
||||
} elsif (($month == 2) && ($day > 28) && (($year%4) && ((!($year%100) || ($year%400))))) {
|
||||
$invalidduedate="Invalid Due Date Specified. Book was not issued. $year is not a leap year.<p>\n";
|
||||
$invalidduedate .= "$year is not a leap year.<p>\n";
|
||||
} else {
|
||||
$date="$year-$month-$day";
|
||||
$date="$year-$month-$day";
|
||||
}
|
||||
}
|
||||
}
|
||||
return ($date, $invalidduedate);
|
||||
}
|
||||
|
||||
|
|
@ -447,66 +436,51 @@ sub patrontable {
|
|||
$template->param(
|
||||
noissues => 'true',
|
||||
color => $color,
|
||||
);
|
||||
if ($flag eq 'GNA'){
|
||||
);
|
||||
if ($flag eq 'GNA' ){ $template->param( gna => 'true'); }
|
||||
if ($flag eq 'LOST' ){ $template->param( lost => 'true'); }
|
||||
if ($flag eq 'DBARRED'){ $template->param(dbarred => 'true'); }
|
||||
if ($flag eq 'CHARGES'){
|
||||
$template->param(
|
||||
gna => 'true'
|
||||
);
|
||||
}
|
||||
if ($flag eq 'LOST'){
|
||||
$template->param(
|
||||
lost => 'true'
|
||||
charges => 'true',
|
||||
chargesmsg => $flags->{'CHARGES'}->{'message'}
|
||||
);
|
||||
}
|
||||
if ($flag eq 'DBARRED'){
|
||||
$template->param(
|
||||
dbarred => 'true'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($flag eq 'CHARGES') {
|
||||
$template->param(
|
||||
charges => 'true',
|
||||
chargesmsg => $flags->{'CHARGES'}->{'message'}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ($flag eq 'CHARGES') {
|
||||
$template->param(
|
||||
charges => 'true',
|
||||
chargesmsg => $flags->{'CHARGES'}->{'message'}
|
||||
);
|
||||
}
|
||||
if ($flag eq 'WAITING') {
|
||||
if ($flag eq 'WAITING') {
|
||||
my $items=$flags->{$flag}->{'itemlist'};
|
||||
my @itemswaiting;
|
||||
foreach my $item (@$items) {
|
||||
my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
|
||||
$iteminformation->{'branchname'} = $branches->{$iteminformation->{'holdingbranch'}}->{'branchname'};
|
||||
push @itemswaiting, $iteminformation;
|
||||
my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
|
||||
$iteminformation->{'branchname'} = $branches->{$iteminformation->{'holdingbranch'}}->{'branchname'};
|
||||
push @itemswaiting, $iteminformation;
|
||||
}
|
||||
$template->param(
|
||||
waiting => 'true',
|
||||
waitingmsg => $flags->{'WAITING'}->{'message'},
|
||||
itemswaiting => \@itemswaiting,
|
||||
);
|
||||
);
|
||||
}
|
||||
if ($flag eq 'ODUES') {
|
||||
$template->param(
|
||||
odues => 'true',
|
||||
oduesmsg => $flags->{'ODUES'}->{'message'}
|
||||
);
|
||||
);
|
||||
|
||||
my $items=$flags->{$flag}->{'itemlist'};
|
||||
my $currentcolor=$color;
|
||||
{
|
||||
my $color=$currentcolor;
|
||||
my @itemswaiting;
|
||||
my $lcolor=$color;
|
||||
my @itemswaiting;
|
||||
foreach my $item (@$items) {
|
||||
($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
|
||||
$lcolor = ($lcolor eq $linecolor1) ? $linecolor2 : $linecolor1;
|
||||
my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
|
||||
push @itemswaiting, $iteminformation;
|
||||
}
|
||||
}
|
||||
if ($query->param('module') ne 'returns'){
|
||||
$template->param( nonreturns => 'true' );
|
||||
}
|
||||
|
|
@ -515,7 +489,7 @@ sub patrontable {
|
|||
$template->param(
|
||||
notes => 'true',
|
||||
notesmsg => $flags->{'NOTES'}->{'message'}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -531,59 +505,47 @@ sub printslip {
|
|||
my ($borrowerissues) = currentissues($env, $borrower);
|
||||
$env->{'nottodaysissues'}=1;
|
||||
$env->{'todaysissues'}=0;
|
||||
my ($borroweriss2)=currentissues($env, $borrower);
|
||||
my ($borroweriss2) = currentissues($env, $borrower);
|
||||
$env->{'nottodaysissues'}=0;
|
||||
my $i=0;
|
||||
my @issues;
|
||||
foreach (sort {$a <=> $b} keys %$borrowerissues) {
|
||||
$issues[$i]=$borrowerissues->{$_};
|
||||
my $dd=$issues[$i]->{'date_due'};
|
||||
#convert to nz style dates
|
||||
#this should be set with some kinda config variable
|
||||
my @tempdate=split(/-/,$dd);
|
||||
$issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]";
|
||||
$i++;
|
||||
$issues[$i]=$borrowerissues->{$_};
|
||||
$issues[$i]->{'date_due'} = C4::Dates->new($issues[$i]->{'date_due'},'iso')->output;
|
||||
# convert to syspref style date
|
||||
$i++;
|
||||
}
|
||||
foreach (sort {$a <=> $b} keys %$borroweriss2) {
|
||||
$issues[$i]=$borroweriss2->{$_};
|
||||
my $dd=$issues[$i]->{'date_due'};
|
||||
#convert to nz style dates
|
||||
#this should be set with some kinda config variable
|
||||
my @tempdate=split(/-/,$dd);
|
||||
$issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]";
|
||||
$i++;
|
||||
}
|
||||
$issues[$i]=$borroweriss2->{$_};
|
||||
$issues[$i]->{'date_due'} = C4::Dates->new($issues[$i]->{'date_due'},'iso')->output;
|
||||
# convert to syspref style date
|
||||
$i++;
|
||||
}
|
||||
remoteprint($env,\@issues,$borrower);
|
||||
}
|
||||
|
||||
# Begin code added by Christina Lee
|
||||
sub set_duedate
|
||||
{
|
||||
my $loanlength;
|
||||
my $loanlength;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare ("select loanlength from biblioitems, biblio,itemtypes, items where barcode = ? and biblio.biblionumber = biblioitems.biblionumber and biblioitems.biblionumber = items.biblionumber and biblioitems.itemtype=itemtypes.itemtype;");
|
||||
$sth->execute($barc);
|
||||
while (my @val = $sth->fetchrow_array()) {
|
||||
$loanlength = @val[0];
|
||||
}
|
||||
my ($s, $min, $hr, $mday, $mo, $year, $wday, $yday) = localtime(time + $loanlength * 86400);
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare ("select loanlength from biblioitems, biblio,itemtypes, items where barcode = ? and biblio.biblionumber = biblioitems.biblionumber and biblioitems.biblionumber = items.biblionumber and biblioitems.itemtype=itemtypes.itemtype;");
|
||||
$sth->execute($barc);
|
||||
while (my @val = $sth->fetchrow_array())
|
||||
{
|
||||
$loanlength = @val[0];
|
||||
}
|
||||
(my $s, my $min, my $hr, my $mday, my $mo, my $year, my $wday, my $yday) = localtime(time + $loanlength * 86400);
|
||||
|
||||
#adjust month and date for output
|
||||
$year = $year - 100;
|
||||
$mo = $mo + 1;
|
||||
|
||||
return ($year, $mo, $mday);
|
||||
#adjust month and date for output
|
||||
$year -= 100;
|
||||
$mo++;
|
||||
return ($year, $mo, $mday);
|
||||
}
|
||||
|
||||
sub get_due_date
|
||||
{
|
||||
my $duedate;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
|
||||
sub get_due_date {
|
||||
# This function is clearly unfinished. Don't rely on it yet.
|
||||
my $duedate;
|
||||
my $dbh = C4::Context->dbh;
|
||||
}
|
||||
|
||||
# End code added by Christina Lee
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ use C4::Auth;
|
|||
use C4::Output;
|
||||
use C4::Koha;
|
||||
use HTML::Template::Pro;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
|
||||
my $query=new CGI;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use C4::Search;
|
|||
use C4::Output;
|
||||
use C4::Members;
|
||||
use HTML::Template::Pro;
|
||||
use C4::Date;
|
||||
use C4::Dates;
|
||||
use C4::Biblio;
|
||||
|
||||
my $query = new CGI;
|
||||
|
|
|
|||
Loading…
Reference in New Issue