koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4/Circulation Circ2.pm


From: Robert Lyon
Subject: [Koha-cvs] koha/C4/Circulation Circ2.pm
Date: Wed, 07 Jun 2006 03:11:36 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Robert Lyon <bob_lyon>  06/06/07 03:11:35

Modified files:
        C4/Circulation : Circ2.pm 

Log message:
        merging katipo changes...
        
        Adding the ability to have charge discounts on items for certain patrons

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&r1=1.109&r2=1.110

Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -b -r1.109 -r1.110
--- Circ2.pm    7 Jun 2006 02:31:18 -0000       1.109
+++ Circ2.pm    7 Jun 2006 03:11:35 -0000       1.110
@@ -3,7 +3,7 @@
 
 package C4::Circulation::Circ2;
 
-# $Id: Circ2.pm,v 1.109 2006/06/07 02:31:18 bob_lyon Exp $
+# $Id: Circ2.pm,v 1.110 2006/06/07 03:11:35 bob_lyon Exp $
 
 #package to deal with Returns
 #written 3/11/99 by address@hidden
@@ -953,6 +953,9 @@
                                my $branchname = 
$branches->{$res->{'branchcode'}}->{'branchname'};
                 if ($cancelreserve){
                                CancelReserve(0, $res->{'itemnumber'}, 
$res->{'borrowernumber'});
+                                } else {
+                                   # set waiting reserve to first in reserve 
queue as book isn't waiting now
+                                   UpdateReserve(1, $res->{'biblionumber'}, 
$res->{'borrowernumber'}, $res->{'branchcode'});
                 }
                        } elsif ($restype eq "Reserved") {
 #                              warn "Reserved";
@@ -1663,7 +1666,7 @@
                        AND items.biblioitemnumber = 
biblioitems.biblioitemnumber
                        AND itemtypes.itemtype     = biblioitems.itemtype
                        AND issues.returndate      IS NULL
-                       ORDER BY issues.date_due";
+                       ORDER BY issues.date_due DESC";
        #    print $select;
        my $sth=$dbh->prepare($select);
        $sth->execute($borrowernumber);
@@ -1759,7 +1762,7 @@
                # because it's a bit messy: given the item number, we need to 
find
                # the biblioitem, which gives us the itemtype, which tells us
                # whether it may be renewed.
-               my $sth2 = $dbh->prepare("select renewalsallowed from 
items,biblioitems,itemtypes
+               my $sth2 = $dbh->prepare("SELECT renewalsallowed from 
items,biblioitems,itemtypes
                where (items.itemnumber = ?)
                and (items.biblioitemnumber = biblioitems.biblioitemnumber)
                and (biblioitems.itemtype = itemtypes.itemtype)");
@@ -1890,9 +1893,26 @@
                                                                and 
(biblioitems.biblioitemnumber = items.biblioitemnumber)
                                                                and 
(biblioitems.itemtype = itemtypes.itemtype)");
        $sth1->execute($itemno);
-       my $data1=$sth1->fetchrow_hashref;
+        if (my $data1=$sth1->fetchrow_hashref) {
        $item_type = $data1->{'itemtype'};
        $charge = $data1->{'rentalcharge'};
+           my $q2 = "select rentaldiscount from issuingrules,borrowers
+              where (borrowers.borrowernumber = ?)
+              and (borrowers.categorycode = issuingrules.categorycode)
+              and (issuingrules.itemtype = ?)";
+            my $sth2=$dbh->prepare($q2);
+            $sth2->execute($bornum,$item_type);
+            if (my $data2=$sth2->fetchrow_hashref) {
+               my $discount = $data2->{'rentaldiscount'};
+               if ($discount eq 'NULL') {
+                   $discount=0;
+               }
+               $charge = ($charge *(100 - $discount)) / 100;
+               #               warn "discount is $discount";
+           }
+        $sth2->finish;
+        }
+
        $sth1->finish;
        return ($charge,$item_type);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]