2626dd47daad110c63a82c0560b134e2364eeac3
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) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 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) 
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) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

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_role(ROLE_CUSTOMER);
18) 
19) require('invoice.php');
20) require_once("inc/debug.php");
Bernd Wurst Fehlendes Include

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

22) global $debugmode;
23) 
24) $section = 'invoice_current';
25) 
26) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

27) if ($_GET['action'] == 'new') {
28)     check_form_token('sepamandat_neu');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

30)     $gueltig_ab = $_REQUEST['gueltig_ab'];
31)     if ($gueltig_ab == 'datum') {
32)         $gueltig_ab = $_REQUEST['gueltig_ab_datum_year'].'-'.$_REQUEST['gueltig_ab_datum_month'].'-'.$_REQUEST['gueltig_ab_datum_day'];
33)     }
34)     if (! check_date($gueltig_ab)) {
35)         system_failure('Konnte das Datum nicht auslesen');
36)     }
37)     DEBUG('Gültig ab: '.$gueltig_ab);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

51)     if (empty($_REQUEST['iban'])) {
52)         system_failure('Es wurde keine IBAN angegeben.');
53)     }
54)     $iban = str_replace(' ', '', $_REQUEST['iban']);
55)     if (! verify_iban($iban)) {
56)         system_failure("Die IBAN scheint nicht korrekt zu sein!");
57)     }
58)     DEBUG('IBAN: '.$iban);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

66)     $bic = null;
67)     if (empty($_REQUEST['bic'])) {
68)         if (substr($iban, 0, 2) == 'DE') {
69)             $bic=null;
70)         } else {
71)             system_failure('Sie haben keinen BIC angegeben. Für Konten außerhalb Deutschlands ist ein BIC weiterhin erforderlich.');
72)         }
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

79)     sepamandat($name, $adresse, $iban, $bankname, $bic, $gueltig_ab);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

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