Getting web links going
[koha.git] / newmember.pl
index 5d1bee5..d600f32 100755 (executable)
@@ -42,7 +42,7 @@ use C4::Interface::CGI::Output;
 use CGI;
 use Date::Manip;
 use HTML::Template;
-
+use C4::Date;
 my %env;
 my $input = new CGI;
 
@@ -126,11 +126,11 @@ if ($ok == 0) {
     }
     if ($data{'joining'} eq ''){
        $data{'joining'}=ParseDate('today');
-       $data{'joining'}=&UnixDate($data{'joining'},'%Y-%m-%d');
+       $data{'joining'}=format_date($data{'joining'});
     }
     if ($data{'expiry'} eq ''){
        $data{'expiry'}=ParseDate('in 1 year');
-       $data{'expiry'}=&UnixDate($data{'expiry'},'%Y-%m-%d');
+       $data{'expiry'}=format_date($data{'expiry'});
     }
     my $ethnic=$data{'ethnicity'}." ".$data{'ethnicnotes'};
     my $postal=$data{'address'}."<br>".$data{'city'};
@@ -149,25 +149,33 @@ if ($ok == 0) {
        push(@inputsloop, \%line);
     }
 
+    #Get the fee
+    my $dbh = C4::Context->dbh;
+    my $sth = $dbh->prepare("SELECT enrolmentfee FROM categories WHERE categorycode = ?");
+    $sth->execute($data{'categorycode'});
+    my ($fee) = $sth->fetchrow;
+    $sth->finish;
+
     $template->param(name => $name,
                     bornum => $data{'borrowernumber'},
                     cardnum => $data{'cardnumber'},
                     memcat => $data{'categorycode'},
-                    area => $data{'area'},
-                    fee => $data{'fee'},
-                    joindate => $data{'joining'},
-                    expdate => $data{'expiry'},
-                    joinbranch => $data{'joinbranch'},
+                    fee => $fee,
+                    joindate => format_date($data{'joining'}),
+                    expdate => format_date($data{'expiry'}),
+                    branchcode => $data{'branchcode'},
                     ethnic => $ethnic,
-                    dob => $data{'dateofbirth'},
+                    dob => format_date($data{'dateofbirth'}),
                     sex => $sex,
                     postal => $postal,
                     home => $home,
+                       zipcode => $data{'zipcode'},
+                       homezipcode => $data{'homezipcode'},
                     phone => $data{'phone'},
                     phoneday => $data{'phoneday'},
                     faxnumber => $data{'faxnumber'},
                     emailaddress => $data{'emailaddress'},
-                     textmessaging => $data{'textmessaging'},
+                       textmessaging => $data{'textmessaging'},
                     contactname => $data{'contactname'},
                     altphone => $data{'altphone'},
                     altrelationship => $data{'altrelationship'},