828df758a7b28057a552c24fe6034a44ea344ae2
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

9) This code is published under a 0BSD license.
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

10) 
11) 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.
12) */
13) 
14) require_role(ROLE_CUSTOMER);
15) 
16) require('invoice.php');
17) require_once("inc/debug.php");
Bernd Wurst Fehlendes Include

Bernd Wurst authored 10 years ago

18) require_once("inc/security.php");
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

19) global $debugmode;
20) 
21) $section = 'invoice_current';
22) 
23) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

24) if ($_GET['action'] == 'new') {
25)     check_form_token('sepamandat_neu');
Hanno remove whitespace in empty...

Hanno authored 6 years ago

26) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

27)     $gueltig_ab = $_REQUEST['gueltig_ab'];
28)     if ($gueltig_ab == 'datum') {
Bernd Wurst use HTML date input

Bernd Wurst authored 1 year ago

29)         $gueltig_ab = $_REQUEST['gueltig_ab_datum'];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

30)     }
31)     if (! check_date($gueltig_ab)) {
32)         system_failure('Konnte das Datum nicht auslesen');
33)     }
34)     DEBUG('Gültig ab: '.$gueltig_ab);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

35) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

36)     if (empty($_REQUEST['kontoinhaber'])) {
37)         system_failure('Bitte geben Sie den Kontoinhaber so an, wie dies bei Ihrer Bank hinterlegt ist.');
38)     }
39)     $name = $_REQUEST['kontoinhaber'];
40)     DEBUG('Kontoinhaber:'.$name);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

41) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

42)     if (empty($_REQUEST['adresse'])) {
43)         system_failure('Bitte geben Sie die Adresse des Kontoinhabers an.');
44)     }
45)     $adresse = $_REQUEST['adresse'];
46)     DEBUG('Adresse: '.$adresse);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

47) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

48)     if (empty($_REQUEST['iban'])) {
49)         system_failure('Es wurde keine IBAN angegeben.');
50)     }
Bernd Wurst Wandle IBAN in Großbuchstaben

Bernd Wurst authored 6 years ago

51)     $iban = str_replace(' ', '', strtoupper($_REQUEST['iban']));
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

52)     if (! verify_iban($iban)) {
53)         system_failure("Die IBAN scheint nicht korrekt zu sein!");
54)     }
55)     DEBUG('IBAN: '.$iban);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

56) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

57)     $bankname = $_REQUEST['bankname'];
58)     if (empty($_REQUEST['bankname'])) {
59)         system_failure('Bitte geben Sie den Namen der Bank an.');
60)     }
61)     DEBUG('Bank: '.$bankname);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

62) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

63)     $bic = null;
64)     if (empty($_REQUEST['bic'])) {
65)         if (substr($iban, 0, 2) == 'DE') {
Hanno Böck codingstyle, spaces between...

Hanno Böck authored 1 year ago

66)             $bic = null;
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

67)         } else {
68)             system_failure('Sie haben keinen BIC angegeben. Für Konten außerhalb Deutschlands ist ein BIC weiterhin erforderlich.');
69)         }
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

70)     } else {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

71)         $bic = $_REQUEST['bic'];
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

72)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

73)     DEBUG('BIC: '.$bic);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

74) 
Hanno remove whitespace in empty...

Hanno authored 6 years ago

75) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

76)     sepamandat($name, $adresse, $iban, $bankname, $bic, $gueltig_ab);
Hanno remove whitespace in empty...

Hanno authored 6 years ago

77) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

78)     redirect($prefix.'go/invoice/current');