Kumara - predecessor to Koha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

  1. #!/usr/bin/perl
  2. #script to keep total of number of issues;
  3. use C4::Circulation::Fines;
  4. use Date::Manip;
  5. my ($count,$data)=Getoverdues();
  6. #print $count;
  7. my $count2=0;
  8. #$count=1000;
  9. my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
  10. $mon++;
  11. $year=$year+1900;
  12. my $date=Date_DaysSince999($mon,$mday,$year);
  13. my $bornum;
  14. my $borrower;
  15. my $max=5;
  16. for (my $i=0;$i<$count;$i++){
  17. my @dates=split('-',$data->[$i]->{'date_due'});
  18. my $date2=Date_DaysSince999($dates[1],$dates[2],$dates[0]);
  19. if ($date2 <= $date){
  20. $count2++;
  21. my $difference=$date-$date2;
  22. if ($bornum != $data->[$i]->{'borrowernumber'}){
  23. $bornum=$data->[$i]->{'borrowernumber'};
  24. $borrower=BorType($bornum);
  25. }
  26. if ($borrower->{'description'} !~ /Staff/ && $borrower->{'description'} !~ /Branch/){
  27. my ($amount)=CalcFine($data->[$i]->{'itemnumber'},$borrower->{'categorycode'},$difference);
  28. if ($amount > $max){
  29. $amount=$max;
  30. }
  31. if ($amount > 0){
  32. UpdateFine($data->[$i]->{'itemnumber'},$bornum,$amount);
  33. print "$i $borrower->{'description'} $difference $amount $data->[$i]->{'date_due'} $date $date2 \n";
  34. } else {
  35. # print "0 fine\n";
  36. }
  37. }
  38. }
  39. }
  40. print "\n $count2\n";