112e0dc636d8ef1ada467bd4a7a68b4362b1b140
Bernd Wurst Setzen als Kundenkontakte e...

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 1 year ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst Setzen als Kundenkontakte e...

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 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst Setzen als Kundenkontakte e...

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_once('contacts.php');
15) require_once('inc/debug.php');
16) require_once('inc/icons.php');
17) 
18) require_once('session/start.php');
19) 
20) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

21) require_role([ROLE_CUSTOMER]);
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

22) $section = 'contacts_list';
23) 
24) title("Adresse verwenden als...");
25) 
26) 
27) output(internal_link('list', 'Zurück zur Übersicht'));
28) 
29) $contact = get_contact($_REQUEST['id']);
30) $kundenkontakte = get_kundenkontakte();
31) $id = $contact['id'];
32) 
33) 
34) if (isset($_REQUEST['useas'])) {
35)     if ($_REQUEST['useas'] == 'kunde') {
36)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
37)             system_failure("Man kann eine Kunden-Adresse nicht löschen, bitte eine neue als Ersatz festlegen!");
38)         } else {
39)             set_kundenkontakt('kunde', $id);
Bernd Wurst Abstrahieren der Anzeigefun...

Bernd Wurst authored 6 years ago

40)             //redirect('useas?id='.$id);
41)             // usability: Dann kann man da eh nichts mehr machen, also zurück zur Übersicht
42)             redirect('list');
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

43)         }
44)     }
45)     if ($_REQUEST['useas'] == 'extern') {
46)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

47)             set_kundenkontakt('extern', null);
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

48)             redirect('useas?id='.$id);
49)         } else {
50)             set_kundenkontakt('extern', $id);
51)             redirect('useas?id='.$id);
52)         }
53)     }
54)     if ($_REQUEST['useas'] == 'rechnung') {
55)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

56)             set_kundenkontakt('rechnung', null);
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

57)             redirect('useas?id='.$id);
58)         } else {
59)             set_kundenkontakt('rechnung', $id);
60)             redirect('useas?id='.$id);
61)         }
62)     }
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

63)     if ($_REQUEST['useas'] == 'dataprotection') {
64)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

65)             set_kundenkontakt('dataprotection', null);
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

66)             redirect('useas?id='.$id);
67)         } else {
68)             set_kundenkontakt('dataprotection', $id);
69)             redirect('useas?id='.$id);
70)         }
71)     }
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

72) } else {
Bernd Wurst Abstrahieren der Anzeigefun...

Bernd Wurst authored 6 years ago

73)     output(display_contact($contact));
Bernd Wurst UI-Änderung, man kann Konta...

Bernd Wurst authored 6 years ago

74)     output('<p>'.internal_link('edit', icon_edit('Adresse bearbeiten')." Adresse bearbeiten", 'id='.$id).'</p>');
75)     if ($id != $kundenkontakte['kunde'] && ! is_domainholder($id)) {
76)         // Die Stamm-Adresse kann man nicht löschen und verwendete Domain-Kontakte auch nicht
77)         output('<p class="delete">'.internal_link('save', "Diese Adresse löschen", 'action=delete&id='.$id).'</p>');
78)     }
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

79) 
80)     output('<h4>Verwendung als Kundenkontakt</h4>');
81)     if ($id == $kundenkontakte['kunde']) {
82)         output("<p>Diese Adresse ist die Stamm-Adresse!</p>");
83)     } else {
84)         if (possible_kundenkontakt($contact)) {
85)             addnew('useas', 'Diese Adresse als Haupt-Adresse des Kontoinhabers festlegen.', 'id='.$_REQUEST['id'].'&useas=kunde');
86)         }
87)         if ($id == $kundenkontakte['extern']) {
Bernd Wurst Security

Bernd Wurst authored 6 years ago

88)             output("<p>Diese Adresse ist die Ersatz-Adresse bei Störungen. ".icon_delete().internal_link('useas', "Zuordnung löschen", 'id='.$_REQUEST['id'].'&useas=extern&action=delete')."</p>");
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

89)         } else {
90)             addnew('useas', 'Diese Adresse als Ersatz-Adresse des Kontoinhabers für Störungen festlegen.', 'id='.$_REQUEST['id'].'&useas=extern');
91)         }
92)         if ($id == $kundenkontakte['rechnung']) {
93)             output("<p>Diese Adresse ist die Rechnungs-Adresse. ".icon_delete().internal_link('useas', "Zuordnung löschen", 'id='.$_REQUEST['id'].'&useas=rechnung&action=delete')."</p>");
94)         } else {
95)             addnew('useas', 'Diese Adresse als Rechnungs-Adresse festlegen.', 'id='.$_REQUEST['id'].'&useas=rechnung');
96)         }
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

97)         if ($id == $kundenkontakte['dataprotection']) {
98)             output("<p>Diese Adresse ist die Adresse des betrieblichen Datenschutzbeauftragten. ".icon_delete().internal_link('useas', "Zuordnung löschen", 'id='.$_REQUEST['id'].'&useas=dataprotection&action=delete')."</p>");
99)         } else {
100)             addnew('useas', 'Diese Adresse als betrieblichen Datenschutzbeauftragten benennen.', 'id='.$_REQUEST['id'].'&useas=dataprotection');
101)         }
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

102)     }
103) 
104) 
Bernd Wurst Security

Bernd Wurst authored 6 years ago

105)     output("<h4>Verwendung als Domaininhaber bzw. -Verwalter</h4>");
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

106)     if (possible_domainholder($contact)) {
Bernd Wurst Security

Bernd Wurst authored 6 years ago

107)         $domains = domainlist_by_contact($contact);
108)         foreach ($domains as $d) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

109)             $funktion = [];
Bernd Wurst Security

Bernd Wurst authored 6 years ago

110)             if ($contact['id'] == $d->owner) {
111)                 $funktion[] = 'Inhaber';
112)             }
113)             if ($contact['id'] == $d->admin_c) {
114)                 $funktion[] = 'Verwalter';
115)             }
116)             $funktion = implode(' und ', $funktion);
117) 
Bernd Wurst Änderungen durch Umbenennun...

Bernd Wurst authored 6 years ago

118)             output('<p>Ist <strong>'.$funktion.'</strong> bei der Domain <strong>'.$d->fqdn.'</strong>. '.internal_link('../domains/detail', icon_edit()." Inhaber dieser Domain ändern", 'id='.$d->id).'</p>');
Bernd Wurst Security

Bernd Wurst authored 6 years ago

119)         }
120)     } else {
121)         output("<p>Zur Verwendung als Domaininhaber müssen Name, vollständige Adresse, E-Mail-Adresse sowie Telefonnummer angegeben sein.</p>");