use C4::Log; # logaction
use C4::Overdues;
use C4::Reserves;
+use C4::Accounts;
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
my $query;
my $sth;
if ($borrowernumber) {
- $sth = $dbh->prepare("select * from borrowers where borrowernumber=?");
+ $sth = $dbh->prepare("select borrowers.*,category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode where borrowernumber=?");
$sth->execute($borrowernumber);
}
elsif ($cardnumber) {
- $sth = $dbh->prepare("select * from borrowers where cardnumber=?");
+ $sth = $dbh->prepare("select borrowers.*,category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode where cardnumber=?");
$sth->execute($cardnumber);
}
else {
. ",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'};
}
#my ($type_city) = @_;
my $dbh = C4::Context->dbh;
- my $query = qq|SELECT cityid,city_name
+ my $query = qq|SELECT cityid,city_zipcode,city_name
FROM cities
ORDER BY city_name|;
my $sth = $dbh->prepare($query);
$sth->execute();
my %city;
my @id;
-
# insert empty value to create a empty choice in cgi popup
-
+ push @id, " ";
+ $city{""} = "";
while ( my $data = $sth->fetchrow_hashref ) {
-
- push @id, $data->{'cityid'};
- $city{ $data->{'cityid'} } = $data->{'city_name'};
+ push @id, $data->{'city_zipcode'}."|".$data->{'city_name'};
+ $city{ $data->{'city_zipcode'}."|".$data->{'city_name'} } = $data->{'city_name'};
}
#test to know if the table contain some records if no the function return nothing