From 6fac0001a11b409fd595580d344eb1a834c83659 Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Tue, 11 Dec 2007 09:53:20 +0100 Subject: [PATCH] Member enrolment fee fixed : if there is an enrolment fee, create a debt on patron subscription Signed-off-by: Joshua Ferraro --- C4/Members.pm | 13 +++++++++++-- members/memberentry.pl | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 2647e7172d..5224b2e8aa 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -27,6 +27,7 @@ use Date::Calc qw/Today Add_Delta_YM/; use C4::Log; # logaction use C4::Overdues; use C4::Reserves; +use C4::Accounts; our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug); @@ -700,14 +701,22 @@ sub AddMember { . ",ethnicity=" . $dbh->quote( $data{'ethnicity'} ) . ",ethnotes=" . $dbh->quote( $data{'ethnotes'} ); my $sth = $dbh->prepare($query); - print "Executing SQL: $query\n"; +# print "Executing SQL: $query\n"; $sth->execute; $sth->finish; $data{'borrowernumber'} = $dbh->{'mysql_insertid'}; &logaction(C4::Context->userenv->{'number'},"MEMBERS","CREATE",$data{'borrowernumber'},"") if C4::Context->preference("BorrowersLog"); - + + # check for enrollment fee & add it if needed + $sth = $dbh->prepare("SELECT enrolmentfee FROM categories WHERE categorycode=?"); + $sth->execute($data{'categorycode'}); + my ($enrolmentfee) = $sth->fetchrow; + if ($enrolmentfee) { + # insert fee in patron debts + manualinvoice($data{'borrowernumber'}, '', '', 'A', $enrolmentfee); + } return $data{'borrowernumber'}; } diff --git a/members/memberentry.pl b/members/memberentry.pl index 9f8e0ae277..f5cf644f9c 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -211,9 +211,9 @@ if ($op eq 'insert'){ if ($destination eq "circ") { print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$data{'cardnumber'}"); } else { - if ($loginexist == 0) { - print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); - } + if ($loginexist == 0) { + print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); + } } } } -- 2.39.5