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

Joshua Ferraro jmf at kados.org
Thu Oct 5 21:53:49 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Joshua Ferraro <kados>	06/10/05 19:53:49

Modified files:
	circ           : circulation.pl 

Log message:
	no changes, just cleanup

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.5&r2=1.81.2.14.2.6

Patches:
Index: circulation.pl
===================================================================
RCS file: /sources/koha/koha/circ/circulation.pl,v
retrieving revision 1.81.2.14.2.5
retrieving revision 1.81.2.14.2.6
diff -u -b -r1.81.2.14.2.5 -r1.81.2.14.2.6
--- circulation.pl	27 Aug 2006 00:21:54 -0000	1.81.2.14.2.5
+++ circulation.pl	5 Oct 2006 19:53:49 -0000	1.81.2.14.2.6
@@ -130,26 +130,17 @@
 if ($borrowernumber) {
 	$borrower = getpatroninformation(\%env,$borrowernumber,0);
 	my ($od,$issue,$fines)=borrdata2(\%env,$borrowernumber);
-	#warn $borrower->{'expiry'};
 	# 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 the expiry date is before today
 	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
+		#borrowercard expired or nearly expired, warn the librarian
 		$template->param(	warndeparture=>"1",
 							renewaldate=>"$renew_year-$renew_month-$renew_day");
 	}
@@ -209,6 +200,16 @@
 my @realtodayissues;
 my @realprevissues;
 my $allowborrow;
+
+#ADDED BY JF FOR AV COUNT
+my ($videocount, $musiccdcount, $audiobookcount);
+my ($videoflag, $videoleftcount);
+my ($musiccdflag, $musiccdleftcount);
+my ($audiobookflag, $audiobookleftcount);
+my $avcount;  # Added by JF to check AVs
+my $avflag;   # ADDED BY JF for AV COUNT
+my $avleftcount; # ADDED BY JF FOR AV COUNT
+
 if ($borrower) {
 # get each issue of the borrower & separate them in todayissues & previous issues
 	my @todaysissues;
@@ -229,6 +230,31 @@
 	my $togglecolor;
 	# parses today & build Template array
 	foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} @todaysissues){
+
+
+                # ADDED BY JF  Check AVs
+                my $bt = $book->{'ccode'};
+                #warn "here's bt:".$bt;
+                #if ($bt eq "Audiobook" or $bt eq "Audiobook (cassette)" or $bt eq "Videocassette" or $bt eq "Videocassette, juvenile non-fiction" or $bt eq "Videocassette, juvenile" or $bt eq "Videocassette, non-fiction" or $bt eq "Music CD" or $bt eq "Video disc") {
+
+                # Limit to 10 AV, AVJ, AVJN, AVNF, and DVD;
+                if ($bt eq "Videocassette" or $bt eq "Videocassette, juvenile non-fiction" or $bt eq "Videocassette, juvenile" or $bt eq "Videocassette, non-fiction" or $bt eq "Video disc") {
+                $videocount++;
+
+                # Limit to 10 CDM
+                } elsif ($bt eq "Music CD") {
+                $musiccdcount++;
+
+                # Limit to 10 AB, AC, JAC, and YAC
+                } elsif ($bt eq "Audiobook" or $bt eq "Audiobook (cassette)") {
+                $audiobookcount++;
+                }
+                # /ADDED BY JF end of Check AVs
+
+
+
+
+	
 		my $dd = $book->{'date_due'};
 		my $datedue = $book->{'date_due'};
 		#$dd=format_date($dd);
@@ -256,6 +282,22 @@
 	# parses previous & build Template array
 	$i = 0;
     foreach my $book (sort {$a->{'date_due'} cmp $b->{'date_due'}} @previousissues){
+
+				# ADDED BY JF  Check AVs
+                my $bt = $book->{'ccode'};
+                # Limit to 10 AV, AVJ, AVJN, AVNF, and DVD;
+                if ($bt eq "Videocassette" or $bt eq "Videocassette, juvenile non-fiction" or $bt eq "Videocassette, juvenile" or $bt eq "Videocassette, non-fiction" or $bt eq "Video disc") {
+                $videocount++;
+
+                # Limit to 10 CDM
+                } elsif ($bt eq "Music CD") {
+                $musiccdcount++;
+
+                # Limit to 10 AB, AC, JAC, and YAC
+                } elsif ($bt eq "Audiobook" or $bt eq "Audiobook (cassette)") {                $audiobookcount++;
+                }
+                # /ADDED BY JF end of Check AVs
+
 		my $dd = $book->{'date_due'};
 		my $datedue = $book->{'date_due'};
 		#$dd=format_date($dd);
@@ -284,6 +326,31 @@
 }
 
 
+# ADDED BY JF Check the number of Videos and work some magic
+ $videoleftcount = 10;
+ if ($videocount >= 10) {
+ $videoleftcount = 0;
+ $videoflag = 1;
+ } elsif ($videocount >= 1){
+ $videoleftcount = 10 - $videocount;
+ }
+# ADDED BY JF Check the number of Music CDs and work some magic
+ $musiccdleftcount = 10;
+ if ($musiccdcount >= 10) {
+ $musiccdleftcount = 0;
+ $musiccdflag = 1;
+ } elsif ($musiccdcount >= 1){
+ $musiccdleftcount = 10 - $musiccdcount;
+ }
+# ADDED BY JF Check the number of Audiobooks and work some magic
+ $audiobookleftcount = 10;
+ if ($audiobookcount >= 10) {
+ $audiobookleftcount = 0;
+ $audiobookflag = 1;
+ } elsif ($audiobookcount >= 1){
+ $audiobookleftcount = 10 - $audiobookcount;
+ }
+
 my @values;
 my %labels;
 my $CGIselectborrower;
@@ -306,6 +373,20 @@
 my @temp=split(/\$/,$amountold);
 $amountold=$temp[1];
 $template->param(
+
+				videocount => $videocount,
+                musiccdcount => $musiccdcount,
+                audiobookcount => $audiobookcount,
+                videoflag => $videoflag,
+                videoleftcount => $videoleftcount,
+                musiccdflag => $musiccdflag,
+                musiccdleftcount => $musiccdleftcount,
+                audiobookflag => $audiobookflag,
+                audiobookleftcount => $audiobookleftcount,
+                avcount => $avcount,
+                avleftcount => $avleftcount,
+                avflag => $avflag,
+
 		findborrower => $findborrower,
 		borrower => $borrower,
 		borrowernumber => $borrowernumber,





More information about the Koha-cvs mailing list