[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/circ circulation.pl [dev_week]
From: |
Joshua Ferraro |
Subject: |
[Koha-cvs] koha/circ circulation.pl [dev_week] |
Date: |
Tue, 11 Jul 2006 13:26:36 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Joshua Ferraro <kados> 06/07/11 13:26:36
Modified files:
circ : circulation.pl
Log message:
syncing with rel_2_2. CIRC is working in dev-week!!!
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/circ/circulation.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.81.2.14.2.1&r2=1.81.2.14.2.2
Patches:
Index: circulation.pl
===================================================================
RCS file: /sources/koha/koha/circ/circulation.pl,v
retrieving revision 1.81.2.14.2.1
retrieving revision 1.81.2.14.2.2
diff -u -b -r1.81.2.14.2.1 -r1.81.2.14.2.2
--- circulation.pl 28 May 2006 18:49:12 -0000 1.81.2.14.2.1
+++ circulation.pl 11 Jul 2006 13:26:36 -0000 1.81.2.14.2.2
@@ -4,7 +4,7 @@
#written 8/5/2002 by Finlay
#script to execute issuing of books
-# New functions (renew etc.) added 07-08-2005 Tumer Garip address@hidden
+
# Copyright 2000-2002 Katipo Communications
#
@@ -35,9 +35,9 @@
use C4::Koha;
use HTML::Template;
use C4::Date;
-use C4::Context;
-use C4::Members;
+use Date::Manip;
+#
# PARAMETERS READING
#
my $query=new CGI;
@@ -52,15 +52,13 @@
});
my $branches = getbranches();
my $printers = getprinters();
-#my $branch = getbranch($query, $branches);
-my $branch=C4::Context->preference("defaultBranch");
+my $branch = getbranch($query, $branches);
my $printer = getprinter($query, $printers);
my $findborrower = $query->param('findborrower');
$findborrower =~ s|,| |g;
$findborrower =~ s|'| |g;
my $borrowernumber = $query->param('borrnumber');
-
my $print=$query->param('print');
my $barcode = $query->param('barcode');
my $year=$query->param('year');
@@ -69,23 +67,15 @@
my $stickyduedate=$query->param('stickyduedate');
my $issueconfirmed = $query->param('issueconfirmed');
my $cancelreserve = $query->param('cancelreserve');
-my %error;
-my $errorflag=$query->param('error');
-if ( $errorflag gt "1"){
-%error=(TOO_EARLY=>{1},) if ($errorflag eq "2");
-%error=(NO_MORE_RENEWALS=>{1},) if ($errorflag eq "3");
-%error=(RESERVE_FOUND=>{1},) if ($errorflag eq "4");
-}elsif ( $errorflag eq "1"){
-%error=(SUCCESFULL_RENEW=>{1},)
-}
+
#set up cookie.....
my $branchcookie;
my $printercookie;
-#if ($query->param('setcookies')) {
-# $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch",
-expires=>'+1y');
-# $printercookie = $query->cookie(-name=>'printer', -value=>"$printer",
-expires=>'+1y');
-#}
+if ($query->param('setcookies')) {
+ $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch",
-expires=>'+1y');
+ $printercookie = $query->cookie(-name=>'printer', -value=>"$printer",
-expires=>'+1y');
+}
my %env; # FIXME env is used as an "environment" variable. Could be dropped
probably...
@@ -95,7 +85,7 @@
my @datearr = localtime(time());
# FIXME - Could just use POSIX::strftime("%Y%m%d", localtime);
-my $todaysdate = (1900+$datearr[5])."-".sprintf ("%0.2d",
($datearr[4]+1))."-".sprintf ("%0.2d", ($datearr[3]));
+my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf
("%0.2d", ($datearr[3]));
# check and see if we should print
@@ -131,38 +121,31 @@
# get the borrower information.....
my $borrower;
-my $bornum=$query->param('bornum');
-if ($bornum){
-$borrowernumber=$bornum;
-}
-my $issues;
if ($borrowernumber) {
$borrower = getpatroninformation(\%env,$borrowernumber,0);
my ($od,$issue,$fines)=borrdata2(\%env,$borrowernumber);
-my $warning;
-
+ #warn $borrower->{'expiry'};
+ my $warningdate = DateCalc($borrower->{'expiry'},"-
".C4::Context->preference('NotifyBorrowerDeparture')." days");
+ my $offset = '+ '.$borrower->{'enrolmentperiod'}.' years';
+ my $renewaldate = DateCalc($warningdate, $offset);
+ $renewaldate = UnixDate($renewaldate,'%Y-%m-%d');
+ my $warning=Date_Cmp(ParseDate("today"),$warningdate);
+ if ($warning>0){
+ #borrowercard expired
+ $template->param(warndeparture=>$warning,
+ renewaldate=>$renewaldate);
+ }
$template->param(overduecount => $od,
- issuecount =>
$issue.$warning,
+ issuecount => $issue,
finetotal => $fines);
-$issues=$issue;
-my $picture;
- my $htdocs = C4::Context->config('opacdir');
-
-$picture =$htdocs.
"/htdocs/uploaded-files/users-photo/".$borrower->{'cardnumber'}.".jpg";
- if (-e $picture)
-{
-
- $template->param(borrowerphoto =>
"http://library.neu.edu.tr/uploaded-files/users-photo/".$borrower->{'cardnumber'}.".jpg");
- }else{
-$picture =
"http://cc.neu.edu.tr/stdpictures/".$borrower->{'cardnumber'}.".jpg";
- $template->param(borrowerphoto => $picture);
-}
}
+
#
# STEP 3 : ISSUING
#
-#Try to issue
+#
+
if ($barcode) {
@@ -170,20 +153,11 @@
my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
if ($issueconfirmed) {
issuebook(\%env, $borrower, $barcode, $datedue,$cancelreserve);
- my ($od,$issue,$fines)=borrdata2(\%env,$borrowernumber);
- my $warning;
-
- $template->param(overduecount => $od,
- issuecount =>
$issue.$warning,
- finetotal => $fines);
-
} else {
- my ($error, $question) = canbookbeissued(\%env, $borrower,
$barcode, $year, $month, $day) unless %error;
- $error=\%error if %error;
+ my ($error, $question) = canbookbeissued(\%env, $borrower,
$barcode, $year, $month, $day);
my $noerror=1;
my $noquestion = 1;
foreach my $impossible (keys %$error) {
-
$template->param($impossible => $$error{$impossible},
IMPOSSIBLE => 1);
$noerror = 0;
@@ -198,22 +172,14 @@
year => $year);
if ($noerror && ($noquestion || $issueconfirmed)) {
issuebook(\%env, $borrower, $barcode, $datedue);
- my ($od,$issue,$fines)=borrdata2(\%env,$borrowernumber);
- my $warning;
-
- $template->param(overduecount => $od,
- issuecount =>
$issue.$warning,
- finetotal => $fines);
}
}
-
}
-
# reload the borrower info for the sake of reseting the flags.....
-#if ($borrowernumber) {
-# $borrower = getpatroninformation(\%env,$borrowernumber,0);
-#}
+if ($borrowernumber) {
+ $borrower = getpatroninformation(\%env,$borrowernumber,0);
+}
##################################################################################
@@ -224,10 +190,8 @@
my $previssues='';
my @realtodayissues;
my @realprevissues;
-#my @renewissues;
my $allowborrow;
if ($borrower) {
-
# get each issue of the borrower & separate them in todayissues & previous
issues
my @todaysissues;
my @previousissues;
@@ -235,16 +199,13 @@
# split in 2 arrays for today & previous
foreach my $it (keys %$issueslist) {
my $issuedate = $issueslist->{$it}->{'timestamp'};
- $issuedate = substr($issuedate, 0, 10);
-
- if ($todaysdate eq $issuedate) {
+ $issuedate = substr($issuedate, 0, 8);
+ if ($todaysdate == $issuedate) {
push @todaysissues, $issueslist->{$it};
} else {
push @previousissues, $issueslist->{$it};
}
}
-
-
my $od; # overdues
my $i = 0;
my $togglecolor;
@@ -252,22 +213,21 @@
foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}}
@todaysissues){
my $dd = $book->{'date_due'};
my $datedue = $book->{'date_due'};
-
$dd=format_date($dd);
-# $datedue=~s/-//g;
- if ($datedue lt $todaysdate) {
+ $datedue=~s/-//g;
+ if ($datedue < $todaysdate) {
$od = 1;
} else {
$od=0;
}
- $book->{'od'}=$od;
- $book->{'dd'}=$dd;
- $book->{'tcolor'}=$togglecolor;
- if ($togglecolor) {
+ if ($i%2) {
$togglecolor=0;
} else {
$togglecolor=1;
}
+ $book->{'togglecolor'} = $togglecolor;
+ $book->{'od'}=$od;
+ $book->{'dd'}=$dd;
if ($book->{'author'} eq ''){
$book->{'author'}=' ';
}
@@ -275,42 +235,35 @@
$i++;
}
-
-
# parses previous & build Template array
- $i=0;
+ $i = 0;
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 lt $todaysdate) {
-
+ $datedue=~s/-//g;
+ if ($datedue < $todaysdate) {
$od = 1;
} else {
$od = 0;
}
-
- if ($togglecolor) {
+ if ($i%2) {
$togglecolor=0;
} else {
$togglecolor=1;
}
- $book->{'tcolor'}=$togglecolor;
+ $book->{'togglecolor'} = $togglecolor;
$book->{'dd'}=$dd;
$book->{'od'}=$od;
- $book->{'tcolor'}=$pcolor;
if ($book->{'author'} eq ''){
$book->{'author'}=' ';
}
-
push @realprevissues,$book;
$i++;
}
-
-}#borrower
+}
my @values;
@@ -325,6 +278,7 @@
-values => address@hidden,
-labels => \%labels,
-size => 7,
+ -tabindex=>'',
-multiple => 0 );
}
#title
@@ -333,7 +287,7 @@
my $amountold=$borrower->{flags}->{'CHARGES'}->{'message'};
my @temp=split(/\$/,$amountold);
$amountold=$temp[1];
-$template->param( today=>format_date($todaysdate),
+$template->param(
findborrower => $findborrower,
borrower => $borrower,
borrowernumber => $borrowernumber,
@@ -343,7 +297,8 @@
printername => $printers->{$printer}->{'printername'},
firstname => $borrower->{'firstname'},
surname => $borrower->{'surname'},
- categorycode =>
getborrowercategory($borrower->{'categorycode'}),
+ expiry => format_date($borrower->{'expiry'}),
+ categorycode => $borrower->{'categorycode'},
streetaddress => $borrower->{'streetaddress'},
emailaddress => $borrower->{'emailaddress'},
borrowernotes => $borrower->{'borrowernotes'},
@@ -357,7 +312,6 @@
CGIselectborrower => $CGIselectborrower,
todayissues => address@hidden,
previssues => address@hidden,
-
);
# set return date if stickyduedate
if ($stickyduedate) {
@@ -375,7 +329,11 @@
if ($branchcookie) {
$cookie=[$cookie, $branchcookie, $printercookie];
}
-
+$template->param(intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+ patronimages => C4::Context->preference("patronimages"),
+ );
output_html_with_http_headers $query, $cookie, $template->output;
####################################################################
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/circ circulation.pl [dev_week],
Joshua Ferraro <=