From 4a8f38ac69f3ad8a785c49bf31e2fe9bd4881f24 Mon Sep 17 00:00:00 2001 From: 7u83 <7u83> Date: Fri, 28 Feb 2020 15:04:43 +0000 Subject: [PATCH] Added stuff to avaluate bank details --- ka.php | 60 ++++++++++++++++++++++++++++---------------- kaform.js | 59 +++++++++++++++++++++++++++++++++++++++++-- submit.php | 73 ++++++++++++++++++++++++++++++++---------------------- 3 files changed, 140 insertions(+), 52 deletions(-) diff --git a/ka.php b/ka.php index d871b38..ee09e13 100644 --- a/ka.php +++ b/ka.php @@ -48,16 +48,32 @@
+ ` id="realname" name="realname" placeholder="Dein Realname (Vorname Nachname)*" />
+

+ + +
+
+ +
+
+
+
+
+ +
+ name="email" placeholder="Deine E-Mail-Adresse*" />
@@ -68,13 +84,13 @@
-
+
@@ -86,21 +102,21 @@
- +
- +

- +
-
+
@@ -112,37 +128,37 @@
- +
- +

- +
- +
-
- +
-
- +
-
+
@@ -230,7 +246,7 @@
- + @@ -243,6 +259,8 @@ + + diff --git a/kaform.js b/kaform.js index d594877..c2de27c 100644 --- a/kaform.js +++ b/kaform.js @@ -1,6 +1,6 @@ var currentRowId=1; - +var banktype = "bank-eu"; function renumberTableRows(){ var row_no=1; @@ -228,7 +228,15 @@ $K.add('module', 'kaform', { tabs: { opened: function(sender) { - console.log('Tab box is ',sender.getActiveBox()); + console.log('Tab box is ',sender.getActiveBox().nodes[0]); + + banktype = sender.getActiveBox().nodes[0].attributes.id.value; + + console.log(banktype); + + + +// console.log(sender); // this.message.show({ message: 'My message' }); } } @@ -291,5 +299,52 @@ function downloadDocument() return; } + if (banktype == "bank-eu"){ + iban = document.getElementById('iban'); + if (!IBAN.isValid(iban.value)){ + document.getElementById("iban").focus(); + showAlert("Bitte igib eine korrekte IBAN ein!"); + return; + } + } + + if (banktype == "bank-paypal"){ + ii = document.getElementById('paypal'); + if (!document.getElementById('paypal').value.trim().length){ + document.getElementById("paypal").focus(); + showAlert("Bitte gib einen PayPal Account an!"); + return; + } + } + + + + + document.getElementById('banktype').value=banktype; document.getElementById("theform").submit(); } + + +/* +function checkIban() +{ + iban = document.getElementById('iban'); + if(IBAN.isValid(iban.value)) + + if( document.getElementById('eu').checked ) { + + if(IBAN.isValid(iban.value)) + { + if(iban.classList.contains('invalid')) iban.classList.remove('invalid'); + iban.classList.add('valid'); + } + else { + if(iban.classList.contains('valid')) iban.classList.remove('valid'); + iban.classList.add('invalid'); + } + } else { + if(iban.classList.contains('invalid')) iban.classList.remove('invalid'); + if(iban.classList.contains('valid')) iban.classList.remove('valid'); + } + } +*/ diff --git a/submit.php b/submit.php index b4e9e5f..66048c5 100644 --- a/submit.php +++ b/submit.php @@ -37,36 +37,43 @@ class kaformPDF extends TCPDF { function mkFrontPDF(){ $comments = str_replace("\n","
",$_POST['comments']); - $bankaddress = str_replace("\n","
",$_POST['bankaddress']); - $address = str_replace("\n","
",$_POST['address']); + $bankaddress = str_replace("\n","
",$_POST['n_bankaddress']); + $address = str_replace("\n","
",$_POST['n_address']); $account_owner = $_POST['owner']; if (!$account_owner) $account_owner = $_POST['realname']; - switch ($_POST['bank']){ - case "EU": + $aw = $_POST; + + switch ($_POST['banktype']){ + + case "bank-eu": $aw = "EU-Banküberweisung"; $aw_details = " Kontoinhaber: $account_owner
- IBAN: $_POST[IBAN]
- BIC: $_POST[BIC]
- Bank: $_POST[Bankname]

- Anmerkungen:
$comments
+ IBAN: $_POST[iban]
+ BIC: $_POST[bic]
+ Bank: $_POST[bankname]

+ Verwendungszweck:
$_POST[purpose]
"; break; - case "Non-EU": + case "bank-noneu": $aw = "Non-EU-Banküberweisung"; $aw_details = " Kontoinhaber: $account_owner
- IBAN: $_POST[IBAN]
- BIC: $_POST[BIC]
- Bank: $_POST[Bankname]

+ Kontonummer: $_POST[n_iban]
+ BIC/SWIFT: $_POST[n_bic]
+ Bank: $_POST[n_ankname]

Bankanschrift:
$bankaddress

Anschrift des Empfängers:
$address

+ Verwendungszweck:
$_POST[n_purpose]
Anmerkungen:
$comments
"; break; + case "bank-paypal": + $aw = "PayPal"; + $aw_details = "PayPal Account:"; } @@ -149,8 +156,11 @@ function mkFrontPDF(){

 
+ Nickname: $_POST[nickname]
Name: $_POST[realname]
+ Telefon: $_POST[phone]
E-Mail: $_POST[email]
+ Ansprechpartner: $_POST[wmdecontact]



@@ -193,21 +203,21 @@ function mkSnippedPdf($key){ $pdf->AddPage('L'); - $pos = array_search($key,array_keys($_POST['desc']))+1; + $pos = array_search($key,array_keys($_POST['description']))+1; - echo "
Make Snipped for $key -> $pos
"; +// echo "
Make Snipped for $key -> $pos
"; # $mydesk = $_POST[desc][$key]; # $amount = $_POST['amount'][$key]; - $desc = $_POST['desc'][$key]; + $desc = $_POST['description'][$key]; $html = <<Posi. $pos +

Position $pos

$desc


$amount EUR


EOD; @@ -263,23 +273,24 @@ $pdfs = array(); $p = mkFrontPDF(); $file = $p; -header('Content-Disposition: attachment; filename="'. basename($file) . '"'); -header('Content-Length: ' . filesize($file)); -readfile($file); +#header('Content-Disposition: attachment; filename="'. basename($file) . '"'); +#header('Content-Length: ' . filesize($file)); +#readfile($file); -var_dump($p); -die(); +#var_dump($p); +#die(); -echo "Making Fromt PDF
"; +#echo "Making Fromt PDF
"; -echo "Did Making Fromt PDF
"; +#echo "Did Making Fromt PDF
"; array_push($pdfs,$p); +//var_dump($pdfs); -foreach ($_POST['desc'] as $key => $val) { - echo "DREESK KEY VAL $key --> $val
"; +foreach ($_POST['description'] as $key => $val) { +// echo "DREESK KEY VAL $key --> $val
"; $p = mkSnippedPDF($key); array_push($pdfs,$p); @@ -288,8 +299,7 @@ foreach ($_POST['desc'] as $key => $val) { } -var_dump($pdfs); - +//var_dump($pdfs); $cmd = "$CONVERT_CMD"; foreach ($pdfs as $filename){ @@ -297,8 +307,13 @@ foreach ($pdfs as $filename){ } $cmd .= " cat output /tmp/result.pdf"; exec ($cmd); +//var_dump($_POST); - -echo "CMD: $cmd
"; +#echo "CMD: $cmd
"; +#die; +$file = "/tmp/result.pdf"; +header('Content-Disposition: attachment; filename="'. basename($file) . '"'); +header('Content-Length: ' . filesize($file)); +readfile($file);