[Koha-cvs] koha/admin issuingrules.pl

Chris Cormack chris at katipo.co.nz
Wed Jun 7 05:00:48 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	Chris Cormack <rangi>	06/06/07 03:00:48

Modified files:
	admin          : issuingrules.pl 

Log message:
	Allowing the rental discount to be modified here too.
	Rental discount effects the amount a borrower is charge to issue an item
	
	eg, if a borrower category has rental discount of 20 (its a percentage) on itemtypes DVD, and a dvd costs $2 to borrow normally, then it will cos them $1.60
	If not set it defaults to zero

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/admin/issuingrules.pl?cvsroot=koha&r1=1.6&r2=1.7

Patches:
Index: issuingrules.pl
===================================================================
RCS file: /sources/koha/koha/admin/issuingrules.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- issuingrules.pl	24 Feb 2006 11:15:01 -0000	1.6
+++ issuingrules.pl	7 Jun 2006 03:00:48 -0000	1.7
@@ -55,8 +55,8 @@
 	my $sth_Fupdate=$dbh->prepare("Update issuingrules set fine=?,firstremind=?,chargeperiod=? where branchcode=? and categorycode=? and itemtype=?");
 	my $sth_Fdelete=$dbh->prepare("delete from issuingrules where branchcode=? and categorycode=? and itemtype=? and issuelength=0");
 
-	my $sth_Iinsert = $dbh->prepare("insert into issuingrules (branchcode,categorycode,itemtype,maxissueqty,issuelength) values (?,?,?,?,?)");
-	my $sth_Iupdate=$dbh->prepare("Update issuingrules set maxissueqty=?, issuelength=? where branchcode=? and categorycode=? and itemtype=?");
+	my $sth_Iinsert = $dbh->prepare("insert into issuingrules (branchcode,categorycode,itemtype,maxissueqty,issuelength,rentaldiscount) values (?,?,?,?,?,?)");
+	my $sth_Iupdate=$dbh->prepare("Update issuingrules set maxissueqty=?, issuelength=?, rentaldiscount=? where branchcode=? and categorycode=? and itemtype=?");
 	my $sth_Idelete=$dbh->prepare("delete from issuingrules where branchcode=? and categorycode=? and itemtype=? and fine=0");
 	foreach my $key (@names){
 		# ISSUES
@@ -65,14 +65,14 @@
 			my $bor = $2; # borrower category
 			my $cat = $3; # item type
 			my $data=$input->param($key);
-			my ($issuelength,$maxissueqty)=split(',',$data);
+			my ($issuelength,$maxissueqty,$rentaldiscount)=split(',',$data);
 # 			if ($maxissueqty >0) {
 				$sth_search->execute($br,$bor,$cat);
 				my $res = $sth_search->fetchrow_hashref();
 				if ($res->{total}) {
-					$sth_Iupdate->execute($maxissueqty,$issuelength,$br,$bor,$cat);
+					$sth_Iupdate->execute($maxissueqty,$issuelength,$rentaldiscount,$br,$bor,$cat);
 				} else {
-					$sth_Iinsert->execute($br,$bor,$cat,$maxissueqty,$issuelength);
+					$sth_Iinsert->execute($br,$bor,$cat,$maxissueqty,$issuelength,$rentaldiscount);
 				}
 # 			} else {
 # 				$sth_Idelete->execute($br,$bor,$cat);
@@ -113,7 +113,7 @@
 
 my $sth=$dbh->prepare("Select description,categorycode from categories order by description");
 $sth->execute;
- my @trow3;
+my @trow3;
 my @title_loop;
 # my $i=0;
 while (my $data=$sth->fetchrow_hashref){
@@ -158,11 +158,12 @@
 		my $fine=$dat->{'fine'}+0;
 		my $maxissueqty = $dat->{'maxissueqty'}+0;
 		my $issuelength = $dat->{'issuelength'}+0;
+	        my $rentaldiscount = $dat->{'rentaldiscount'}+0;
 		my $finesvalue;
 		$finesvalue= "$fine,$dat->{'firstremind'},$dat->{'chargeperiod'}" if $fine+$dat->{'firstremind'}+$dat->{'chargeperiod'}>0;
 		my $issuingvalue;
 # 		if ($maxissueqty>0) {
-		    $issuingvalue = "$issuelength,$maxissueqty" if $issuelength+$maxissueqty>0;
+		    $issuingvalue = "$issuelength,$maxissueqty,$rentaldiscount" if $issuelength+$maxissueqty>0;
 # 		}
 # 		else {		
 # 		    $issuingvalue = "$issuelength, 5";





More information about the Koha-cvs mailing list