@@ -20,48 +20,43 @@ public function show(Request $request, $token, $action)
2020 $ order_id = $ req ->p ->id ;
2121 $ order = Order::find ($ order_id );
2222
23- switch ($ action ) {
24- case 'show ' :
25- $ links = [];
26- $ type = $ order ->supplier ->notify_on_close_enabled ;
23+ if ($ action == 'show ' ) {
24+ $ links = [];
25+ $ type = $ order ->supplier ->notify_on_close_enabled ;
2726
28- if ($ type == 'shipping_summary ' ) {
29- $ types = ['shipping ' , 'summary ' ];
30- }
31- else {
32- $ types = [$ type ];
33- }
27+ if ($ type == 'shipping_summary ' ) {
28+ $ types = ['shipping ' , 'summary ' ];
29+ }
30+ else {
31+ $ types = [$ type ];
32+ }
3433
35- foreach ($ types as $ t ) {
36- $ base_filename = __ ('texts.orders.files.order. ' . $ t );
37- $ links [$ base_filename . ' - CSV ' ] = publicGateGetLink ('odoc ' , $ t . '_csv ' , ['id ' => $ order ->id ]);
38- $ links [$ base_filename . ' - PDF ' ] = publicGateGetLink ('odoc ' , $ t . '_pdf ' , ['id ' => $ order ->id ]);
39- }
34+ foreach ($ types as $ t ) {
35+ $ base_filename = __ ('texts.orders.files.order. ' . $ t );
36+ $ links [$ base_filename . ' - CSV ' ] = publicGateGetLink ('odoc ' , $ t . '_csv ' , ['id ' => $ order ->id ]);
37+ $ links [$ base_filename . ' - PDF ' ] = publicGateGetLink ('odoc ' , $ t . '_pdf ' , ['id ' => $ order ->id ]);
38+ }
4039
41- return view ('public.order_documents ' , [
42- 'order ' => $ order ,
43- 'links ' => $ links ,
44- ]);
45-
46- break ;
47-
48- default :
49- $ printer = new OrderPrinter ();
50- list ($ type , $ format ) = explode ('_ ' , $ action );
51-
52- return $ printer ->document ($ order , $ type , [
53- 'format ' => $ format ,
54- 'status ' => 'pending ' ,
55- 'extra_modifiers ' => 0 ,
56- 'action ' => 'download ' ,
57- ]);
40+ return view ('public.order_documents ' , [
41+ 'order ' => $ order ,
42+ 'links ' => $ links ,
43+ ]);
44+ }
45+ else {
46+ $ printer = new OrderPrinter ();
47+ list ($ type , $ format ) = explode ('_ ' , $ action );
5848
59- break ;
49+ return $ printer ->document ($ order , $ type , [
50+ 'format ' => $ format ,
51+ 'status ' => 'pending ' ,
52+ 'extra_modifiers ' => 0 ,
53+ 'action ' => 'download ' ,
54+ ]);
6055 }
6156 break ;
6257
6358 default :
64- throw new \Exception ('Richiesta ' . $ req ->t . ' non riconosciuta ' );
59+ throw new \UnexpectedValueException ('Richiesta ' . $ req ->t . ' non riconosciuta ' );
6560 break ;
6661 }
6762 }
0 commit comments