2626dd47daad110c63a82c0560b134e2364eeac3
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) 
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 Setzen als Kundenkontakte e...

Bernd Wurst authored 6 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_once('contacts.php');
18) require_once('inc/debug.php');
19) require_once('inc/icons.php');
20) require_once('inc/jquery.php');
21) #javascript();
22) 
23) require_once('session/start.php');
24) 
25) 
26) require_role(array(ROLE_CUSTOMER));
27) $section = 'contacts_list';
28) 
29) title("Adresse verwenden als...");
30) 
31) 
32) output(internal_link('list', 'Zurück zur Übersicht'));
33) 
34) $contact = get_contact($_REQUEST['id']);
35) $kundenkontakte = get_kundenkontakte();
36) $id = $contact['id'];
37) 
38) 
39) if (isset($_REQUEST['useas'])) {
40)     if ($_REQUEST['useas'] == 'kunde') {
41)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
42)             system_failure("Man kann eine Kunden-Adresse nicht löschen, bitte eine neue als Ersatz festlegen!");
43)         } else {
44)             set_kundenkontakt('kunde', $id);
Bernd Wurst Abstrahieren der Anzeigefun...

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

48)         }
49)     }
50)     if ($_REQUEST['useas'] == 'extern') {
51)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 6 years ago

53)             redirect('useas?id='.$id);
54)         } else {
55)             set_kundenkontakt('extern', $id);
56)             redirect('useas?id='.$id);
57)         }
58)     }
59)     if ($_REQUEST['useas'] == 'rechnung') {
60)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 6 years ago

62)             redirect('useas?id='.$id);
63)         } else {
64)             set_kundenkontakt('rechnung', $id);
65)             redirect('useas?id='.$id);
66)         }
67)     }
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 5 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 5 years ago

71)             redirect('useas?id='.$id);
72)         } else {
73)             set_kundenkontakt('dataprotection', $id);
74)             redirect('useas?id='.$id);
75)         }
76)     }
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

93)             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

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

Bernd Wurst authored 5 years ago

102)         if ($id == $kundenkontakte['dataprotection']) {
103)             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>");
104)         } else {
105)             addnew('useas', 'Diese Adresse als betrieblichen Datenschutzbeauftragten benennen.', 'id='.$_REQUEST['id'].'&useas=dataprotection');
106)         }
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

107)     }
108) 
109) 
Bernd Wurst Security

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

112)         $domains = domainlist_by_contact($contact);
113)         foreach ($domains as $d) {
114)             $funktion = array();
115)             if ($contact['id'] == $d->owner) {
116)                 $funktion[] = 'Inhaber';
117)             }
118)             if ($contact['id'] == $d->admin_c) {
119)                 $funktion[] = 'Verwalter';
120)             }
121)             $funktion = implode(' und ', $funktion);
122) 
Bernd Wurst Änderungen durch Umbenennun...

Bernd Wurst authored 6 years ago

123)             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

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