@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | { |
68 | 68 | $view = $this->getView(); |
69 | 69 | |
70 | - $this->setData( $view ); |
|
70 | + $this->setData($view); |
|
71 | 71 | $view->downloadBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->downloadBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/download/template-item'; |
78 | 78 | $default = 'product/item-download-default.php'; |
79 | 79 | |
80 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
80 | + return $view->render($view->config($tplconf, $default)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $this->setData( $view ); |
|
93 | + $this->setData($view); |
|
94 | 94 | $view->downloadBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->downloadBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/download/template-item'; |
101 | 101 | $default = 'product/item-download-default.php'; |
102 | 102 | |
103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
103 | + return $view->render($view->config($tplconf, $default)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -112,35 +112,35 @@ discard block |
||
112 | 112 | public function delete() |
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | - $listManager = \Aimeos\MShop\Factory::createManager( $context = $this->getContext(), 'product/lists' ); |
|
115 | + $listManager = \Aimeos\MShop\Factory::createManager($context = $this->getContext(), 'product/lists'); |
|
116 | 116 | $search = $listManager->createSearch(); |
117 | 117 | |
118 | - foreach( (array) $view->param( 'id' ) as $id ) |
|
118 | + foreach ((array) $view->param('id') as $id) |
|
119 | 119 | { |
120 | - $listItems = $this->getListItems( $id ); |
|
121 | - $items = $this->getAttributeItems( $listItems ); |
|
120 | + $listItems = $this->getListItems($id); |
|
121 | + $items = $this->getAttributeItems($listItems); |
|
122 | 122 | |
123 | - foreach( $listItems as $listid => $listItem ) |
|
123 | + foreach ($listItems as $listid => $listItem) |
|
124 | 124 | { |
125 | 125 | $refId = $listItem->getRefId(); |
126 | 126 | |
127 | 127 | $expr = array( |
128 | - $search->compare( '==', 'product.lists.refid', $refId ), |
|
129 | - $search->compare( '==', 'product.lists.domain', 'attribute' ), |
|
130 | - $search->compare( '==', 'product.lists.type.code', 'hidden' ), |
|
131 | - $search->compare( '==', 'product.lists.type.domain', 'attribute' ), |
|
128 | + $search->compare('==', 'product.lists.refid', $refId), |
|
129 | + $search->compare('==', 'product.lists.domain', 'attribute'), |
|
130 | + $search->compare('==', 'product.lists.type.code', 'hidden'), |
|
131 | + $search->compare('==', 'product.lists.type.domain', 'attribute'), |
|
132 | 132 | ); |
133 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
134 | - $result = $listManager->aggregate( $search, 'product.lists.refid' ); |
|
133 | + $search->setConditions($search->combine('&&', $expr)); |
|
134 | + $result = $listManager->aggregate($search, 'product.lists.refid'); |
|
135 | 135 | |
136 | - if( isset( $items[$refId] ) && $result[$refId] == 1 ) { |
|
137 | - $listItem->setRefItem( $items[$refId] ); |
|
136 | + if (isset($items[$refId]) && $result[$refId] == 1) { |
|
137 | + $listItem->setRefItem($items[$refId]); |
|
138 | 138 | } else { |
139 | - unset( $listItems[$id] ); |
|
139 | + unset($listItems[$id]); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - $this->cleanupItems( $listItems, array() ); |
|
143 | + $this->cleanupItems($listItems, array()); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | { |
155 | 155 | $view = $this->getView(); |
156 | 156 | |
157 | - $this->setData( $view ); |
|
157 | + $this->setData($view); |
|
158 | 158 | $view->downloadBody = ''; |
159 | 159 | |
160 | - foreach( $this->getSubClients() as $client ) { |
|
160 | + foreach ($this->getSubClients() as $client) { |
|
161 | 161 | $view->downloadBody .= $client->get(); |
162 | 162 | } |
163 | 163 | |
164 | 164 | $tplconf = 'admin/jqadm/product/download/template-item'; |
165 | 165 | $default = 'product/item-download-default.php'; |
166 | 166 | |
167 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
167 | + return $view->render($view->config($tplconf, $default)); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -178,18 +178,18 @@ discard block |
||
178 | 178 | $view = $this->getView(); |
179 | 179 | $context = $this->getContext(); |
180 | 180 | |
181 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
182 | - $attrManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
181 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
182 | + $attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
183 | 183 | |
184 | 184 | $manager->begin(); |
185 | 185 | $attrManager->begin(); |
186 | 186 | |
187 | 187 | try |
188 | 188 | { |
189 | - $this->updateItems( $view ); |
|
189 | + $this->updateItems($view); |
|
190 | 190 | $view->downloadBody = ''; |
191 | 191 | |
192 | - foreach( $this->getSubClients() as $client ) { |
|
192 | + foreach ($this->getSubClients() as $client) { |
|
193 | 193 | $view->downloadBody .= $client->save(); |
194 | 194 | } |
195 | 195 | |
@@ -197,19 +197,19 @@ discard block |
||
197 | 197 | $manager->commit(); |
198 | 198 | return; |
199 | 199 | } |
200 | - catch( \Aimeos\MShop\Exception $e ) |
|
200 | + catch (\Aimeos\MShop\Exception $e) |
|
201 | 201 | { |
202 | - $error = array( 'product-item-download' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
203 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
202 | + $error = array('product-item-download' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
203 | + $view->errors = $view->get('errors', array()) + $error; |
|
204 | 204 | |
205 | 205 | $attrManager->rollback(); |
206 | 206 | $manager->rollback(); |
207 | 207 | } |
208 | - catch( \Exception $e ) |
|
208 | + catch (\Exception $e) |
|
209 | 209 | { |
210 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
211 | - $error = array( 'product-item-download' => $e->getMessage() ); |
|
212 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
210 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
211 | + $error = array('product-item-download' => $e->getMessage()); |
|
212 | + $view->errors = $view->get('errors', array()) + $error; |
|
213 | 213 | |
214 | 214 | $attrManager->rollback(); |
215 | 215 | $manager->rollback(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @param string|null $name Name of the sub-client (Default if null) |
227 | 227 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
228 | 228 | */ |
229 | - public function getSubClient( $type, $name = null ) |
|
229 | + public function getSubClient($type, $name = null) |
|
230 | 230 | { |
231 | 231 | /** admin/jqadm/product/download/decorators/excludes |
232 | 232 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @see admin/jqadm/product/download/decorators/excludes |
302 | 302 | * @see admin/jqadm/product/download/decorators/global |
303 | 303 | */ |
304 | - return $this->createSubClient( 'product/download/' . $type, $name ); |
|
304 | + return $this->createSubClient('product/download/' . $type, $name); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -311,29 +311,29 @@ discard block |
||
311 | 311 | * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
312 | 312 | * @param array $listIds List of IDs of the still used list items |
313 | 313 | */ |
314 | - protected function cleanupItems( array $listItems, array $listIds ) |
|
314 | + protected function cleanupItems(array $listItems, array $listIds) |
|
315 | 315 | { |
316 | 316 | $context = $this->getContext(); |
317 | - $fs = $context->getFilesystemManager()->get( 'fs-secure' ); |
|
318 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
319 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
317 | + $fs = $context->getFilesystemManager()->get('fs-secure'); |
|
318 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
319 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
320 | 320 | |
321 | 321 | $rmItems = array(); |
322 | - $rmListIds = array_diff( array_keys( $listItems ), $listIds ); |
|
322 | + $rmListIds = array_diff(array_keys($listItems), $listIds); |
|
323 | 323 | |
324 | - foreach( $rmListIds as $rmListId ) |
|
324 | + foreach ($rmListIds as $rmListId) |
|
325 | 325 | { |
326 | - if( ( $item = $listItems[$rmListId]->getRefItem() ) !== null ) |
|
326 | + if (($item = $listItems[$rmListId]->getRefItem()) !== null) |
|
327 | 327 | { |
328 | - if( $item->getCode() != '' && $fs->has( $item->getCode() ) ) { |
|
329 | - $fs->rm( $item->getCode() ); |
|
328 | + if ($item->getCode() != '' && $fs->has($item->getCode())) { |
|
329 | + $fs->rm($item->getCode()); |
|
330 | 330 | } |
331 | 331 | $rmItems[] = $item->getId(); |
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
335 | - $listManager->deleteItems( $rmListIds ); |
|
336 | - $manager->deleteItems( $rmItems ); |
|
335 | + $listManager->deleteItems($rmListIds); |
|
336 | + $manager->deleteItems($rmItems); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -345,13 +345,13 @@ discard block |
||
345 | 345 | protected function createItem() |
346 | 346 | { |
347 | 347 | $context = $this->getContext(); |
348 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
349 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/type' ); |
|
348 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
349 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/type'); |
|
350 | 350 | |
351 | 351 | $item = $manager->createItem(); |
352 | - $item->setTypeId( $typeManager->findItem( 'download', array(), 'product' )->getId() ); |
|
353 | - $item->setDomain( 'product' ); |
|
354 | - $item->setStatus( 1 ); |
|
352 | + $item->setTypeId($typeManager->findItem('download', array(), 'product')->getId()); |
|
353 | + $item->setDomain('product'); |
|
354 | + $item->setStatus(1); |
|
355 | 355 | |
356 | 356 | return $item; |
357 | 357 | } |
@@ -363,17 +363,17 @@ discard block |
||
363 | 363 | * @param string $id Parent ID for the new list item |
364 | 364 | * @return \Aimeos\MShop\Common\Item\Lists\Iface New list item object |
365 | 365 | */ |
366 | - protected function createListItem( $id ) |
|
366 | + protected function createListItem($id) |
|
367 | 367 | { |
368 | 368 | $context = $this->getContext(); |
369 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
370 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
369 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
370 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
371 | 371 | |
372 | 372 | $item = $manager->createItem(); |
373 | - $item->setTypeId( $typeManager->findItem( 'hidden', array(), 'attribute' )->getId() ); |
|
374 | - $item->setDomain( 'attribute' ); |
|
375 | - $item->setParentId( $id ); |
|
376 | - $item->setStatus( 1 ); |
|
373 | + $item->setTypeId($typeManager->findItem('hidden', array(), 'attribute')->getId()); |
|
374 | + $item->setDomain('attribute'); |
|
375 | + $item->setParentId($id); |
|
376 | + $item->setStatus(1); |
|
377 | 377 | |
378 | 378 | return $item; |
379 | 379 | } |
@@ -385,27 +385,27 @@ discard block |
||
385 | 385 | * @param array $listItems List of list items with IDs as key and items implementing \Aimeos\MShop\Common\Item\List\Iface as values |
386 | 386 | * @return array List of attribute items with ID as key and items implementing \Aimeos\MShop\Attribute\Item\Iface as values |
387 | 387 | */ |
388 | - protected function getAttributeItems( array $listItems ) |
|
388 | + protected function getAttributeItems(array $listItems) |
|
389 | 389 | { |
390 | 390 | $refIds = array(); |
391 | 391 | |
392 | - foreach( $listItems as $item ) { |
|
392 | + foreach ($listItems as $item) { |
|
393 | 393 | $refIds[] = $item->getRefId(); |
394 | 394 | } |
395 | 395 | |
396 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
396 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
397 | 397 | |
398 | 398 | $search = $manager->createSearch(); |
399 | 399 | $expr = array( |
400 | - $search->compare( '==', 'attribute.id', $refIds ), |
|
401 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
402 | - $search->compare( '==', 'attribute.type.domain', 'product' ), |
|
403 | - $search->compare( '==', 'attribute.type.code', 'download' ), |
|
400 | + $search->compare('==', 'attribute.id', $refIds), |
|
401 | + $search->compare('==', 'attribute.domain', 'product'), |
|
402 | + $search->compare('==', 'attribute.type.domain', 'product'), |
|
403 | + $search->compare('==', 'attribute.type.code', 'download'), |
|
404 | 404 | ); |
405 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
406 | - $search->setSlice( 0, 0x7fffffff ); |
|
405 | + $search->setConditions($search->combine('&&', $expr)); |
|
406 | + $search->setSlice(0, 0x7fffffff); |
|
407 | 407 | |
408 | - return $manager->searchItems( $search ); |
|
408 | + return $manager->searchItems($search); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -415,20 +415,20 @@ discard block |
||
415 | 415 | * @param string $prodid Unique product ID |
416 | 416 | * @return array Associative list of bundle product IDs as keys and list items as values |
417 | 417 | */ |
418 | - protected function getListItems( $prodid ) |
|
418 | + protected function getListItems($prodid) |
|
419 | 419 | { |
420 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
420 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists'); |
|
421 | 421 | |
422 | 422 | $search = $manager->createSearch(); |
423 | 423 | $expr = array( |
424 | - $search->compare( '==', 'product.lists.parentid', $prodid ), |
|
425 | - $search->compare( '==', 'product.lists.domain', 'attribute' ), |
|
426 | - $search->compare( '==', 'product.lists.type.domain', 'attribute' ), |
|
427 | - $search->compare( '==', 'product.lists.type.code', 'hidden' ), |
|
424 | + $search->compare('==', 'product.lists.parentid', $prodid), |
|
425 | + $search->compare('==', 'product.lists.domain', 'attribute'), |
|
426 | + $search->compare('==', 'product.lists.type.domain', 'attribute'), |
|
427 | + $search->compare('==', 'product.lists.type.code', 'hidden'), |
|
428 | 428 | ); |
429 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
429 | + $search->setConditions($search->combine('&&', $expr)); |
|
430 | 430 | |
431 | - return $manager->searchItems( $search ); |
|
431 | + return $manager->searchItems($search); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | */ |
440 | 440 | protected function getSubClientNames() |
441 | 441 | { |
442 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
442 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | |
@@ -448,29 +448,29 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
450 | 450 | */ |
451 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
451 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
452 | 452 | { |
453 | - $view->downloadData = (array) $view->param( 'download', array() ); |
|
453 | + $view->downloadData = (array) $view->param('download', array()); |
|
454 | 454 | |
455 | - if( !empty( $view->downloadData ) ) { |
|
455 | + if (!empty($view->downloadData)) { |
|
456 | 456 | return; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $data = array(); |
460 | - $listItems = $this->getListItems( $view->item->getId() ); |
|
461 | - $attrItems = $this->getAttributeItems( $listItems ); |
|
460 | + $listItems = $this->getListItems($view->item->getId()); |
|
461 | + $attrItems = $this->getAttributeItems($listItems); |
|
462 | 462 | |
463 | - foreach( $listItems as $listItem ) |
|
463 | + foreach ($listItems as $listItem) |
|
464 | 464 | { |
465 | - if( !isset( $attrItems[$listItem->getRefId()] ) ) { |
|
465 | + if (!isset($attrItems[$listItem->getRefId()])) { |
|
466 | 466 | continue; |
467 | 467 | } |
468 | 468 | |
469 | - foreach( $listItem->toArray() as $key => $value ) { |
|
469 | + foreach ($listItem->toArray() as $key => $value) { |
|
470 | 470 | $data[$key] = $value; |
471 | 471 | } |
472 | 472 | |
473 | - foreach( $attrItems[$listItem->getRefId()]->toArray() as $key => $value ) { |
|
473 | + foreach ($attrItems[$listItem->getRefId()]->toArray() as $key => $value) { |
|
474 | 474 | $data[$key] = $value; |
475 | 475 | } |
476 | 476 | |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | |
479 | 479 | try |
480 | 480 | { |
481 | - $fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' ); |
|
481 | + $fs = $this->getContext()->getFilesystemManager()->get('fs-secure'); |
|
482 | 482 | |
483 | - $data['time'] = $fs->time( $data['path'] ); |
|
484 | - $data['size'] = $fs->size( $data['path'] ); |
|
483 | + $data['time'] = $fs->time($data['path']); |
|
484 | + $data['size'] = $fs->size($data['path']); |
|
485 | 485 | } |
486 | - catch( \Exception $e ) { ; } // Show product even if file isn't available any more |
|
486 | + catch (\Exception $e) {; } // Show product even if file isn't available any more |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | $view->downloadData = $data; |
@@ -497,22 +497,22 @@ discard block |
||
497 | 497 | * @param string $path Path the file should be stored at |
498 | 498 | * @return string Path to the uploaded file |
499 | 499 | */ |
500 | - protected function storeFile( \Psr\Http\Message\UploadedFileInterface $file, $path ) |
|
500 | + protected function storeFile(\Psr\Http\Message\UploadedFileInterface $file, $path) |
|
501 | 501 | { |
502 | - $fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' ); |
|
502 | + $fs = $this->getContext()->getFilesystemManager()->get('fs-secure'); |
|
503 | 503 | |
504 | - if( $path == null ) |
|
504 | + if ($path == null) |
|
505 | 505 | { |
506 | - $ext = pathinfo( $file->getClientFilename(), PATHINFO_EXTENSION ); |
|
507 | - $hash = md5( $file->getClientFilename() . microtime( true ) ); |
|
508 | - $path = sprintf( '%s/%s/%s.%s', $hash[0], $hash[1], $hash, $ext ); |
|
506 | + $ext = pathinfo($file->getClientFilename(), PATHINFO_EXTENSION); |
|
507 | + $hash = md5($file->getClientFilename() . microtime(true)); |
|
508 | + $path = sprintf('%s/%s/%s.%s', $hash[0], $hash[1], $hash, $ext); |
|
509 | 509 | |
510 | - if( !$fs->isdir( $hash[0] . '/' . $hash[1] ) ) { |
|
511 | - $fs->mkdir( $hash[0] . '/' . $hash[1] ); |
|
510 | + if (!$fs->isdir($hash[0] . '/' . $hash[1])) { |
|
511 | + $fs->mkdir($hash[0] . '/' . $hash[1]); |
|
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - $fs->writes( $path, $file->getStream()->detach() ); |
|
515 | + $fs->writes($path, $file->getStream()->detach()); |
|
516 | 516 | |
517 | 517 | return $path; |
518 | 518 | } |
@@ -523,47 +523,47 @@ discard block |
||
523 | 523 | * |
524 | 524 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
525 | 525 | */ |
526 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
526 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
527 | 527 | { |
528 | 528 | $id = $view->item->getId(); |
529 | 529 | $context = $this->getContext(); |
530 | 530 | |
531 | - $attrManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
532 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
531 | + $attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
532 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
533 | 533 | |
534 | - $listItems = $this->getListItems( $id ); |
|
535 | - $listId = $view->param( 'download/product.lists.id' ); |
|
534 | + $listItems = $this->getListItems($id); |
|
535 | + $listId = $view->param('download/product.lists.id'); |
|
536 | 536 | |
537 | - if( isset( $listItems[$listId] ) ) { |
|
537 | + if (isset($listItems[$listId])) { |
|
538 | 538 | $litem = $listItems[$listId]; |
539 | 539 | } else { |
540 | - $litem = $this->createListItem( $id ); |
|
540 | + $litem = $this->createListItem($id); |
|
541 | 541 | } |
542 | 542 | |
543 | - if( ( $attrId = $view->param( 'download/attribute.id' ) ) != '' ) { |
|
544 | - $item = $attrManager->getItem( $attrId ); |
|
543 | + if (($attrId = $view->param('download/attribute.id')) != '') { |
|
544 | + $item = $attrManager->getItem($attrId); |
|
545 | 545 | } else { |
546 | 546 | $item = $this->createItem(); |
547 | 547 | } |
548 | 548 | |
549 | - if( ( $file = $view->value( (array) $view->request()->getUploadedFiles(), 'download/file' ) ) !== null |
|
549 | + if (($file = $view->value((array) $view->request()->getUploadedFiles(), 'download/file')) !== null |
|
550 | 550 | && $file->getError() === UPLOAD_ERR_OK |
551 | 551 | ) { |
552 | - $path = ( $view->param( 'download/overwrite' ) == 1 ? $item->getCode() : null ); |
|
553 | - $item->setCode( $this->storeFile( $file, $path ) ); |
|
552 | + $path = ($view->param('download/overwrite') == 1 ? $item->getCode() : null); |
|
553 | + $item->setCode($this->storeFile($file, $path)); |
|
554 | 554 | } |
555 | 555 | |
556 | - if( ( $label = $view->param( 'download/attribute.label' ) ) != '' ) |
|
556 | + if (($label = $view->param('download/attribute.label')) != '') |
|
557 | 557 | { |
558 | - $item->setLabel( $label ); |
|
559 | - $attrManager->saveItem( $item ); |
|
558 | + $item->setLabel($label); |
|
559 | + $attrManager->saveItem($item); |
|
560 | 560 | |
561 | - $litem->setPosition( 0 ); |
|
562 | - $litem->setRefId( $item->getId() ); |
|
563 | - $litem->setStatus( $view->param( 'download/product.lists.status' ) ); |
|
564 | - $listManager->saveItem( $litem ); |
|
561 | + $litem->setPosition(0); |
|
562 | + $litem->setRefId($item->getId()); |
|
563 | + $litem->setStatus($view->param('download/product.lists.status')); |
|
564 | + $listManager->saveItem($litem); |
|
565 | 565 | } |
566 | 566 | |
567 | - $this->cleanupItems( $listItems, array( $listId ) ); |
|
567 | + $this->cleanupItems($listItems, array($listId)); |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | \ No newline at end of file |
@@ -196,16 +196,14 @@ discard block |
||
196 | 196 | $attrManager->commit(); |
197 | 197 | $manager->commit(); |
198 | 198 | return; |
199 | - } |
|
200 | - catch( \Aimeos\MShop\Exception $e ) |
|
199 | + } catch( \Aimeos\MShop\Exception $e ) |
|
201 | 200 | { |
202 | 201 | $error = array( 'product-item-download' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
203 | 202 | $view->errors = $view->get( 'errors', array() ) + $error; |
204 | 203 | |
205 | 204 | $attrManager->rollback(); |
206 | 205 | $manager->rollback(); |
207 | - } |
|
208 | - catch( \Exception $e ) |
|
206 | + } catch( \Exception $e ) |
|
209 | 207 | { |
210 | 208 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
211 | 209 | $error = array( 'product-item-download' => $e->getMessage() ); |
@@ -482,8 +480,7 @@ discard block |
||
482 | 480 | |
483 | 481 | $data['time'] = $fs->time( $data['path'] ); |
484 | 482 | $data['size'] = $fs->size( $data['path'] ); |
485 | - } |
|
486 | - catch( \Exception $e ) { ; } // Show product even if file isn't available any more |
|
483 | + } catch( \Exception $e ) { ; } // Show product even if file isn't available any more |
|
487 | 484 | } |
488 | 485 | |
489 | 486 | $view->downloadData = $data; |