[Koha-cvs] koha/circ circulation.pl [dev_week]

Joshua Ferraro jmf at kados.org
Sun Aug 27 02:21:54 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Joshua Ferraro <kados>	06/08/27 00:21:54

Modified files:
	circ           : circulation.pl 

Log message:
	ZOOM is too slow when run from circulation.pl, this commit removes the
	ZOOM updating via circ and returns to the old method of just updating
	the issues and items tables. I'll be committing a new batch update
	script to be run in cron to update Zebra every 5 minutes or so ...

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.4&r2=1.81.2.14.2.5

Patches:
Index: circulation.pl
===================================================================
RCS file: /sources/koha/koha/circ/circulation.pl,v
retrieving revision 1.81.2.14.2.4
retrieving revision 1.81.2.14.2.5
diff -u -b -r1.81.2.14.2.4 -r1.81.2.14.2.5
--- circulation.pl	26 Aug 2006 14:02:57 -0000	1.81.2.14.2.4
+++ circulation.pl	27 Aug 2006 00:21:54 -0000	1.81.2.14.2.5
@@ -34,8 +34,14 @@
 use C4::Interface::CGI::Output;
 use C4::Koha;
 use HTML::Template;
-use C4::Date;
-use Date::Manip;
+#use C4::Date;
+use Date::Calc qw(
+Today
+Today_and_Now
+Add_Delta_YM
+Date_to_Days
+);
+#use Date::Manip;
 
 #
 # PARAMETERS READING
@@ -125,17 +131,29 @@
 	$borrower = getpatroninformation(\%env,$borrowernumber,0);
 	my ($od,$issue,$fines)=borrdata2(\%env,$borrowernumber);
 	#warn $borrower->{'expiry'};
- 	my $warningdate = DateCalc($borrower->{'expiry'},"- ".C4::Context->preference('NotifyBorrowerDeparture')."  days");
-	my $offset = '+ '.$borrower->{'enrolmentperiod'}.' years';
-	my $renewaldate = DateCalc(ParseDate("today"), $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);
+	# Warningdate is the date that the warning starts appearing
+	my ($today_year,$today_month,$today_day) = Today();
+	my ($warning_year,$warning_month,$warning_day) = split /-/, $borrower->{'expiry'};
+
+ 	#my $warningdate = DateCalc($borrower->{'expiry'},"- ".C4::Context->preference('NotifyBorrowerDeparture')."  days");
+	#my $offset = '+ '.$borrower->{'enrolmentperiod'}.' years';
+	#my $renewaldate = DateCalc(ParseDate("today"), $offset);
+
+	# Renew day is calculated by adding the enrolment period to today
+	my ($renew_year,$renew_month,$renew_day) = Add_Delta_YM($today_year,$today_month,$today_day, $borrower->{'enrolmentperiod'},0); 
+	#Add_Delta_DHMS(Today_and_Now(), $borrower->{'enrolmentperiod'},0,0,0);
+
+#	$renewaldate = UnixDate($renewaldate,'%Y-%m-%d');
+	#my $warning=Date_Cmp(ParseDate("today"),$warningdate);
+	
+	if (Date_to_Days($today_year,$today_month,$today_day) > Date_to_Days($warning_year,$warning_month,$warning_day)) {
+
+	#if ($warning>0){ 
+		#borrowercard expired or nearly expired
+		$template->param(	warndeparture=>"1",
+							renewaldate=>"$renew_year-$renew_month-$renew_day");
 	}
-	$template->param(overduecount => $od,
+	$template->param(		overduecount => $od,
 							issuecount => $issue,
 							finetotal => $fines);
 }
@@ -213,7 +231,7 @@
 	foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} @todaysissues){
 		my $dd = $book->{'date_due'};
 		my $datedue = $book->{'date_due'};
-		$dd=format_date($dd);
+		#$dd=format_date($dd);
 		$datedue=~s/-//g;
 		if ($datedue < $todaysdate) {
 			$od = 1;
@@ -240,7 +258,7 @@
     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);
+		#$dd=format_date($dd);
 		my $pcolor = '';
 		my $od = '';
 		$datedue=~s/-//g;
@@ -297,7 +315,7 @@
 		printername => $printers->{$printer}->{'printername'},
 		firstname => $borrower->{'firstname'},
 		surname => $borrower->{'surname'},
-		expiry => format_date($borrower->{'expiry'}),
+		expiry => $borrower->{'expiry'}, #format_date($borrower->{'expiry'}),
 		categorycode => $borrower->{'categorycode'},
 		streetaddress => $borrower->{'streetaddress'},
 		emailaddress => $borrower->{'emailaddress'},





More information about the Koha-cvs mailing list