@@ -6,10 +6,10 @@ |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | $enc = $this->encoder(); |
9 | -$currencies = array_keys( $this->get( 'orderCurrencyItems', [] ) ); |
|
9 | +$currencies = array_keys($this->get('orderCurrencyItems', [])); |
|
10 | 10 | |
11 | 11 | |
12 | 12 | ?> |
13 | -<div class="dashboard-order row" data-currencies="<?= $enc->attr( json_encode( $currencies ) ) ?>"> |
|
14 | - <?= $this->get( 'orderBody' ); ?> |
|
13 | +<div class="dashboard-order row" data-currencies="<?= $enc->attr(json_encode($currencies)) ?>"> |
|
14 | + <?= $this->get('orderBody'); ?> |
|
15 | 15 | </div> |
@@ -92,14 +92,12 @@ discard block |
||
92 | 92 | $view->tabindex = ++$idx + 1; |
93 | 93 | $view->itemBody .= $client->copy(); |
94 | 94 | } |
95 | - } |
|
96 | - catch( \Aimeos\MShop\Exception $e ) |
|
95 | + } catch( \Aimeos\MShop\Exception $e ) |
|
97 | 96 | { |
98 | 97 | $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
99 | 98 | $view->errors = $view->get( 'errors', [] ) + $error; |
100 | 99 | $this->logException( $e ); |
101 | - } |
|
102 | - catch( \Exception $e ) |
|
100 | + } catch( \Exception $e ) |
|
103 | 101 | { |
104 | 102 | $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
105 | 103 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -144,14 +142,12 @@ discard block |
||
144 | 142 | $view->tabindex = ++$idx + 1; |
145 | 143 | $view->itemBody .= $client->create(); |
146 | 144 | } |
147 | - } |
|
148 | - catch( \Aimeos\MShop\Exception $e ) |
|
145 | + } catch( \Aimeos\MShop\Exception $e ) |
|
149 | 146 | { |
150 | 147 | $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
151 | 148 | $view->errors = $view->get( 'errors', [] ) + $error; |
152 | 149 | $this->logException( $e ); |
153 | - } |
|
154 | - catch( \Exception $e ) |
|
150 | + } catch( \Exception $e ) |
|
155 | 151 | { |
156 | 152 | $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
157 | 153 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -192,14 +188,12 @@ discard block |
||
192 | 188 | |
193 | 189 | $this->nextAction( $view, 'search', 'plugin', null, 'delete' ); |
194 | 190 | return; |
195 | - } |
|
196 | - catch( \Aimeos\MShop\Exception $e ) |
|
191 | + } catch( \Aimeos\MShop\Exception $e ) |
|
197 | 192 | { |
198 | 193 | $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
199 | 194 | $view->errors = $view->get( 'errors', [] ) + $error; |
200 | 195 | $this->logException( $e ); |
201 | - } |
|
202 | - catch( \Exception $e ) |
|
196 | + } catch( \Exception $e ) |
|
203 | 197 | { |
204 | 198 | $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
205 | 199 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -244,14 +238,12 @@ discard block |
||
244 | 238 | $view->tabindex = ++$idx + 1; |
245 | 239 | $view->itemBody .= $client->get(); |
246 | 240 | } |
247 | - } |
|
248 | - catch( \Aimeos\MShop\Exception $e ) |
|
241 | + } catch( \Aimeos\MShop\Exception $e ) |
|
249 | 242 | { |
250 | 243 | $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
251 | 244 | $view->errors = $view->get( 'errors', [] ) + $error; |
252 | 245 | $this->logException( $e ); |
253 | - } |
|
254 | - catch( \Exception $e ) |
|
246 | + } catch( \Exception $e ) |
|
255 | 247 | { |
256 | 248 | $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
257 | 249 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -288,18 +280,15 @@ discard block |
||
288 | 280 | |
289 | 281 | $this->nextAction( $view, $view->param( 'next' ), 'plugin', $view->item->getId(), 'save' ); |
290 | 282 | return; |
291 | - } |
|
292 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
283 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
293 | 284 | { |
294 | 285 | // fall through to create |
295 | - } |
|
296 | - catch( \Aimeos\MShop\Exception $e ) |
|
286 | + } catch( \Aimeos\MShop\Exception $e ) |
|
297 | 287 | { |
298 | 288 | $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
299 | 289 | $view->errors = $view->get( 'errors', [] ) + $error; |
300 | 290 | $this->logException( $e ); |
301 | - } |
|
302 | - catch( \Exception $e ) |
|
291 | + } catch( \Exception $e ) |
|
303 | 292 | { |
304 | 293 | $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
305 | 294 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -342,14 +331,12 @@ discard block |
||
342 | 331 | foreach( $this->getSubClients() as $client ) { |
343 | 332 | $view->itemBody .= $client->search(); |
344 | 333 | } |
345 | - } |
|
346 | - catch( \Aimeos\MShop\Exception $e ) |
|
334 | + } catch( \Aimeos\MShop\Exception $e ) |
|
347 | 335 | { |
348 | 336 | $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
349 | 337 | $view->errors = $view->get( 'errors', [] ) + $error; |
350 | 338 | $this->logException( $e ); |
351 | - } |
|
352 | - catch( \Exception $e ) |
|
339 | + } catch( \Exception $e ) |
|
353 | 340 | { |
354 | 341 | $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
355 | 342 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Plugin; |
12 | 12 | |
13 | -sprintf( 'plugin' ); // for translation |
|
13 | +sprintf('plugin'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,41 +35,41 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'plugin' ); |
|
42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'plugin'); |
|
43 | 43 | |
44 | - $view->item = $manager->getItem( $id ); |
|
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
44 | + $view->item = $manager->getItem($id); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemProviders = $this->getProviderNames(); |
48 | 48 | $view->itemDecorators = $this->getDecoratorNames(); |
49 | - $view->itemAttributes = $this->getConfigAttributes( $view->item ); |
|
49 | + $view->itemAttributes = $this->getConfigAttributes($view->item); |
|
50 | 50 | $view->itemTypes = $this->getTypeItems(); |
51 | 51 | $view->itemBody = ''; |
52 | 52 | |
53 | - foreach( $this->getSubClients() as $idx => $client ) |
|
53 | + foreach ($this->getSubClients() as $idx => $client) |
|
54 | 54 | { |
55 | 55 | $view->tabindex = ++$idx + 1; |
56 | 56 | $view->itemBody .= $client->copy(); |
57 | 57 | } |
58 | 58 | } |
59 | - catch( \Aimeos\MShop\Exception $e ) |
|
59 | + catch (\Aimeos\MShop\Exception $e) |
|
60 | 60 | { |
61 | - $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
62 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
63 | - $this->logException( $e ); |
|
61 | + $error = array('plugin-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
62 | + $view->errors = $view->get('errors', []) + $error; |
|
63 | + $this->logException($e); |
|
64 | 64 | } |
65 | - catch( \Exception $e ) |
|
65 | + catch (\Exception $e) |
|
66 | 66 | { |
67 | - $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
68 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
69 | - $this->logException( $e ); |
|
67 | + $error = array('plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
68 | + $view->errors = $view->get('errors', []) + $error; |
|
69 | + $this->logException($e); |
|
70 | 70 | } |
71 | 71 | |
72 | - return $this->render( $view ); |
|
72 | + return $this->render($view); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | |
86 | 86 | try |
87 | 87 | { |
88 | - $data = $view->param( 'item', [] ); |
|
88 | + $data = $view->param('item', []); |
|
89 | 89 | |
90 | - if( !isset( $view->item ) ) { |
|
91 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'plugin' )->createItem(); |
|
90 | + if (!isset($view->item)) { |
|
91 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'plugin')->createItem(); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $data['plugin.siteid'] = $view->item->getSiteId(); |
@@ -100,26 +100,26 @@ discard block |
||
100 | 100 | $view->itemData = $data; |
101 | 101 | $view->itemBody = ''; |
102 | 102 | |
103 | - foreach( $this->getSubClients() as $idx => $client ) |
|
103 | + foreach ($this->getSubClients() as $idx => $client) |
|
104 | 104 | { |
105 | 105 | $view->tabindex = ++$idx + 1; |
106 | 106 | $view->itemBody .= $client->create(); |
107 | 107 | } |
108 | 108 | } |
109 | - catch( \Aimeos\MShop\Exception $e ) |
|
109 | + catch (\Aimeos\MShop\Exception $e) |
|
110 | 110 | { |
111 | - $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
112 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
113 | - $this->logException( $e ); |
|
111 | + $error = array('plugin-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
112 | + $view->errors = $view->get('errors', []) + $error; |
|
113 | + $this->logException($e); |
|
114 | 114 | } |
115 | - catch( \Exception $e ) |
|
115 | + catch (\Exception $e) |
|
116 | 116 | { |
117 | - $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
118 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
119 | - $this->logException( $e ); |
|
117 | + $error = array('plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
118 | + $view->errors = $view->get('errors', []) + $error; |
|
119 | + $this->logException($e); |
|
120 | 120 | } |
121 | 121 | |
122 | - return $this->render( $view ); |
|
122 | + return $this->render($view); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -133,38 +133,38 @@ discard block |
||
133 | 133 | $view = $this->getView(); |
134 | 134 | $context = $this->getContext(); |
135 | 135 | |
136 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'plugin' ); |
|
136 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'plugin'); |
|
137 | 137 | $manager->begin(); |
138 | 138 | |
139 | 139 | try |
140 | 140 | { |
141 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
142 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
141 | + if (($id = $view->param('id')) === null) { |
|
142 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
143 | 143 | } |
144 | 144 | |
145 | - $view->item = $manager->getItem( $id ); |
|
145 | + $view->item = $manager->getItem($id); |
|
146 | 146 | |
147 | - foreach( $this->getSubClients() as $client ) { |
|
147 | + foreach ($this->getSubClients() as $client) { |
|
148 | 148 | $client->delete(); |
149 | 149 | } |
150 | 150 | |
151 | - $manager->deleteItem( $id ); |
|
151 | + $manager->deleteItem($id); |
|
152 | 152 | $manager->commit(); |
153 | 153 | |
154 | - $this->nextAction( $view, 'search', 'plugin', null, 'delete' ); |
|
154 | + $this->nextAction($view, 'search', 'plugin', null, 'delete'); |
|
155 | 155 | return; |
156 | 156 | } |
157 | - catch( \Aimeos\MShop\Exception $e ) |
|
157 | + catch (\Aimeos\MShop\Exception $e) |
|
158 | 158 | { |
159 | - $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
160 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
161 | - $this->logException( $e ); |
|
159 | + $error = array('plugin-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
160 | + $view->errors = $view->get('errors', []) + $error; |
|
161 | + $this->logException($e); |
|
162 | 162 | } |
163 | - catch( \Exception $e ) |
|
163 | + catch (\Exception $e) |
|
164 | 164 | { |
165 | - $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
166 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
167 | - $this->logException( $e ); |
|
165 | + $error = array('plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
166 | + $view->errors = $view->get('errors', []) + $error; |
|
167 | + $this->logException($e); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $manager->rollback(); |
@@ -185,41 +185,41 @@ discard block |
||
185 | 185 | |
186 | 186 | try |
187 | 187 | { |
188 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
189 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
188 | + if (($id = $view->param('id')) === null) { |
|
189 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
190 | 190 | } |
191 | 191 | |
192 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'plugin' ); |
|
192 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'plugin'); |
|
193 | 193 | |
194 | - $view->item = $manager->getItem( $id ); |
|
195 | - $view->itemData = $this->toArray( $view->item ); |
|
194 | + $view->item = $manager->getItem($id); |
|
195 | + $view->itemData = $this->toArray($view->item); |
|
196 | 196 | $view->itemSubparts = $this->getSubClientNames(); |
197 | 197 | $view->itemDecorators = $this->getDecoratorNames(); |
198 | 198 | $view->itemProviders = $this->getProviderNames(); |
199 | - $view->itemAttributes = $this->getConfigAttributes( $view->item ); |
|
199 | + $view->itemAttributes = $this->getConfigAttributes($view->item); |
|
200 | 200 | $view->itemTypes = $this->getTypeItems(); |
201 | 201 | $view->itemBody = ''; |
202 | 202 | |
203 | - foreach( $this->getSubClients() as $idx => $client ) |
|
203 | + foreach ($this->getSubClients() as $idx => $client) |
|
204 | 204 | { |
205 | 205 | $view->tabindex = ++$idx + 1; |
206 | 206 | $view->itemBody .= $client->get(); |
207 | 207 | } |
208 | 208 | } |
209 | - catch( \Aimeos\MShop\Exception $e ) |
|
209 | + catch (\Aimeos\MShop\Exception $e) |
|
210 | 210 | { |
211 | - $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
212 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
213 | - $this->logException( $e ); |
|
211 | + $error = array('plugin-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
212 | + $view->errors = $view->get('errors', []) + $error; |
|
213 | + $this->logException($e); |
|
214 | 214 | } |
215 | - catch( \Exception $e ) |
|
215 | + catch (\Exception $e) |
|
216 | 216 | { |
217 | - $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
218 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
219 | - $this->logException( $e ); |
|
217 | + $error = array('plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
218 | + $view->errors = $view->get('errors', []) + $error; |
|
219 | + $this->logException($e); |
|
220 | 220 | } |
221 | 221 | |
222 | - return $this->render( $view ); |
|
222 | + return $this->render($view); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -233,40 +233,40 @@ discard block |
||
233 | 233 | $view = $this->getView(); |
234 | 234 | $context = $this->getContext(); |
235 | 235 | |
236 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'plugin' ); |
|
236 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'plugin'); |
|
237 | 237 | $manager->begin(); |
238 | 238 | |
239 | 239 | try |
240 | 240 | { |
241 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
242 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
241 | + $item = $this->fromArray($view->param('item', [])); |
|
242 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
243 | 243 | $view->itemBody = ''; |
244 | 244 | |
245 | - foreach( $this->getSubClients() as $client ) { |
|
245 | + foreach ($this->getSubClients() as $client) { |
|
246 | 246 | $view->itemBody .= $client->save(); |
247 | 247 | } |
248 | 248 | |
249 | - $manager->saveItem( clone $view->item ); |
|
249 | + $manager->saveItem(clone $view->item); |
|
250 | 250 | $manager->commit(); |
251 | 251 | |
252 | - $this->nextAction( $view, $view->param( 'next' ), 'plugin', $view->item->getId(), 'save' ); |
|
252 | + $this->nextAction($view, $view->param('next'), 'plugin', $view->item->getId(), 'save'); |
|
253 | 253 | return; |
254 | 254 | } |
255 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
255 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
256 | 256 | { |
257 | 257 | // fall through to create |
258 | 258 | } |
259 | - catch( \Aimeos\MShop\Exception $e ) |
|
259 | + catch (\Aimeos\MShop\Exception $e) |
|
260 | 260 | { |
261 | - $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
262 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
263 | - $this->logException( $e ); |
|
261 | + $error = array('plugin-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
262 | + $view->errors = $view->get('errors', []) + $error; |
|
263 | + $this->logException($e); |
|
264 | 264 | } |
265 | - catch( \Exception $e ) |
|
265 | + catch (\Exception $e) |
|
266 | 266 | { |
267 | - $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
268 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
269 | - $this->logException( $e ); |
|
267 | + $error = array('plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
268 | + $view->errors = $view->get('errors', []) + $error; |
|
269 | + $this->logException($e); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | $manager->rollback(); |
@@ -288,35 +288,35 @@ discard block |
||
288 | 288 | try |
289 | 289 | { |
290 | 290 | $total = 0; |
291 | - $params = $this->storeSearchParams( $view->param(), 'plugin' ); |
|
292 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'plugin' ); |
|
291 | + $params = $this->storeSearchParams($view->param(), 'plugin'); |
|
292 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'plugin'); |
|
293 | 293 | |
294 | 294 | $search = $manager->createSearch(); |
295 | - $search->setSortations( [$search->sort( '+', 'plugin.type' ), $search->sort( '+', 'plugin.position' )] ); |
|
296 | - $search = $this->initCriteria( $search, $params ); |
|
295 | + $search->setSortations([$search->sort('+', 'plugin.type'), $search->sort('+', 'plugin.position')]); |
|
296 | + $search = $this->initCriteria($search, $params); |
|
297 | 297 | |
298 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
299 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
298 | + $view->items = $manager->searchItems($search, [], $total); |
|
299 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
300 | 300 | $view->filterOperators = $search->getOperators(); |
301 | 301 | $view->itemTypes = $this->getTypeItems(); |
302 | 302 | $view->total = $total; |
303 | 303 | $view->itemBody = ''; |
304 | 304 | |
305 | - foreach( $this->getSubClients() as $client ) { |
|
305 | + foreach ($this->getSubClients() as $client) { |
|
306 | 306 | $view->itemBody .= $client->search(); |
307 | 307 | } |
308 | 308 | } |
309 | - catch( \Aimeos\MShop\Exception $e ) |
|
309 | + catch (\Aimeos\MShop\Exception $e) |
|
310 | 310 | { |
311 | - $error = array( 'plugin-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
312 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
313 | - $this->logException( $e ); |
|
311 | + $error = array('plugin-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
312 | + $view->errors = $view->get('errors', []) + $error; |
|
313 | + $this->logException($e); |
|
314 | 314 | } |
315 | - catch( \Exception $e ) |
|
315 | + catch (\Exception $e) |
|
316 | 316 | { |
317 | - $error = array( 'plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
318 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
319 | - $this->logException( $e ); |
|
317 | + $error = array('plugin-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
318 | + $view->errors = $view->get('errors', []) + $error; |
|
319 | + $this->logException($e); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** admin/jqadm/plugin/template-list |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $tplconf = 'admin/jqadm/plugin/template-list'; |
342 | 342 | $default = 'plugin/list-standard'; |
343 | 343 | |
344 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
344 | + return $view->render($view->config($tplconf, $default)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * @param string|null $name Name of the sub-client (Default if null) |
353 | 353 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
354 | 354 | */ |
355 | - public function getSubClient( $type, $name = null ) |
|
355 | + public function getSubClient($type, $name = null) |
|
356 | 356 | { |
357 | 357 | /** admin/jqadm/plugin/decorators/excludes |
358 | 358 | * Excludes decorators added by the "common" option from the plugin JQAdm client |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @see admin/jqadm/plugin/decorators/excludes |
428 | 428 | * @see admin/jqadm/plugin/decorators/global |
429 | 429 | */ |
430 | - return $this->createSubClient( 'plugin/' . $type, $name ); |
|
430 | + return $this->createSubClient('plugin/' . $type, $name); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -437,13 +437,13 @@ discard block |
||
437 | 437 | * @param \Aimeos\MShop\Plugin\Item\Iface $item Plugin item incl. provider/decorator property |
438 | 438 | * @return \Aimeos\MW\Common\Critera\Attribute\Iface[] List of configuration attributes |
439 | 439 | */ |
440 | - public function getConfigAttributes( \Aimeos\MShop\Plugin\Item\Iface $item ) |
|
440 | + public function getConfigAttributes(\Aimeos\MShop\Plugin\Item\Iface $item) |
|
441 | 441 | { |
442 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'plugin' ); |
|
442 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'plugin'); |
|
443 | 443 | |
444 | 444 | try { |
445 | - return $manager->getProvider( $item, $item->getType() )->getConfigBE(); |
|
446 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
445 | + return $manager->getProvider($item, $item->getType())->getConfigBE(); |
|
446 | + } catch (\Aimeos\MShop\Exception $e) { |
|
447 | 447 | return []; |
448 | 448 | } |
449 | 449 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | protected function getDecoratorNames() |
458 | 458 | { |
459 | 459 | $ds = DIRECTORY_SEPARATOR; |
460 | - return $this->getClassNames( 'MShop' . $ds . 'Plugin' . $ds . 'Provider' . $ds . 'Decorator' ); |
|
460 | + return $this->getClassNames('MShop' . $ds . 'Plugin' . $ds . 'Provider' . $ds . 'Decorator'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | { |
471 | 471 | $ds = DIRECTORY_SEPARATOR; |
472 | 472 | return [ |
473 | - 'order' => $this->getClassNames( 'MShop' . $ds . 'Plugin' . $ds . 'Provider' . $ds . 'Order' ) |
|
473 | + 'order' => $this->getClassNames('MShop' . $ds . 'Plugin' . $ds . 'Provider' . $ds . 'Order') |
|
474 | 474 | ]; |
475 | 475 | } |
476 | 476 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @since 2017.10 |
516 | 516 | * @category Developer |
517 | 517 | */ |
518 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/plugin/standard/subparts', [] ); |
|
518 | + return $this->getContext()->getConfig()->get('admin/jqadm/plugin/standard/subparts', []); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | */ |
527 | 527 | protected function getTypeItems() |
528 | 528 | { |
529 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'plugin/type' ); |
|
529 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'plugin/type'); |
|
530 | 530 | |
531 | - $search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
532 | - $search->setSortations( array( $search->sort( '+', 'plugin.type.label' ) ) ); |
|
531 | + $search = $typeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
532 | + $search->setSortations(array($search->sort('+', 'plugin.type.label'))); |
|
533 | 533 | |
534 | - return $typeManager->searchItems( $search ); |
|
534 | + return $typeManager->searchItems($search); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | |
@@ -541,17 +541,17 @@ discard block |
||
541 | 541 | * @param string[] Data array |
542 | 542 | * @return \Aimeos\MShop\Plugin\Item\Iface New plugin item object |
543 | 543 | */ |
544 | - protected function fromArray( array $data ) |
|
544 | + protected function fromArray(array $data) |
|
545 | 545 | { |
546 | 546 | $conf = []; |
547 | 547 | |
548 | - if( isset( $data['config']['key'] ) ) |
|
548 | + if (isset($data['config']['key'])) |
|
549 | 549 | { |
550 | - foreach( (array) $data['config']['key'] as $idx => $key ) |
|
550 | + foreach ((array) $data['config']['key'] as $idx => $key) |
|
551 | 551 | { |
552 | - if( trim( $key ) !== '' && isset( $data['config']['val'][$idx] ) ) |
|
552 | + if (trim($key) !== '' && isset($data['config']['val'][$idx])) |
|
553 | 553 | { |
554 | - if( ( $val = json_decode( $data['config']['val'][$idx] ) ) === null ) { |
|
554 | + if (($val = json_decode($data['config']['val'][$idx])) === null) { |
|
555 | 555 | $conf[$key] = $data['config']['val'][$idx]; |
556 | 556 | } else { |
557 | 557 | $conf[$key] = $val; |
@@ -560,16 +560,16 @@ discard block |
||
560 | 560 | } |
561 | 561 | } |
562 | 562 | |
563 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'plugin' ); |
|
563 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'plugin'); |
|
564 | 564 | |
565 | - if( isset( $data['plugin.id'] ) && $data['plugin.id'] != '' ) { |
|
566 | - $item = $manager->getItem( $data['plugin.id'] ); |
|
565 | + if (isset($data['plugin.id']) && $data['plugin.id'] != '') { |
|
566 | + $item = $manager->getItem($data['plugin.id']); |
|
567 | 567 | } else { |
568 | 568 | $item = $manager->createItem(); |
569 | 569 | } |
570 | 570 | |
571 | - $item->fromArray( $data ); |
|
572 | - $item->setConfig( $conf ); |
|
571 | + $item->fromArray($data); |
|
572 | + $item->setConfig($conf); |
|
573 | 573 | |
574 | 574 | return $item; |
575 | 575 | } |
@@ -581,21 +581,21 @@ discard block |
||
581 | 581 | * @param \Aimeos\MShop\Plugin\Item\Iface $item Plugin item object |
582 | 582 | * @return string[] Multi-dimensional associative list of item data |
583 | 583 | */ |
584 | - protected function toArray( \Aimeos\MShop\Plugin\Item\Iface $item, $copy = false ) |
|
584 | + protected function toArray(\Aimeos\MShop\Plugin\Item\Iface $item, $copy = false) |
|
585 | 585 | { |
586 | 586 | $config = $item->getConfig(); |
587 | - $data = $item->toArray( true ); |
|
587 | + $data = $item->toArray(true); |
|
588 | 588 | $data['config'] = []; |
589 | 589 | |
590 | - if( $copy === true ) |
|
590 | + if ($copy === true) |
|
591 | 591 | { |
592 | 592 | $data['plugin.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
593 | 593 | $data['plugin.id'] = ''; |
594 | 594 | } |
595 | 595 | |
596 | - ksort( $config ); |
|
596 | + ksort($config); |
|
597 | 597 | |
598 | - foreach( $config as $key => $value ) |
|
598 | + foreach ($config as $key => $value) |
|
599 | 599 | { |
600 | 600 | $data['config']['key'][] = $key; |
601 | 601 | $data['config']['val'][] = $value; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
612 | 612 | * @return string HTML output |
613 | 613 | */ |
614 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
614 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
615 | 615 | { |
616 | 616 | /** admin/jqadm/plugin/template-item |
617 | 617 | * Relative path to the HTML body template for the plugin item. |
@@ -635,6 +635,6 @@ discard block |
||
635 | 635 | $tplconf = 'admin/jqadm/plugin/template-item'; |
636 | 636 | $default = 'plugin/item-standard'; |
637 | 637 | |
638 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
638 | + return $view->render($view->config($tplconf, $default)); |
|
639 | 639 | } |
640 | 640 | } |
@@ -111,14 +111,12 @@ |
||
111 | 111 | foreach( $this->getSubClients() as $client ) { |
112 | 112 | $view->listBody .= $client->search(); |
113 | 113 | } |
114 | - } |
|
115 | - catch( \Aimeos\MShop\Exception $e ) |
|
114 | + } catch( \Aimeos\MShop\Exception $e ) |
|
116 | 115 | { |
117 | 116 | $error = array( 'dashboard' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
118 | 117 | $view->errors = $view->get( 'errors', [] ) + $error; |
119 | 118 | $this->logException( $e ); |
120 | - } |
|
121 | - catch( \Exception $e ) |
|
119 | + } catch( \Exception $e ) |
|
122 | 120 | { |
123 | 121 | $error = array( 'dashboard' => $e->getMessage() ); |
124 | 122 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Dashboard; |
12 | 12 | |
13 | -sprintf( 'dashboard' ); // for translation |
|
13 | +sprintf('dashboard'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | { |
50 | 50 | $view->listBody = ''; |
51 | 51 | |
52 | - foreach( $this->getSubClients() as $client ) { |
|
52 | + foreach ($this->getSubClients() as $client) { |
|
53 | 53 | $view->listBody .= $client->search(); |
54 | 54 | } |
55 | 55 | } |
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
56 | + catch (\Aimeos\MShop\Exception $e) |
|
57 | 57 | { |
58 | - $error = array( 'dashboard' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
59 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
60 | - $this->logException( $e ); |
|
58 | + $error = array('dashboard' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
59 | + $view->errors = $view->get('errors', []) + $error; |
|
60 | + $this->logException($e); |
|
61 | 61 | } |
62 | - catch( \Exception $e ) |
|
62 | + catch (\Exception $e) |
|
63 | 63 | { |
64 | - $error = array( 'dashboard' => $e->getMessage() ); |
|
65 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
66 | - $this->logException( $e ); |
|
64 | + $error = array('dashboard' => $e->getMessage()); |
|
65 | + $view->errors = $view->get('errors', []) + $error; |
|
66 | + $this->logException($e); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** admin/jqadm/dashboard/template-list |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $tplconf = 'admin/jqadm/dashboard/template-list'; |
89 | 89 | $default = 'dashboard/list-standard'; |
90 | 90 | |
91 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
91 | + return $view->render($view->config($tplconf, $default)); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param string|null $name Name of the sub-client (Default if null) |
100 | 100 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
101 | 101 | */ |
102 | - public function getSubClient( $type, $name = null ) |
|
102 | + public function getSubClient($type, $name = null) |
|
103 | 103 | { |
104 | 104 | /** admin/jqadm/dashboard/decorators/excludes |
105 | 105 | * Excludes decorators added by the "common" option from the dashboard JQAdm client |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @see admin/jqadm/dashboard/decorators/excludes |
175 | 175 | * @see admin/jqadm/dashboard/decorators/global |
176 | 176 | */ |
177 | - return $this->createSubClient( 'dashboard/' . $type, $name ); |
|
177 | + return $this->createSubClient('dashboard/' . $type, $name); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -218,6 +218,6 @@ discard block |
||
218 | 218 | * @since 2016.07 |
219 | 219 | * @category Developer |
220 | 220 | */ |
221 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/dashboard/standard/subparts', [] ); |
|
221 | + return $this->getContext()->getConfig()->get('admin/jqadm/dashboard/standard/subparts', []); |
|
222 | 222 | } |
223 | 223 | } |
@@ -125,14 +125,12 @@ discard block |
||
125 | 125 | $view->tabindex = ++$idx + 1; |
126 | 126 | $view->itemBody .= $client->copy(); |
127 | 127 | } |
128 | - } |
|
129 | - catch( \Aimeos\MShop\Exception $e ) |
|
128 | + } catch( \Aimeos\MShop\Exception $e ) |
|
130 | 129 | { |
131 | 130 | $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
132 | 131 | $view->errors = $view->get( 'errors', [] ) + $error; |
133 | 132 | $this->logException( $e ); |
134 | - } |
|
135 | - catch( \Exception $e ) |
|
133 | + } catch( \Exception $e ) |
|
136 | 134 | { |
137 | 135 | $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
138 | 136 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -177,14 +175,12 @@ discard block |
||
177 | 175 | $view->tabindex = ++$idx + 1; |
178 | 176 | $view->itemBody .= $client->create(); |
179 | 177 | } |
180 | - } |
|
181 | - catch( \Aimeos\MShop\Exception $e ) |
|
178 | + } catch( \Aimeos\MShop\Exception $e ) |
|
182 | 179 | { |
183 | 180 | $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
184 | 181 | $view->errors = $view->get( 'errors', [] ) + $error; |
185 | 182 | $this->logException( $e ); |
186 | - } |
|
187 | - catch( \Exception $e ) |
|
183 | + } catch( \Exception $e ) |
|
188 | 184 | { |
189 | 185 | $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
190 | 186 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -225,14 +221,12 @@ discard block |
||
225 | 221 | |
226 | 222 | $this->nextAction( $view, 'search', 'service', null, 'delete' ); |
227 | 223 | return; |
228 | - } |
|
229 | - catch( \Aimeos\MShop\Exception $e ) |
|
224 | + } catch( \Aimeos\MShop\Exception $e ) |
|
230 | 225 | { |
231 | 226 | $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
232 | 227 | $view->errors = $view->get( 'errors', [] ) + $error; |
233 | 228 | $this->logException( $e ); |
234 | - } |
|
235 | - catch( \Exception $e ) |
|
229 | + } catch( \Exception $e ) |
|
236 | 230 | { |
237 | 231 | $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
238 | 232 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -277,14 +271,12 @@ discard block |
||
277 | 271 | $view->tabindex = ++$idx + 1; |
278 | 272 | $view->itemBody .= $client->get(); |
279 | 273 | } |
280 | - } |
|
281 | - catch( \Aimeos\MShop\Exception $e ) |
|
274 | + } catch( \Aimeos\MShop\Exception $e ) |
|
282 | 275 | { |
283 | 276 | $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
284 | 277 | $view->errors = $view->get( 'errors', [] ) + $error; |
285 | 278 | $this->logException( $e ); |
286 | - } |
|
287 | - catch( \Exception $e ) |
|
279 | + } catch( \Exception $e ) |
|
288 | 280 | { |
289 | 281 | $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
290 | 282 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -321,18 +313,15 @@ discard block |
||
321 | 313 | |
322 | 314 | $this->nextAction( $view, $view->param( 'next' ), 'service', $view->item->getId(), 'save' ); |
323 | 315 | return; |
324 | - } |
|
325 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
316 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
326 | 317 | { |
327 | 318 | // fall through to create |
328 | - } |
|
329 | - catch( \Aimeos\MShop\Exception $e ) |
|
319 | + } catch( \Aimeos\MShop\Exception $e ) |
|
330 | 320 | { |
331 | 321 | $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
332 | 322 | $view->errors = $view->get( 'errors', [] ) + $error; |
333 | 323 | $this->logException( $e ); |
334 | - } |
|
335 | - catch( \Exception $e ) |
|
324 | + } catch( \Exception $e ) |
|
336 | 325 | { |
337 | 326 | $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
338 | 327 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -375,14 +364,12 @@ discard block |
||
375 | 364 | foreach( $this->getSubClients() as $client ) { |
376 | 365 | $view->itemBody .= $client->search(); |
377 | 366 | } |
378 | - } |
|
379 | - catch( \Aimeos\MShop\Exception $e ) |
|
367 | + } catch( \Aimeos\MShop\Exception $e ) |
|
380 | 368 | { |
381 | 369 | $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
382 | 370 | $view->errors = $view->get( 'errors', [] ) + $error; |
383 | 371 | $this->logException( $e ); |
384 | - } |
|
385 | - catch( \Exception $e ) |
|
372 | + } catch( \Exception $e ) |
|
386 | 373 | { |
387 | 374 | $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
388 | 375 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service; |
12 | 12 | |
13 | -sprintf( 'service' ); // for translation |
|
13 | +sprintf('service'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,41 +35,41 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
43 | 43 | |
44 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
44 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemProviders = $this->getProviderNames(); |
48 | 48 | $view->itemDecorators = $this->getDecoratorNames(); |
49 | - $view->itemAttributes = $this->getConfigAttributes( $view->item ); |
|
49 | + $view->itemAttributes = $this->getConfigAttributes($view->item); |
|
50 | 50 | $view->itemTypes = $this->getTypeItems(); |
51 | 51 | $view->itemBody = ''; |
52 | 52 | |
53 | - foreach( $this->getSubClients() as $idx => $client ) |
|
53 | + foreach ($this->getSubClients() as $idx => $client) |
|
54 | 54 | { |
55 | 55 | $view->tabindex = ++$idx + 1; |
56 | 56 | $view->itemBody .= $client->copy(); |
57 | 57 | } |
58 | 58 | } |
59 | - catch( \Aimeos\MShop\Exception $e ) |
|
59 | + catch (\Aimeos\MShop\Exception $e) |
|
60 | 60 | { |
61 | - $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
62 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
63 | - $this->logException( $e ); |
|
61 | + $error = array('service-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
62 | + $view->errors = $view->get('errors', []) + $error; |
|
63 | + $this->logException($e); |
|
64 | 64 | } |
65 | - catch( \Exception $e ) |
|
65 | + catch (\Exception $e) |
|
66 | 66 | { |
67 | - $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
68 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
69 | - $this->logException( $e ); |
|
67 | + $error = array('service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
68 | + $view->errors = $view->get('errors', []) + $error; |
|
69 | + $this->logException($e); |
|
70 | 70 | } |
71 | 71 | |
72 | - return $this->render( $view ); |
|
72 | + return $this->render($view); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | |
86 | 86 | try |
87 | 87 | { |
88 | - $data = $view->param( 'item', [] ); |
|
88 | + $data = $view->param('item', []); |
|
89 | 89 | |
90 | - if( !isset( $view->item ) ) { |
|
91 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'service' )->createItem(); |
|
90 | + if (!isset($view->item)) { |
|
91 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'service')->createItem(); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $data['service.siteid'] = $view->item->getSiteId(); |
@@ -100,26 +100,26 @@ discard block |
||
100 | 100 | $view->itemData = $data; |
101 | 101 | $view->itemBody = ''; |
102 | 102 | |
103 | - foreach( $this->getSubClients() as $idx => $client ) |
|
103 | + foreach ($this->getSubClients() as $idx => $client) |
|
104 | 104 | { |
105 | 105 | $view->tabindex = ++$idx + 1; |
106 | 106 | $view->itemBody .= $client->create(); |
107 | 107 | } |
108 | 108 | } |
109 | - catch( \Aimeos\MShop\Exception $e ) |
|
109 | + catch (\Aimeos\MShop\Exception $e) |
|
110 | 110 | { |
111 | - $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
112 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
113 | - $this->logException( $e ); |
|
111 | + $error = array('service-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
112 | + $view->errors = $view->get('errors', []) + $error; |
|
113 | + $this->logException($e); |
|
114 | 114 | } |
115 | - catch( \Exception $e ) |
|
115 | + catch (\Exception $e) |
|
116 | 116 | { |
117 | - $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
118 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
119 | - $this->logException( $e ); |
|
117 | + $error = array('service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
118 | + $view->errors = $view->get('errors', []) + $error; |
|
119 | + $this->logException($e); |
|
120 | 120 | } |
121 | 121 | |
122 | - return $this->render( $view ); |
|
122 | + return $this->render($view); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -133,39 +133,39 @@ discard block |
||
133 | 133 | $view = $this->getView(); |
134 | 134 | $context = $this->getContext(); |
135 | 135 | |
136 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
136 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
137 | 137 | $manager->begin(); |
138 | 138 | |
139 | 139 | try |
140 | 140 | { |
141 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
142 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
141 | + if (($id = $view->param('id')) === null) { |
|
142 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
143 | 143 | } |
144 | 144 | |
145 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
145 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
146 | 146 | |
147 | - foreach( $this->getSubClients() as $client ) { |
|
147 | + foreach ($this->getSubClients() as $client) { |
|
148 | 148 | $client->delete(); |
149 | 149 | } |
150 | 150 | |
151 | - $manager->saveItem( $view->item ); |
|
152 | - $manager->deleteItem( $id ); |
|
151 | + $manager->saveItem($view->item); |
|
152 | + $manager->deleteItem($id); |
|
153 | 153 | $manager->commit(); |
154 | 154 | |
155 | - $this->nextAction( $view, 'search', 'service', null, 'delete' ); |
|
155 | + $this->nextAction($view, 'search', 'service', null, 'delete'); |
|
156 | 156 | return; |
157 | 157 | } |
158 | - catch( \Aimeos\MShop\Exception $e ) |
|
158 | + catch (\Aimeos\MShop\Exception $e) |
|
159 | 159 | { |
160 | - $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
161 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
162 | - $this->logException( $e ); |
|
160 | + $error = array('service-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
161 | + $view->errors = $view->get('errors', []) + $error; |
|
162 | + $this->logException($e); |
|
163 | 163 | } |
164 | - catch( \Exception $e ) |
|
164 | + catch (\Exception $e) |
|
165 | 165 | { |
166 | - $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
167 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
168 | - $this->logException( $e ); |
|
166 | + $error = array('service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
167 | + $view->errors = $view->get('errors', []) + $error; |
|
168 | + $this->logException($e); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | $manager->rollback(); |
@@ -186,41 +186,41 @@ discard block |
||
186 | 186 | |
187 | 187 | try |
188 | 188 | { |
189 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
190 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
189 | + if (($id = $view->param('id')) === null) { |
|
190 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
191 | 191 | } |
192 | 192 | |
193 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
193 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
194 | 194 | |
195 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
196 | - $view->itemData = $this->toArray( $view->item ); |
|
195 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
196 | + $view->itemData = $this->toArray($view->item); |
|
197 | 197 | $view->itemSubparts = $this->getSubClientNames(); |
198 | 198 | $view->itemDecorators = $this->getDecoratorNames(); |
199 | 199 | $view->itemProviders = $this->getProviderNames(); |
200 | - $view->itemAttributes = $this->getConfigAttributes( $view->item ); |
|
200 | + $view->itemAttributes = $this->getConfigAttributes($view->item); |
|
201 | 201 | $view->itemTypes = $this->getTypeItems(); |
202 | 202 | $view->itemBody = ''; |
203 | 203 | |
204 | - foreach( $this->getSubClients() as $idx => $client ) |
|
204 | + foreach ($this->getSubClients() as $idx => $client) |
|
205 | 205 | { |
206 | 206 | $view->tabindex = ++$idx + 1; |
207 | 207 | $view->itemBody .= $client->get(); |
208 | 208 | } |
209 | 209 | } |
210 | - catch( \Aimeos\MShop\Exception $e ) |
|
210 | + catch (\Aimeos\MShop\Exception $e) |
|
211 | 211 | { |
212 | - $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
213 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
214 | - $this->logException( $e ); |
|
212 | + $error = array('service-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
213 | + $view->errors = $view->get('errors', []) + $error; |
|
214 | + $this->logException($e); |
|
215 | 215 | } |
216 | - catch( \Exception $e ) |
|
216 | + catch (\Exception $e) |
|
217 | 217 | { |
218 | - $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
219 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
220 | - $this->logException( $e ); |
|
218 | + $error = array('service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
219 | + $view->errors = $view->get('errors', []) + $error; |
|
220 | + $this->logException($e); |
|
221 | 221 | } |
222 | 222 | |
223 | - return $this->render( $view ); |
|
223 | + return $this->render($view); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -234,40 +234,40 @@ discard block |
||
234 | 234 | $view = $this->getView(); |
235 | 235 | $context = $this->getContext(); |
236 | 236 | |
237 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
237 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
238 | 238 | $manager->begin(); |
239 | 239 | |
240 | 240 | try |
241 | 241 | { |
242 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
243 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
242 | + $item = $this->fromArray($view->param('item', [])); |
|
243 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
244 | 244 | $view->itemBody = ''; |
245 | 245 | |
246 | - foreach( $this->getSubClients() as $client ) { |
|
246 | + foreach ($this->getSubClients() as $client) { |
|
247 | 247 | $view->itemBody .= $client->save(); |
248 | 248 | } |
249 | 249 | |
250 | - $manager->saveItem( clone $view->item ); |
|
250 | + $manager->saveItem(clone $view->item); |
|
251 | 251 | $manager->commit(); |
252 | 252 | |
253 | - $this->nextAction( $view, $view->param( 'next' ), 'service', $view->item->getId(), 'save' ); |
|
253 | + $this->nextAction($view, $view->param('next'), 'service', $view->item->getId(), 'save'); |
|
254 | 254 | return; |
255 | 255 | } |
256 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
256 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
257 | 257 | { |
258 | 258 | // fall through to create |
259 | 259 | } |
260 | - catch( \Aimeos\MShop\Exception $e ) |
|
260 | + catch (\Aimeos\MShop\Exception $e) |
|
261 | 261 | { |
262 | - $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
263 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
264 | - $this->logException( $e ); |
|
262 | + $error = array('service-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
263 | + $view->errors = $view->get('errors', []) + $error; |
|
264 | + $this->logException($e); |
|
265 | 265 | } |
266 | - catch( \Exception $e ) |
|
266 | + catch (\Exception $e) |
|
267 | 267 | { |
268 | - $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
269 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
270 | - $this->logException( $e ); |
|
268 | + $error = array('service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
269 | + $view->errors = $view->get('errors', []) + $error; |
|
270 | + $this->logException($e); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | $manager->rollback(); |
@@ -289,35 +289,35 @@ discard block |
||
289 | 289 | try |
290 | 290 | { |
291 | 291 | $total = 0; |
292 | - $params = $this->storeSearchParams( $view->param(), 'service' ); |
|
293 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
292 | + $params = $this->storeSearchParams($view->param(), 'service'); |
|
293 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
294 | 294 | |
295 | 295 | $search = $manager->createSearch(); |
296 | - $search->setSortations( [$search->sort( '+', 'service.type' ), $search->sort( '+', 'service.position' )] ); |
|
297 | - $search = $this->initCriteria( $search, $params ); |
|
296 | + $search->setSortations([$search->sort('+', 'service.type'), $search->sort('+', 'service.position')]); |
|
297 | + $search = $this->initCriteria($search, $params); |
|
298 | 298 | |
299 | - $view->items = $manager->searchItems( $search, $this->getDomains(), $total ); |
|
300 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
299 | + $view->items = $manager->searchItems($search, $this->getDomains(), $total); |
|
300 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
301 | 301 | $view->filterOperators = $search->getOperators(); |
302 | 302 | $view->itemTypes = $this->getTypeItems(); |
303 | 303 | $view->total = $total; |
304 | 304 | $view->itemBody = ''; |
305 | 305 | |
306 | - foreach( $this->getSubClients() as $client ) { |
|
306 | + foreach ($this->getSubClients() as $client) { |
|
307 | 307 | $view->itemBody .= $client->search(); |
308 | 308 | } |
309 | 309 | } |
310 | - catch( \Aimeos\MShop\Exception $e ) |
|
310 | + catch (\Aimeos\MShop\Exception $e) |
|
311 | 311 | { |
312 | - $error = array( 'service-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
313 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
314 | - $this->logException( $e ); |
|
312 | + $error = array('service-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
313 | + $view->errors = $view->get('errors', []) + $error; |
|
314 | + $this->logException($e); |
|
315 | 315 | } |
316 | - catch( \Exception $e ) |
|
316 | + catch (\Exception $e) |
|
317 | 317 | { |
318 | - $error = array( 'service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
319 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
320 | - $this->logException( $e ); |
|
318 | + $error = array('service-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
319 | + $view->errors = $view->get('errors', []) + $error; |
|
320 | + $this->logException($e); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** admin/jqadm/service/template-list |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $tplconf = 'admin/jqadm/service/template-list'; |
343 | 343 | $default = 'service/list-standard'; |
344 | 344 | |
345 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
345 | + return $view->render($view->config($tplconf, $default)); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * @param string|null $name Name of the sub-client (Default if null) |
354 | 354 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
355 | 355 | */ |
356 | - public function getSubClient( $type, $name = null ) |
|
356 | + public function getSubClient($type, $name = null) |
|
357 | 357 | { |
358 | 358 | /** admin/jqadm/service/decorators/excludes |
359 | 359 | * Excludes decorators added by the "common" option from the service JQAdm client |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * @see admin/jqadm/service/decorators/excludes |
429 | 429 | * @see admin/jqadm/service/decorators/global |
430 | 430 | */ |
431 | - return $this->createSubClient( 'service/' . $type, $name ); |
|
431 | + return $this->createSubClient('service/' . $type, $name); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item incl. provider/decorator property |
439 | 439 | * @return \Aimeos\MW\Common\Critera\Attribute\Iface[] List of configuration attributes |
440 | 440 | */ |
441 | - public function getConfigAttributes( \Aimeos\MShop\Service\Item\Iface $item ) |
|
441 | + public function getConfigAttributes(\Aimeos\MShop\Service\Item\Iface $item) |
|
442 | 442 | { |
443 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
443 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
444 | 444 | |
445 | 445 | try { |
446 | - return $manager->getProvider( $item, $item->getType() )->getConfigBE(); |
|
447 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
446 | + return $manager->getProvider($item, $item->getType())->getConfigBE(); |
|
447 | + } catch (\Aimeos\MShop\Exception $e) { |
|
448 | 448 | return []; |
449 | 449 | } |
450 | 450 | } |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | * @since 2017.10 |
469 | 469 | * @category Developer |
470 | 470 | */ |
471 | - $domains = array( 'media', 'price', 'text' ); |
|
471 | + $domains = array('media', 'price', 'text'); |
|
472 | 472 | |
473 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/domains', $domains ); |
|
473 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/domains', $domains); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | protected function getDecoratorNames() |
483 | 483 | { |
484 | 484 | $ds = DIRECTORY_SEPARATOR; |
485 | - return $this->getClassNames( 'MShop' . $ds . 'Service' . $ds . 'Provider' . $ds . 'Decorator' ); |
|
485 | + return $this->getClassNames('MShop' . $ds . 'Service' . $ds . 'Provider' . $ds . 'Decorator'); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -495,8 +495,8 @@ discard block |
||
495 | 495 | { |
496 | 496 | $ds = DIRECTORY_SEPARATOR; |
497 | 497 | return [ |
498 | - 'delivery' => $this->getClassNames( 'MShop' . $ds . 'Service' . $ds . 'Provider' . $ds . 'Delivery' ), |
|
499 | - 'payment' => $this->getClassNames( 'MShop' . $ds . 'Service' . $ds . 'Provider' . $ds . 'Payment' ), |
|
498 | + 'delivery' => $this->getClassNames('MShop' . $ds . 'Service' . $ds . 'Provider' . $ds . 'Delivery'), |
|
499 | + 'payment' => $this->getClassNames('MShop' . $ds . 'Service' . $ds . 'Provider' . $ds . 'Payment'), |
|
500 | 500 | ]; |
501 | 501 | } |
502 | 502 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * @since 2017.10 |
542 | 542 | * @category Developer |
543 | 543 | */ |
544 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/standard/subparts', [] ); |
|
544 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/standard/subparts', []); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | */ |
553 | 553 | protected function getTypeItems() |
554 | 554 | { |
555 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service/type' ); |
|
555 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service/type'); |
|
556 | 556 | |
557 | - $search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
558 | - $search->setSortations( array( $search->sort( '+', 'service.type.label' ) ) ); |
|
557 | + $search = $typeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
558 | + $search->setSortations(array($search->sort('+', 'service.type.label'))); |
|
559 | 559 | |
560 | - return $typeManager->searchItems( $search ); |
|
560 | + return $typeManager->searchItems($search); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -567,17 +567,17 @@ discard block |
||
567 | 567 | * @param string[] Data array |
568 | 568 | * @return \Aimeos\MShop\Service\Item\Iface New service item object |
569 | 569 | */ |
570 | - protected function fromArray( array $data ) |
|
570 | + protected function fromArray(array $data) |
|
571 | 571 | { |
572 | 572 | $conf = []; |
573 | 573 | |
574 | - if( isset( $data['config']['key'] ) ) |
|
574 | + if (isset($data['config']['key'])) |
|
575 | 575 | { |
576 | - foreach( (array) $data['config']['key'] as $idx => $key ) |
|
576 | + foreach ((array) $data['config']['key'] as $idx => $key) |
|
577 | 577 | { |
578 | - if( trim( $key ) !== '' && isset( $data['config']['val'][$idx] ) ) |
|
578 | + if (trim($key) !== '' && isset($data['config']['val'][$idx])) |
|
579 | 579 | { |
580 | - if( ( $val = json_decode( $data['config']['val'][$idx] ) ) === null ) { |
|
580 | + if (($val = json_decode($data['config']['val'][$idx])) === null) { |
|
581 | 581 | $conf[$key] = $data['config']['val'][$idx]; |
582 | 582 | } else { |
583 | 583 | $conf[$key] = $val; |
@@ -586,16 +586,16 @@ discard block |
||
586 | 586 | } |
587 | 587 | } |
588 | 588 | |
589 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
589 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
590 | 590 | |
591 | - if( isset( $data['service.id'] ) && $data['service.id'] != '' ) { |
|
592 | - $item = $manager->getItem( $data['service.id'], $this->getDomains() ); |
|
591 | + if (isset($data['service.id']) && $data['service.id'] != '') { |
|
592 | + $item = $manager->getItem($data['service.id'], $this->getDomains()); |
|
593 | 593 | } else { |
594 | 594 | $item = $manager->createItem(); |
595 | 595 | } |
596 | 596 | |
597 | - $item->fromArray( $data ); |
|
598 | - $item->setConfig( $conf ); |
|
597 | + $item->fromArray($data); |
|
598 | + $item->setConfig($conf); |
|
599 | 599 | |
600 | 600 | return $item; |
601 | 601 | } |
@@ -607,22 +607,22 @@ discard block |
||
607 | 607 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object |
608 | 608 | * @return string[] Multi-dimensional associative list of item data |
609 | 609 | */ |
610 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, $copy = false ) |
|
610 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, $copy = false) |
|
611 | 611 | { |
612 | 612 | $config = $item->getConfig(); |
613 | - $data = $item->toArray( true ); |
|
613 | + $data = $item->toArray(true); |
|
614 | 614 | $data['config'] = []; |
615 | 615 | |
616 | - if( $copy === true ) |
|
616 | + if ($copy === true) |
|
617 | 617 | { |
618 | 618 | $data['service.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
619 | 619 | $data['service.code'] = $data['service.code'] . '_copy'; |
620 | 620 | $data['service.id'] = ''; |
621 | 621 | } |
622 | 622 | |
623 | - ksort( $config ); |
|
623 | + ksort($config); |
|
624 | 624 | |
625 | - foreach( $config as $key => $value ) |
|
625 | + foreach ($config as $key => $value) |
|
626 | 626 | { |
627 | 627 | $data['config']['key'][] = $key; |
628 | 628 | $data['config']['val'][] = $value; |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
639 | 639 | * @return string HTML output |
640 | 640 | */ |
641 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
641 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
642 | 642 | { |
643 | 643 | /** admin/jqadm/service/template-item |
644 | 644 | * Relative path to the HTML body template for the service item. |
@@ -662,6 +662,6 @@ discard block |
||
662 | 662 | $tplconf = 'admin/jqadm/service/template-item'; |
663 | 663 | $default = 'service/item-standard'; |
664 | 664 | |
665 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
665 | + return $view->render($view->config($tplconf, $default)); |
|
666 | 666 | } |
667 | 667 | } |
@@ -122,14 +122,12 @@ discard block |
||
122 | 122 | $view->tabindex = ++$idx + 1; |
123 | 123 | $view->itemBody .= $client->copy(); |
124 | 124 | } |
125 | - } |
|
126 | - catch( \Aimeos\MShop\Exception $e ) |
|
125 | + } catch( \Aimeos\MShop\Exception $e ) |
|
127 | 126 | { |
128 | 127 | $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
129 | 128 | $view->errors = $view->get( 'errors', [] ) + $error; |
130 | 129 | $this->logException( $e ); |
131 | - } |
|
132 | - catch( \Exception $e ) |
|
130 | + } catch( \Exception $e ) |
|
133 | 131 | { |
134 | 132 | $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
135 | 133 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -172,14 +170,12 @@ discard block |
||
172 | 170 | $view->tabindex = ++$idx + 1; |
173 | 171 | $view->itemBody .= $client->create(); |
174 | 172 | } |
175 | - } |
|
176 | - catch( \Aimeos\MShop\Exception $e ) |
|
173 | + } catch( \Aimeos\MShop\Exception $e ) |
|
177 | 174 | { |
178 | 175 | $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
179 | 176 | $view->errors = $view->get( 'errors', [] ) + $error; |
180 | 177 | $this->logException( $e ); |
181 | - } |
|
182 | - catch( \Exception $e ) |
|
178 | + } catch( \Exception $e ) |
|
183 | 179 | { |
184 | 180 | $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
185 | 181 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -220,14 +216,12 @@ discard block |
||
220 | 216 | |
221 | 217 | $this->nextAction( $view, 'search', 'customer', null, 'delete' ); |
222 | 218 | return; |
223 | - } |
|
224 | - catch( \Aimeos\MShop\Exception $e ) |
|
219 | + } catch( \Aimeos\MShop\Exception $e ) |
|
225 | 220 | { |
226 | 221 | $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
227 | 222 | $view->errors = $view->get( 'errors', [] ) + $error; |
228 | 223 | $this->logException( $e ); |
229 | - } |
|
230 | - catch( \Exception $e ) |
|
224 | + } catch( \Exception $e ) |
|
231 | 225 | { |
232 | 226 | $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
233 | 227 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -269,14 +263,12 @@ discard block |
||
269 | 263 | $view->tabindex = ++$idx + 1; |
270 | 264 | $view->itemBody .= $client->get(); |
271 | 265 | } |
272 | - } |
|
273 | - catch( \Aimeos\MShop\Exception $e ) |
|
266 | + } catch( \Aimeos\MShop\Exception $e ) |
|
274 | 267 | { |
275 | 268 | $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
276 | 269 | $view->errors = $view->get( 'errors', [] ) + $error; |
277 | 270 | $this->logException( $e ); |
278 | - } |
|
279 | - catch( \Exception $e ) |
|
271 | + } catch( \Exception $e ) |
|
280 | 272 | { |
281 | 273 | $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
282 | 274 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -313,18 +305,15 @@ discard block |
||
313 | 305 | |
314 | 306 | $this->nextAction( $view, $view->param( 'next' ), 'customer', $view->item->getId(), 'save' ); |
315 | 307 | return; |
316 | - } |
|
317 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
308 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
318 | 309 | { |
319 | 310 | // fall through to create |
320 | - } |
|
321 | - catch( \Aimeos\MShop\Exception $e ) |
|
311 | + } catch( \Aimeos\MShop\Exception $e ) |
|
322 | 312 | { |
323 | 313 | $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
324 | 314 | $view->errors = $view->get( 'errors', [] ) + $error; |
325 | 315 | $this->logException( $e ); |
326 | - } |
|
327 | - catch( \Exception $e ) |
|
316 | + } catch( \Exception $e ) |
|
328 | 317 | { |
329 | 318 | $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
330 | 319 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -363,14 +352,12 @@ discard block |
||
363 | 352 | foreach( $this->getSubClients() as $client ) { |
364 | 353 | $view->itemBody .= $client->search(); |
365 | 354 | } |
366 | - } |
|
367 | - catch( \Aimeos\MShop\Exception $e ) |
|
355 | + } catch( \Aimeos\MShop\Exception $e ) |
|
368 | 356 | { |
369 | 357 | $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
370 | 358 | $view->errors = $view->get( 'errors', [] ) + $error; |
371 | 359 | $this->logException( $e ); |
372 | - } |
|
373 | - catch( \Exception $e ) |
|
360 | + } catch( \Exception $e ) |
|
374 | 361 | { |
375 | 362 | $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
376 | 363 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Customer; |
12 | 12 | |
13 | -sprintf( 'customer' ); // for translation |
|
13 | +sprintf('customer'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,38 +35,38 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
43 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
43 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
44 | 44 | |
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemGroups = $this->getGroupItems(); |
48 | 48 | $view->itemBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $idx => $client ) |
|
50 | + foreach ($this->getSubClients() as $idx => $client) |
|
51 | 51 | { |
52 | 52 | $view->tabindex = ++$idx + 1; |
53 | 53 | $view->itemBody .= $client->copy(); |
54 | 54 | } |
55 | 55 | } |
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
56 | + catch (\Aimeos\MShop\Exception $e) |
|
57 | 57 | { |
58 | - $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
59 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
60 | - $this->logException( $e ); |
|
58 | + $error = array('customer-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
59 | + $view->errors = $view->get('errors', []) + $error; |
|
60 | + $this->logException($e); |
|
61 | 61 | } |
62 | - catch( \Exception $e ) |
|
62 | + catch (\Exception $e) |
|
63 | 63 | { |
64 | - $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
65 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
66 | - $this->logException( $e ); |
|
64 | + $error = array('customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
65 | + $view->errors = $view->get('errors', []) + $error; |
|
66 | + $this->logException($e); |
|
67 | 67 | } |
68 | 68 | |
69 | - return $this->render( $view ); |
|
69 | + return $this->render($view); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | |
83 | 83 | try |
84 | 84 | { |
85 | - $data = $view->param( 'item', [] ); |
|
85 | + $data = $view->param('item', []); |
|
86 | 86 | |
87 | - if( !isset( $view->item ) ) { |
|
88 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'customer' )->createItem(); |
|
87 | + if (!isset($view->item)) { |
|
88 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'customer')->createItem(); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $data['customer.siteid'] = $view->item->getSiteId(); |
@@ -95,26 +95,26 @@ discard block |
||
95 | 95 | $view->itemData = $data; |
96 | 96 | $view->itemBody = ''; |
97 | 97 | |
98 | - foreach( $this->getSubClients() as $idx => $client ) |
|
98 | + foreach ($this->getSubClients() as $idx => $client) |
|
99 | 99 | { |
100 | 100 | $view->tabindex = ++$idx + 1; |
101 | 101 | $view->itemBody .= $client->create(); |
102 | 102 | } |
103 | 103 | } |
104 | - catch( \Aimeos\MShop\Exception $e ) |
|
104 | + catch (\Aimeos\MShop\Exception $e) |
|
105 | 105 | { |
106 | - $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
107 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
108 | - $this->logException( $e ); |
|
106 | + $error = array('customer-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
107 | + $view->errors = $view->get('errors', []) + $error; |
|
108 | + $this->logException($e); |
|
109 | 109 | } |
110 | - catch( \Exception $e ) |
|
110 | + catch (\Exception $e) |
|
111 | 111 | { |
112 | - $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
113 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
114 | - $this->logException( $e ); |
|
112 | + $error = array('customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
113 | + $view->errors = $view->get('errors', []) + $error; |
|
114 | + $this->logException($e); |
|
115 | 115 | } |
116 | 116 | |
117 | - return $this->render( $view ); |
|
117 | + return $this->render($view); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -128,39 +128,39 @@ discard block |
||
128 | 128 | $view = $this->getView(); |
129 | 129 | $context = $this->getContext(); |
130 | 130 | |
131 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
131 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
132 | 132 | $manager->begin(); |
133 | 133 | |
134 | 134 | try |
135 | 135 | { |
136 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
137 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
136 | + if (($id = $view->param('id')) === null) { |
|
137 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
138 | 138 | } |
139 | 139 | |
140 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
140 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
141 | 141 | |
142 | - foreach( $this->getSubClients() as $client ) { |
|
142 | + foreach ($this->getSubClients() as $client) { |
|
143 | 143 | $client->delete(); |
144 | 144 | } |
145 | 145 | |
146 | - $manager->saveItem( $view->item ); |
|
147 | - $manager->deleteItem( $id ); |
|
146 | + $manager->saveItem($view->item); |
|
147 | + $manager->deleteItem($id); |
|
148 | 148 | $manager->commit(); |
149 | 149 | |
150 | - $this->nextAction( $view, 'search', 'customer', null, 'delete' ); |
|
150 | + $this->nextAction($view, 'search', 'customer', null, 'delete'); |
|
151 | 151 | return; |
152 | 152 | } |
153 | - catch( \Aimeos\MShop\Exception $e ) |
|
153 | + catch (\Aimeos\MShop\Exception $e) |
|
154 | 154 | { |
155 | - $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
156 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
157 | - $this->logException( $e ); |
|
155 | + $error = array('customer-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
156 | + $view->errors = $view->get('errors', []) + $error; |
|
157 | + $this->logException($e); |
|
158 | 158 | } |
159 | - catch( \Exception $e ) |
|
159 | + catch (\Exception $e) |
|
160 | 160 | { |
161 | - $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
162 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
163 | - $this->logException( $e ); |
|
161 | + $error = array('customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
162 | + $view->errors = $view->get('errors', []) + $error; |
|
163 | + $this->logException($e); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $manager->rollback(); |
@@ -181,38 +181,38 @@ discard block |
||
181 | 181 | |
182 | 182 | try |
183 | 183 | { |
184 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
185 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
184 | + if (($id = $view->param('id')) === null) { |
|
185 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
186 | 186 | } |
187 | 187 | |
188 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
188 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
189 | 189 | |
190 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
190 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
191 | 191 | $view->itemSubparts = $this->getSubClientNames(); |
192 | - $view->itemData = $this->toArray( $view->item ); |
|
192 | + $view->itemData = $this->toArray($view->item); |
|
193 | 193 | $view->itemGroups = $this->getGroupItems(); |
194 | 194 | $view->itemBody = ''; |
195 | 195 | |
196 | - foreach( $this->getSubClients() as $idx => $client ) |
|
196 | + foreach ($this->getSubClients() as $idx => $client) |
|
197 | 197 | { |
198 | 198 | $view->tabindex = ++$idx + 1; |
199 | 199 | $view->itemBody .= $client->get(); |
200 | 200 | } |
201 | 201 | } |
202 | - catch( \Aimeos\MShop\Exception $e ) |
|
202 | + catch (\Aimeos\MShop\Exception $e) |
|
203 | 203 | { |
204 | - $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
205 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
206 | - $this->logException( $e ); |
|
204 | + $error = array('customer-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
205 | + $view->errors = $view->get('errors', []) + $error; |
|
206 | + $this->logException($e); |
|
207 | 207 | } |
208 | - catch( \Exception $e ) |
|
208 | + catch (\Exception $e) |
|
209 | 209 | { |
210 | - $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
211 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
212 | - $this->logException( $e ); |
|
210 | + $error = array('customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
211 | + $view->errors = $view->get('errors', []) + $error; |
|
212 | + $this->logException($e); |
|
213 | 213 | } |
214 | 214 | |
215 | - return $this->render( $view ); |
|
215 | + return $this->render($view); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -226,40 +226,40 @@ discard block |
||
226 | 226 | $view = $this->getView(); |
227 | 227 | $context = $this->getContext(); |
228 | 228 | |
229 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
229 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
230 | 230 | $manager->begin(); |
231 | 231 | |
232 | 232 | try |
233 | 233 | { |
234 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
235 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
234 | + $item = $this->fromArray($view->param('item', [])); |
|
235 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
236 | 236 | $view->itemBody = ''; |
237 | 237 | |
238 | - foreach( $this->getSubClients() as $client ) { |
|
238 | + foreach ($this->getSubClients() as $client) { |
|
239 | 239 | $view->itemBody .= $client->save(); |
240 | 240 | } |
241 | 241 | |
242 | - $manager->saveItem( clone $view->item ); |
|
242 | + $manager->saveItem(clone $view->item); |
|
243 | 243 | $manager->commit(); |
244 | 244 | |
245 | - $this->nextAction( $view, $view->param( 'next' ), 'customer', $view->item->getId(), 'save' ); |
|
245 | + $this->nextAction($view, $view->param('next'), 'customer', $view->item->getId(), 'save'); |
|
246 | 246 | return; |
247 | 247 | } |
248 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
248 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
249 | 249 | { |
250 | 250 | // fall through to create |
251 | 251 | } |
252 | - catch( \Aimeos\MShop\Exception $e ) |
|
252 | + catch (\Aimeos\MShop\Exception $e) |
|
253 | 253 | { |
254 | - $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
255 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
256 | - $this->logException( $e ); |
|
254 | + $error = array('customer-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
255 | + $view->errors = $view->get('errors', []) + $error; |
|
256 | + $this->logException($e); |
|
257 | 257 | } |
258 | - catch( \Exception $e ) |
|
258 | + catch (\Exception $e) |
|
259 | 259 | { |
260 | - $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
261 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
262 | - $this->logException( $e ); |
|
260 | + $error = array('customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
261 | + $view->errors = $view->get('errors', []) + $error; |
|
262 | + $this->logException($e); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | $manager->rollback(); |
@@ -281,31 +281,31 @@ discard block |
||
281 | 281 | try |
282 | 282 | { |
283 | 283 | $total = 0; |
284 | - $params = $this->storeSearchParams( $view->param(), 'customer' ); |
|
285 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
286 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
284 | + $params = $this->storeSearchParams($view->param(), 'customer'); |
|
285 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
286 | + $search = $this->initCriteria($manager->createSearch(), $params); |
|
287 | 287 | |
288 | - $view->items = $manager->searchItems( $search, $this->getDomains(), $total ); |
|
289 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
288 | + $view->items = $manager->searchItems($search, $this->getDomains(), $total); |
|
289 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
290 | 290 | $view->filterOperators = $search->getOperators(); |
291 | 291 | $view->total = $total; |
292 | 292 | $view->itemBody = ''; |
293 | 293 | |
294 | - foreach( $this->getSubClients() as $client ) { |
|
294 | + foreach ($this->getSubClients() as $client) { |
|
295 | 295 | $view->itemBody .= $client->search(); |
296 | 296 | } |
297 | 297 | } |
298 | - catch( \Aimeos\MShop\Exception $e ) |
|
298 | + catch (\Aimeos\MShop\Exception $e) |
|
299 | 299 | { |
300 | - $error = array( 'customer-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
301 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
302 | - $this->logException( $e ); |
|
300 | + $error = array('customer-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
301 | + $view->errors = $view->get('errors', []) + $error; |
|
302 | + $this->logException($e); |
|
303 | 303 | } |
304 | - catch( \Exception $e ) |
|
304 | + catch (\Exception $e) |
|
305 | 305 | { |
306 | - $error = array( 'customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
307 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
308 | - $this->logException( $e ); |
|
306 | + $error = array('customer-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
307 | + $view->errors = $view->get('errors', []) + $error; |
|
308 | + $this->logException($e); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** admin/jqadm/customer/template-list |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $tplconf = 'admin/jqadm/customer/template-list'; |
331 | 331 | $default = 'customer/list-standard'; |
332 | 332 | |
333 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
333 | + return $view->render($view->config($tplconf, $default)); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param string|null $name Name of the sub-client (Default if null) |
342 | 342 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
343 | 343 | */ |
344 | - public function getSubClient( $type, $name = null ) |
|
344 | + public function getSubClient($type, $name = null) |
|
345 | 345 | { |
346 | 346 | /** admin/jqadm/customer/decorators/excludes |
347 | 347 | * Excludes decorators added by the "common" option from the customer JQAdm client |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @see admin/jqadm/customer/decorators/excludes |
417 | 417 | * @see admin/jqadm/customer/decorators/global |
418 | 418 | */ |
419 | - return $this->createSubClient( 'customer/' . $type, $name ); |
|
419 | + return $this->createSubClient('customer/' . $type, $name); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | */ |
441 | 441 | $domains = ['customer/address', 'customer/group', 'customer/property']; |
442 | 442 | |
443 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/customer/domains', $domains ); |
|
443 | + return $this->getContext()->getConfig()->get('admin/jqadm/customer/domains', $domains); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | protected function getGroupItems() |
453 | 453 | { |
454 | 454 | $list = []; |
455 | - $isSuper = $this->getView()->access( ['super'] ); |
|
456 | - $isAdmin = $this->getView()->access( ['admin'] ); |
|
455 | + $isSuper = $this->getView()->access(['super']); |
|
456 | + $isAdmin = $this->getView()->access(['admin']); |
|
457 | 457 | |
458 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/group' ); |
|
458 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/group'); |
|
459 | 459 | $search = $manager->createSearch(); |
460 | - $search->setSortations( [$search->sort( '+', 'customer.group.label' )] ); |
|
460 | + $search->setSortations([$search->sort('+', 'customer.group.label')]); |
|
461 | 461 | |
462 | - foreach( $manager->searchItems( $search ) as $groupId => $groupItem ) |
|
462 | + foreach ($manager->searchItems($search) as $groupId => $groupItem) |
|
463 | 463 | { |
464 | - if( !$isSuper && in_array( $groupItem->getCode(), ['super'] ) ) { |
|
464 | + if (!$isSuper && in_array($groupItem->getCode(), ['super'])) { |
|
465 | 465 | continue; |
466 | 466 | } |
467 | 467 | |
468 | - if( !$isSuper && !$isAdmin && in_array( $groupItem->getCode(), ['super', 'admin', 'editor'] ) ) { |
|
468 | + if (!$isSuper && !$isAdmin && in_array($groupItem->getCode(), ['super', 'admin', 'editor'])) { |
|
469 | 469 | continue; |
470 | 470 | } |
471 | 471 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @since 2017.07 |
517 | 517 | * @category Developer |
518 | 518 | */ |
519 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/customer/standard/subparts', [] ); |
|
519 | + return $this->getContext()->getConfig()->get('admin/jqadm/customer/standard/subparts', []); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -527,21 +527,21 @@ discard block |
||
527 | 527 | * @param string[] Data array |
528 | 528 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item object |
529 | 529 | */ |
530 | - protected function fromArray( array $data ) |
|
530 | + protected function fromArray(array $data) |
|
531 | 531 | { |
532 | 532 | $data['customer.label'] = $data['customer.firstname'] . ' ' . $data['customer.lastname']; |
533 | 533 | $data['customer.code'] = $data['customer.email']; |
534 | 534 | |
535 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
535 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
536 | 536 | |
537 | - if( isset( $data['customer.id'] ) && $data['customer.id'] != '' ) { |
|
538 | - $item = $manager->getItem( $data['customer.id'], $this->getDomains() ); |
|
537 | + if (isset($data['customer.id']) && $data['customer.id'] != '') { |
|
538 | + $item = $manager->getItem($data['customer.id'], $this->getDomains()); |
|
539 | 539 | } else { |
540 | 540 | $item = $manager->createItem(); |
541 | 541 | } |
542 | 542 | |
543 | - $item->fromArray( $data ); |
|
544 | - $item->setGroups( array_intersect( array_keys( $this->getGroupItems() ), $item->getGroups() ) ); |
|
543 | + $item->fromArray($data); |
|
544 | + $item->setGroups(array_intersect(array_keys($this->getGroupItems()), $item->getGroups())); |
|
545 | 545 | |
546 | 546 | return $item; |
547 | 547 | } |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
554 | 554 | * @return string[] Multi-dimensional associative list of item data |
555 | 555 | */ |
556 | - protected function toArray( \Aimeos\MShop\Customer\Item\Iface $item, $copy = false ) |
|
556 | + protected function toArray(\Aimeos\MShop\Customer\Item\Iface $item, $copy = false) |
|
557 | 557 | { |
558 | - $data = $item->toArray( true ); |
|
558 | + $data = $item->toArray(true); |
|
559 | 559 | |
560 | - if( $copy === true ) |
|
560 | + if ($copy === true) |
|
561 | 561 | { |
562 | 562 | $data['customer.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
563 | 563 | $data['customer.email'] = ''; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
575 | 575 | * @return string HTML output |
576 | 576 | */ |
577 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
577 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
578 | 578 | { |
579 | 579 | /** admin/jqadm/customer/template-item |
580 | 580 | * Relative path to the HTML body template for the customer item. |
@@ -598,6 +598,6 @@ discard block |
||
598 | 598 | $tplconf = 'admin/jqadm/customer/template-item'; |
599 | 599 | $default = 'customer/item-standard'; |
600 | 600 | |
601 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
601 | + return $view->render($view->config($tplconf, $default)); |
|
602 | 602 | } |
603 | 603 | } |
@@ -84,14 +84,12 @@ |
||
84 | 84 | foreach( $this->getSubClients() as $client ) { |
85 | 85 | $view->itemBody .= $client->search(); |
86 | 86 | } |
87 | - } |
|
88 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
87 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
89 | 88 | { |
90 | 89 | $error = array( 'log-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
91 | 90 | $view->errors = $view->get( 'errors', [] ) + $error; |
92 | 91 | $this->logException( $e ); |
93 | - } |
|
94 | - catch( \Exception $e ) |
|
92 | + } catch( \Exception $e ) |
|
95 | 93 | { |
96 | 94 | $error = array( 'log-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
97 | 95 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Log; |
12 | 12 | |
13 | -sprintf( 'log' ); // for translation |
|
13 | +sprintf('log'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -36,32 +36,32 @@ discard block |
||
36 | 36 | try |
37 | 37 | { |
38 | 38 | $total = 0; |
39 | - $params = $this->storeSearchParams( $view->param(), 'log' ); |
|
40 | - $manager = \Aimeos\MAdmin\Factory::createManager( $context, 'log' ); |
|
39 | + $params = $this->storeSearchParams($view->param(), 'log'); |
|
40 | + $manager = \Aimeos\MAdmin\Factory::createManager($context, 'log'); |
|
41 | 41 | |
42 | 42 | $search = $manager->createSearch(); |
43 | - $search->setSortations( [$search->sort( '-', 'log.timestamp')] ); |
|
44 | - $search = $this->initCriteria( $search, $params ); |
|
43 | + $search->setSortations([$search->sort('-', 'log.timestamp')]); |
|
44 | + $search = $this->initCriteria($search, $params); |
|
45 | 45 | |
46 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
46 | + $view->items = $manager->searchItems($search, [], $total); |
|
47 | 47 | $view->total = $total; |
48 | 48 | $view->itemBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->itemBody .= $client->search(); |
52 | 52 | } |
53 | 53 | } |
54 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
54 | + catch (\Aimeos\MAdmin\Exception $e) |
|
55 | 55 | { |
56 | - $error = array( 'log-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
57 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
58 | - $this->logException( $e ); |
|
56 | + $error = array('log-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
57 | + $view->errors = $view->get('errors', []) + $error; |
|
58 | + $this->logException($e); |
|
59 | 59 | } |
60 | - catch( \Exception $e ) |
|
60 | + catch (\Exception $e) |
|
61 | 61 | { |
62 | - $error = array( 'log-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
63 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
64 | - $this->logException( $e ); |
|
62 | + $error = array('log-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
63 | + $view->errors = $view->get('errors', []) + $error; |
|
64 | + $this->logException($e); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** admin/jqadm/log/template-list |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $tplconf = 'admin/jqadm/log/template-list'; |
87 | 87 | $default = 'log/list-standard'; |
88 | 88 | |
89 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
89 | + return $view->render($view->config($tplconf, $default)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param string|null $name Name of the sub-client (Default if null) |
98 | 98 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
99 | 99 | */ |
100 | - public function getSubClient( $type, $name = null ) |
|
100 | + public function getSubClient($type, $name = null) |
|
101 | 101 | { |
102 | 102 | /** admin/jqadm/log/decorators/excludes |
103 | 103 | * Excludes decorators added by the "common" option from the log JQAdm client |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @see admin/jqadm/log/decorators/excludes |
173 | 173 | * @see admin/jqadm/log/decorators/global |
174 | 174 | */ |
175 | - return $this->createSubClient( 'log/' . $type, $name ); |
|
175 | + return $this->createSubClient('log/' . $type, $name); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @since 2018.04 |
217 | 217 | * @category Developer |
218 | 218 | */ |
219 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/log/standard/subparts', [] ); |
|
219 | + return $this->getContext()->getConfig()->get('admin/jqadm/log/standard/subparts', []); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
227 | 227 | * @return string HTML output |
228 | 228 | */ |
229 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
229 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
230 | 230 | { |
231 | 231 | /** admin/jqadm/log/template-item |
232 | 232 | * Relative path to the HTML body template for the log item. |
@@ -250,6 +250,6 @@ discard block |
||
250 | 250 | $tplconf = 'admin/jqadm/log/template-item'; |
251 | 251 | $default = 'log/item-standard'; |
252 | 252 | |
253 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
253 | + return $view->render($view->config($tplconf, $default)); |
|
254 | 254 | } |
255 | 255 | } |
@@ -121,14 +121,12 @@ discard block |
||
121 | 121 | $view->tabindex = ++$idx + 1; |
122 | 122 | $view->itemBody .= $client->copy(); |
123 | 123 | } |
124 | - } |
|
125 | - catch( \Aimeos\MShop\Exception $e ) |
|
124 | + } catch( \Aimeos\MShop\Exception $e ) |
|
126 | 125 | { |
127 | 126 | $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
128 | 127 | $view->errors = $view->get( 'errors', [] ) + $error; |
129 | 128 | $this->logException( $e ); |
130 | - } |
|
131 | - catch( \Exception $e ) |
|
129 | + } catch( \Exception $e ) |
|
132 | 130 | { |
133 | 131 | $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
134 | 132 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -170,14 +168,12 @@ discard block |
||
170 | 168 | $view->tabindex = ++$idx + 1; |
171 | 169 | $view->itemBody .= $client->create(); |
172 | 170 | } |
173 | - } |
|
174 | - catch( \Aimeos\MShop\Exception $e ) |
|
171 | + } catch( \Aimeos\MShop\Exception $e ) |
|
175 | 172 | { |
176 | 173 | $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
177 | 174 | $view->errors = $view->get( 'errors', [] ) + $error; |
178 | 175 | $this->logException( $e ); |
179 | - } |
|
180 | - catch( \Exception $e ) |
|
176 | + } catch( \Exception $e ) |
|
181 | 177 | { |
182 | 178 | $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
183 | 179 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -218,14 +214,12 @@ discard block |
||
218 | 214 | |
219 | 215 | $this->nextAction( $view, 'search', 'supplier', null, 'delete' ); |
220 | 216 | return; |
221 | - } |
|
222 | - catch( \Aimeos\MShop\Exception $e ) |
|
217 | + } catch( \Aimeos\MShop\Exception $e ) |
|
223 | 218 | { |
224 | 219 | $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
225 | 220 | $view->errors = $view->get( 'errors', [] ) + $error; |
226 | 221 | $this->logException( $e ); |
227 | - } |
|
228 | - catch( \Exception $e ) |
|
222 | + } catch( \Exception $e ) |
|
229 | 223 | { |
230 | 224 | $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
231 | 225 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -266,14 +260,12 @@ discard block |
||
266 | 260 | $view->tabindex = ++$idx + 1; |
267 | 261 | $view->itemBody .= $client->get(); |
268 | 262 | } |
269 | - } |
|
270 | - catch( \Aimeos\MShop\Exception $e ) |
|
263 | + } catch( \Aimeos\MShop\Exception $e ) |
|
271 | 264 | { |
272 | 265 | $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
273 | 266 | $view->errors = $view->get( 'errors', [] ) + $error; |
274 | 267 | $this->logException( $e ); |
275 | - } |
|
276 | - catch( \Exception $e ) |
|
268 | + } catch( \Exception $e ) |
|
277 | 269 | { |
278 | 270 | $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
279 | 271 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -310,18 +302,15 @@ discard block |
||
310 | 302 | |
311 | 303 | $this->nextAction( $view, $view->param( 'next' ), 'supplier', $view->item->getId(), 'save' ); |
312 | 304 | return; |
313 | - } |
|
314 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
305 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
315 | 306 | { |
316 | 307 | // fall through to create |
317 | - } |
|
318 | - catch( \Aimeos\MShop\Exception $e ) |
|
308 | + } catch( \Aimeos\MShop\Exception $e ) |
|
319 | 309 | { |
320 | 310 | $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
321 | 311 | $view->errors = $view->get( 'errors', [] ) + $error; |
322 | 312 | $this->logException( $e ); |
323 | - } |
|
324 | - catch( \Exception $e ) |
|
313 | + } catch( \Exception $e ) |
|
325 | 314 | { |
326 | 315 | $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
327 | 316 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -360,14 +349,12 @@ discard block |
||
360 | 349 | foreach( $this->getSubClients() as $client ) { |
361 | 350 | $view->itemBody .= $client->search(); |
362 | 351 | } |
363 | - } |
|
364 | - catch( \Aimeos\MShop\Exception $e ) |
|
352 | + } catch( \Aimeos\MShop\Exception $e ) |
|
365 | 353 | { |
366 | 354 | $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
367 | 355 | $view->errors = $view->get( 'errors', [] ) + $error; |
368 | 356 | $this->logException( $e ); |
369 | - } |
|
370 | - catch( \Exception $e ) |
|
357 | + } catch( \Exception $e ) |
|
371 | 358 | { |
372 | 359 | $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
373 | 360 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Supplier; |
12 | 12 | |
13 | -sprintf( 'supplier' ); // for translation |
|
13 | +sprintf('supplier'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,37 +35,37 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
|
43 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'supplier'); |
|
43 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
44 | 44 | |
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemBody = ''; |
48 | 48 | |
49 | - foreach( $this->getSubClients() as $idx => $client ) |
|
49 | + foreach ($this->getSubClients() as $idx => $client) |
|
50 | 50 | { |
51 | 51 | $view->tabindex = ++$idx + 1; |
52 | 52 | $view->itemBody .= $client->copy(); |
53 | 53 | } |
54 | 54 | } |
55 | - catch( \Aimeos\MShop\Exception $e ) |
|
55 | + catch (\Aimeos\MShop\Exception $e) |
|
56 | 56 | { |
57 | - $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
59 | - $this->logException( $e ); |
|
57 | + $error = array('supplier-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
58 | + $view->errors = $view->get('errors', []) + $error; |
|
59 | + $this->logException($e); |
|
60 | 60 | } |
61 | - catch( \Exception $e ) |
|
61 | + catch (\Exception $e) |
|
62 | 62 | { |
63 | - $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
65 | - $this->logException( $e ); |
|
63 | + $error = array('supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
64 | + $view->errors = $view->get('errors', []) + $error; |
|
65 | + $this->logException($e); |
|
66 | 66 | } |
67 | 67 | |
68 | - return $this->render( $view ); |
|
68 | + return $this->render($view); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | try |
83 | 83 | { |
84 | - $data = $view->param( 'item', [] ); |
|
84 | + $data = $view->param('item', []); |
|
85 | 85 | |
86 | - if( !isset( $view->item ) ) { |
|
87 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'supplier' )->createItem(); |
|
86 | + if (!isset($view->item)) { |
|
87 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'supplier')->createItem(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $data['supplier.siteid'] = $view->item->getSiteId(); |
@@ -93,26 +93,26 @@ discard block |
||
93 | 93 | $view->itemData = $data; |
94 | 94 | $view->itemBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $idx => $client ) |
|
96 | + foreach ($this->getSubClients() as $idx => $client) |
|
97 | 97 | { |
98 | 98 | $view->tabindex = ++$idx + 1; |
99 | 99 | $view->itemBody .= $client->create(); |
100 | 100 | } |
101 | 101 | } |
102 | - catch( \Aimeos\MShop\Exception $e ) |
|
102 | + catch (\Aimeos\MShop\Exception $e) |
|
103 | 103 | { |
104 | - $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
105 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
106 | - $this->logException( $e ); |
|
104 | + $error = array('supplier-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
105 | + $view->errors = $view->get('errors', []) + $error; |
|
106 | + $this->logException($e); |
|
107 | 107 | } |
108 | - catch( \Exception $e ) |
|
108 | + catch (\Exception $e) |
|
109 | 109 | { |
110 | - $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
111 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
112 | - $this->logException( $e ); |
|
110 | + $error = array('supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
111 | + $view->errors = $view->get('errors', []) + $error; |
|
112 | + $this->logException($e); |
|
113 | 113 | } |
114 | 114 | |
115 | - return $this->render( $view ); |
|
115 | + return $this->render($view); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -126,39 +126,39 @@ discard block |
||
126 | 126 | $view = $this->getView(); |
127 | 127 | $context = $this->getContext(); |
128 | 128 | |
129 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
|
129 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'supplier'); |
|
130 | 130 | $manager->begin(); |
131 | 131 | |
132 | 132 | try |
133 | 133 | { |
134 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
135 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
134 | + if (($id = $view->param('id')) === null) { |
|
135 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
136 | 136 | } |
137 | 137 | |
138 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
138 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
139 | 139 | |
140 | - foreach( $this->getSubClients() as $client ) { |
|
140 | + foreach ($this->getSubClients() as $client) { |
|
141 | 141 | $client->delete(); |
142 | 142 | } |
143 | 143 | |
144 | - $manager->saveItem( $view->item ); |
|
145 | - $manager->deleteItem( $id ); |
|
144 | + $manager->saveItem($view->item); |
|
145 | + $manager->deleteItem($id); |
|
146 | 146 | $manager->commit(); |
147 | 147 | |
148 | - $this->nextAction( $view, 'search', 'supplier', null, 'delete' ); |
|
148 | + $this->nextAction($view, 'search', 'supplier', null, 'delete'); |
|
149 | 149 | return; |
150 | 150 | } |
151 | - catch( \Aimeos\MShop\Exception $e ) |
|
151 | + catch (\Aimeos\MShop\Exception $e) |
|
152 | 152 | { |
153 | - $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
154 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
155 | - $this->logException( $e ); |
|
153 | + $error = array('supplier-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
154 | + $view->errors = $view->get('errors', []) + $error; |
|
155 | + $this->logException($e); |
|
156 | 156 | } |
157 | - catch( \Exception $e ) |
|
157 | + catch (\Exception $e) |
|
158 | 158 | { |
159 | - $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
160 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
161 | - $this->logException( $e ); |
|
159 | + $error = array('supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
160 | + $view->errors = $view->get('errors', []) + $error; |
|
161 | + $this->logException($e); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $manager->rollback(); |
@@ -179,37 +179,37 @@ discard block |
||
179 | 179 | |
180 | 180 | try |
181 | 181 | { |
182 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
183 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
182 | + if (($id = $view->param('id')) === null) { |
|
183 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
184 | 184 | } |
185 | 185 | |
186 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
|
186 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'supplier'); |
|
187 | 187 | |
188 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
188 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
189 | 189 | $view->itemSubparts = $this->getSubClientNames(); |
190 | - $view->itemData = $this->toArray( $view->item ); |
|
190 | + $view->itemData = $this->toArray($view->item); |
|
191 | 191 | $view->itemBody = ''; |
192 | 192 | |
193 | - foreach( $this->getSubClients() as $idx => $client ) |
|
193 | + foreach ($this->getSubClients() as $idx => $client) |
|
194 | 194 | { |
195 | 195 | $view->tabindex = ++$idx + 1; |
196 | 196 | $view->itemBody .= $client->get(); |
197 | 197 | } |
198 | 198 | } |
199 | - catch( \Aimeos\MShop\Exception $e ) |
|
199 | + catch (\Aimeos\MShop\Exception $e) |
|
200 | 200 | { |
201 | - $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
202 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
203 | - $this->logException( $e ); |
|
201 | + $error = array('supplier-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
202 | + $view->errors = $view->get('errors', []) + $error; |
|
203 | + $this->logException($e); |
|
204 | 204 | } |
205 | - catch( \Exception $e ) |
|
205 | + catch (\Exception $e) |
|
206 | 206 | { |
207 | - $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
208 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
209 | - $this->logException( $e ); |
|
207 | + $error = array('supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
208 | + $view->errors = $view->get('errors', []) + $error; |
|
209 | + $this->logException($e); |
|
210 | 210 | } |
211 | 211 | |
212 | - return $this->render( $view ); |
|
212 | + return $this->render($view); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -223,40 +223,40 @@ discard block |
||
223 | 223 | $view = $this->getView(); |
224 | 224 | $context = $this->getContext(); |
225 | 225 | |
226 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
|
226 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'supplier'); |
|
227 | 227 | $manager->begin(); |
228 | 228 | |
229 | 229 | try |
230 | 230 | { |
231 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
232 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
231 | + $item = $this->fromArray($view->param('item', [])); |
|
232 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
233 | 233 | $view->itemBody = ''; |
234 | 234 | |
235 | - foreach( $this->getSubClients() as $client ) { |
|
235 | + foreach ($this->getSubClients() as $client) { |
|
236 | 236 | $view->itemBody .= $client->save(); |
237 | 237 | } |
238 | 238 | |
239 | - $manager->saveItem( clone $view->item ); |
|
239 | + $manager->saveItem(clone $view->item); |
|
240 | 240 | $manager->commit(); |
241 | 241 | |
242 | - $this->nextAction( $view, $view->param( 'next' ), 'supplier', $view->item->getId(), 'save' ); |
|
242 | + $this->nextAction($view, $view->param('next'), 'supplier', $view->item->getId(), 'save'); |
|
243 | 243 | return; |
244 | 244 | } |
245 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
245 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
246 | 246 | { |
247 | 247 | // fall through to create |
248 | 248 | } |
249 | - catch( \Aimeos\MShop\Exception $e ) |
|
249 | + catch (\Aimeos\MShop\Exception $e) |
|
250 | 250 | { |
251 | - $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
252 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
253 | - $this->logException( $e ); |
|
251 | + $error = array('supplier-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
252 | + $view->errors = $view->get('errors', []) + $error; |
|
253 | + $this->logException($e); |
|
254 | 254 | } |
255 | - catch( \Exception $e ) |
|
255 | + catch (\Exception $e) |
|
256 | 256 | { |
257 | - $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
258 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
259 | - $this->logException( $e ); |
|
257 | + $error = array('supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
258 | + $view->errors = $view->get('errors', []) + $error; |
|
259 | + $this->logException($e); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | $manager->rollback(); |
@@ -278,31 +278,31 @@ discard block |
||
278 | 278 | try |
279 | 279 | { |
280 | 280 | $total = 0; |
281 | - $params = $this->storeSearchParams( $view->param(), 'supplier' ); |
|
282 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
|
283 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
281 | + $params = $this->storeSearchParams($view->param(), 'supplier'); |
|
282 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'supplier'); |
|
283 | + $search = $this->initCriteria($manager->createSearch(), $params); |
|
284 | 284 | |
285 | - $view->items = $manager->searchItems( $search, $this->getDomains(), $total ); |
|
286 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
285 | + $view->items = $manager->searchItems($search, $this->getDomains(), $total); |
|
286 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
287 | 287 | $view->filterOperators = $search->getOperators(); |
288 | 288 | $view->total = $total; |
289 | 289 | $view->itemBody = ''; |
290 | 290 | |
291 | - foreach( $this->getSubClients() as $client ) { |
|
291 | + foreach ($this->getSubClients() as $client) { |
|
292 | 292 | $view->itemBody .= $client->search(); |
293 | 293 | } |
294 | 294 | } |
295 | - catch( \Aimeos\MShop\Exception $e ) |
|
295 | + catch (\Aimeos\MShop\Exception $e) |
|
296 | 296 | { |
297 | - $error = array( 'supplier-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
298 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
299 | - $this->logException( $e ); |
|
297 | + $error = array('supplier-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
298 | + $view->errors = $view->get('errors', []) + $error; |
|
299 | + $this->logException($e); |
|
300 | 300 | } |
301 | - catch( \Exception $e ) |
|
301 | + catch (\Exception $e) |
|
302 | 302 | { |
303 | - $error = array( 'supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
304 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
305 | - $this->logException( $e ); |
|
303 | + $error = array('supplier-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
304 | + $view->errors = $view->get('errors', []) + $error; |
|
305 | + $this->logException($e); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** admin/jqadm/supplier/template-list |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $tplconf = 'admin/jqadm/supplier/template-list'; |
328 | 328 | $default = 'supplier/list-standard'; |
329 | 329 | |
330 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
330 | + return $view->render($view->config($tplconf, $default)); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @param string|null $name Name of the sub-client (Default if null) |
339 | 339 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
340 | 340 | */ |
341 | - public function getSubClient( $type, $name = null ) |
|
341 | + public function getSubClient($type, $name = null) |
|
342 | 342 | { |
343 | 343 | /** admin/jqadm/supplier/decorators/excludes |
344 | 344 | * Excludes decorators added by the "common" option from the supplier JQAdm client |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @see admin/jqadm/supplier/decorators/excludes |
414 | 414 | * @see admin/jqadm/supplier/decorators/global |
415 | 415 | */ |
416 | - return $this->createSubClient( 'supplier/' . $type, $name ); |
|
416 | + return $this->createSubClient('supplier/' . $type, $name); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | $domains = ['media', 'supplier/address', 'text']; |
439 | 439 | |
440 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/supplier/domains', $domains ); |
|
440 | + return $this->getContext()->getConfig()->get('admin/jqadm/supplier/domains', $domains); |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | * @since 2017.10 |
482 | 482 | * @category Developer |
483 | 483 | */ |
484 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/supplier/standard/subparts', [] ); |
|
484 | + return $this->getContext()->getConfig()->get('admin/jqadm/supplier/standard/subparts', []); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -492,17 +492,17 @@ discard block |
||
492 | 492 | * @param string[] Data array |
493 | 493 | * @return \Aimeos\MShop\Supplier\Item\Iface New supplier item object |
494 | 494 | */ |
495 | - protected function fromArray( array $data ) |
|
495 | + protected function fromArray(array $data) |
|
496 | 496 | { |
497 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' ); |
|
497 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'supplier'); |
|
498 | 498 | |
499 | - if( isset( $data['supplier.id'] ) && $data['supplier.id'] != '' ) { |
|
500 | - $item = $manager->getItem( $data['supplier.id'], $this->getDomains() ); |
|
499 | + if (isset($data['supplier.id']) && $data['supplier.id'] != '') { |
|
500 | + $item = $manager->getItem($data['supplier.id'], $this->getDomains()); |
|
501 | 501 | } else { |
502 | 502 | $item = $manager->createItem(); |
503 | 503 | } |
504 | 504 | |
505 | - $item->fromArray( $data ); |
|
505 | + $item->fromArray($data); |
|
506 | 506 | |
507 | 507 | return $item; |
508 | 508 | } |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | * @param \Aimeos\MShop\Supplier\Item\Iface $item Supplier item object |
515 | 515 | * @return string[] Multi-dimensional associative list of item data |
516 | 516 | */ |
517 | - protected function toArray( \Aimeos\MShop\Supplier\Item\Iface $item, $copy = false ) |
|
517 | + protected function toArray(\Aimeos\MShop\Supplier\Item\Iface $item, $copy = false) |
|
518 | 518 | { |
519 | - $data = $item->toArray( true ); |
|
519 | + $data = $item->toArray(true); |
|
520 | 520 | |
521 | - if( $copy === true ) |
|
521 | + if ($copy === true) |
|
522 | 522 | { |
523 | 523 | $data['supplier.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
524 | 524 | $data['supplier.code'] = $data['supplier.code'] . '_copy'; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
536 | 536 | * @return string HTML output |
537 | 537 | */ |
538 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
538 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
539 | 539 | { |
540 | 540 | /** admin/jqadm/supplier/template-item |
541 | 541 | * Relative path to the HTML body template for the supplier item. |
@@ -559,6 +559,6 @@ discard block |
||
559 | 559 | $tplconf = 'admin/jqadm/supplier/template-item'; |
560 | 560 | $default = 'supplier/item-standard'; |
561 | 561 | |
562 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
562 | + return $view->render($view->config($tplconf, $default)); |
|
563 | 563 | } |
564 | 564 | } |
@@ -133,14 +133,12 @@ discard block |
||
133 | 133 | $view->tabindex = ++$idx + 1; |
134 | 134 | $view->itemBody .= $client->copy(); |
135 | 135 | } |
136 | - } |
|
137 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + } catch( \Aimeos\MShop\Exception $e ) |
|
138 | 137 | { |
139 | 138 | $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
140 | 139 | $view->errors = $view->get( 'errors', [] ) + $error; |
141 | 140 | $this->logException( $e ); |
142 | - } |
|
143 | - catch( \Exception $e ) |
|
141 | + } catch( \Exception $e ) |
|
144 | 142 | { |
145 | 143 | $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
146 | 144 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -183,14 +181,12 @@ discard block |
||
183 | 181 | $view->tabindex = ++$idx + 1; |
184 | 182 | $view->itemBody .= $client->create(); |
185 | 183 | } |
186 | - } |
|
187 | - catch( \Aimeos\MShop\Exception $e ) |
|
184 | + } catch( \Aimeos\MShop\Exception $e ) |
|
188 | 185 | { |
189 | 186 | $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
190 | 187 | $view->errors = $view->get( 'errors', [] ) + $error; |
191 | 188 | $this->logException( $e ); |
192 | - } |
|
193 | - catch( \Exception $e ) |
|
189 | + } catch( \Exception $e ) |
|
194 | 190 | { |
195 | 191 | $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
196 | 192 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -231,14 +227,12 @@ discard block |
||
231 | 227 | |
232 | 228 | $this->nextAction( $view, 'search', 'attribute', null, 'delete' ); |
233 | 229 | return; |
234 | - } |
|
235 | - catch( \Aimeos\MShop\Exception $e ) |
|
230 | + } catch( \Aimeos\MShop\Exception $e ) |
|
236 | 231 | { |
237 | 232 | $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
238 | 233 | $view->errors = $view->get( 'errors', [] ) + $error; |
239 | 234 | $this->logException( $e ); |
240 | - } |
|
241 | - catch( \Exception $e ) |
|
235 | + } catch( \Exception $e ) |
|
242 | 236 | { |
243 | 237 | $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
244 | 238 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -280,14 +274,12 @@ discard block |
||
280 | 274 | $view->tabindex = ++$idx + 1; |
281 | 275 | $view->itemBody .= $client->get(); |
282 | 276 | } |
283 | - } |
|
284 | - catch( \Aimeos\MShop\Exception $e ) |
|
277 | + } catch( \Aimeos\MShop\Exception $e ) |
|
285 | 278 | { |
286 | 279 | $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
287 | 280 | $view->errors = $view->get( 'errors', [] ) + $error; |
288 | 281 | $this->logException( $e ); |
289 | - } |
|
290 | - catch( \Exception $e ) |
|
282 | + } catch( \Exception $e ) |
|
291 | 283 | { |
292 | 284 | $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
293 | 285 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -324,18 +316,15 @@ discard block |
||
324 | 316 | |
325 | 317 | $this->nextAction( $view, $view->param( 'next' ), 'attribute', $view->item->getId(), 'save' ); |
326 | 318 | return; |
327 | - } |
|
328 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
319 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
329 | 320 | { |
330 | 321 | // fall through to create |
331 | - } |
|
332 | - catch( \Aimeos\MShop\Exception $e ) |
|
322 | + } catch( \Aimeos\MShop\Exception $e ) |
|
333 | 323 | { |
334 | 324 | $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
335 | 325 | $view->errors = $view->get( 'errors', [] ) + $error; |
336 | 326 | $this->logException( $e ); |
337 | - } |
|
338 | - catch( \Exception $e ) |
|
327 | + } catch( \Exception $e ) |
|
339 | 328 | { |
340 | 329 | $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
341 | 330 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -375,14 +364,12 @@ discard block |
||
375 | 364 | foreach( $this->getSubClients() as $client ) { |
376 | 365 | $view->itemBody .= $client->search(); |
377 | 366 | } |
378 | - } |
|
379 | - catch( \Aimeos\MShop\Exception $e ) |
|
367 | + } catch( \Aimeos\MShop\Exception $e ) |
|
380 | 368 | { |
381 | 369 | $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
382 | 370 | $view->errors = $view->get( 'errors', [] ) + $error; |
383 | 371 | $this->logException( $e ); |
384 | - } |
|
385 | - catch( \Exception $e ) |
|
372 | + } catch( \Exception $e ) |
|
386 | 373 | { |
387 | 374 | $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
388 | 375 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Attribute; |
12 | 12 | |
13 | -sprintf( 'attribute' ); // for translation |
|
13 | +sprintf('attribute'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,38 +35,38 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
43 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
43 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
44 | 44 | |
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemTypes = $this->getTypeItems(); |
48 | 48 | $view->itemBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $idx => $client ) |
|
50 | + foreach ($this->getSubClients() as $idx => $client) |
|
51 | 51 | { |
52 | 52 | $view->tabindex = ++$idx + 1; |
53 | 53 | $view->itemBody .= $client->copy(); |
54 | 54 | } |
55 | 55 | } |
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
56 | + catch (\Aimeos\MShop\Exception $e) |
|
57 | 57 | { |
58 | - $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
59 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
60 | - $this->logException( $e ); |
|
58 | + $error = array('attribute-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
59 | + $view->errors = $view->get('errors', []) + $error; |
|
60 | + $this->logException($e); |
|
61 | 61 | } |
62 | - catch( \Exception $e ) |
|
62 | + catch (\Exception $e) |
|
63 | 63 | { |
64 | - $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
65 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
66 | - $this->logException( $e ); |
|
64 | + $error = array('attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
65 | + $view->errors = $view->get('errors', []) + $error; |
|
66 | + $this->logException($e); |
|
67 | 67 | } |
68 | 68 | |
69 | - return $this->render( $view ); |
|
69 | + return $this->render($view); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | |
83 | 83 | try |
84 | 84 | { |
85 | - $data = $view->param( 'item', [] ); |
|
85 | + $data = $view->param('item', []); |
|
86 | 86 | |
87 | - if( !isset( $view->item ) ) { |
|
88 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'attribute' )->createItem(); |
|
87 | + if (!isset($view->item)) { |
|
88 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'attribute')->createItem(); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $data['attribute.siteid'] = $view->item->getSiteId(); |
@@ -95,26 +95,26 @@ discard block |
||
95 | 95 | $view->itemData = $data; |
96 | 96 | $view->itemBody = ''; |
97 | 97 | |
98 | - foreach( $this->getSubClients() as $idx => $client ) |
|
98 | + foreach ($this->getSubClients() as $idx => $client) |
|
99 | 99 | { |
100 | 100 | $view->tabindex = ++$idx + 1; |
101 | 101 | $view->itemBody .= $client->create(); |
102 | 102 | } |
103 | 103 | } |
104 | - catch( \Aimeos\MShop\Exception $e ) |
|
104 | + catch (\Aimeos\MShop\Exception $e) |
|
105 | 105 | { |
106 | - $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
107 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
108 | - $this->logException( $e ); |
|
106 | + $error = array('attribute-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
107 | + $view->errors = $view->get('errors', []) + $error; |
|
108 | + $this->logException($e); |
|
109 | 109 | } |
110 | - catch( \Exception $e ) |
|
110 | + catch (\Exception $e) |
|
111 | 111 | { |
112 | - $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
113 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
114 | - $this->logException( $e ); |
|
112 | + $error = array('attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
113 | + $view->errors = $view->get('errors', []) + $error; |
|
114 | + $this->logException($e); |
|
115 | 115 | } |
116 | 116 | |
117 | - return $this->render( $view ); |
|
117 | + return $this->render($view); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -128,39 +128,39 @@ discard block |
||
128 | 128 | $view = $this->getView(); |
129 | 129 | $context = $this->getContext(); |
130 | 130 | |
131 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
131 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
132 | 132 | $manager->begin(); |
133 | 133 | |
134 | 134 | try |
135 | 135 | { |
136 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
137 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
136 | + if (($id = $view->param('id')) === null) { |
|
137 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
138 | 138 | } |
139 | 139 | |
140 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
140 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
141 | 141 | |
142 | - foreach( $this->getSubClients() as $client ) { |
|
142 | + foreach ($this->getSubClients() as $client) { |
|
143 | 143 | $client->delete(); |
144 | 144 | } |
145 | 145 | |
146 | - $manager->saveItem( $view->item ); |
|
147 | - $manager->deleteItem( $id ); |
|
146 | + $manager->saveItem($view->item); |
|
147 | + $manager->deleteItem($id); |
|
148 | 148 | $manager->commit(); |
149 | 149 | |
150 | - $this->nextAction( $view, 'search', 'attribute', null, 'delete' ); |
|
150 | + $this->nextAction($view, 'search', 'attribute', null, 'delete'); |
|
151 | 151 | return; |
152 | 152 | } |
153 | - catch( \Aimeos\MShop\Exception $e ) |
|
153 | + catch (\Aimeos\MShop\Exception $e) |
|
154 | 154 | { |
155 | - $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
156 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
157 | - $this->logException( $e ); |
|
155 | + $error = array('attribute-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
156 | + $view->errors = $view->get('errors', []) + $error; |
|
157 | + $this->logException($e); |
|
158 | 158 | } |
159 | - catch( \Exception $e ) |
|
159 | + catch (\Exception $e) |
|
160 | 160 | { |
161 | - $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
162 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
163 | - $this->logException( $e ); |
|
161 | + $error = array('attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
162 | + $view->errors = $view->get('errors', []) + $error; |
|
163 | + $this->logException($e); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $manager->rollback(); |
@@ -181,38 +181,38 @@ discard block |
||
181 | 181 | |
182 | 182 | try |
183 | 183 | { |
184 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
185 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
184 | + if (($id = $view->param('id')) === null) { |
|
185 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
186 | 186 | } |
187 | 187 | |
188 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
188 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
189 | 189 | |
190 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
190 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
191 | 191 | $view->itemSubparts = $this->getSubClientNames(); |
192 | - $view->itemData = $this->toArray( $view->item ); |
|
192 | + $view->itemData = $this->toArray($view->item); |
|
193 | 193 | $view->itemTypes = $this->getTypeItems(); |
194 | 194 | $view->itemBody = ''; |
195 | 195 | |
196 | - foreach( $this->getSubClients() as $idx => $client ) |
|
196 | + foreach ($this->getSubClients() as $idx => $client) |
|
197 | 197 | { |
198 | 198 | $view->tabindex = ++$idx + 1; |
199 | 199 | $view->itemBody .= $client->get(); |
200 | 200 | } |
201 | 201 | } |
202 | - catch( \Aimeos\MShop\Exception $e ) |
|
202 | + catch (\Aimeos\MShop\Exception $e) |
|
203 | 203 | { |
204 | - $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
205 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
206 | - $this->logException( $e ); |
|
204 | + $error = array('attribute-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
205 | + $view->errors = $view->get('errors', []) + $error; |
|
206 | + $this->logException($e); |
|
207 | 207 | } |
208 | - catch( \Exception $e ) |
|
208 | + catch (\Exception $e) |
|
209 | 209 | { |
210 | - $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
211 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
212 | - $this->logException( $e ); |
|
210 | + $error = array('attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
211 | + $view->errors = $view->get('errors', []) + $error; |
|
212 | + $this->logException($e); |
|
213 | 213 | } |
214 | 214 | |
215 | - return $this->render( $view ); |
|
215 | + return $this->render($view); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -226,40 +226,40 @@ discard block |
||
226 | 226 | $view = $this->getView(); |
227 | 227 | $context = $this->getContext(); |
228 | 228 | |
229 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
229 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
230 | 230 | $manager->begin(); |
231 | 231 | |
232 | 232 | try |
233 | 233 | { |
234 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
235 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
234 | + $item = $this->fromArray($view->param('item', [])); |
|
235 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
236 | 236 | $view->itemBody = ''; |
237 | 237 | |
238 | - foreach( $this->getSubClients() as $client ) { |
|
238 | + foreach ($this->getSubClients() as $client) { |
|
239 | 239 | $view->itemBody .= $client->save(); |
240 | 240 | } |
241 | 241 | |
242 | - $manager->saveItem( clone $view->item ); |
|
242 | + $manager->saveItem(clone $view->item); |
|
243 | 243 | $manager->commit(); |
244 | 244 | |
245 | - $this->nextAction( $view, $view->param( 'next' ), 'attribute', $view->item->getId(), 'save' ); |
|
245 | + $this->nextAction($view, $view->param('next'), 'attribute', $view->item->getId(), 'save'); |
|
246 | 246 | return; |
247 | 247 | } |
248 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
248 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
249 | 249 | { |
250 | 250 | // fall through to create |
251 | 251 | } |
252 | - catch( \Aimeos\MShop\Exception $e ) |
|
252 | + catch (\Aimeos\MShop\Exception $e) |
|
253 | 253 | { |
254 | - $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
255 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
256 | - $this->logException( $e ); |
|
254 | + $error = array('attribute-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
255 | + $view->errors = $view->get('errors', []) + $error; |
|
256 | + $this->logException($e); |
|
257 | 257 | } |
258 | - catch( \Exception $e ) |
|
258 | + catch (\Exception $e) |
|
259 | 259 | { |
260 | - $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
261 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
262 | - $this->logException( $e ); |
|
260 | + $error = array('attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
261 | + $view->errors = $view->get('errors', []) + $error; |
|
262 | + $this->logException($e); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | $manager->rollback(); |
@@ -281,32 +281,32 @@ discard block |
||
281 | 281 | try |
282 | 282 | { |
283 | 283 | $total = 0; |
284 | - $params = $this->storeSearchParams( $view->param(), 'attribute' ); |
|
285 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
286 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
284 | + $params = $this->storeSearchParams($view->param(), 'attribute'); |
|
285 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
286 | + $search = $this->initCriteria($manager->createSearch(), $params); |
|
287 | 287 | |
288 | - $view->items = $manager->searchItems( $search, $this->getDomains(), $total ); |
|
289 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
288 | + $view->items = $manager->searchItems($search, $this->getDomains(), $total); |
|
289 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
290 | 290 | $view->filterOperators = $search->getOperators(); |
291 | 291 | $view->itemTypes = $this->getTypeItems(); |
292 | 292 | $view->total = $total; |
293 | 293 | $view->itemBody = ''; |
294 | 294 | |
295 | - foreach( $this->getSubClients() as $client ) { |
|
295 | + foreach ($this->getSubClients() as $client) { |
|
296 | 296 | $view->itemBody .= $client->search(); |
297 | 297 | } |
298 | 298 | } |
299 | - catch( \Aimeos\MShop\Exception $e ) |
|
299 | + catch (\Aimeos\MShop\Exception $e) |
|
300 | 300 | { |
301 | - $error = array( 'attribute-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
302 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
303 | - $this->logException( $e ); |
|
301 | + $error = array('attribute-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
302 | + $view->errors = $view->get('errors', []) + $error; |
|
303 | + $this->logException($e); |
|
304 | 304 | } |
305 | - catch( \Exception $e ) |
|
305 | + catch (\Exception $e) |
|
306 | 306 | { |
307 | - $error = array( 'attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
308 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
309 | - $this->logException( $e ); |
|
307 | + $error = array('attribute-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
308 | + $view->errors = $view->get('errors', []) + $error; |
|
309 | + $this->logException($e); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** admin/jqadm/attribute/template-list |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $tplconf = 'admin/jqadm/attribute/template-list'; |
332 | 332 | $default = 'attribute/list-standard'; |
333 | 333 | |
334 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
334 | + return $view->render($view->config($tplconf, $default)); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @param string|null $name Name of the sub-client (Default if null) |
343 | 343 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
344 | 344 | */ |
345 | - public function getSubClient( $type, $name = null ) |
|
345 | + public function getSubClient($type, $name = null) |
|
346 | 346 | { |
347 | 347 | /** admin/jqadm/attribute/decorators/excludes |
348 | 348 | * Excludes decorators added by the "common" option from the attribute JQAdm client |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @see admin/jqadm/attribute/decorators/excludes |
418 | 418 | * @see admin/jqadm/attribute/decorators/global |
419 | 419 | */ |
420 | - return $this->createSubClient( 'attribute/' . $type, $name ); |
|
420 | + return $this->createSubClient('attribute/' . $type, $name); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | * @since 2017.07 |
440 | 440 | * @category Developer |
441 | 441 | */ |
442 | - $domains = array( 'attribute/property', 'media', 'price', 'text' ); |
|
442 | + $domains = array('attribute/property', 'media', 'price', 'text'); |
|
443 | 443 | |
444 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/attribute/domains', $domains ); |
|
444 | + return $this->getContext()->getConfig()->get('admin/jqadm/attribute/domains', $domains); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @since 2017.07 |
486 | 486 | * @category Developer |
487 | 487 | */ |
488 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/attribute/standard/subparts', [] ); |
|
488 | + return $this->getContext()->getConfig()->get('admin/jqadm/attribute/standard/subparts', []); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -496,12 +496,12 @@ discard block |
||
496 | 496 | */ |
497 | 497 | protected function getTypeItems() |
498 | 498 | { |
499 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute/type' ); |
|
499 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute/type'); |
|
500 | 500 | |
501 | - $search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
502 | - $search->setSortations( array( $search->sort( '+', 'attribute.type.code' ) ) ); |
|
501 | + $search = $typeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
502 | + $search->setSortations(array($search->sort('+', 'attribute.type.code'))); |
|
503 | 503 | |
504 | - return $typeManager->searchItems( $search ); |
|
504 | + return $typeManager->searchItems($search); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | |
@@ -511,17 +511,17 @@ discard block |
||
511 | 511 | * @param string[] Data array |
512 | 512 | * @return \Aimeos\MShop\Attribute\Item\Iface New attribute item object |
513 | 513 | */ |
514 | - protected function fromArray( array $data ) |
|
514 | + protected function fromArray(array $data) |
|
515 | 515 | { |
516 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
516 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
517 | 517 | |
518 | - if( isset( $data['attribute.id'] ) && $data['attribute.id'] != '' ) { |
|
519 | - $item = $manager->getItem( $data['attribute.id'], $this->getDomains() ); |
|
518 | + if (isset($data['attribute.id']) && $data['attribute.id'] != '') { |
|
519 | + $item = $manager->getItem($data['attribute.id'], $this->getDomains()); |
|
520 | 520 | } else { |
521 | 521 | $item = $manager->createItem(); |
522 | 522 | } |
523 | 523 | |
524 | - $item->fromArray( $data ); |
|
524 | + $item->fromArray($data); |
|
525 | 525 | |
526 | 526 | return $item; |
527 | 527 | } |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | * @param \Aimeos\MShop\Attribute\Item\Iface $item Attribute item object |
534 | 534 | * @return string[] Multi-dimensional associative list of item data |
535 | 535 | */ |
536 | - protected function toArray( \Aimeos\MShop\Attribute\Item\Iface $item, $copy = false ) |
|
536 | + protected function toArray(\Aimeos\MShop\Attribute\Item\Iface $item, $copy = false) |
|
537 | 537 | { |
538 | - $data = $item->toArray( true ); |
|
538 | + $data = $item->toArray(true); |
|
539 | 539 | |
540 | - if( $copy === true ) |
|
540 | + if ($copy === true) |
|
541 | 541 | { |
542 | 542 | $data['attribute.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
543 | 543 | $data['attribute.code'] = $data['attribute.code'] . '_copy'; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
555 | 555 | * @return string HTML output |
556 | 556 | */ |
557 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
557 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
558 | 558 | { |
559 | 559 | /** admin/jqadm/attribute/template-item |
560 | 560 | * Relative path to the HTML body template for the attribute item. |
@@ -578,6 +578,6 @@ discard block |
||
578 | 578 | $tplconf = 'admin/jqadm/attribute/template-item'; |
579 | 579 | $default = 'attribute/item-standard'; |
580 | 580 | |
581 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
581 | + return $view->render($view->config($tplconf, $default)); |
|
582 | 582 | } |
583 | 583 | } |
@@ -99,14 +99,12 @@ discard block |
||
99 | 99 | $view->tabindex = ++$idx + 1; |
100 | 100 | $view->itemBody .= $client->copy(); |
101 | 101 | } |
102 | - } |
|
103 | - catch( \Aimeos\MShop\Exception $e ) |
|
102 | + } catch( \Aimeos\MShop\Exception $e ) |
|
104 | 103 | { |
105 | 104 | $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
106 | 105 | $view->errors = $view->get( 'errors', [] ) + $error; |
107 | 106 | $this->logException( $e ); |
108 | - } |
|
109 | - catch( \Exception $e ) |
|
107 | + } catch( \Exception $e ) |
|
110 | 108 | { |
111 | 109 | $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
112 | 110 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -148,14 +146,12 @@ discard block |
||
148 | 146 | $view->tabindex = ++$idx + 1; |
149 | 147 | $view->itemBody .= $client->create(); |
150 | 148 | } |
151 | - } |
|
152 | - catch( \Aimeos\MShop\Exception $e ) |
|
149 | + } catch( \Aimeos\MShop\Exception $e ) |
|
153 | 150 | { |
154 | 151 | $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
155 | 152 | $view->errors = $view->get( 'errors', [] ) + $error; |
156 | 153 | $this->logException( $e ); |
157 | - } |
|
158 | - catch( \Exception $e ) |
|
154 | + } catch( \Exception $e ) |
|
159 | 155 | { |
160 | 156 | $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
161 | 157 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -194,14 +190,12 @@ discard block |
||
194 | 190 | |
195 | 191 | $msg = $context->getI18n()->dt( 'admin', 'Your export will be available in a few minutes for download' ); |
196 | 192 | $view->info = $view->get( 'info', [] ) + ['order-item' => $msg]; |
197 | - } |
|
198 | - catch( \Aimeos\MShop\Exception $e ) |
|
193 | + } catch( \Aimeos\MShop\Exception $e ) |
|
199 | 194 | { |
200 | 195 | $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
201 | 196 | $view->errors = $view->get( 'errors', [] ) + $error; |
202 | 197 | $this->logException( $e ); |
203 | - } |
|
204 | - catch( \Exception $e ) |
|
198 | + } catch( \Exception $e ) |
|
205 | 199 | { |
206 | 200 | $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
207 | 201 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -240,14 +234,12 @@ discard block |
||
240 | 234 | $view->tabindex = ++$idx + 1; |
241 | 235 | $view->itemBody .= $client->get(); |
242 | 236 | } |
243 | - } |
|
244 | - catch( \Aimeos\MShop\Exception $e ) |
|
237 | + } catch( \Aimeos\MShop\Exception $e ) |
|
245 | 238 | { |
246 | 239 | $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
247 | 240 | $view->errors = $view->get( 'errors', [] ) + $error; |
248 | 241 | $this->logException( $e ); |
249 | - } |
|
250 | - catch( \Exception $e ) |
|
242 | + } catch( \Exception $e ) |
|
251 | 243 | { |
252 | 244 | $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
253 | 245 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -284,18 +276,15 @@ discard block |
||
284 | 276 | |
285 | 277 | $this->nextAction( $view, $view->param( 'next' ), 'order', $view->item->getId(), 'save' ); |
286 | 278 | return; |
287 | - } |
|
288 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
279 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
289 | 280 | { |
290 | 281 | // fall through to create |
291 | - } |
|
292 | - catch( \Aimeos\MShop\Exception $e ) |
|
282 | + } catch( \Aimeos\MShop\Exception $e ) |
|
293 | 283 | { |
294 | 284 | $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
295 | 285 | $view->errors = $view->get( 'errors', [] ) + $error; |
296 | 286 | $this->logException( $e ); |
297 | - } |
|
298 | - catch( \Exception $e ) |
|
287 | + } catch( \Exception $e ) |
|
299 | 288 | { |
300 | 289 | $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
301 | 290 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -338,14 +327,12 @@ discard block |
||
338 | 327 | foreach( $this->getSubClients() as $client ) { |
339 | 328 | $view->itemBody .= $client->search(); |
340 | 329 | } |
341 | - } |
|
342 | - catch( \Aimeos\MShop\Exception $e ) |
|
330 | + } catch( \Aimeos\MShop\Exception $e ) |
|
343 | 331 | { |
344 | 332 | $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
345 | 333 | $view->errors = $view->get( 'errors', [] ) + $error; |
346 | 334 | $this->logException( $e ); |
347 | - } |
|
348 | - catch( \Exception $e ) |
|
335 | + } catch( \Exception $e ) |
|
349 | 336 | { |
350 | 337 | $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
351 | 338 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -556,8 +543,7 @@ discard block |
||
556 | 543 | { |
557 | 544 | $attrItem = $attrItems[$array['order.base.service.attribute.id']]; |
558 | 545 | unset( $attrItems[$array['order.base.service.attribute.id']] ); |
559 | - } |
|
560 | - else |
|
546 | + } else |
|
561 | 547 | { |
562 | 548 | $attrItem = $attrManager->createItem(); |
563 | 549 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Order; |
12 | 12 | |
13 | -sprintf( 'order' ); // for translation |
|
13 | +sprintf('order'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,37 +35,37 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
43 | - $view->item = $manager->load( $id ); |
|
42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
43 | + $view->item = $manager->load($id); |
|
44 | 44 | |
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemBody = ''; |
48 | 48 | |
49 | - foreach( $this->getSubClients() as $idx => $client ) |
|
49 | + foreach ($this->getSubClients() as $idx => $client) |
|
50 | 50 | { |
51 | 51 | $view->tabindex = ++$idx + 1; |
52 | 52 | $view->itemBody .= $client->copy(); |
53 | 53 | } |
54 | 54 | } |
55 | - catch( \Aimeos\MShop\Exception $e ) |
|
55 | + catch (\Aimeos\MShop\Exception $e) |
|
56 | 56 | { |
57 | - $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
59 | - $this->logException( $e ); |
|
57 | + $error = array('order-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
58 | + $view->errors = $view->get('errors', []) + $error; |
|
59 | + $this->logException($e); |
|
60 | 60 | } |
61 | - catch( \Exception $e ) |
|
61 | + catch (\Exception $e) |
|
62 | 62 | { |
63 | - $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
65 | - $this->logException( $e ); |
|
63 | + $error = array('order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
64 | + $view->errors = $view->get('errors', []) + $error; |
|
65 | + $this->logException($e); |
|
66 | 66 | } |
67 | 67 | |
68 | - return $this->render( $view ); |
|
68 | + return $this->render($view); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | try |
83 | 83 | { |
84 | - $data = $view->param( 'item', [] ); |
|
84 | + $data = $view->param('item', []); |
|
85 | 85 | |
86 | - if( !isset( $view->item ) ) { |
|
87 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->createItem(); |
|
86 | + if (!isset($view->item)) { |
|
87 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'order/base')->createItem(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $data['order.siteid'] = $view->item->getSiteId(); |
@@ -93,26 +93,26 @@ discard block |
||
93 | 93 | $view->itemData = $data; |
94 | 94 | $view->itemBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $idx => $client ) |
|
96 | + foreach ($this->getSubClients() as $idx => $client) |
|
97 | 97 | { |
98 | 98 | $view->tabindex = ++$idx + 1; |
99 | 99 | $view->itemBody .= $client->create(); |
100 | 100 | } |
101 | 101 | } |
102 | - catch( \Aimeos\MShop\Exception $e ) |
|
102 | + catch (\Aimeos\MShop\Exception $e) |
|
103 | 103 | { |
104 | - $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
105 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
106 | - $this->logException( $e ); |
|
104 | + $error = array('order-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
105 | + $view->errors = $view->get('errors', []) + $error; |
|
106 | + $this->logException($e); |
|
107 | 107 | } |
108 | - catch( \Exception $e ) |
|
108 | + catch (\Exception $e) |
|
109 | 109 | { |
110 | - $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
111 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
112 | - $this->logException( $e ); |
|
110 | + $error = array('order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
111 | + $view->errors = $view->get('errors', []) + $error; |
|
112 | + $this->logException($e); |
|
113 | 113 | } |
114 | 114 | |
115 | - return $this->render( $view ); |
|
115 | + return $this->render($view); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -128,34 +128,34 @@ discard block |
||
128 | 128 | |
129 | 129 | try |
130 | 130 | { |
131 | - $params = $this->storeSearchParams( $view->param(), 'order' ); |
|
131 | + $params = $this->storeSearchParams($view->param(), 'order'); |
|
132 | 132 | $msg = ['sitecode' => $context->getLocale()->getSite()->getCode()]; |
133 | 133 | |
134 | - if( isset( $params['filter'] ) ) { |
|
135 | - $msg['filter'] = $this->getCriteriaConditions( $params['filter'] ); |
|
134 | + if (isset($params['filter'])) { |
|
135 | + $msg['filter'] = $this->getCriteriaConditions($params['filter']); |
|
136 | 136 | } |
137 | 137 | |
138 | - if( isset( $params['sort'] ) ) { |
|
139 | - $msg['sort'] = $this->getCriteriaSortations( $params['sort'] ); |
|
138 | + if (isset($params['sort'])) { |
|
139 | + $msg['sort'] = $this->getCriteriaSortations($params['sort']); |
|
140 | 140 | } |
141 | 141 | |
142 | - $mq = $context->getMessageQueueManager()->get( 'mq-admin' )->getQueue( 'order-export' ); |
|
143 | - $mq->add( json_encode( $msg ) ); |
|
142 | + $mq = $context->getMessageQueueManager()->get('mq-admin')->getQueue('order-export'); |
|
143 | + $mq->add(json_encode($msg)); |
|
144 | 144 | |
145 | - $msg = $context->getI18n()->dt( 'admin', 'Your export will be available in a few minutes for download' ); |
|
146 | - $view->info = $view->get( 'info', [] ) + ['order-item' => $msg]; |
|
145 | + $msg = $context->getI18n()->dt('admin', 'Your export will be available in a few minutes for download'); |
|
146 | + $view->info = $view->get('info', []) + ['order-item' => $msg]; |
|
147 | 147 | } |
148 | - catch( \Aimeos\MShop\Exception $e ) |
|
148 | + catch (\Aimeos\MShop\Exception $e) |
|
149 | 149 | { |
150 | - $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
151 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
152 | - $this->logException( $e ); |
|
150 | + $error = array('order-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
151 | + $view->errors = $view->get('errors', []) + $error; |
|
152 | + $this->logException($e); |
|
153 | 153 | } |
154 | - catch( \Exception $e ) |
|
154 | + catch (\Exception $e) |
|
155 | 155 | { |
156 | - $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
157 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
158 | - $this->logException( $e ); |
|
156 | + $error = array('order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
157 | + $view->errors = $view->get('errors', []) + $error; |
|
158 | + $this->logException($e); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return $this->search(); |
@@ -174,38 +174,38 @@ discard block |
||
174 | 174 | |
175 | 175 | try |
176 | 176 | { |
177 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
178 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
177 | + if (($id = $view->param('id')) === null) { |
|
178 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
179 | 179 | } |
180 | 180 | |
181 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
181 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
182 | 182 | $refs = ['order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service']; |
183 | 183 | |
184 | - $view->item = $manager->getItem( $id, $refs ); |
|
184 | + $view->item = $manager->getItem($id, $refs); |
|
185 | 185 | $view->itemSubparts = $this->getSubClientNames(); |
186 | - $view->itemData = $this->toArray( $view->item ); |
|
186 | + $view->itemData = $this->toArray($view->item); |
|
187 | 187 | $view->itemBody = ''; |
188 | 188 | |
189 | - foreach( $this->getSubClients() as $idx => $client ) |
|
189 | + foreach ($this->getSubClients() as $idx => $client) |
|
190 | 190 | { |
191 | 191 | $view->tabindex = ++$idx + 1; |
192 | 192 | $view->itemBody .= $client->get(); |
193 | 193 | } |
194 | 194 | } |
195 | - catch( \Aimeos\MShop\Exception $e ) |
|
195 | + catch (\Aimeos\MShop\Exception $e) |
|
196 | 196 | { |
197 | - $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
198 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
199 | - $this->logException( $e ); |
|
197 | + $error = array('order-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
198 | + $view->errors = $view->get('errors', []) + $error; |
|
199 | + $this->logException($e); |
|
200 | 200 | } |
201 | - catch( \Exception $e ) |
|
201 | + catch (\Exception $e) |
|
202 | 202 | { |
203 | - $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
204 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
205 | - $this->logException( $e ); |
|
203 | + $error = array('order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
204 | + $view->errors = $view->get('errors', []) + $error; |
|
205 | + $this->logException($e); |
|
206 | 206 | } |
207 | 207 | |
208 | - return $this->render( $view ); |
|
208 | + return $this->render($view); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -219,40 +219,40 @@ discard block |
||
219 | 219 | $view = $this->getView(); |
220 | 220 | $context = $this->getContext(); |
221 | 221 | |
222 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
222 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
223 | 223 | $manager->begin(); |
224 | 224 | |
225 | 225 | try |
226 | 226 | { |
227 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
228 | - $view->item = $item->getId() ? $item : $manager->store( clone $item ); |
|
227 | + $item = $this->fromArray($view->param('item', [])); |
|
228 | + $view->item = $item->getId() ? $item : $manager->store(clone $item); |
|
229 | 229 | $view->itemBody = ''; |
230 | 230 | |
231 | - foreach( $this->getSubClients() as $client ) { |
|
231 | + foreach ($this->getSubClients() as $client) { |
|
232 | 232 | $view->itemBody .= $client->save(); |
233 | 233 | } |
234 | 234 | |
235 | - $manager->store( clone $view->item ); |
|
235 | + $manager->store(clone $view->item); |
|
236 | 236 | $manager->commit(); |
237 | 237 | |
238 | - $this->nextAction( $view, $view->param( 'next' ), 'order', $view->item->getId(), 'save' ); |
|
238 | + $this->nextAction($view, $view->param('next'), 'order', $view->item->getId(), 'save'); |
|
239 | 239 | return; |
240 | 240 | } |
241 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
241 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
242 | 242 | { |
243 | 243 | // fall through to create |
244 | 244 | } |
245 | - catch( \Aimeos\MShop\Exception $e ) |
|
245 | + catch (\Aimeos\MShop\Exception $e) |
|
246 | 246 | { |
247 | - $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
248 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
249 | - $this->logException( $e ); |
|
247 | + $error = array('order-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
248 | + $view->errors = $view->get('errors', []) + $error; |
|
249 | + $this->logException($e); |
|
250 | 250 | } |
251 | - catch( \Exception $e ) |
|
251 | + catch (\Exception $e) |
|
252 | 252 | { |
253 | - $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
254 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
255 | - $this->logException( $e ); |
|
253 | + $error = array('order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
254 | + $view->errors = $view->get('errors', []) + $error; |
|
255 | + $this->logException($e); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | $manager->rollback(); |
@@ -274,35 +274,35 @@ discard block |
||
274 | 274 | try |
275 | 275 | { |
276 | 276 | $total = 0; |
277 | - $params = $this->storeSearchParams( $view->param(), 'order' ); |
|
278 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
277 | + $params = $this->storeSearchParams($view->param(), 'order'); |
|
278 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
279 | 279 | |
280 | 280 | $search = $manager->createSearch(); |
281 | - $search->setSortations( [$search->sort( '-', 'order.id' )] ); |
|
282 | - $search = $this->initCriteria( $search, $params ); |
|
281 | + $search->setSortations([$search->sort('-', 'order.id')]); |
|
282 | + $search = $this->initCriteria($search, $params); |
|
283 | 283 | |
284 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
285 | - $view->baseItems = $this->getOrderBaseItems( $view->items ); |
|
286 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
284 | + $view->items = $manager->searchItems($search, [], $total); |
|
285 | + $view->baseItems = $this->getOrderBaseItems($view->items); |
|
286 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
287 | 287 | $view->filterOperators = $search->getOperators(); |
288 | 288 | $view->total = $total; |
289 | 289 | $view->itemBody = ''; |
290 | 290 | |
291 | - foreach( $this->getSubClients() as $client ) { |
|
291 | + foreach ($this->getSubClients() as $client) { |
|
292 | 292 | $view->itemBody .= $client->search(); |
293 | 293 | } |
294 | 294 | } |
295 | - catch( \Aimeos\MShop\Exception $e ) |
|
295 | + catch (\Aimeos\MShop\Exception $e) |
|
296 | 296 | { |
297 | - $error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
298 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
299 | - $this->logException( $e ); |
|
297 | + $error = array('order-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
298 | + $view->errors = $view->get('errors', []) + $error; |
|
299 | + $this->logException($e); |
|
300 | 300 | } |
301 | - catch( \Exception $e ) |
|
301 | + catch (\Exception $e) |
|
302 | 302 | { |
303 | - $error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
304 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
305 | - $this->logException( $e ); |
|
303 | + $error = array('order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
304 | + $view->errors = $view->get('errors', []) + $error; |
|
305 | + $this->logException($e); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** admin/jqadm/order/template-list |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $tplconf = 'admin/jqadm/order/template-list'; |
328 | 328 | $default = 'order/list-standard'; |
329 | 329 | |
330 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
330 | + return $view->render($view->config($tplconf, $default)); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @param string|null $name Name of the sub-client (Default if null) |
339 | 339 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
340 | 340 | */ |
341 | - public function getSubClient( $type, $name = null ) |
|
341 | + public function getSubClient($type, $name = null) |
|
342 | 342 | { |
343 | 343 | /** admin/jqadm/order/decorators/excludes |
344 | 344 | * Excludes decorators added by the "common" option from the order JQAdm client |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @see admin/jqadm/order/decorators/excludes |
414 | 414 | * @see admin/jqadm/order/decorators/global |
415 | 415 | */ |
416 | - return $this->createSubClient( 'order/' . $type, $name ); |
|
416 | + return $this->createSubClient('order/' . $type, $name); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | |
@@ -423,19 +423,19 @@ discard block |
||
423 | 423 | * @param \Aimeos\MShop\Order\Item\Iface[] $orderItems List of order items |
424 | 424 | * @param \Aimeos\MShop\Order\Item\Base\Iface[] List of order base items |
425 | 425 | */ |
426 | - protected function getOrderBaseItems( array $orderItems ) |
|
426 | + protected function getOrderBaseItems(array $orderItems) |
|
427 | 427 | { |
428 | 428 | $baseIds = []; |
429 | - foreach( $orderItems as $item ) { |
|
429 | + foreach ($orderItems as $item) { |
|
430 | 430 | $baseIds[] = $item->getBaseId(); |
431 | 431 | } |
432 | 432 | |
433 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' ); |
|
433 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base'); |
|
434 | 434 | |
435 | - $search = $manager->createSearch()->setSlice( 0, count( $baseIds ) ); |
|
436 | - $search->setConditions( $search->compare( '==', 'order.base.id', $baseIds ) ); |
|
435 | + $search = $manager->createSearch()->setSlice(0, count($baseIds)); |
|
436 | + $search->setConditions($search->compare('==', 'order.base.id', $baseIds)); |
|
437 | 437 | |
438 | - return $manager->searchItems( $search, ['order/base/address', 'order/base/service'] ); |
|
438 | + return $manager->searchItems($search, ['order/base/address', 'order/base/service']); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @since 2016.01 |
480 | 480 | * @category Developer |
481 | 481 | */ |
482 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/order/standard/subparts', [] ); |
|
482 | + return $this->getContext()->getConfig()->get('admin/jqadm/order/standard/subparts', []); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -489,72 +489,72 @@ discard block |
||
489 | 489 | * @param string[] Data array |
490 | 490 | * @return \Aimeos\MShop\Order\Item\Iface New order item object |
491 | 491 | */ |
492 | - protected function fromArray( array $data ) |
|
492 | + protected function fromArray(array $data) |
|
493 | 493 | { |
494 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' ); |
|
495 | - $attrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/service/attribute' ); |
|
494 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base'); |
|
495 | + $attrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/service/attribute'); |
|
496 | 496 | |
497 | - if( isset( $data['order.base.id'] ) ) { |
|
498 | - $basket = $manager->load( $data['order.base.id'] ); |
|
497 | + if (isset($data['order.base.id'])) { |
|
498 | + $basket = $manager->load($data['order.base.id']); |
|
499 | 499 | } else { |
500 | 500 | $basket = $manager->createItem(); |
501 | 501 | } |
502 | 502 | |
503 | - $basket->fromArray( $data ); |
|
503 | + $basket->fromArray($data); |
|
504 | 504 | |
505 | - foreach( $basket->getProducts() as $pos => $product ) |
|
505 | + foreach ($basket->getProducts() as $pos => $product) |
|
506 | 506 | { |
507 | - if( isset( $data['product'][$pos]['order.base.product.status'] ) ) { |
|
508 | - $product->setStatus( $data['product'][$pos]['order.base.product.status'] ); |
|
507 | + if (isset($data['product'][$pos]['order.base.product.status'])) { |
|
508 | + $product->setStatus($data['product'][$pos]['order.base.product.status']); |
|
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | - foreach( $basket->getAddresses() as $type => $address ) |
|
512 | + foreach ($basket->getAddresses() as $type => $address) |
|
513 | 513 | { |
514 | - if( isset( $data['address'][$type] ) ) { |
|
515 | - $address->fromArray( (array) $data['address'][$type] ); |
|
516 | - $basket->setAddress( $address, $type ); |
|
514 | + if (isset($data['address'][$type])) { |
|
515 | + $address->fromArray((array) $data['address'][$type]); |
|
516 | + $basket->setAddress($address, $type); |
|
517 | 517 | } else { |
518 | - $basket->deleteAddress( $type ); |
|
518 | + $basket->deleteAddress($type); |
|
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
522 | - foreach( $basket->getServices() as $type => $services ) |
|
522 | + foreach ($basket->getServices() as $type => $services) |
|
523 | 523 | { |
524 | - foreach( $services as $serviceId => $service ) |
|
524 | + foreach ($services as $serviceId => $service) |
|
525 | 525 | { |
526 | 526 | $list = []; |
527 | 527 | $attrItems = $service->getAttributeItems(); |
528 | 528 | |
529 | - if( isset( $data['service'][$type][$serviceId] ) ) |
|
529 | + if (isset($data['service'][$type][$serviceId])) |
|
530 | 530 | { |
531 | - foreach( (array) $data['service'][$type][$serviceId] as $key => $pair ) |
|
531 | + foreach ((array) $data['service'][$type][$serviceId] as $key => $pair) |
|
532 | 532 | { |
533 | - foreach( $pair as $pos => $value ) { |
|
533 | + foreach ($pair as $pos => $value) { |
|
534 | 534 | $list[$pos][$key] = $value; |
535 | 535 | } |
536 | 536 | } |
537 | 537 | |
538 | - foreach( $list as $array ) |
|
538 | + foreach ($list as $array) |
|
539 | 539 | { |
540 | - if( isset( $attrItems[$array['order.base.service.attribute.id']] ) ) |
|
540 | + if (isset($attrItems[$array['order.base.service.attribute.id']])) |
|
541 | 541 | { |
542 | 542 | $attrItem = $attrItems[$array['order.base.service.attribute.id']]; |
543 | - unset( $attrItems[$array['order.base.service.attribute.id']] ); |
|
543 | + unset($attrItems[$array['order.base.service.attribute.id']]); |
|
544 | 544 | } |
545 | 545 | else |
546 | 546 | { |
547 | 547 | $attrItem = $attrManager->createItem(); |
548 | 548 | } |
549 | 549 | |
550 | - $attrItem->fromArray( $array ); |
|
551 | - $attrItem->setParentId( $service->getId() ); |
|
550 | + $attrItem->fromArray($array); |
|
551 | + $attrItem->setParentId($service->getId()); |
|
552 | 552 | |
553 | - $item = $attrManager->saveItem( $attrItem ); |
|
553 | + $item = $attrManager->saveItem($attrItem); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
557 | - $attrManager->deleteItems( array_keys( $attrItems ) ); |
|
557 | + $attrManager->deleteItems(array_keys($attrItems)); |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
@@ -568,53 +568,53 @@ discard block |
||
568 | 568 | * @param \Aimeos\MShop\Order\Item\Base\Iface $item Order base item object |
569 | 569 | * @return string[] Multi-dimensional associative list of item data |
570 | 570 | */ |
571 | - protected function toArray( \Aimeos\MShop\Order\Item\Base\Iface $item, $copy = false ) |
|
571 | + protected function toArray(\Aimeos\MShop\Order\Item\Base\Iface $item, $copy = false) |
|
572 | 572 | { |
573 | 573 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
574 | - $data = $item->toArray( true ); |
|
574 | + $data = $item->toArray(true); |
|
575 | 575 | |
576 | - if( $item->getCustomerId() != '' ) |
|
576 | + if ($item->getCustomerId() != '') |
|
577 | 577 | { |
578 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
578 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
579 | 579 | |
580 | 580 | try { |
581 | - $data += $manager->getItem( $item->getCustomerId() )->toArray(); |
|
582 | - } catch( \Exception $e ) {}; |
|
581 | + $data += $manager->getItem($item->getCustomerId())->toArray(); |
|
582 | + } catch (\Exception $e) {}; |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | |
586 | - if( $copy === true ) |
|
586 | + if ($copy === true) |
|
587 | 587 | { |
588 | 588 | $data['order.base.siteid'] = $siteId; |
589 | 589 | $data['order.base.id'] = ''; |
590 | 590 | } |
591 | 591 | |
592 | - foreach( $item->getAddresses() as $type => $addrItem ) |
|
592 | + foreach ($item->getAddresses() as $type => $addrItem) |
|
593 | 593 | { |
594 | - $list = $addrItem->toArray( true ); |
|
594 | + $list = $addrItem->toArray(true); |
|
595 | 595 | |
596 | - foreach( $list as $key => $value ) { |
|
596 | + foreach ($list as $key => $value) { |
|
597 | 597 | $data['address'][$type][$key] = $value; |
598 | 598 | } |
599 | 599 | |
600 | - if( $copy === true ) |
|
600 | + if ($copy === true) |
|
601 | 601 | { |
602 | 602 | $data['address'][$type]['order.base.address.siteid'] = $siteId; |
603 | 603 | $data['address'][$type]['order.base.address.id'] = ''; |
604 | 604 | } |
605 | 605 | } |
606 | 606 | |
607 | - if( $copy !== true ) |
|
607 | + if ($copy !== true) |
|
608 | 608 | { |
609 | - foreach( $item->getServices() as $type => $services ) |
|
609 | + foreach ($item->getServices() as $type => $services) |
|
610 | 610 | { |
611 | - foreach( $services as $serviceItem ) |
|
611 | + foreach ($services as $serviceItem) |
|
612 | 612 | { |
613 | 613 | $serviceId = $serviceItem->getServiceId(); |
614 | 614 | |
615 | - foreach( $serviceItem->getAttributeItems() as $attrItem ) |
|
615 | + foreach ($serviceItem->getAttributeItems() as $attrItem) |
|
616 | 616 | { |
617 | - foreach( $attrItem->toArray( true ) as $key => $value ) { |
|
617 | + foreach ($attrItem->toArray(true) as $key => $value) { |
|
618 | 618 | $data['service'][$type][$serviceId][$key][] = $value; |
619 | 619 | } |
620 | 620 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | - foreach( $item->getProducts() as $pos => $productItem ) { |
|
625 | + foreach ($item->getProducts() as $pos => $productItem) { |
|
626 | 626 | $data['product'][$pos]['order.base.product.status'] = $productItem->getStatus(); |
627 | 627 | } |
628 | 628 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
637 | 637 | * @return string HTML output |
638 | 638 | */ |
639 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
639 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
640 | 640 | { |
641 | 641 | /** admin/jqadm/order/template-item |
642 | 642 | * Relative path to the HTML body template for the order item. |
@@ -660,6 +660,6 @@ discard block |
||
660 | 660 | $tplconf = 'admin/jqadm/order/template-item'; |
661 | 661 | $default = 'order/item-standard'; |
662 | 662 | |
663 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
663 | + return $view->render($view->config($tplconf, $default)); |
|
664 | 664 | } |
665 | 665 | } |