96649f21ba18d07757afa9d98998f7a22c0d86a3
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
5) Written 2008-2018 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) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 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) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

20) function get_orderprocessing_contract()
21) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

22)     $args = [
23)         "cid" => (int) $_SESSION['customerinfo']['customerno'], ];
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

24)     $result = db_query("SELECT id, signed, type, startdate, enddate FROM kundendaten.contract WHERE customer=:cid AND type='orderprocessing' AND (enddate IS NULL OR enddate < CURDATE())", $args);
25)     if ($result->rowCount() == 0) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

26)         return null;
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

27)     }
28)     $line = $result->fetch();
29)     return $line;
30) }
31) 
32) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

33) function contract_html()
34) {
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

35)     use_module('contacts');
36)     require_once('contacts.php');
Hanno remove whitespace in empty...

Hanno authored 5 years ago

37) 
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

38)     $kundenkontakte = get_kundenkontakte();
39)     $kunde = get_contact($kundenkontakte['kunde']);
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 4 years ago

40)     $adresse = nl2br("\n".filter_output_html($kunde['address']."\n".$kunde['country'].'-'.$kunde['zip'].' '.$kunde['city']));
41)     $name = filter_output_html($kunde['name']);
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

42)     if ($kunde['company']) {
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 4 years ago

43)         $name = filter_output_html($kunde['company'])."<br />".filter_output_html($kunde['name']);
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

44)     }
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 4 years ago

45)     $email = filter_output_html($kunde['email']);
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

46)     $address = "<strong>$name</strong>$adresse</p><p>E-Mail-Adresse: $email";
Hanno remove whitespace in empty...

Hanno authored 5 years ago

47) 
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

48)     $date = date('d.m.Y');
49) 
50)     $DIR=realpath(dirname(__FILE__).'/..');
51) 
52)     $vertrag = file_get_contents($DIR.'/vertrag.html');
53)     $vertrag = str_replace('((ADRESSE))', $address, $vertrag);
54)     $vertrag = str_replace('((DATUM))', $date, $vertrag);
55) 
56)     $vertrag = str_replace('</body>', '', $vertrag);
57)     $vertrag = str_replace('</html>', '', $vertrag);
58) 
59)     return $vertrag."<br><br><pagebreak>\n".file_get_contents($DIR.'/anlage1.html')."<br><br><pagebreak>\n".file_get_contents($DIR.'/anlage2.html')."</body></html>";
60) }
61) 
62) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

63) function save_op_contract($pdfdata)
64) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

65)     $args = ["cid" => $_SESSION['customerinfo']['customerno'],
66)             "pdfdata" => $pdfdata, ];
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

67)     db_query(
68)         "INSERT INTO kundendaten.contract (customer, signed, type, startdate, pdfdata) VALUES (:cid, NOW(), 'orderprocessing', CURDATE(), :pdfdata)",
69)         $args
70)     );
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 5 years ago

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

Hanno authored 5 years ago

74) function get_contract_pdf($id)
75) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

76)     $args = ["id" => $id,
77)         "cid" => $_SESSION['customerinfo']['customerno'], ];