@@ -11,17 +11,17 @@ |
||
11 | 11 | * Set error reporting to maximum |
12 | 12 | */ |
13 | 13 | error_reporting( -1 ); |
14 | -ini_set( 'display_errors', '1' ); |
|
14 | +ini_set('display_errors', '1'); |
|
15 | 15 | |
16 | -date_default_timezone_set( 'UTC' ); |
|
16 | +date_default_timezone_set('UTC'); |
|
17 | 17 | |
18 | 18 | /* |
19 | 19 | * Set locale settings to reasonable defaults |
20 | 20 | */ |
21 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
22 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
23 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
24 | -setlocale( LC_TIME, 'POSIX' ); |
|
21 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
22 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
23 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
24 | +setlocale(LC_TIME, 'POSIX'); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | require_once 'TestHelperJqadm.php'; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
35 | 35 | * and a list of relative paths inside the core or the extension as values |
36 | 36 | */ |
37 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
37 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths) |
|
38 | 38 | { |
39 | 39 | $this->context = $context; |
40 | 40 | $this->templatePaths = $templatePaths; |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getView() |
50 | 50 | { |
51 | - if( !isset( $this->view ) ) { |
|
52 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'No view available' ) ); |
|
51 | + if (!isset($this->view)) { |
|
52 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('No view available')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | return $this->view; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output |
63 | 63 | * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
64 | 64 | */ |
65 | - public function setView( \Aimeos\MW\View\Iface $view ) |
|
65 | + public function setView(\Aimeos\MW\View\Iface $view) |
|
66 | 66 | { |
67 | 67 | $this->view = $view; |
68 | 68 | return $this; |
@@ -98,29 +98,29 @@ discard block |
||
98 | 98 | * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Admin\JQAdm\Catalog\Decorator\" |
99 | 99 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
100 | 100 | */ |
101 | - protected function addDecorators( \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, |
|
102 | - array $decorators, $classprefix ) |
|
101 | + protected function addDecorators(\Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, |
|
102 | + array $decorators, $classprefix) |
|
103 | 103 | { |
104 | 104 | $iface = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\Iface'; |
105 | 105 | |
106 | - foreach( $decorators as $name ) |
|
106 | + foreach ($decorators as $name) |
|
107 | 107 | { |
108 | - if( ctype_alnum( $name ) === false ) |
|
108 | + if (ctype_alnum($name) === false) |
|
109 | 109 | { |
110 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
111 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); |
|
110 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
111 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid class name "%1$s"', $classname)); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | $classname = $classprefix . $name; |
115 | 115 | |
116 | - if( class_exists( $classname ) === false ) { |
|
117 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
116 | + if (class_exists($classname) === false) { |
|
117 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
118 | 118 | } |
119 | 119 | |
120 | - $client = new $classname( $client, $this->context, $this->templatePaths ); |
|
120 | + $client = new $classname($client, $this->context, $this->templatePaths); |
|
121 | 121 | |
122 | - if( !( $client instanceof $iface ) ) { |
|
123 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ) ); |
|
122 | + if (!($client instanceof $iface)) { |
|
123 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface)); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -136,35 +136,35 @@ discard block |
||
136 | 136 | * @param string $path Admin string in lower case, e.g. "catalog/detail/basic" |
137 | 137 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
138 | 138 | */ |
139 | - protected function addClientDecorators( \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path ) |
|
139 | + protected function addClientDecorators(\Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path) |
|
140 | 140 | { |
141 | - if( !is_string( $path ) || $path === '' ) { |
|
142 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid domain "%1$s"', $path ) ); |
|
141 | + if (!is_string($path) || $path === '') { |
|
142 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid domain "%1$s"', $path)); |
|
143 | 143 | } |
144 | 144 | |
145 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
145 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
146 | 146 | $config = $this->context->getConfig(); |
147 | 147 | |
148 | - $decorators = $config->get( 'admin/jqadm/common/decorators/default', array() ); |
|
149 | - $excludes = $config->get( 'admin/jqadm/' . $path . '/decorators/excludes', array() ); |
|
148 | + $decorators = $config->get('admin/jqadm/common/decorators/default', array()); |
|
149 | + $excludes = $config->get('admin/jqadm/' . $path . '/decorators/excludes', array()); |
|
150 | 150 | |
151 | - foreach( $decorators as $key => $name ) |
|
151 | + foreach ($decorators as $key => $name) |
|
152 | 152 | { |
153 | - if( in_array( $name, $excludes ) ) { |
|
154 | - unset( $decorators[$key] ); |
|
153 | + if (in_array($name, $excludes)) { |
|
154 | + unset($decorators[$key]); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
159 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
159 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
160 | 160 | |
161 | 161 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
162 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/global', array() ); |
|
163 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
162 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/global', array()); |
|
163 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
164 | 164 | |
165 | 165 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\' . $localClass . '\\Decorator\\'; |
166 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/local', array() ); |
|
167 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
166 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/local', array()); |
|
167 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
168 | 168 | |
169 | 169 | return $client; |
170 | 170 | } |
@@ -177,35 +177,35 @@ discard block |
||
177 | 177 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-part object |
179 | 179 | */ |
180 | - protected function createSubClient( $path, $name ) |
|
180 | + protected function createSubClient($path, $name) |
|
181 | 181 | { |
182 | - $path = strtolower( $path ); |
|
182 | + $path = strtolower($path); |
|
183 | 183 | |
184 | - if( $name === null ) { |
|
185 | - $name = $this->context->getConfig()->get( 'admin/jqadm/' . $path . '/name', 'Standard' ); |
|
184 | + if ($name === null) { |
|
185 | + $name = $this->context->getConfig()->get('admin/jqadm/' . $path . '/name', 'Standard'); |
|
186 | 186 | } |
187 | 187 | |
188 | - if( empty( $name ) || ctype_alnum( $name ) === false ) { |
|
189 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in client name "%1$s"', $name ) ); |
|
188 | + if (empty($name) || ctype_alnum($name) === false) { |
|
189 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in client name "%1$s"', $name)); |
|
190 | 190 | } |
191 | 191 | |
192 | - $subnames = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
192 | + $subnames = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
193 | 193 | |
194 | 194 | $classname = '\\Aimeos\\Admin\\JQAdm\\' . $subnames . '\\' . $name; |
195 | 195 | $interface = '\\Aimeos\\Admin\\JQAdm\\Iface'; |
196 | 196 | |
197 | - if( class_exists( $classname ) === false ) { |
|
198 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
197 | + if (class_exists($classname) === false) { |
|
198 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
199 | 199 | } |
200 | 200 | |
201 | - $object = new $classname( $this->context, $this->templatePaths ); |
|
201 | + $object = new $classname($this->context, $this->templatePaths); |
|
202 | 202 | |
203 | - if( ( $object instanceof $interface ) === false ) { |
|
204 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
203 | + if (($object instanceof $interface) === false) { |
|
204 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface)); |
|
205 | 205 | } |
206 | 206 | |
207 | - $object = $this->addClientDecorators( $object, $this->templatePaths, $path ); |
|
208 | - $object->setView( $this->view ); |
|
207 | + $object = $this->addClientDecorators($object, $this->templatePaths, $path); |
|
208 | + $object->setView($this->view); |
|
209 | 209 | |
210 | 210 | return $object; |
211 | 211 | } |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | * @param array $names List of parameter names |
218 | 218 | * @return array Associative list of parameters names as key and their values |
219 | 219 | */ |
220 | - protected function getClientParams( $names = array( 'resource', 'site', 'lang', 'fields', 'filter', 'page', 'sort' ) ) |
|
220 | + protected function getClientParams($names = array('resource', 'site', 'lang', 'fields', 'filter', 'page', 'sort')) |
|
221 | 221 | { |
222 | 222 | $list = array(); |
223 | 223 | |
224 | - foreach( $names as $name ) |
|
224 | + foreach ($names as $name) |
|
225 | 225 | { |
226 | - if( ( $val = $this->view->param( $name ) ) !== null ) { |
|
226 | + if (($val = $this->view->param($name)) !== null) { |
|
227 | 227 | $list[$name] = $val; |
228 | 228 | } |
229 | 229 | } |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | */ |
259 | 259 | protected function getSubClients() |
260 | 260 | { |
261 | - if( !isset( $this->subclients ) ) |
|
261 | + if (!isset($this->subclients)) |
|
262 | 262 | { |
263 | 263 | $this->subclients = array(); |
264 | 264 | |
265 | - foreach( $this->getSubClientNames() as $name ) { |
|
266 | - $this->subclients[] = $this->getSubClient( $name ); |
|
265 | + foreach ($this->getSubClientNames() as $name) { |
|
266 | + $this->subclients[] = $this->getSubClient($name); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | * @param array $params List of criteria data with condition, sorting and paging |
290 | 290 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
291 | 291 | */ |
292 | - protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
292 | + protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
293 | 293 | { |
294 | - $this->initCriteriaConditions( $criteria, $params ); |
|
295 | - $this->initCriteriaSortations( $criteria, $params ); |
|
296 | - $this->initCriteriaSlice( $criteria, $params ); |
|
294 | + $this->initCriteriaConditions($criteria, $params); |
|
295 | + $this->initCriteriaSortations($criteria, $params); |
|
296 | + $this->initCriteriaSlice($criteria, $params); |
|
297 | 297 | |
298 | 298 | return $criteria; |
299 | 299 | } |
@@ -305,24 +305,24 @@ discard block |
||
305 | 305 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
306 | 306 | * @param array $params List of criteria data with condition, sorting and paging |
307 | 307 | */ |
308 | - private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
308 | + private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
309 | 309 | { |
310 | - if( isset( $params['filter'] ) && isset( $params['filter']['key'] ) ) |
|
310 | + if (isset($params['filter']) && isset($params['filter']['key'])) |
|
311 | 311 | { |
312 | 312 | $expr = array(); |
313 | 313 | $existing = $criteria->getConditions(); |
314 | 314 | |
315 | - foreach( (array) $params['filter']['key'] as $idx => $key ) |
|
315 | + foreach ((array) $params['filter']['key'] as $idx => $key) |
|
316 | 316 | { |
317 | - if( $key != '' && isset( $params['filter']['op'][$idx] ) && $params['filter']['op'][$idx] != '' |
|
318 | - && isset( $params['filter']['val'][$idx] ) |
|
317 | + if ($key != '' && isset($params['filter']['op'][$idx]) && $params['filter']['op'][$idx] != '' |
|
318 | + && isset($params['filter']['val'][$idx]) |
|
319 | 319 | ) { |
320 | - $expr[] = $criteria->compare( $params['filter']['op'][$idx], $key, $params['filter']['val'][$idx] ); |
|
320 | + $expr[] = $criteria->compare($params['filter']['op'][$idx], $key, $params['filter']['val'][$idx]); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | $expr[] = $existing; |
325 | - $criteria->setConditions( $criteria->combine( '&&', $expr ) ); |
|
325 | + $criteria->setConditions($criteria->combine('&&', $expr)); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
@@ -333,12 +333,12 @@ discard block |
||
333 | 333 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
334 | 334 | * @param array $params List of criteria data with condition, sorting and paging |
335 | 335 | */ |
336 | - private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
336 | + private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
337 | 337 | { |
338 | - $start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 ); |
|
339 | - $size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 100 ); |
|
338 | + $start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0); |
|
339 | + $size = (isset($params['page']['limit']) ? $params['page']['limit'] : 100); |
|
340 | 340 | |
341 | - $criteria->setSlice( $start, $size ); |
|
341 | + $criteria->setSlice($start, $size); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -348,23 +348,23 @@ discard block |
||
348 | 348 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
349 | 349 | * @param array $params List of criteria data with condition, sorting and paging |
350 | 350 | */ |
351 | - private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
351 | + private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
352 | 352 | { |
353 | - if( !isset( $params['sort'] ) ) { |
|
353 | + if (!isset($params['sort'])) { |
|
354 | 354 | return; |
355 | 355 | } |
356 | 356 | |
357 | 357 | $sortation = array(); |
358 | 358 | |
359 | - foreach( (array) $params['sort'] as $sort ) |
|
359 | + foreach ((array) $params['sort'] as $sort) |
|
360 | 360 | { |
361 | - if( $sort[0] === '-' ) { |
|
362 | - $sortation[] = $criteria->sort( '-', substr( $sort, 1 ) ); |
|
361 | + if ($sort[0] === '-') { |
|
362 | + $sortation[] = $criteria->sort('-', substr($sort, 1)); |
|
363 | 363 | } else { |
364 | - $sortation[] = $criteria->sort( '+', $sort ); break; |
|
364 | + $sortation[] = $criteria->sort('+', $sort); break; |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
368 | - $criteria->setSortations( $sortation ); |
|
368 | + $criteria->setSortations($sortation); |
|
369 | 369 | } |
370 | 370 | } |
@@ -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->attributeBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->attributeBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/characteristic/attribute/template-item'; |
78 | 78 | $default = 'product/item-characteristic-attribute-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->attributeBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->attributeBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/characteristic/attribute/template-item'; |
101 | 101 | $default = 'product/item-characteristic-attribute-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 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->attributeBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->attributeBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/characteristic/attribute/template-item'; |
124 | 124 | $default = 'product/item-characteristic-attribute-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,32 +137,32 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | - $this->updateItems( $view ); |
|
145 | + $this->updateItems($view); |
|
146 | 146 | $view->attributeBody = ''; |
147 | 147 | |
148 | - foreach( $this->getSubClients() as $client ) { |
|
148 | + foreach ($this->getSubClients() as $client) { |
|
149 | 149 | $view->attributeBody .= $client->save(); |
150 | 150 | } |
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | 154 | } |
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
155 | + catch (\Aimeos\MShop\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'product-item-characteristic-attribute' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
157 | + $error = array('product-item-characteristic-attribute' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
158 | + $view->errors = $view->get('errors', array()) + $error; |
|
159 | 159 | $manager->rollback(); |
160 | 160 | } |
161 | - catch( \Exception $e ) |
|
161 | + catch (\Exception $e) |
|
162 | 162 | { |
163 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
164 | - $error = array( 'product-item-characteristic-attribute' => $e->getMessage() ); |
|
165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
164 | + $error = array('product-item-characteristic-attribute' => $e->getMessage()); |
|
165 | + $view->errors = $view->get('errors', array()) + $error; |
|
166 | 166 | $manager->rollback(); |
167 | 167 | } |
168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param string|null $name Name of the sub-client (Default if null) |
178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
179 | 179 | */ |
180 | - public function getSubClient( $type, $name = null ) |
|
180 | + public function getSubClient($type, $name = null) |
|
181 | 181 | { |
182 | 182 | /** admin/jqadm/product/characteristic/attribute/decorators/excludes |
183 | 183 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @see admin/jqadm/product/characteristic/attribute/decorators/excludes |
253 | 253 | * @see admin/jqadm/product/characteristic/attribute/decorators/global |
254 | 254 | */ |
255 | - return $this->createSubClient( 'product/characteristic/attribute/' . $type, $name ); |
|
255 | + return $this->createSubClient('product/characteristic/attribute/' . $type, $name); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | protected function getSubClientNames() |
265 | 265 | { |
266 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
266 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -273,20 +273,20 @@ discard block |
||
273 | 273 | * @param string $prodid Unique product ID |
274 | 274 | * @return array Associative list of attribute product IDs as keys and list items as values |
275 | 275 | */ |
276 | - protected function getListItems( $prodid ) |
|
276 | + protected function getListItems($prodid) |
|
277 | 277 | { |
278 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
278 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists'); |
|
279 | 279 | |
280 | 280 | $search = $manager->createSearch(); |
281 | 281 | $expr = array( |
282 | - $search->compare( '==', 'product.lists.parentid', $prodid ), |
|
283 | - $search->compare( '==', 'product.lists.domain', 'attribute' ), |
|
284 | - $search->compare( '==', 'product.lists.type.domain', 'attribute' ), |
|
285 | - $search->compare( '==', 'product.lists.type.code', 'default' ), |
|
282 | + $search->compare('==', 'product.lists.parentid', $prodid), |
|
283 | + $search->compare('==', 'product.lists.domain', 'attribute'), |
|
284 | + $search->compare('==', 'product.lists.type.domain', 'attribute'), |
|
285 | + $search->compare('==', 'product.lists.type.code', 'default'), |
|
286 | 286 | ); |
287 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
287 | + $search->setConditions($search->combine('&&', $expr)); |
|
288 | 288 | |
289 | - return $manager->searchItems( $search ); |
|
289 | + return $manager->searchItems($search); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -295,18 +295,18 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
297 | 297 | */ |
298 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
298 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
299 | 299 | { |
300 | - $data = (array) $view->param( 'characteristic/attribute', array() ); |
|
300 | + $data = (array) $view->param('characteristic/attribute', array()); |
|
301 | 301 | |
302 | - if( empty( $data ) ) |
|
302 | + if (empty($data)) |
|
303 | 303 | { |
304 | - foreach( $view->item->getListItems( 'attribute', 'default' ) as $listItem ) |
|
304 | + foreach ($view->item->getListItems('attribute', 'default') as $listItem) |
|
305 | 305 | { |
306 | 306 | $refItem = $listItem->getRefItem(); |
307 | - $data['attribute.label'][] = ( $refItem ? $refItem->getLabel() : '' ); |
|
307 | + $data['attribute.label'][] = ($refItem ? $refItem->getLabel() : ''); |
|
308 | 308 | |
309 | - foreach( $listItem->toArray() as $key => $value ) { |
|
309 | + foreach ($listItem->toArray() as $key => $value) { |
|
310 | 310 | $data[$key][] = $value; |
311 | 311 | } |
312 | 312 | } |
@@ -321,39 +321,39 @@ discard block |
||
321 | 321 | * |
322 | 322 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
323 | 323 | */ |
324 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
324 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
325 | 325 | { |
326 | 326 | $context = $this->getContext(); |
327 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
328 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
327 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
328 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
329 | 329 | |
330 | 330 | $id = $view->item->getId(); |
331 | - $map = $this->getListItems( $id ); |
|
332 | - $listIds = (array) $view->param( 'characteristic/attribute/product.lists.id', array() ); |
|
331 | + $map = $this->getListItems($id); |
|
332 | + $listIds = (array) $view->param('characteristic/attribute/product.lists.id', array()); |
|
333 | 333 | |
334 | 334 | |
335 | - foreach( $listIds as $pos => $listid ) |
|
335 | + foreach ($listIds as $pos => $listid) |
|
336 | 336 | { |
337 | - if( isset( $map[$listid] ) ) { |
|
338 | - unset( $map[$listid], $listIds[$pos] ); |
|
337 | + if (isset($map[$listid])) { |
|
338 | + unset($map[$listid], $listIds[$pos]); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | - $manager->deleteItems( array_keys( $map ) ); |
|
342 | + $manager->deleteItems(array_keys($map)); |
|
343 | 343 | |
344 | 344 | |
345 | 345 | $item = $manager->createItem(); |
346 | - $item->setTypeId( $typeManager->findItem( 'default', array(), 'attribute' )->getId() ); |
|
347 | - $item->setDomain( 'attribute' ); |
|
348 | - $item->setParentId( $id ); |
|
346 | + $item->setTypeId($typeManager->findItem('default', array(), 'attribute')->getId()); |
|
347 | + $item->setDomain('attribute'); |
|
348 | + $item->setParentId($id); |
|
349 | 349 | |
350 | - foreach( $listIds as $pos => $listid ) |
|
350 | + foreach ($listIds as $pos => $listid) |
|
351 | 351 | { |
352 | - $item->setId( null ); |
|
353 | - $item->setRefId( $view->param( 'characteristic/attribute/product.lists.refid/' . $pos ) ); |
|
354 | - $item->setPosition( $pos ); |
|
352 | + $item->setId(null); |
|
353 | + $item->setRefId($view->param('characteristic/attribute/product.lists.refid/' . $pos)); |
|
354 | + $item->setPosition($pos); |
|
355 | 355 | |
356 | - $manager->saveItem( $item, false ); |
|
356 | + $manager->saveItem($item, false); |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | } |
360 | 360 | \ No newline at end of file |
@@ -151,14 +151,12 @@ |
||
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | - } |
|
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
154 | + } catch( \Aimeos\MShop\Exception $e ) |
|
156 | 155 | { |
157 | 156 | $error = array( 'product-item-characteristic-attribute' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
158 | 157 | $view->errors = $view->get( 'errors', array() ) + $error; |
159 | 158 | $manager->rollback(); |
160 | - } |
|
161 | - catch( \Exception $e ) |
|
159 | + } catch( \Exception $e ) |
|
162 | 160 | { |
163 | 161 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
164 | 162 | $error = array( 'product-item-characteristic-attribute' => $e->getMessage() ); |
@@ -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->propertyBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->propertyBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/characteristic/property/template-item'; |
78 | 78 | $default = 'product/item-characteristic-property-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->propertyBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->propertyBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/characteristic/property/template-item'; |
101 | 101 | $default = 'product/item-characteristic-property-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 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->propertyBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->propertyBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/characteristic/property/template-item'; |
124 | 124 | $default = 'product/item-characteristic-property-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,32 +137,32 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | - $this->updateItems( $view ); |
|
145 | + $this->updateItems($view); |
|
146 | 146 | $view->propertyBody = ''; |
147 | 147 | |
148 | - foreach( $this->getSubClients() as $client ) { |
|
148 | + foreach ($this->getSubClients() as $client) { |
|
149 | 149 | $view->propertyBody .= $client->save(); |
150 | 150 | } |
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | 154 | } |
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
155 | + catch (\Aimeos\MShop\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'product-item-characteristic-property' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
157 | + $error = array('product-item-characteristic-property' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
158 | + $view->errors = $view->get('errors', array()) + $error; |
|
159 | 159 | $manager->rollback(); |
160 | 160 | } |
161 | - catch( \Exception $e ) |
|
161 | + catch (\Exception $e) |
|
162 | 162 | { |
163 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
164 | - $error = array( 'product-item-characteristic-property' => $e->getMessage() ); |
|
165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
164 | + $error = array('product-item-characteristic-property' => $e->getMessage()); |
|
165 | + $view->errors = $view->get('errors', array()) + $error; |
|
166 | 166 | $manager->rollback(); |
167 | 167 | } |
168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param string|null $name Name of the sub-client (Default if null) |
178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
179 | 179 | */ |
180 | - public function getSubClient( $type, $name = null ) |
|
180 | + public function getSubClient($type, $name = null) |
|
181 | 181 | { |
182 | 182 | /** admin/jqadm/product/characteristic/property/decorators/excludes |
183 | 183 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @see admin/jqadm/product/characteristic/property/decorators/excludes |
253 | 253 | * @see admin/jqadm/product/characteristic/property/decorators/global |
254 | 254 | */ |
255 | - return $this->createSubClient( 'product/characteristic/property/' . $type, $name ); |
|
255 | + return $this->createSubClient('product/characteristic/property/' . $type, $name); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | protected function getSubClientNames() |
265 | 265 | { |
266 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
266 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -273,20 +273,20 @@ discard block |
||
273 | 273 | * @param string $prodid Unique product ID |
274 | 274 | * @return array Associative list of property IDs as keys and property items as values |
275 | 275 | */ |
276 | - protected function getProperties( $prodid ) |
|
276 | + protected function getProperties($prodid) |
|
277 | 277 | { |
278 | - $excludes = array( 'package-length', 'package-height', 'package-width', 'package-weight' ); |
|
279 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
278 | + $excludes = array('package-length', 'package-height', 'package-width', 'package-weight'); |
|
279 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property'); |
|
280 | 280 | |
281 | 281 | $search = $manager->createSearch(); |
282 | 282 | $expr = array( |
283 | - $search->compare( '==', 'product.property.parentid', $prodid ), |
|
284 | - $search->compare( '!=', 'product.property.type.code', $excludes ), |
|
283 | + $search->compare('==', 'product.property.parentid', $prodid), |
|
284 | + $search->compare('!=', 'product.property.type.code', $excludes), |
|
285 | 285 | ); |
286 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
287 | - $search->setSlice( 0, 0x7fffffff ); |
|
286 | + $search->setConditions($search->combine('&&', $expr)); |
|
287 | + $search->setSlice(0, 0x7fffffff); |
|
288 | 288 | |
289 | - return $manager->searchItems( $search ); |
|
289 | + return $manager->searchItems($search); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -297,14 +297,14 @@ discard block |
||
297 | 297 | */ |
298 | 298 | protected function getPropertyTypes() |
299 | 299 | { |
300 | - $excludes = array( 'package-length', 'package-height', 'package-width', 'package-weight' ); |
|
301 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property/type' ); |
|
300 | + $excludes = array('package-length', 'package-height', 'package-width', 'package-weight'); |
|
301 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property/type'); |
|
302 | 302 | |
303 | 303 | $search = $manager->createSearch(); |
304 | - $search->setConditions( $search->compare( '!=', 'product.property.type.code', $excludes ) ); |
|
305 | - $search->setSlice( 0, 0x7fffffff ); |
|
304 | + $search->setConditions($search->compare('!=', 'product.property.type.code', $excludes)); |
|
305 | + $search->setSlice(0, 0x7fffffff); |
|
306 | 306 | |
307 | - return $manager->searchItems( $search ); |
|
307 | + return $manager->searchItems($search); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | |
@@ -313,15 +313,15 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
315 | 315 | */ |
316 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
316 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
317 | 317 | { |
318 | - $data = (array) $view->param( 'characteristic/property', array() ); |
|
318 | + $data = (array) $view->param('characteristic/property', array()); |
|
319 | 319 | |
320 | - if( empty( $data ) ) |
|
320 | + if (empty($data)) |
|
321 | 321 | { |
322 | - foreach( $this->getProperties( $view->item->getId() ) as $item ) |
|
322 | + foreach ($this->getProperties($view->item->getId()) as $item) |
|
323 | 323 | { |
324 | - foreach( $item->toArray() as $key => $value ) { |
|
324 | + foreach ($item->toArray() as $key => $value) { |
|
325 | 325 | $data[$key][] = $value; |
326 | 326 | } |
327 | 327 | } |
@@ -337,38 +337,38 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
339 | 339 | */ |
340 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
340 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
341 | 341 | { |
342 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
342 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property'); |
|
343 | 343 | |
344 | 344 | $id = $view->item->getId(); |
345 | - $map = $this->getProperties( $id ); |
|
346 | - $ids = (array) $view->param( 'characteristic/property/product.property.id', array() ); |
|
345 | + $map = $this->getProperties($id); |
|
346 | + $ids = (array) $view->param('characteristic/property/product.property.id', array()); |
|
347 | 347 | |
348 | 348 | $item = $manager->createItem(); |
349 | 349 | |
350 | - foreach( $ids as $pos => $propertyId ) |
|
350 | + foreach ($ids as $pos => $propertyId) |
|
351 | 351 | { |
352 | - if( isset( $map[$propertyId] ) ) |
|
352 | + if (isset($map[$propertyId])) |
|
353 | 353 | { |
354 | 354 | $item = $map[$propertyId]; |
355 | - unset( $map[$propertyId] ); |
|
355 | + unset($map[$propertyId]); |
|
356 | 356 | } |
357 | 357 | else |
358 | 358 | { |
359 | - $item->setId( null ); |
|
360 | - $item->setParentId( $id ); |
|
359 | + $item->setId(null); |
|
360 | + $item->setParentId($id); |
|
361 | 361 | } |
362 | 362 | |
363 | - $lang = $view->param( 'characteristic/property/product.property.languageid/' . $pos, null ); |
|
363 | + $lang = $view->param('characteristic/property/product.property.languageid/' . $pos, null); |
|
364 | 364 | |
365 | - $item->setLanguageId( ( $lang ? $lang : null ) ); |
|
366 | - $item->setTypeId( $view->param( 'characteristic/property/product.property.typeid/' . $pos, null ) ); |
|
367 | - $item->setValue( $view->param( 'characteristic/property/product.property.value/' . $pos, '' ) ); |
|
365 | + $item->setLanguageId(($lang ? $lang : null)); |
|
366 | + $item->setTypeId($view->param('characteristic/property/product.property.typeid/' . $pos, null)); |
|
367 | + $item->setValue($view->param('characteristic/property/product.property.value/' . $pos, '')); |
|
368 | 368 | |
369 | - $manager->saveItem( $item, false ); |
|
369 | + $manager->saveItem($item, false); |
|
370 | 370 | } |
371 | 371 | |
372 | - $manager->deleteItems( array_keys( $map ) ); |
|
372 | + $manager->deleteItems(array_keys($map)); |
|
373 | 373 | } |
374 | 374 | } |
@@ -151,14 +151,12 @@ discard block |
||
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | - } |
|
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
154 | + } catch( \Aimeos\MShop\Exception $e ) |
|
156 | 155 | { |
157 | 156 | $error = array( 'product-item-characteristic-property' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
158 | 157 | $view->errors = $view->get( 'errors', array() ) + $error; |
159 | 158 | $manager->rollback(); |
160 | - } |
|
161 | - catch( \Exception $e ) |
|
159 | + } catch( \Exception $e ) |
|
162 | 160 | { |
163 | 161 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
164 | 162 | $error = array( 'product-item-characteristic-property' => $e->getMessage() ); |
@@ -353,8 +351,7 @@ discard block |
||
353 | 351 | { |
354 | 352 | $item = $map[$propertyId]; |
355 | 353 | unset( $map[$propertyId] ); |
356 | - } |
|
357 | - else |
|
354 | + } else |
|
358 | 355 | { |
359 | 356 | $item->setId( null ); |
360 | 357 | $item->setParentId( $id ); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @category Developer |
56 | 56 | */ |
57 | 57 | private $subPartPath = 'admin/jqadm/product/characteristic/standard/subparts'; |
58 | - private $subPartNames = array( 'attribute', 'property' ); |
|
58 | + private $subPartNames = array('attribute', 'property'); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -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->characteristicBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->characteristicBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/characteristic/template-item'; |
78 | 78 | $default = 'product/item-characteristic-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->characteristicBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->characteristicBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/characteristic/template-item'; |
101 | 101 | $default = 'product/item-characteristic-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 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->characteristicBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->characteristicBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/characteristic/template-item'; |
124 | 124 | $default = 'product/item-characteristic-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,31 +137,31 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | 145 | $view->characteristicBody = ''; |
146 | 146 | |
147 | - foreach( $this->getSubClients() as $client ) { |
|
147 | + foreach ($this->getSubClients() as $client) { |
|
148 | 148 | $view->characteristicBody .= $client->save(); |
149 | 149 | } |
150 | 150 | |
151 | 151 | $manager->commit(); |
152 | 152 | return; |
153 | 153 | } |
154 | - catch( \Aimeos\MShop\Exception $e ) |
|
154 | + catch (\Aimeos\MShop\Exception $e) |
|
155 | 155 | { |
156 | - $error = array( 'product-item-characteristic' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
157 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
156 | + $error = array('product-item-characteristic' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
157 | + $view->errors = $view->get('errors', array()) + $error; |
|
158 | 158 | $manager->rollback(); |
159 | 159 | } |
160 | - catch( \Exception $e ) |
|
160 | + catch (\Exception $e) |
|
161 | 161 | { |
162 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
163 | - $error = array( 'product-item-characteristic' => $e->getMessage() ); |
|
164 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
162 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
163 | + $error = array('product-item-characteristic' => $e->getMessage()); |
|
164 | + $view->errors = $view->get('errors', array()) + $error; |
|
165 | 165 | $manager->rollback(); |
166 | 166 | } |
167 | 167 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @param string|null $name Name of the sub-client (Default if null) |
177 | 177 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
178 | 178 | */ |
179 | - public function getSubClient( $type, $name = null ) |
|
179 | + public function getSubClient($type, $name = null) |
|
180 | 180 | { |
181 | 181 | /** admin/jqadm/product/characteristic/decorators/excludes |
182 | 182 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @see admin/jqadm/product/characteristic/decorators/excludes |
252 | 252 | * @see admin/jqadm/product/characteristic/decorators/global |
253 | 253 | */ |
254 | - return $this->createSubClient( 'product/characteristic/' . $type, $name ); |
|
254 | + return $this->createSubClient('product/characteristic/' . $type, $name); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | protected function getSubClientNames() |
264 | 264 | { |
265 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
265 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
273 | 273 | */ |
274 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
274 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
275 | 275 | { |
276 | - $view->characteristicData = (array) $view->param( 'characteristic', array() );; |
|
276 | + $view->characteristicData = (array) $view->param('characteristic', array()); ; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | \ No newline at end of file |
@@ -150,14 +150,12 @@ |
||
150 | 150 | |
151 | 151 | $manager->commit(); |
152 | 152 | return; |
153 | - } |
|
154 | - catch( \Aimeos\MShop\Exception $e ) |
|
153 | + } catch( \Aimeos\MShop\Exception $e ) |
|
155 | 154 | { |
156 | 155 | $error = array( 'product-item-characteristic' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
157 | 156 | $view->errors = $view->get( 'errors', array() ) + $error; |
158 | 157 | $manager->rollback(); |
159 | - } |
|
160 | - catch( \Exception $e ) |
|
158 | + } catch( \Exception $e ) |
|
161 | 159 | { |
162 | 160 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
163 | 161 | $error = array( 'product-item-characteristic' => $e->getMessage() ); |
@@ -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->priceBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->priceBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/price/template-item'; |
78 | 78 | $default = 'product/item-price-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->priceBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->priceBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/price/template-item'; |
101 | 101 | $default = 'product/item-price-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 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->priceBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->priceBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/price/template-item'; |
124 | 124 | $default = 'product/item-price-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
141 | - $textManager = \Aimeos\MShop\Factory::createManager( $context, 'text' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
141 | + $textManager = \Aimeos\MShop\Factory::createManager($context, 'text'); |
|
142 | 142 | |
143 | 143 | $manager->begin(); |
144 | 144 | $textManager->begin(); |
145 | 145 | |
146 | 146 | try |
147 | 147 | { |
148 | - $this->updateItems( $view ); |
|
148 | + $this->updateItems($view); |
|
149 | 149 | $view->priceBody = ''; |
150 | 150 | |
151 | - foreach( $this->getSubClients() as $client ) { |
|
151 | + foreach ($this->getSubClients() as $client) { |
|
152 | 152 | $view->priceBody .= $client->save(); |
153 | 153 | } |
154 | 154 | |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | $manager->commit(); |
157 | 157 | return; |
158 | 158 | } |
159 | - catch( \Aimeos\MShop\Exception $e ) |
|
159 | + catch (\Aimeos\MShop\Exception $e) |
|
160 | 160 | { |
161 | - $error = array( 'product-item-price' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
162 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
161 | + $error = array('product-item-price' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
162 | + $view->errors = $view->get('errors', array()) + $error; |
|
163 | 163 | |
164 | 164 | $textManager->rollback(); |
165 | 165 | $manager->rollback(); |
166 | 166 | } |
167 | - catch( \Exception $e ) |
|
167 | + catch (\Exception $e) |
|
168 | 168 | { |
169 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
170 | - $error = array( 'product-item-price' => $e->getMessage() ); |
|
171 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
169 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
170 | + $error = array('product-item-price' => $e->getMessage()); |
|
171 | + $view->errors = $view->get('errors', array()) + $error; |
|
172 | 172 | |
173 | 173 | $textManager->rollback(); |
174 | 174 | $manager->rollback(); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param string|null $name Name of the sub-client (Default if null) |
186 | 186 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
187 | 187 | */ |
188 | - public function getSubClient( $type, $name = null ) |
|
188 | + public function getSubClient($type, $name = null) |
|
189 | 189 | { |
190 | 190 | /** admin/jqadm/product/price/decorators/excludes |
191 | 191 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @see admin/jqadm/product/price/decorators/excludes |
261 | 261 | * @see admin/jqadm/product/price/decorators/global |
262 | 262 | */ |
263 | - return $this->createSubClient( 'product/price/' . $type, $name ); |
|
263 | + return $this->createSubClient('product/price/' . $type, $name); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | protected function getSubClientNames() |
273 | 273 | { |
274 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
274 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | */ |
283 | 283 | protected function getPriceTypes() |
284 | 284 | { |
285 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'price/type' ); |
|
285 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'price/type'); |
|
286 | 286 | |
287 | 287 | $search = $manager->createSearch(); |
288 | - $search->setConditions( $search->compare( '==', 'price.type.domain', 'product' ) ); |
|
289 | - $search->setSortations( array( $search->sort( '+', 'price.type.label' ) ) ); |
|
288 | + $search->setConditions($search->compare('==', 'price.type.domain', 'product')); |
|
289 | + $search->setSortations(array($search->sort('+', 'price.type.label'))); |
|
290 | 290 | |
291 | - return $manager->searchItems( $search ); |
|
291 | + return $manager->searchItems($search); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
@@ -297,27 +297,27 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
299 | 299 | */ |
300 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
300 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
301 | 301 | { |
302 | - $data = (array) $view->param( 'price', array() ); |
|
302 | + $data = (array) $view->param('price', array()); |
|
303 | 303 | |
304 | - if( empty( $view->priceData ) && ( $id = $view->item->getId() ) !== null ) |
|
304 | + if (empty($view->priceData) && ($id = $view->item->getId()) !== null) |
|
305 | 305 | { |
306 | - foreach( $view->item->getListItems( 'price' ) as $id => $listItem ) |
|
306 | + foreach ($view->item->getListItems('price') as $id => $listItem) |
|
307 | 307 | { |
308 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
308 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
309 | 309 | continue; |
310 | 310 | } |
311 | 311 | |
312 | 312 | $data['product.lists.id'][] = $id; |
313 | 313 | |
314 | - foreach( $refItem->toArray() as $key => $value ) { |
|
314 | + foreach ($refItem->toArray() as $key => $value) { |
|
315 | 315 | $data[$key][] = $value; |
316 | 316 | } |
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
320 | - if( !isset( $data['price.currencyid'] ) ) { // show at least one block |
|
320 | + if (!isset($data['price.currencyid'])) { // show at least one block |
|
321 | 321 | $data['price.currencyid'][] = $this->getContext()->getLocale()->getCurrencyId(); |
322 | 322 | } |
323 | 323 | |
@@ -331,40 +331,40 @@ discard block |
||
331 | 331 | * |
332 | 332 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
333 | 333 | */ |
334 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
334 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
335 | 335 | { |
336 | 336 | $id = $view->item->getId(); |
337 | 337 | $context = $this->getContext(); |
338 | 338 | |
339 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
340 | - $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
341 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
342 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
339 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
340 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
341 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
342 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
343 | 343 | |
344 | - $listIds = (array) $view->param( 'price/product.lists.id', array() ); |
|
345 | - $listItems = $manager->getItem( $id, array( 'price' ) )->getListItems( 'price' ); |
|
344 | + $listIds = (array) $view->param('price/product.lists.id', array()); |
|
345 | + $listItems = $manager->getItem($id, array('price'))->getListItems('price'); |
|
346 | 346 | |
347 | 347 | |
348 | 348 | $listItem = $listManager->createItem(); |
349 | - $listItem->setTypeId( $listTypeManager->findItem( 'default', array(), 'price' )->getId() ); |
|
350 | - $listItem->setDomain( 'price' ); |
|
351 | - $listItem->setParentId( $id ); |
|
352 | - $listItem->setStatus( 1 ); |
|
349 | + $listItem->setTypeId($listTypeManager->findItem('default', array(), 'price')->getId()); |
|
350 | + $listItem->setDomain('price'); |
|
351 | + $listItem->setParentId($id); |
|
352 | + $listItem->setStatus(1); |
|
353 | 353 | |
354 | 354 | $priceItem = $priceManager->createItem(); |
355 | - $priceItem->setDomain( 'product' ); |
|
356 | - $priceItem->setStatus( 1 ); |
|
355 | + $priceItem->setDomain('product'); |
|
356 | + $priceItem->setStatus(1); |
|
357 | 357 | |
358 | 358 | |
359 | - foreach( $listIds as $idx => $listid ) |
|
359 | + foreach ($listIds as $idx => $listid) |
|
360 | 360 | { |
361 | - if( !isset( $listItems[$listid] ) ) |
|
361 | + if (!isset($listItems[$listid])) |
|
362 | 362 | { |
363 | 363 | $litem = $listItem; |
364 | - $litem->setId( null ); |
|
364 | + $litem->setId(null); |
|
365 | 365 | |
366 | 366 | $item = $priceItem; |
367 | - $item->setId( null ); |
|
367 | + $item->setId(null); |
|
368 | 368 | } |
369 | 369 | else |
370 | 370 | { |
@@ -372,32 +372,32 @@ discard block |
||
372 | 372 | $item = $litem->getRefItem(); |
373 | 373 | } |
374 | 374 | |
375 | - $item->setLabel( $view->param( 'price/price.label/' . $idx ) ); |
|
376 | - $item->setTypeId( $view->param( 'price/price.typeid/' . $idx ) ); |
|
377 | - $item->setCurrencyId( $view->param( 'price/price.currencyid/' . $idx ) ); |
|
378 | - $item->setQuantity( $view->param( 'price/price.quantity/' . $idx ) ); |
|
379 | - $item->setValue( $view->param( 'price/price.value/' . $idx ) ); |
|
380 | - $item->setCosts( $view->param( 'price/price.costs/' . $idx ) ); |
|
381 | - $item->setRebate( $view->param( 'price/price.rebate/' . $idx ) ); |
|
382 | - $item->setTaxRate( $view->param( 'price/price.taxrate/' . $idx ) ); |
|
375 | + $item->setLabel($view->param('price/price.label/' . $idx)); |
|
376 | + $item->setTypeId($view->param('price/price.typeid/' . $idx)); |
|
377 | + $item->setCurrencyId($view->param('price/price.currencyid/' . $idx)); |
|
378 | + $item->setQuantity($view->param('price/price.quantity/' . $idx)); |
|
379 | + $item->setValue($view->param('price/price.value/' . $idx)); |
|
380 | + $item->setCosts($view->param('price/price.costs/' . $idx)); |
|
381 | + $item->setRebate($view->param('price/price.rebate/' . $idx)); |
|
382 | + $item->setTaxRate($view->param('price/price.taxrate/' . $idx)); |
|
383 | 383 | |
384 | - $priceManager->saveItem( $item ); |
|
384 | + $priceManager->saveItem($item); |
|
385 | 385 | |
386 | - $litem->setPosition( $idx ); |
|
387 | - $litem->setRefId( $item->getId() ); |
|
386 | + $litem->setPosition($idx); |
|
387 | + $litem->setRefId($item->getId()); |
|
388 | 388 | |
389 | - $listManager->saveItem( $litem, false ); |
|
389 | + $listManager->saveItem($litem, false); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
393 | 393 | $rmIds = array(); |
394 | - $rmListIds = array_diff( array_keys( $listItems ), $listIds ); |
|
394 | + $rmListIds = array_diff(array_keys($listItems), $listIds); |
|
395 | 395 | |
396 | - foreach( $rmListIds as $id ) { |
|
396 | + foreach ($rmListIds as $id) { |
|
397 | 397 | $rmIds[] = $listItems[$id]->getRefId(); |
398 | 398 | } |
399 | 399 | |
400 | - $listManager->deleteItems( $rmListIds ); |
|
401 | - $priceManager->deleteItems( $rmIds ); |
|
400 | + $listManager->deleteItems($rmListIds); |
|
401 | + $priceManager->deleteItems($rmIds); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | \ No newline at end of file |
@@ -155,16 +155,14 @@ discard block |
||
155 | 155 | $textManager->commit(); |
156 | 156 | $manager->commit(); |
157 | 157 | return; |
158 | - } |
|
159 | - catch( \Aimeos\MShop\Exception $e ) |
|
158 | + } catch( \Aimeos\MShop\Exception $e ) |
|
160 | 159 | { |
161 | 160 | $error = array( 'product-item-price' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
162 | 161 | $view->errors = $view->get( 'errors', array() ) + $error; |
163 | 162 | |
164 | 163 | $textManager->rollback(); |
165 | 164 | $manager->rollback(); |
166 | - } |
|
167 | - catch( \Exception $e ) |
|
165 | + } catch( \Exception $e ) |
|
168 | 166 | { |
169 | 167 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
170 | 168 | $error = array( 'product-item-price' => $e->getMessage() ); |
@@ -365,8 +363,7 @@ discard block |
||
365 | 363 | |
366 | 364 | $item = $priceItem; |
367 | 365 | $item->setId( null ); |
368 | - } |
|
369 | - else |
|
366 | + } else |
|
370 | 367 | { |
371 | 368 | $litem = $listItems[$listid]; |
372 | 369 | $item = $litem->getRefItem(); |
@@ -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 ) { ; } |
|
486 | + catch (\Exception $e) {; } |
|
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,49 +523,49 @@ 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 | $attrIds = array(); |
529 | 529 | $id = $view->item->getId(); |
530 | 530 | $context = $this->getContext(); |
531 | 531 | |
532 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
533 | - $attrManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
534 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
532 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
533 | + $attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
534 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
535 | 535 | |
536 | - $listItems = $this->getListItems( $id ); |
|
537 | - $listId = $view->param( 'download/product.lists.id' ); |
|
536 | + $listItems = $this->getListItems($id); |
|
537 | + $listId = $view->param('download/product.lists.id'); |
|
538 | 538 | |
539 | - if( isset( $listItems[$listId] ) ) { |
|
539 | + if (isset($listItems[$listId])) { |
|
540 | 540 | $litem = $listItems[$listId]; |
541 | 541 | } else { |
542 | - $litem = $this->createListItem( $id ); |
|
542 | + $litem = $this->createListItem($id); |
|
543 | 543 | } |
544 | 544 | |
545 | - if( ( $attrId = $view->param( 'download/attribute.id' ) ) != '' ) { |
|
546 | - $item = $attrManager->getItem( $attrId ); |
|
545 | + if (($attrId = $view->param('download/attribute.id')) != '') { |
|
546 | + $item = $attrManager->getItem($attrId); |
|
547 | 547 | } else { |
548 | 548 | $item = $this->createItem(); |
549 | 549 | } |
550 | 550 | |
551 | - if( ( $file = $view->value( (array) $view->request()->getUploadedFiles(), 'download/file' ) ) !== null |
|
551 | + if (($file = $view->value((array) $view->request()->getUploadedFiles(), 'download/file')) !== null |
|
552 | 552 | && $file->getError() === UPLOAD_ERR_OK |
553 | 553 | ) { |
554 | - $path = ( $view->param( 'download/overwrite' ) == 1 ? $item->getCode() : null ); |
|
555 | - $item->setCode( $this->storeFile( $file, $path ) ); |
|
554 | + $path = ($view->param('download/overwrite') == 1 ? $item->getCode() : null); |
|
555 | + $item->setCode($this->storeFile($file, $path)); |
|
556 | 556 | } |
557 | 557 | |
558 | - if( ( $label = $view->param( 'download/attribute.label' ) ) != '' ) |
|
558 | + if (($label = $view->param('download/attribute.label')) != '') |
|
559 | 559 | { |
560 | - $item->setLabel( $label ); |
|
561 | - $attrManager->saveItem( $item ); |
|
560 | + $item->setLabel($label); |
|
561 | + $attrManager->saveItem($item); |
|
562 | 562 | |
563 | - $litem->setPosition( 0 ); |
|
564 | - $litem->setRefId( $item->getId() ); |
|
565 | - $litem->setStatus( $view->param( 'download/product.lists.status' ) ); |
|
566 | - $listManager->saveItem( $litem ); |
|
563 | + $litem->setPosition(0); |
|
564 | + $litem->setRefId($item->getId()); |
|
565 | + $litem->setStatus($view->param('download/product.lists.status')); |
|
566 | + $listManager->saveItem($litem); |
|
567 | 567 | } |
568 | 568 | |
569 | - $this->cleanupItems( $listItems, array( $listId ) ); |
|
569 | + $this->cleanupItems($listItems, array($listId)); |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | \ 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 ) { ; } |
|
483 | + } catch( \Exception $e ) { ; } |
|
487 | 484 | } |
488 | 485 | |
489 | 486 | $view->downloadData = $data; |
@@ -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->bundleBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->bundleBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/bundle/template-item'; |
78 | 78 | $default = 'product/item-bundle-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->bundleBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->bundleBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/bundle/template-item'; |
101 | 101 | $default = 'product/item-bundle-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 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->bundleBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->bundleBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/bundle/template-item'; |
124 | 124 | $default = 'product/item-bundle-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,32 +137,32 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | - $this->updateItems( $view ); |
|
145 | + $this->updateItems($view); |
|
146 | 146 | $view->bundleBody = ''; |
147 | 147 | |
148 | - foreach( $this->getSubClients() as $client ) { |
|
148 | + foreach ($this->getSubClients() as $client) { |
|
149 | 149 | $view->bundleBody .= $client->save(); |
150 | 150 | } |
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | 154 | } |
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
155 | + catch (\Aimeos\MShop\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'product-item-bundle' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
157 | + $error = array('product-item-bundle' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
158 | + $view->errors = $view->get('errors', array()) + $error; |
|
159 | 159 | $manager->rollback(); |
160 | 160 | } |
161 | - catch( \Exception $e ) |
|
161 | + catch (\Exception $e) |
|
162 | 162 | { |
163 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
164 | - $error = array( 'product-item-bundle' => $e->getMessage() ); |
|
165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
164 | + $error = array('product-item-bundle' => $e->getMessage()); |
|
165 | + $view->errors = $view->get('errors', array()) + $error; |
|
166 | 166 | $manager->rollback(); |
167 | 167 | } |
168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param string|null $name Name of the sub-client (Default if null) |
178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
179 | 179 | */ |
180 | - public function getSubClient( $type, $name = null ) |
|
180 | + public function getSubClient($type, $name = null) |
|
181 | 181 | { |
182 | 182 | /** admin/jqadm/product/bundle/decorators/excludes |
183 | 183 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @see admin/jqadm/product/bundle/decorators/excludes |
253 | 253 | * @see admin/jqadm/product/bundle/decorators/global |
254 | 254 | */ |
255 | - return $this->createSubClient( 'product/bundle/' . $type, $name ); |
|
255 | + return $this->createSubClient('product/bundle/' . $type, $name); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | protected function getSubClientNames() |
265 | 265 | { |
266 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
266 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -273,20 +273,20 @@ discard block |
||
273 | 273 | * @param string $prodid Unique product ID |
274 | 274 | * @return array Associative list of bundle product IDs as keys and list items as values |
275 | 275 | */ |
276 | - protected function getListItems( $prodid ) |
|
276 | + protected function getListItems($prodid) |
|
277 | 277 | { |
278 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
278 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists'); |
|
279 | 279 | |
280 | 280 | $search = $manager->createSearch(); |
281 | 281 | $expr = array( |
282 | - $search->compare( '==', 'product.lists.parentid', $prodid ), |
|
283 | - $search->compare( '==', 'product.lists.domain', 'product' ), |
|
284 | - $search->compare( '==', 'product.lists.type.domain', 'product' ), |
|
285 | - $search->compare( '==', 'product.lists.type.code', 'default' ), |
|
282 | + $search->compare('==', 'product.lists.parentid', $prodid), |
|
283 | + $search->compare('==', 'product.lists.domain', 'product'), |
|
284 | + $search->compare('==', 'product.lists.type.domain', 'product'), |
|
285 | + $search->compare('==', 'product.lists.type.code', 'default'), |
|
286 | 286 | ); |
287 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
287 | + $search->setConditions($search->combine('&&', $expr)); |
|
288 | 288 | |
289 | - return $manager->searchItems( $search ); |
|
289 | + return $manager->searchItems($search); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -295,18 +295,18 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
297 | 297 | */ |
298 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
298 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
299 | 299 | { |
300 | - $data = (array) $view->param( 'bundle', array() ); |
|
300 | + $data = (array) $view->param('bundle', array()); |
|
301 | 301 | |
302 | - if( empty( $data ) ) |
|
302 | + if (empty($data)) |
|
303 | 303 | { |
304 | - foreach( $view->item->getListItems( 'product', 'default' ) as $listItem ) |
|
304 | + foreach ($view->item->getListItems('product', 'default') as $listItem) |
|
305 | 305 | { |
306 | 306 | $refItem = $listItem->getRefItem(); |
307 | - $data['product.label'][] = ( $refItem ? $refItem->getLabel() : '' ); |
|
307 | + $data['product.label'][] = ($refItem ? $refItem->getLabel() : ''); |
|
308 | 308 | |
309 | - foreach( $listItem->toArray() as $key => $value ) { |
|
309 | + foreach ($listItem->toArray() as $key => $value) { |
|
310 | 310 | $data[$key][] = $value; |
311 | 311 | } |
312 | 312 | } |
@@ -321,43 +321,43 @@ discard block |
||
321 | 321 | * |
322 | 322 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
323 | 323 | */ |
324 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
324 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
325 | 325 | { |
326 | - if( $view->item->getType() !== 'bundle' ) { |
|
326 | + if ($view->item->getType() !== 'bundle') { |
|
327 | 327 | return; |
328 | 328 | } |
329 | 329 | |
330 | 330 | $context = $this->getContext(); |
331 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
332 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
331 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
332 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
333 | 333 | |
334 | 334 | $id = $view->item->getId(); |
335 | - $map = $this->getListItems( $id ); |
|
336 | - $listIds = (array) $view->param( 'bundle/product.lists.id', array() ); |
|
335 | + $map = $this->getListItems($id); |
|
336 | + $listIds = (array) $view->param('bundle/product.lists.id', array()); |
|
337 | 337 | |
338 | 338 | |
339 | - foreach( $listIds as $pos => $listid ) |
|
339 | + foreach ($listIds as $pos => $listid) |
|
340 | 340 | { |
341 | - if( isset( $map[$listid] ) ) { |
|
342 | - unset( $map[$listid], $listIds[$pos] ); |
|
341 | + if (isset($map[$listid])) { |
|
342 | + unset($map[$listid], $listIds[$pos]); |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - $manager->deleteItems( array_keys( $map ) ); |
|
346 | + $manager->deleteItems(array_keys($map)); |
|
347 | 347 | |
348 | 348 | |
349 | 349 | $item = $manager->createItem(); |
350 | - $item->setTypeId( $typeManager->findItem( 'default', array(), 'product' )->getId() ); |
|
351 | - $item->setDomain( 'product' ); |
|
352 | - $item->setParentId( $id ); |
|
350 | + $item->setTypeId($typeManager->findItem('default', array(), 'product')->getId()); |
|
351 | + $item->setDomain('product'); |
|
352 | + $item->setParentId($id); |
|
353 | 353 | |
354 | - foreach( $listIds as $pos => $listid ) |
|
354 | + foreach ($listIds as $pos => $listid) |
|
355 | 355 | { |
356 | - $item->setId( null ); |
|
357 | - $item->setRefId( $view->param( 'bundle/product.lists.refid/' . $pos ) ); |
|
358 | - $item->setPosition( $pos ); |
|
356 | + $item->setId(null); |
|
357 | + $item->setRefId($view->param('bundle/product.lists.refid/' . $pos)); |
|
358 | + $item->setPosition($pos); |
|
359 | 359 | |
360 | - $manager->saveItem( $item, false ); |
|
360 | + $manager->saveItem($item, false); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | } |
364 | 364 | \ No newline at end of file |
@@ -151,14 +151,12 @@ |
||
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | - } |
|
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
154 | + } catch( \Aimeos\MShop\Exception $e ) |
|
156 | 155 | { |
157 | 156 | $error = array( 'product-item-bundle' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
158 | 157 | $view->errors = $view->get( 'errors', array() ) + $error; |
159 | 158 | $manager->rollback(); |
160 | - } |
|
161 | - catch( \Exception $e ) |
|
159 | + } catch( \Exception $e ) |
|
162 | 160 | { |
163 | 161 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
164 | 162 | $error = array( 'product-item-bundle' => $e->getMessage() ); |
@@ -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->stockBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->stockBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/stock/template-item'; |
78 | 78 | $default = 'product/item-stock-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->stockBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->stockBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/stock/template-item'; |
101 | 101 | $default = 'product/item-stock-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 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->stockBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->stockBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/stock/template-item'; |
124 | 124 | $default = 'product/item-stock-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,32 +137,32 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/stock' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/stock'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | - $this->updateItems( $view ); |
|
145 | + $this->updateItems($view); |
|
146 | 146 | $view->stockBody = ''; |
147 | 147 | |
148 | - foreach( $this->getSubClients() as $client ) { |
|
148 | + foreach ($this->getSubClients() as $client) { |
|
149 | 149 | $view->stockBody .= $client->save(); |
150 | 150 | } |
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | 154 | } |
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
155 | + catch (\Aimeos\MShop\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'product-item-stock' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
157 | + $error = array('product-item-stock' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
158 | + $view->errors = $view->get('errors', array()) + $error; |
|
159 | 159 | $manager->rollback(); |
160 | 160 | } |
161 | - catch( \Exception $e ) |
|
161 | + catch (\Exception $e) |
|
162 | 162 | { |
163 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
164 | - $error = array( 'product-item-stock' => $e->getMessage() ); |
|
165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
164 | + $error = array('product-item-stock' => $e->getMessage()); |
|
165 | + $view->errors = $view->get('errors', array()) + $error; |
|
166 | 166 | $manager->rollback(); |
167 | 167 | } |
168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param string|null $name Name of the sub-client (Default if null) |
178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
179 | 179 | */ |
180 | - public function getSubClient( $type, $name = null ) |
|
180 | + public function getSubClient($type, $name = null) |
|
181 | 181 | { |
182 | 182 | /** admin/jqadm/product/stock/decorators/excludes |
183 | 183 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @see admin/jqadm/product/stock/decorators/excludes |
253 | 253 | * @see admin/jqadm/product/stock/decorators/global |
254 | 254 | */ |
255 | - return $this->createSubClient( 'product/stock/' . $type, $name ); |
|
255 | + return $this->createSubClient('product/stock/' . $type, $name); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | protected function getSubClientNames() |
265 | 265 | { |
266 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
266 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -272,28 +272,28 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
274 | 274 | */ |
275 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
275 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
276 | 276 | { |
277 | 277 | $context = $this->getContext(); |
278 | - $whManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/stock/warehouse' ); |
|
278 | + $whManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/stock/warehouse'); |
|
279 | 279 | |
280 | - $view->stockWarehouses = $whManager->searchItems( $whManager->createSearch() ); |
|
281 | - $view->stockData = (array) $view->param( 'stock', array() ); |
|
280 | + $view->stockWarehouses = $whManager->searchItems($whManager->createSearch()); |
|
281 | + $view->stockData = (array) $view->param('stock', array()); |
|
282 | 282 | |
283 | - if( !empty( $view->stockData ) || ( $id = $view->item->getId() ) === null ) { |
|
283 | + if (!empty($view->stockData) || ($id = $view->item->getId()) === null) { |
|
284 | 284 | return; |
285 | 285 | } |
286 | 286 | |
287 | 287 | $data = array(); |
288 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/stock' ); |
|
288 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/stock'); |
|
289 | 289 | |
290 | 290 | $search = $manager->createSearch(); |
291 | - $search->setConditions( $search->compare( '==', 'product.stock.parentid', $id ) ); |
|
292 | - $search->setSortations( array( $search->sort( '+', 'product.stock.warehouse.code' ) ) ); |
|
291 | + $search->setConditions($search->compare('==', 'product.stock.parentid', $id)); |
|
292 | + $search->setSortations(array($search->sort('+', 'product.stock.warehouse.code'))); |
|
293 | 293 | |
294 | - foreach( $manager->searchItems( $search ) as $item ) |
|
294 | + foreach ($manager->searchItems($search) as $item) |
|
295 | 295 | { |
296 | - foreach( $item->toArray() as $key => $value ) { |
|
296 | + foreach ($item->toArray() as $key => $value) { |
|
297 | 297 | $data[$key][] = $value; |
298 | 298 | } |
299 | 299 | } |
@@ -307,32 +307,32 @@ discard block |
||
307 | 307 | * |
308 | 308 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
309 | 309 | */ |
310 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
310 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
311 | 311 | { |
312 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/stock' ); |
|
312 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/stock'); |
|
313 | 313 | |
314 | 314 | $search = $manager->createSearch(); |
315 | - $search->setConditions( $search->compare( '==', 'product.stock.parentid', $view->item->getId() ) ); |
|
316 | - $items = $manager->searchitems( $search ); |
|
315 | + $search->setConditions($search->compare('==', 'product.stock.parentid', $view->item->getId())); |
|
316 | + $items = $manager->searchitems($search); |
|
317 | 317 | |
318 | - $list = (array) $view->param( 'stock/product.stock.id', array() ); |
|
318 | + $list = (array) $view->param('stock/product.stock.id', array()); |
|
319 | 319 | |
320 | - foreach( $list as $idx => $id ) |
|
320 | + foreach ($list as $idx => $id) |
|
321 | 321 | { |
322 | - if( !isset( $items[$id] ) ) { |
|
322 | + if (!isset($items[$id])) { |
|
323 | 323 | $item = $manager->createItem(); |
324 | 324 | } else { |
325 | 325 | $item = $items[$id]; |
326 | 326 | } |
327 | 327 | |
328 | - $item->setParentId( $view->item->getId() ); |
|
329 | - $item->setWarehouseId( $view->param( 'stock/product.stock.warehouseid/' . $idx ) ); |
|
330 | - $item->setStocklevel( $view->param( 'stock/product.stock.stocklevel/' . $idx ) ); |
|
331 | - $item->setDateBack( $view->param( 'stock/product.stock.dateback/' . $idx ) ); |
|
328 | + $item->setParentId($view->item->getId()); |
|
329 | + $item->setWarehouseId($view->param('stock/product.stock.warehouseid/' . $idx)); |
|
330 | + $item->setStocklevel($view->param('stock/product.stock.stocklevel/' . $idx)); |
|
331 | + $item->setDateBack($view->param('stock/product.stock.dateback/' . $idx)); |
|
332 | 332 | |
333 | - $manager->saveItem( $item, false ); |
|
333 | + $manager->saveItem($item, false); |
|
334 | 334 | } |
335 | 335 | |
336 | - $manager->deleteItems( array_diff( array_keys( $items ), $list ) ); |
|
336 | + $manager->deleteItems(array_diff(array_keys($items), $list)); |
|
337 | 337 | } |
338 | 338 | } |
@@ -151,14 +151,12 @@ |
||
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | - } |
|
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
154 | + } catch( \Aimeos\MShop\Exception $e ) |
|
156 | 155 | { |
157 | 156 | $error = array( 'product-item-stock' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
158 | 157 | $view->errors = $view->get( 'errors', array() ) + $error; |
159 | 158 | $manager->rollback(); |
160 | - } |
|
161 | - catch( \Exception $e ) |
|
159 | + } catch( \Exception $e ) |
|
162 | 160 | { |
163 | 161 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
164 | 162 | $error = array( 'product-item-stock' => $e->getMessage() ); |