| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
require_once "mail_func.php";
|
|
|
4 |
error_reporting( E_ALL & ~ E_NOTICE );
|
|
|
5 |
ini_set( "register_globals", "On" );
|
|
|
6 |
|
|
|
7 |
define( "Range", 100 );
|
|
|
8 |
define( "modul_name", "Warenwirtschaft" );
|
|
|
9 |
define( "tool_name", "bestellung" );
|
|
|
10 |
require_once "/web/apache/content-management/Online-Shop/connect2.php";
|
|
|
11 |
|
|
|
12 |
$time = microtime_float();
|
|
|
13 |
|
|
|
14 |
require_once
|
|
|
15 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/system/getBestellungLieferscheinStatus.php";
|
|
|
16 |
require_once
|
|
|
17 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/system/getBestellungRechnungStatus.php";
|
|
|
18 |
require_once
|
|
|
19 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/system/getBestellungStatus.php";
|
|
|
20 |
require_once
|
|
|
21 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/system/getBestellungSumme.php";
|
|
|
22 |
require_once
|
|
|
23 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/system/mysql_query_logged.php";
|
|
|
24 |
require_once
|
|
|
25 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/system/artikelDatabase.php";
|
|
|
26 |
require_once
|
|
|
27 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/system/bestellung_puffern.php";
|
|
|
28 |
require_once
|
|
|
29 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/system/getVersandItems.php";
|
|
|
30 |
require_once
|
|
|
31 |
"/web/apache/content-management/Warenwirtschaft/includes/best_manu/system/getShops.php";
|
|
|
32 |
require_once
|
|
|
33 |
"/web/apache/content-management/Warenwirtschaft/includes/bestellungen/createOrderText.php"; // Ma
|
|
|
34 |
|
|
|
35 |
$self = basename( $PHP_SELF );
|
|
|
36 |
$action = $_GET['action'];
|
|
|
37 |
|
|
|
38 |
$Felddaten = explode( ";", $web_rechte["Warenwirtschaft"]["bestellung"]["mail_client"] );
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
$pos = array_search( "websettingid", $Felddaten );
|
|
|
42 |
if ( isset( $_GET["id"] ) )
|
|
|
43 |
{
|
|
|
44 |
if ( $pos !== false )
|
|
|
45 |
{
|
|
|
46 |
$adminMail = rawurldecode( $_SESSION['mailData'][$_GET["Bestellung"]][$_GET['id']]['mailfrom'] );
|
|
|
47 |
}
|
|
|
48 |
else
|
|
|
49 |
{
|
|
|
50 |
$adminMail = $Felddaten[0];
|
|
|
51 |
}
|
|
|
52 |
}
|
|
|
53 |
else
|
|
|
54 |
{
|
|
|
55 |
$adminMail = $_POST["adminMail"];
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
$pos = array_search( "noconfirm", $Felddaten );
|
|
|
59 |
$noconfirm = false;
|
|
|
60 |
if ( $pos !== false )
|
|
|
61 |
{
|
|
|
62 |
$noconfirm = true;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
$pos = array_search( "nocopy", $Felddaten );
|
|
|
66 |
$nocopy = false;
|
|
|
67 |
if ( $pos !== false )
|
|
|
68 |
{
|
|
|
69 |
$nocopy = true;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
if ( $_POST['update']['list'] )
|
|
|
73 |
{
|
|
|
74 |
$art = $_POST["button"];
|
|
|
75 |
$art = str_replace( "ä", "ae", $art );
|
|
|
76 |
$art = str_replace( "ö", "oe", $art );
|
|
|
77 |
$art = str_replace( "ü", "ue", $art );
|
|
|
78 |
$art = str_replace( "ß", "ss", $art );
|
|
|
79 |
$art = str_replace( "Ä", "Ae", $art );
|
|
|
80 |
$art = str_replace( "Ö", "Oe", $art );
|
|
|
81 |
$art = str_replace( "Ü", "Ue", $art );
|
|
|
82 |
|
|
|
83 |
$body = stripslashes( $_POST['body'] ) . "\n\n";
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
$extra = array( "shops_ID" => $_POST["shops_ID"], "bestellung" => $_POST["Bestellung"],
|
|
|
87 |
"headers" => array( "From" => $adminMail ) );
|
|
|
88 |
if ( !$nocopy )
|
|
|
89 |
{
|
|
|
90 |
$mail[] = send_email( $adminMail, $_POST['subject'], $body, $extra );
|
|
|
91 |
}
|
|
|
92 |
else
|
|
|
93 |
{
|
|
|
94 |
$mail[] = true;
|
|
|
95 |
}
|
|
|
96 |
$mail[] = send_email( $_POST['mailto'], $_POST['subject'], $body, $extra );
|
|
|
97 |
/*weban_debug( "E-Mail an Kunden:" );
|
|
|
98 |
weban_debug( $mail[1] );
|
|
|
99 |
weban_debug( "E-Mail an Admin:" );
|
|
|
100 |
weban_debug( $mail[0] );*/
|
|
|
101 |
|
|
|
102 |
$vorlage = false;
|
|
|
103 |
if ( !PEAR::isError( $mail[0] ) && !PEAR::isError( $mail[1] ) )
|
|
|
104 |
{
|
|
|
105 |
$_GET['message'] = "Die Mail wurde gesendet an: " . $_POST['mailto'];
|
|
|
106 |
$_GET['message'] .= ( !$nocopy ) ? " & $adminMail" : "";
|
|
|
107 |
$_GET['send'] = true;
|
|
|
108 |
$ln = generate_LN( $_POST["Bestellung"], $art );
|
|
|
109 |
|
|
|
110 |
$besteallart_id = ( isset( $web_rechte["Warenwirtschaft"]["bestellung"]["bestellart"] ) ) ?
|
|
|
111 |
1 : null;
|
|
|
112 |
$vorlage = checkHTMLVorlage( $_POST["shops_ID"], $bestellart_id );
|
|
|
113 |
if ( isset( $web_rechte["Warenwirtschaft"]["bestellung"]["html_emails"] ) &&
|
|
|
114 |
$vorlage )
|
|
|
115 |
{
|
|
|
116 |
create_html_pdf( $_POST["Bestellung"], $adminMail, $_POST["mailto"],
|
|
|
117 |
$body, $art, $ln );
|
|
|
118 |
}
|
|
|
119 |
else
|
|
|
120 |
{
|
|
|
121 |
create_pdf( $_POST["Bestellung"], $adminMail, $_POST["mailto"],
|
|
|
122 |
$body, $art, $ln );
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
} elseif ( $mail[0]===true && PEAR::isError( $mail[1] ) )
|
|
|
126 |
{
|
|
|
127 |
$_GET["message"] = "Fehler beim versenden an: " . $_POST["mailto"] .
|
|
|
128 |
"\n";
|
|
|
129 |
$_GET["message"] .= "Die E-Mail wurde erfolgreich an $adminMail verschickt";
|
|
|
130 |
|
|
|
131 |
} elseif ( $mail[1] ===true && PEAR::isError( $mail[0] ))
|
|
|
132 |
{
|
|
|
133 |
$_GET['message'] = "Die Mail wurde gesendet an: " . $_POST['mailto'];
|
|
|
134 |
if ( !$nocopy )
|
|
|
135 |
{
|
|
|
136 |
$_GET["message"] .= "\n";
|
|
|
137 |
$_GET["message"] .= "Fehler beim Versenden an: " . $adminMail;
|
|
|
138 |
}
|
|
|
139 |
$_GET['send'] = true;
|
|
|
140 |
$ln = generate_LN( $_POST["Bestellung"], $art );
|
|
|
141 |
|
|
|
142 |
$besteallart_id = ( isset( $web_rechte["Warenwirtschaft"]["bestellung"]["bestellart"] ) ) ?
|
|
|
143 |
1 : null;
|
|
|
144 |
$vorlage = checkHTMLVorlage( $_POST["shops_ID"], $bestellart_id );
|
|
|
145 |
if ( isset( $web_rechte["Warenwirtschaft"]["bestellung"]["html_emails"] ) &&
|
|
|
146 |
$vorlage )
|
|
|
147 |
{
|
|
|
148 |
create_html_pdf( $_POST["Bestellung"], $adminMail, $_POST["mailto"],
|
|
|
149 |
$body, $art, $ln );
|
|
|
150 |
}
|
|
|
151 |
else
|
|
|
152 |
{
|
|
|
153 |
create_pdf( $_POST["Bestellung"], $adminMail, $_POST["mailto"],
|
|
|
154 |
$body, $art, $ln );
|
|
|
155 |
}
|
|
|
156 |
}
|
|
|
157 |
else
|
|
|
158 |
{
|
|
|
159 |
$_GET['message'] = "Fehler beim versenden an: " . $_POST['mailto'] .
|
|
|
160 |
" & $adminMail";
|
|
|
161 |
$_GET['send'] = false;
|
|
|
162 |
}
|
|
|
163 |
//weban_debug( $_GET["message"] );
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
if ( $_GET["Bestellung"] )
|
|
|
167 |
{ //Dokumente ausgeben, die dieser Bestellung hinzugefügt worden sind (z. B. Rechnungen)
|
|
|
168 |
$sql = "
|
|
|
169 |
SELECT
|
|
|
170 |
document
|
|
|
171 |
FROM
|
|
|
172 |
dokumente
|
|
|
173 |
WHERE
|
|
|
174 |
data_foreign=" . $_GET["Bestellung"] . "
|
|
|
175 |
AND
|
|
|
176 |
table_foreign='Bestellung'
|
|
|
177 |
";
|
|
|
178 |
$res = mysql_query( $sql );
|
|
|
179 |
while ( $row = mysql_fetch_assoc( $res ) )
|
|
|
180 |
{
|
|
|
181 |
$dateien[] = array( "name" => $row["document"], "url" =>
|
|
|
182 |
"images/dokumente" );
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
//Dokumente ausgeben, die im Verzeichnis '/images/vorlagen' liegen
|
|
|
186 |
|
|
|
187 |
if ( file_exists( $webs["verzeichnis"] . "/images/vorlagen/" ) )
|
|
|
188 |
{
|
|
|
189 |
require_once "File/Find.php";
|
|
|
190 |
$files = File_Find::glob( "/.*/", $webs["verzeichnis"] .
|
|
|
191 |
"/images/vorlagen/", "perl" );
|
|
|
192 |
if ( is_array( $files ) )
|
|
|
193 |
{
|
|
|
194 |
foreach ( $files as $file )
|
|
|
195 |
{
|
|
|
196 |
$dateien[] = array( "name" => $file, "url" =>
|
|
|
197 |
"images/vorlagen" );
|
|
|
198 |
}
|
|
|
199 |
}
|
|
|
200 |
}
|
|
|
201 |
require_once "Weban_Smarty.class.php";
|
|
|
202 |
$GLOBALS["ui"] = new Weban_Smarty();
|
|
|
203 |
$besteallart_id = ( isset( $web_rechte["Warenwirtschaft"]["bestellung"]["bestellart"] ) ) ?
|
|
|
204 |
1 : null;
|
|
|
205 |
$vorlage = checkHTMLVorlage( $_GET["shop"], $bestellart_id );
|
|
|
206 |
$GLOBALS["ui"]->assign( "vorlage", $vorlage );
|
|
|
207 |
$GLOBALS["ui"]->compile_dir = $_SERVER["DOCUMENT_ROOT"] . "/templates_c/";
|
|
|
208 |
$GLOBALS["ui"]->compile_id = "Warenwirtschaft|MailClient";
|
|
|
209 |
$GLOBALS["ui"]->assign( "adminMail", $adminMail );
|
|
|
210 |
$GLOBALS["ui"]->assign( "dateien", $dateien );
|
|
|
211 |
$GLOBALS["ui"]->assign( "nocopy", $nocopy );
|
|
|
212 |
$GLOBALS["ui"]->assign( "noconfirm", $noconfirm );
|
|
|
213 |
$GLOBALS["ui"]->assign( "webs", $webs );
|
|
|
214 |
$GLOBALS["ui"]->assign( "web_rechte", $web_rechte );
|
|
|
215 |
$GLOBALS["ui"]->assign( "user_rechte", $user_rechte );
|
|
|
216 |
$GLOBALS["ui"]->display( "index.tpl" );
|
|
|
217 |
}
|
|
|
218 |
?>
|