koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha C4/Circulation/Fines.pm misc/fines.pl


From: Bruno Toumi
Subject: [Koha-cvs] koha C4/Circulation/Fines.pm misc/fines.pl
Date: Mon, 07 May 2007 14:57:01 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Changes by:     Bruno Toumi <btoumi>    07/05/07 14:57:01

Modified files:
        C4/Circulation : Fines.pm 
        misc           : fines.pl 

Log message:
        bug fix : adding condition for create the right notify_id

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Fines.pm?cvsroot=koha&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/koha/misc/fines.pl?cvsroot=koha&r1=1.3&r2=1.4

Patches:
Index: C4/Circulation/Fines.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Fines.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- C4/Circulation/Fines.pm     18 Apr 2007 17:00:14 -0000      1.27
+++ C4/Circulation/Fines.pm     7 May 2007 14:57:01 -0000       1.28
@@ -1,6 +1,6 @@
 package C4::Circulation::Fines;
 
-# $Id: Fines.pm,v 1.27 2007/04/18 17:00:14 tipaul Exp $
+# $Id: Fines.pm,v 1.28 2007/05/07 14:57:01 btoumi Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -29,7 +29,7 @@
 use C4::Log; # logaction
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.27 $' =~ /\d+/g; 
+$VERSION = do { my @v = '$Revision: 1.28 $' =~ /\d+/g; 
 shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -901,15 +901,19 @@
 =cut
 
 sub CheckAccountLineLevelInfo {
-    my($borrowernumber,$itemnumber,$level) = @_;
+    my($borrowernumber,$itemnumber,$level,$datedue) = @_;
+       my @formatdate;
+       @formatdate=split('-',$datedue);
+       $datedue=$formatdate[2]."/".$formatdate[1]."/".$formatdate[0];
     my $dbh = C4::Context->dbh;
         my $query=    qq|SELECT count(*)
             FROM accountlines
             WHERE borrowernumber =?
             AND itemnumber = ?
-            AND notify_level=?|;
+                       AND notify_level=?
+                       AND description like ?|;
     my $sth=$dbh->prepare($query);
-        $sth->execute($borrowernumber,$itemnumber,$level);
+       $sth->execute($borrowernumber,$itemnumber,$level,"%$datedue%");
         my ($exist)=$sth->fetchrow;
         $sth->finish;
         return($exist);
@@ -1015,12 +1019,17 @@
 sub CheckExistantNotifyid {
      my($borrowernumber,$date_due) = @_;
      my $dbh = C4::Context->dbh;
-         my $query =  qq|SELECT notify_id FROM issues,accountlines
-             WHERE accountlines.borrowernumber =?
-             AND issues.itemnumber= accountlines.itemnumber
-              AND date_due = ?|;
+       my @formatdate;
+       @formatdate=split('-',$date_due);
+       $date_due=$formatdate[2]."/".$formatdate[1]."/".$formatdate[0];
+       my $query =  qq|SELECT notify_id FROM accountlines 
+                       WHERE description like ?
+                       AND borrowernumber =?
+                       AND( accounttype='FU'  OR accounttype='F' )
+                           AND notify_id != 0
+                       AND notify_id != 1|;
     my $sth=$dbh->prepare($query);
-         $sth->execute($borrowernumber,$date_due);
+               $sth->execute("%$date_due%",$borrowernumber);
          my ($exist)=$sth->fetchrow;
          $sth->finish;
          if ($exist eq '')

Index: misc/fines.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/fines.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- misc/fines.pl       4 Apr 2007 16:46:23 -0000       1.3
+++ misc/fines.pl       7 May 2007 14:57:01 -0000       1.4
@@ -25,7 +25,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: fines.pl,v 1.3 2007/04/04 16:46:23 tipaul Exp $
+# $Id: fines.pl,v 1.4 2007/05/07 14:57:01 btoumi Exp $
 
 use C4::Context;
 use C4::Circulation;
@@ -91,7 +91,7 @@
         
UpdateFine($data->[$i]->{'itemnumber'},$data->[$i]->{'borrowernumber'},$amount,$type,$due);
         my 
$getnotifyid=CheckExistantNotifyid($borrower->{'borrowernumber'},$datedue);
     
-        my 
$update=CheckAccountLineLevelInfo($borrower->{'borrowernumber'},$data->[$i]->{'itemnumber'},1);
+        my 
$update=CheckAccountLineLevelInfo($borrower->{'borrowernumber'},$data->[$i]->{'itemnumber'},1,$datedue);
             if ($update eq '0'){
                         if ($getnotifyid eq '0'){
                             
$starter=GetNextIdNotify($reference,$borrower->{'borrowernumber'});
@@ -118,7 +118,7 @@
         if ($daycount >= $delays2 && $daycount < $delays3){
         my $debarred2=GetOverduerules($borrower->{'categorycode'},2);
         (UpdateBorrowerDebarred($borrower->{'borrowernumber'}))if(($debarred2 
eq '1' ) and ($debarredstatus eq '0'));
-        my 
$update=CheckAccountLineLevelInfo($borrower->{'borrowernumber'},$data->[$i]->{'itemnumber'},2);
+       my 
$update=CheckAccountLineLevelInfo($borrower->{'borrowernumber'},$data->[$i]->{'itemnumber'},2,$datedue);
         if ($update eq '0'){
         
UpdateAccountLines(undef,2,$borrower->{'borrowernumber'},$data->[$i]->{'itemnumber'});
         }
@@ -129,7 +129,7 @@
         if ($daycount >= $delays3  ){
             my $debarred3=GetOverduerules($borrower->{'categorycode'},3);
             
(UpdateBorrowerDebarred($borrower->{'borrowernumber'}))if(($debarred3 eq '1' ) 
and ($debarredstatus eq '0'));
-            my 
$update=CheckAccountLineLevelInfo($borrower->{'borrowernumber'},$data->[$i]->{'itemnumber'},3);
+            my 
$update=CheckAccountLineLevelInfo($borrower->{'borrowernumber'},$data->[$i]->{'itemnumber'},3,$datedue);
             if ($update eq '0'){
                     
UpdateAccountLines(undef,3,$borrower->{'borrowernumber'},$data->[$i]->{'itemnumber'});
             }




reply via email to

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