diff --git a/ka.php b/ka.php
index bfcb2e5..31f5e89 100644
--- a/ka.php
+++ b/ka.php
@@ -221,7 +221,7 @@ Grund für abweichende Kontoinhabende Person">
-
-
-
+
diff --git a/kaform.js b/kaform.js
index e9e5ba3..0bf57c3 100644
--- a/kaform.js
+++ b/kaform.js
@@ -30,7 +30,7 @@ function disableCurrency()
document.getElementById("a_currency").disabled=true;
}
else {
- document.getElementById("a_currency").disabled=false;
+ document.getElementById("a_currency").disabled=true;
}
}
@@ -301,7 +301,17 @@ function check_field(fieldid,message){
//
//
//
-function downloadDocument()
+//
+function downloadDocument2(){
+ downloadDocument(true);
+}
+
+function downloadDocument1(){
+ downloadDocument(false);
+}
+
+
+function downloadDocument(mail)
{
/* if (!check_field("nickname", "Bitte gib deinen Nicknamen an!"))
return;
@@ -351,6 +361,14 @@ function downloadDocument()
return;
};
+ if (mail){
+ document.getElementById('sendmail').value="yes";
+
+ }
+ else{
+ document.getElementById('sendmail').value="no";
+
+ }
document.getElementById('banktype').value=banktype;
diff --git a/submit.php b/submit.php
index 1b01d0f..f4fab8a 100644
--- a/submit.php
+++ b/submit.php
@@ -2,6 +2,9 @@
session_start();
require "config.php";
+require "PHPMailer/PHPMailer.php";
+require "PHPMailer/SMTP.php";
+require "PHPMailer/Exception.php";
#$CONVERT_CMD = "/usr/bin/pdftk";
@@ -405,8 +408,33 @@ $cmd .= " cat output $resultnam.pdf";
exec ($cmd);
#var_dump($_POST);
-#echo "CMD: $cmd
";
-#die;
+$file = "$resultnam.pdf";
+
+if ($_POST['sendmail']=='yes'){
+ $subj = "Kostenerstattungsantrag ueber".calcSum()." EUR";
+
+ $mail = new PHPMailer\PHPMailer\PHPMailer();
+ $mail->IsSMTP();
+ $mail->setFrom("noc@wikimedia.de");
+ $mail->Subject = $subj;
+ $mail->Body = "Kostenerstattungsantragi ...";
+ $mail->AddAddress("tube@surfpoeten.de");
+ $mail->AddAttachment( $file , 'antrag.pdf' );
+
+ $mail->Host = $mailHost; // Specify main and backup server
+ $mail->Port = $mailPort; // Set the SMTP port
+ $mail->SMTPAuth = $mailSMTPAuth;
+ $mail->Username = $mailUsername;
+ $mail->Password = $mailPassword;
+ $mail->SMTPSecure = $mailSMTPSecure; // Enable encryption, 'ssl' also accepted
+ $rc = $mail->send();
+ if (!$rc) {
+ echo 'Mailer Error: ' . $mail->ErrorInfo;
+ }
+ echo "Dein Antrag wurde versendet";
+
+ die;
+}
$file = "$resultnam.pdf";
header('Content-Disposition: attachment; filename="'. basename($file) . '"');
header('Content-Length: ' . filesize($file));