076c63f7beea9304bb3e3d02ea286214590088ea
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

1) <?php
Bernd Wurst API-Authtoken, Idle-Warnung...

Bernd Wurst authored 5 years ago

2) require_once "lib/api.php";
3) require_once "lib/auftrag.php";
Bernd Wurst Großschreibung von Namen sa...

Bernd Wurst authored 4 months ago

4) require_once "lib/helper.php";
Bernd Wurst Session zerstören wenn der...

Bernd Wurst authored 1 year ago

5) if (!file_exists("../data/".date("Y"))) {
6)     mkdir("../data/".date("Y"));
7) }
8) 
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

9) session_start();
Bernd Wurst Änderungen 2024 und Cookie...

Bernd Wurst authored 5 months ago

10) if (isset($_COOKIE['MODE']) && $_COOKIE['MODE'] == 'local') {
11)     $_SESSION['mode'] = 'local';
12) }
Bernd Wurst kill idle sessions

Bernd Wurst authored 2 years ago

13) if (isset($_SESSION['last_activity']) && $_SESSION['last_activity'] < time()-(20*60)) {
14)     // Session seit 20 Minuten nicht benutzt
15)     if (isset($_SESSION['kundennr']) || isset($_SESSION['orderid'])) {
16)         // Session hat Inhalt
17)         // Auftrag lokal speichern
Bernd Wurst time() am Beginn der Datein...

Bernd Wurst authored 2 years ago

18)         $filename = "../data/".date('Y').'/'.time().'-canceledsession.json';
Bernd Wurst kill idle sessions

Bernd Wurst authored 2 years ago

19)         if (isset($_SESSION['orderid'])) {
Bernd Wurst time() am Beginn der Datein...

Bernd Wurst authored 2 years ago

20)             $filename = "../data/".date('Y').'/'.time().'-canceledsession-'.$_SESSION['orderid'].'.json';
Bernd Wurst kill idle sessions

Bernd Wurst authored 2 years ago

21)         }
22)         @file_put_contents($filename, json_encode($_SESSION));
Bernd Wurst Noch ein Versuch, den Mode...

Bernd Wurst authored 1 year ago

23)         header('Location: clear.php');
24)         die();
Bernd Wurst kill idle sessions

Bernd Wurst authored 2 years ago

25)     }
26) }
27) $_SESSION['last_activity'] = time();
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

28) $_SESSION['warnings'] = [];
29) 
30) $_SESSION['angeliefert'] = true;
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

31) 
Bernd Wurst API-Authtoken, Idle-Warnung...

Bernd Wurst authored 5 years ago

32) $handle_length = 8;
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

33) if (! isset($_SESSION['handle']) || !$_SESSION['handle']) {
34)     $random = base64_encode(md5(microtime()));
Bernd Wurst API-Authtoken, Idle-Warnung...

Bernd Wurst authored 5 years ago

35)     $_SESSION['handle'] = substr(str_replace(array('+', '=', '/'), '', $random), 0, $handle_length);
Bernd Wurst Änderungen Stand 2019

Bernd Wurst authored 5 years ago

36)     $_SESSION['date'] = date('Y-m-d H:i:s.v');
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

37)     $_SESSION['complete'] = false;
38) }
39) 
Bernd Wurst Änderungen Stand 2019

Bernd Wurst authored 5 years ago

40) 
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

41) function showError()
42) {
43)     switch ($_REQUEST['form']) {
44)         case 'start':
Bernd Wurst migration auf bootstrap-5 u...

Bernd Wurst authored 5 months ago

45)                 $redirect = 'index.php?error&num='.urlencode($number).'&lname='.urlencode($lname).'&fname='.urlencode($fname);
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

46)                 break;
47)         case 'address':
48)                 $redirect = 'address.php?error';
49)                 break;
50)         case 'anlieferung':
51)                 $redirect = 'anlieferung.php?error';
52)                 break;
53)         case 'gitterbox':
54)             $redirect = 'gitterbox.php?error';
55)             break;
56)         case 'obstart':
57)             $redirect = 'obstart.php?error';
58)             break;
59)         case 'gebrauchte':
60)             $redirect = 'gebrauchte.php?error';
61)             break;
62)         case 'auftrag':
63)             $redirect = 'auftrag.php?error';
64)             break;
65)          case 'frischsaft':
66)             $redirect = 'frischsaft.php?error';
67)             break;
68)         case 'summary':
69)             $redirect = 'summary.php?error';
70)             break;
71)     }
72)     header('Location: '.$redirect);
73)     die();
74) }
75) 
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

76) function nextPage()
77) {
78)     if (!isset($_SESSION['address_done'])) {
79)         return "address.php";
80)     } elseif (!isset($_SESSION['notification_done'])) {
81)         return "notification.php";
82)     } elseif (!isset($_SESSION['angeliefert']) && $_SESSION['mode'] != 'local') {
83)         return "anlieferung.php";
84)     } elseif (!isset($_SESSION['gitterbox_done'])) {
85)         return "gitterbox.php";
86)     } elseif (!isset($_SESSION['obstart_done'])) {
87)         return "obstart.php";
88)     } elseif (!isset($_SESSION['gebrauchte_done'])) {
89)         return "gebrauchte.php";
90)     } elseif (!isset($_SESSION['auftrag_done'])) {
91)         return "auftrag.php";
92)     } elseif (!isset($_SESSION['frischsaft_done'])) {
93)         return "frischsaft.php";
94)     } else {
95)         return 'summary.php';
96)     }
97) }
98) 
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

99) $redirect = NULL;
100) if (isset($_REQUEST['form'])) {
101)     switch ($_REQUEST['form']) {
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

102)         case 'start':
Bernd Wurst migration auf bootstrap-5 u...

Bernd Wurst authored 5 months ago

103)             $lname = '';
104)             if (isset($_REQUEST['lname']) && trim($_REQUEST['lname']) != '') {
Bernd Wurst Großschreibung von Namen sa...

Bernd Wurst authored 4 months ago

105)                 $lname = namen_korrigieren($_REQUEST['lname']);
Bernd Wurst migration auf bootstrap-5 u...

Bernd Wurst authored 5 months ago

106)             }
107)             $fname = '';
108)             if (isset($_REQUEST['fname']) && trim($_REQUEST['fname']) != '') {
Bernd Wurst Großschreibung von Namen sa...

Bernd Wurst authored 4 months ago

109)                 $fname = namen_korrigieren($_REQUEST['fname']);
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

110)             }
111) 
Bernd Wurst Änderungen 2024 und Cookie...

Bernd Wurst authored 5 months ago

112)             $number = '';
113)             if (isset($_REQUEST['phone']) && trim($_REQUEST['phone']) != '') {
114)                 $number = trim($_REQUEST['phone']);
115)             }
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

116)             if (substr($number, 0, 1) != "0" && substr($number, 0, 3) != '+49') {
Bernd Wurst Ergänze lokale Vorwahl bei...

Bernd Wurst authored 7 years ago

117)                 $number = '07192'.$number;
118)             }
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

119) 
Bernd Wurst Fange ungültige Telefonnumm...

Bernd Wurst authored 2 years ago

120)             $number = format_number_national($number);
121) 
Bernd Wurst migration auf bootstrap-5 u...

Bernd Wurst authored 5 months ago

122)             if (! $number || !$lname || !format_number_api($number)) {
123)                 $redirect = 'index.php?error&num='.urlencode($number).'&lname='.urlencode($lname).'&fname='.urlencode($fname);
Bernd Wurst Fange ungültige Telefonnumm...

Bernd Wurst authored 2 years ago

124)                 break;
125)             }
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

126) 
Bernd Wurst migration auf bootstrap-5 u...

Bernd Wurst authored 5 months ago

127)             $_SESSION['lname'] = htmlspecialchars($lname);
128)             $_SESSION['fname'] = htmlspecialchars($fname);
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 7 years ago

129)             $_SESSION['phone'] = htmlspecialchars($number);
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

130)             if (isset($_REQUEST['save']) && $_REQUEST['save'] == 'yes' && $_SESSION['mode'] != 'local') {
Bernd Wurst migration auf bootstrap-5 u...

Bernd Wurst authored 5 months ago

131)                 setcookie('LNAME', $lname, time() + 24*3600*500, "");
132)                 setcookie('FNAME', $fname, time() + 24*3600*500, "");
Bernd Wurst Cookie löschbar, Datenschut...

Bernd Wurst authored 7 years ago

133)                 setcookie('NUMBER', $number, time() + 24*3600*500, "");
134)             }
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

135) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 7 years ago

136)             $redirect = 'address.php';
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

137)             break;
138) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

139)         case 'address':
Bernd Wurst frage E-Mail-Adresse ab

Bernd Wurst authored 2 years ago

140)             $fields = array("firma", "fname", "lname", "address", "zip", "city", "email");
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

141)             foreach ($fields as $f) {
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

142)                 if (isset($_REQUEST[$f]) && trim($_REQUEST[$f]) != '') {
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 7 years ago

143)                     $_SESSION[$f] = trim(htmlspecialchars($_REQUEST[$f]));
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

144)                 } else {
145)                     if (! isset($_SESSION[$f])) {
146)                         $_SESSION[$f] = '';
147)                     }
148)                 }
149)             }
Bernd Wurst Fehlermeldungen auf BS4 por...

Bernd Wurst authored 7 years ago

150)             if ($_SESSION['lname'] == '') {
151)                 $redirect = 'address.php?error';
152)                 break;
153)             }
Bernd Wurst Änderungen 2024 und Cookie...

Bernd Wurst authored 5 months ago

154)             if ($_SESSION['fname'] != '') {
155)                 $_SESSION['name'] = $_SESSION['lname'].', '.$_SESSION['fname'];
156)             }
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

157)             if (!isset($_SESSION['kundennr']) || !$_SESSION['kundennr']) {
158)                 $_SESSION['kundennr'] = erstelle_kunde($_SESSION);
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

159)                 $_SESSION['phonenumbers'] = [$_SESSION['phone']];
160)                 $_SESSION['emailaddrs'] = [];
161)                 if ($_SESSION['email'] != '') {
162)                     $_SESSION['emailaddrs'][] = $_SESSION['email'];
163)                 }
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

164)                 if (!$_SESSION['kundennr']) {
165)                     showError();
166)                     }
Bernd Wurst frage E-Mail-Adresse ab

Bernd Wurst authored 2 years ago

167)             } else {
168)                 if (isset($_SESSION['email']) && $_SESSION['email']) {
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

169)                     // Not implemented
170)                     //update_kunde($_SESSION['kundennr'], ['email' => $_SESSION['email']]);
Bernd Wurst frage E-Mail-Adresse ab

Bernd Wurst authored 2 years ago

171)                 }
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

172)             }
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

173)             $_SESSION['address_done'] = true;
174)             $redirect = nextPage();
Bernd Wurst Auswahl, ob per E-Mail oder...

Bernd Wurst authored 1 year ago

175)             break;
176) 
177)         case 'notification':
178)             if (isset($_REQUEST['notification'])) {
Bernd Wurst Änderungen 2024 und Cookie...

Bernd Wurst authored 5 months ago

179)                 list($schema, $content) = explode(':', $_REQUEST['notification']);
180)                 if ($schema == 'sms' or $schema == 'whatsapp') {
181)                     $content = format_number_api($content);
Bernd Wurst Auswahl, ob per E-Mail oder...

Bernd Wurst authored 1 year ago

182)                 }
Bernd Wurst Änderungen 2024 und Cookie...

Bernd Wurst authored 5 months ago

183)                 $_SESSION['notificationPreference'] = $schema.':'.$content;
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

184)                 $_SESSION['notification_done'] = true;
Bernd Wurst Auswahl, ob per E-Mail oder...

Bernd Wurst authored 1 year ago

185)             }
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

186)             $redirect = nextPage();
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

187)             break;
188) 
Bernd Wurst Auswahl, ob per E-Mail oder...

Bernd Wurst authored 1 year ago

189) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

190)         case 'anlieferung':
191)             if (isset($_REQUEST['schonda'])) {
192)                 $_SESSION['angeliefert'] = true;
193)                 $redirect = 'gitterbox.php';
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

194)                 break;
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

195)             }
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

196)             if (isset($_REQUEST['kommtnoch'])) {
197)                 $_SESSION['angeliefert'] = false;
198)                 $redirect = 'gitterbox_spaeter.php';
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

199)                 break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

200)             }
201)             break;
202)         case 'gitterbox':
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

203)             if (isset($_REQUEST['lieferart'])) {
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

204)                 $_SESSION['gitterbox_done'] = true;
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

205)                 if ($_REQUEST['lieferart'] == 'gitterbox') {
206)                     $_SESSION['lieferart'] = 'gitterbox';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 7 years ago

207)                     $_SESSION['gbcount'] = htmlspecialchars($_REQUEST['gbcount']);
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

208)                 }
209)                 if ($_REQUEST['lieferart'] == 'anhaenger') {
210)                     $_SESSION['lieferart'] = 'anhaenger';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 7 years ago

211)                     $_SESSION['kennz'] = htmlspecialchars($_REQUEST['kennz']);
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

212)                     if ($_SESSION['angeliefert'] === false && ! $_SESSION['kennz']) {
213)                         $redirect = 'gitterbox_spaeter.php?error';
214)                         break;
215)                     }
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

216)                 }
217)             }
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

218)             $redirect = nextPage();
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

219)             break;
220) 
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

221)          case 'obstart':
222)             $_SESSION['obstart'] = $_REQUEST['obstart'];
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

223)             $_SESSION['obstart_done'] = true;
224)             $redirect = nextPage();
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

225) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

226)          case 'gebrauchte':
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

227)             if (isset($_REQUEST['kartonsja'])) {
228)                 $_SESSION['kartons'] = true;
229)             } 
230)             if (isset($_REQUEST['kartonsnein'])) {
231)                 $_SESSION['kartons'] = false;
232)             }
233) 
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

234)             $_SESSION['gebrauchte_done'] = true;
235)             $redirect = nextPage();
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

236)             break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

237)          case 'auftrag':
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

238)             if (isset($_REQUEST['3er'])) {
239)                 $_SESSION['neue'] = '3er';
240)             }
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

241)             if (isset($_REQUEST['5er'])) {
242)                 $_SESSION['neue'] = '5er';
243)             }
244)             if (isset($_REQUEST['10er'])) {
245)                 $_SESSION['neue'] = '10er';
246)             }
247)             if (isset($_REQUEST['submit']) && isset($_REQUEST['sonstiges']) && $_REQUEST['sonstiges'] != '') {
248)                 $_SESSION['neue'] = 'sonstiges';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 7 years ago

249)                 $_SESSION['sonstiges'] = htmlspecialchars($_REQUEST['sonstiges']);
Bernd Wurst Freitext auf separater Seite

Bernd Wurst authored 3 months ago

250)             } elseif (isset($_REQUEST['sonstiges'])) {
251)                 $_SESSION['neue'] = 'sonstiges';
252)                 $redirect = 'auftrag.php?sonstiges';
253)                 break;
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

254)             }
255) 
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

256)             $_SESSION['auftrag_done'] = true;
257)             $redirect = nextPage();
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

258)             break;
259) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

260)          case 'frischsaft':
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

261)             if (isset($_REQUEST['frischsaftnein'])) {
262)                 $_SESSION['frischsaft'] = 0;
263)             } elseif (isset($_REQUEST['frischsaft'])) {
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 7 years ago

264)                 $_SESSION['frischsaft'] = htmlspecialchars($_REQUEST['frischsaft']);
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

265)             }
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

266)             $_SESSION['frischsaft_done'] = true;
267)             $redirect = nextPage();
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

268)             break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 7 years ago

269)         case 'summary':
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 7 years ago

270)             if (isset($_REQUEST['anmerkungen'])) {
271)                 $_SESSION['anmerkungen'] = htmlspecialchars($_REQUEST['anmerkungen']);
272)             }
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

273) 
274)             $_SESSION['complete'] = true;
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

275)             $redirect = 'finish.php';
Bernd Wurst Initial commit

Bernd Wurst authored 7 years ago

276)             break;
277) 
278)     }
279) }
280) 
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

281) /*
282)  * Um das Speichern in der API kümmern wir uns, wenn Kundendaten, Obstart und grundsätzliche Auftragsdaten feststehen
283)  */
284) if (isset($_SESSION['neue'])) {
285)     // Bevor dieses Datenfeld vorhanden ist, macht Speichern keinen Sinn
286)     $auftrag = [];
287)     /* Herunterladen bringt nichts, da wir einfach immer unsere bekannten Daten rein schieben. Parallelität ist nicht gewünscht
288)      * if (isset($auftrag['id'])) {
289)         // Auftrag ist schon in der API, aktuellen Stand herunter laden
290)         $auftrag = api_call('GET', 'orders/'.$auftrag['id']);
291)     }*/
292) 
293)     // customer
294)     if (isset($_SESSION['kundennr'])) {
295)         $auftrag['customer'] = $_SESSION['kundennr'];
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

296)         $auftrag['name'] = $_SESSION['name'];
297)         $auftrag['phone'] = $_SESSION['phone'];
298)         $auftrag['email'] = isset($_SESSION['email']) ? $_SESSION['email'] : null;
Bernd Wurst Auswahl, ob per E-Mail oder...

Bernd Wurst authored 1 year ago

299)         $auftrag['notificationPreference'] = $_SESSION['notificationPreference'];
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

300)         $auftrag['fruitTypeName'] = $_SESSION['obstart'];
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

301)     }
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

302)     // containers
303)     if (isset($_SESSION['lieferart']) && $_SESSION['lieferart'] == 'gitterbox' && isset($_SESSION['gbcount']) && $_SESSION['gbcount'] > 0) {
304)         $auftrag['containers'] = array_fill(0, $_SESSION['gbcount'], [ "type" => "box", "weight" => 400 ]);
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

305)     }
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

306)     if (isset($_SESSION['lieferart']) && $_SESSION['lieferart'] == 'anhaenger') {
307)         if (!isset($_SESSION['kennz'])) {
308)             $_SESSION['kennz'] = null;
309)         }
310)         $auftrag['containers'] = [
311)             ["type" => "trailer",
312)             "weight" => 0,
313)             "label" => $_SESSION['kennz']]
314)         ];
315)     }
316)     // usedPackages
317)     if (isset($_SESSION['kartons'])) {
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

318)         $auftrag['haveUsed'] = (bool) $_SESSION['kartons'];
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

319)     }
320) 
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

321)     // plannedPackagings
322)     if (isset($_SESSION['neue'])) {
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

323)         $plan = [];
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

324)         if ($_SESSION['neue'] == 'sonstiges') {
Bernd Wurst Springe zur summary, nach d...

Bernd Wurst authored 3 months ago

325)             $auftrag['free'] = $_SESSION["sonstiges"];
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

326)         } else {
327)             $plan[] = [
328)                 "packageType" => $_SESSION['neue'],
329)                 "wish" => "rest"
330)             ];
Bernd Wurst Bugfix: Frischsaft wurde ni...

Bernd Wurst authored 2 years ago

331)         }
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

332)         if (isset($_SESSION['frischsaft']) && $_SESSION['frischsaft'] > 0) {
333)             $plan[] = [
334)                 "packageType" => "frischsaft",
335)                 "wish" => $_SESSION['frischsaft']
336)             ];
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

337)         }
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

338) 
339)         $auftrag['wishes'] = $plan;
Bernd Wurst Bugfix: Frischsaft wurde ni...

Bernd Wurst authored 2 years ago

340)         
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

341)     }
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

342) 
343) 
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

344)     // notes
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

345)     $auftrag['notes'] = '';
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

346)     if (isset($_SESSION['anmerkungen']) && $_SESSION['anmerkungen'] != '') {
Bernd Wurst free und notes getrennt

Bernd Wurst authored 3 months ago

347)         $auftrag['notes'] = $_SESSION['anmerkungen'];
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

348)     }
Bernd Wurst Änderungen 2024 und Cookie...

Bernd Wurst authored 5 months ago

349)     if ($_SESSION['mode'] != 'local') {
350)         $auftrag['notes'] .= "\nAuftrag wurde mit einem eigenen Gerät erstellt.";
351)     }
Bernd Wurst Session zerstören wenn der...

Bernd Wurst authored 1 year ago

352)     if (!isset($_SESSION['complete']) || $_SESSION['complete'] == false) {
353)         $auftrag['notes'] .= "\nAuftrag unvollständig erfasst.";
354)     }
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

355) 
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

356)     // Auftrag lokal speichern
357)     $filename = "../data/".date('Y').'/'.time().'.json';
358)     if (isset($_SESSION['orderid'])) {
Bernd Wurst time() am Beginn der Datein...

Bernd Wurst authored 2 years ago

359)         $filename = "../data/".date('Y').'/'.time().'-'.$_SESSION['orderid'].'.json';
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

360)     }
361)     @file_put_contents($filename, json_encode($auftrag));
362)      if (isset($_SESSION['orderid']) && $_SESSION['orderid']) {
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

363)         // update
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

364)         $ret = api_call('PUT', 'anonymous/updateorder/'.$_SESSION['orderid'], $auftrag);
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

365)     } else {
366)         // neu
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

367)         $ret = api_call('POST', 'anonymous/neworder', $auftrag);
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

368)     }
369)     if ($ret['status_code'] >= 400) {
370)         foreach ($ret['data']['validation_errors'] as $item) {
Bernd Wurst Fange ungültige Telefonnumm...

Bernd Wurst authored 2 years ago

371)             $_SESSION['warnings'][] = $item['key'].': '.$item['message'];
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

372)         }
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

373)         return showError();
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

374)     }
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

375)     $ret = $ret['data'];
Bernd Wurst Umstellung auf neue (anonym...

Bernd Wurst authored 3 months ago

376)     $_SESSION['orderid'] = $ret['uuid'];
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

377) 
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

378)     if (!isset($ret['id'])) {
379)         echo "Es gabe einen Fehler beim Abspeichern des Auftrags. Wir bitten dies zu entschuldigen und einen Papierauftrag auszufüllen.";
380)         file_put_contents("../error.log", 
381)             date("Y-m-d H:i:s") . ': '.json_encode($auftrag).
382)             print_r($ret, true).'\n', FILE_APPEND | LOCK_EX);
383)         die();
384)     }
385) 
386)     // Auftrag lokal speichern
387)     if (isset($_SESSION['orderid'])) {
Bernd Wurst time() am Beginn der Datein...

Bernd Wurst authored 2 years ago

388)         $filename = "../data/".date('Y').'/'.time().'-'.$_SESSION['orderid'].'.json';
Bernd Wurst API-Aufrufe über Guzzle um...

Bernd Wurst authored 2 years ago

389)     }
390)     @file_put_contents($filename, json_encode($auftrag));
Bernd Wurst Neue API 2023

Bernd Wurst authored 2 years ago

391)     /*
392)     if ($ret['status'] == 'error') {
393)         echo 'Es gibt ein Problem beim Speichern des Auftrags. Bitte verwenden Sie diesmal einen Papier-Auftrag.';
394)         die();
395)     }
396)     */
Bernd Wurst Erste Version, die über die...

Bernd Wurst authored 5 years ago

397) }
398)