[Koha-devel] CVS: koha/C4 Accounts2.pm,1.3,1.4
Chris Cormack
rangi at users.sourceforge.net
Wed Apr 18 04:51:20 CEST 2001
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv10396/C4
Modified Files:
Accounts2.pm
Log Message:
Add functionality so that when the replacement cost of a lost item is paid
Its returned off the members/patrons card. And a note is placed on the item
saying that its been paid for.
The item stays marked as lost. But the patron does not accrue more fines
Index: Accounts2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Accounts2.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Accounts2.pm 2001/04/02 22:51:26 1.3
--- Accounts2.pm 2001/04/18 02:51:18 1.4
***************
*** 9,12 ****
--- 9,13 ----
use C4::Database;
use C4::Stats;
+ use C4::Search;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
***************
*** 109,112 ****
--- 110,115 ----
sub makepayment{
#here we update both the accountoffsets and the account lines
+ #updated to check, if they are paying off a lost item, we return the item
+ # from their card, and put a note on the item record
my ($bornumber,$accountno,$amount,$user)=@_;
my $env;
***************
*** 115,121 ****
my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
my $newamtos=0;
my $updquery="Update accountlines set amountoutstanding=0 where
borrowernumber=$bornumber and accountno=$accountno";
! my $sth=$dbh->prepare($updquery);
$sth->execute;
$sth->finish;
--- 118,130 ----
my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
my $newamtos=0;
+ my $sel="Select * from accountlines where borrowernumber=$bornumber and
+ accountno=$accountno";
+ my $sth=$dbh->prepare($sel);
+ $sth->execute;
+ my $data=$sth->fetchrow_hashref;
+ $sth->finish;
my $updquery="Update accountlines set amountoutstanding=0 where
borrowernumber=$bornumber and accountno=$accountno";
! $sth=$dbh->prepare($updquery);
$sth->execute;
$sth->finish;
***************
*** 138,141 ****
--- 147,154 ----
$sth->finish;
$dbh->disconnect;
+ #check to see what accounttype
+ if ($data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L'){
+ returnlost($bornumber,$data->{'itemnumber'});
+ }
}
***************
*** 174,177 ****
$dbh->disconnect;
}
!
END { } # module clean-up code here (global destructor)
--- 187,208 ----
$dbh->disconnect;
}
!
! sub returnlost{
! my ($borrnum,$itemnum)=@_;
! my $dbh=C4Connect;
! my $borrower=borrdata('',$borrnum); #from C4::Search;
! my $upiss="Update issues set returndate=now() where
! borrowernumber='$borrnum' and itemnumber='$itemnum' and returndate is null";
! my $sth=$dbh->prepare($upiss);
! $sth->execute;
! $sth->finish;
! my $date='2001-04-18';
! my $bor="$borrower->{'firstname'} $borrower->{'surname'} $borrower->{'cardnumber'}";
! my $upitem="Update items set itemnotes='Paid for by $bor $date' where itemnumber='$itemnum'";
! $sth=$dbh->prepare($upitem);
! $sth->execute;
! $sth->finish;
! $dbh->disconnect;
! }
!
END { } # module clean-up code here (global destructor)
More information about the Koha-devel
mailing list