Funktion um Name und Adresse aus den Kundendaten in das SEPA-Mandat zu kopieren
Bernd Wurst

Bernd Wurst commited on 2013-12-31 08:28:57
Zeige 2 geänderte Dateien mit 44 Einfügungen und 1 Löschungen.

... ...
@@ -69,7 +69,7 @@ $html .= '<p><input type="radio" id="gueltig_ab_datum" name="gueltig_ab" value="
69 69
 
70 70
 $html .= '<h4>Ihre Bankverbindung</h4>';
71 71
 $html .= '<table>
72
-<tr><td><label for="kontoinhaber">Name des Kontoinhabers:</label></td><td><input type="text" name="kontoinhaber" id="kontoinhaber" value="'.$_SESSION['customerinfo']['name'].'" /></td></tr>
72
+<tr><td><label for="kontoinhaber">Name des Kontoinhabers:</label></td><td><input type="text" name="kontoinhaber" id="kontoinhaber" /> <button id="copydata">Von Kundendaten kopieren</button></td></tr>
73 73
 <tr><td><label for="adresse">Adresse des Kontoinhabers:</label></td><td><textarea cols="50" lines="2" name="adresse" id="adresse"></textarea></td></tr>
74 74
 <tr><td><label for="iban">IBAN:</label></td><td><input type="text" name="iban" id="iban" size="30" /><span id="iban_feedback"></span></td></tr>
75 75
 <tr><td><label for="bankname">Name der Bank:</label></td><td><input type="text" name="bankname" id="bankname" size="30" /></td></tr>
... ...
@@ -116,7 +116,19 @@ function searchbank()
116 116
   }
117 117
 }
118 118
 
119
+function copydata_worker( result ) {
120
+  $("#kontoinhaber").val(result.kundenname);
121
+  $("#adresse").val(result.adresse);
122
+}
123
+
124
+function copydata( event ) {
125
+  event.preventDefault();
126
+  var kunde = $.getJSON("sepamandat_copydata", copydata_worker);
127
+}
128
+
129
+
119 130
 $(\'#iban\').on("change keyup paste", searchbank );
131
+$("#copydata").click(copydata);
120 132
 
121 133
 </script>
122 134
 ');
... ...
@@ -0,0 +1,31 @@
1
+<?php
2
+/*
3
+This file belongs to the Webinterface of schokokeks.org Hosting
4
+
5
+Written 2008-2013 by schokokeks.org Hosting, namely
6
+  Bernd Wurst <bernd@schokokeks.org>
7
+  Hanno Böck <hanno@schokokeks.org>
8
+
9
+To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10
+
11
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12
+http://creativecommons.org/publicdomain/zero/1.0/
13
+
14
+Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15
+*/
16
+
17
+require_once('inc/base.php');
18
+require_once('inc/debug.php');
19
+
20
+require_once('invoice.php');
21
+
22
+$kundenname = $_SESSION['customerinfo']['name'];
23
+$id = (int) $_SESSION['customerinfo']['customerno'];
24
+$result = db_query("SELECT CONCAT(adresse, '\\\\n', plz, ' ', ort) AS adresse FROM kundendaten.kunden WHERE id={$id}");
25
+$r = mysql_fetch_assoc($result);
26
+
27
+header("Content-Type: text/javascript");
28
+echo ' { "kundenname": "'.$kundenname.'", "adresse": "'.$r["adresse"].'" } ';
29
+die();
30
+
31
+
0 32