fe8d7c2025e33349ab1e51c0e906ec3ee69dcff2
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 6 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 Neues Modul zum Abschließen...

Bernd Wurst authored 6 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 Neues Modul zum Abschließen...

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

Hanno authored 6 years ago

17) function get_orderprocessing_contract()
18) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

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

Bernd Wurst authored 6 years ago

21)     $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);
22)     if ($result->rowCount() == 0) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

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

Bernd Wurst authored 6 years ago

24)     }
25)     $line = $result->fetch();
26)     return $line;
27) }
28) 
29) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

30) function contract_html()
31) {
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 6 years ago

32)     use_module('contacts');
33)     require_once('contacts.php');
Hanno remove whitespace in empty...

Hanno authored 6 years ago

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

Bernd Wurst authored 6 years ago

35)     $kundenkontakte = get_kundenkontakte();
36)     $kunde = get_contact($kundenkontakte['kunde']);
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

37)     $adresse = nl2br("\n" . filter_output_html($kunde['address'] . "\n" . $kunde['country'] . '-' . $kunde['zip'] . ' ' . $kunde['city']));
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 5 years ago

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

Bernd Wurst authored 6 years ago

39)     if ($kunde['company']) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

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

Bernd Wurst authored 6 years ago

41)     }
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 5 years ago

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

Bernd Wurst authored 6 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 6 years ago

45)     $date = date('d.m.Y');
46) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

47)     $DIR = realpath(dirname(__FILE__) . '/..');
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 6 years ago

48) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

49)     $vertrag = file_get_contents($DIR . '/vertrag.html');
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 6 years ago

50)     $vertrag = str_replace('((ADRESSE))', $address, $vertrag);
51)     $vertrag = str_replace('((DATUM))', $date, $vertrag);
52) 
53)     $vertrag = str_replace('</body>', '', $vertrag);
54)     $vertrag = str_replace('</html>', '', $vertrag);
55) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

56)     return $vertrag . "<br><br><pagebreak>\n" . file_get_contents($DIR . '/anlage1.html') . "<br><br><pagebreak>\n" . file_get_contents($DIR . '/anlage2.html') . "</body></html>";
Bernd Wurst Neues Modul zum Abschließen...

Bernd Wurst authored 6 years ago

57) }
58) 
59) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

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

Hanno Böck authored 3 years ago

62)     $args = ["cid" => $_SESSION['customerinfo']['customerno'],
Hanno Böck Neue codingstyle-rule array...

Hanno Böck authored 8 months ago

63)         "pdfdata" => $pdfdata, ];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

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

Bernd Wurst authored 6 years ago

68) }
69) 
70) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

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

Hanno Böck authored 3 years ago

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