@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @param array $siteids List of IDs for sites whose entries should be deleted |
230 | 230 | */ |
231 | - public function cleanup( array $siteids ) |
|
231 | + public function cleanup(array $siteids) |
|
232 | 232 | { |
233 | 233 | $path = 'mshop/customer/manager/submanagers'; |
234 | - foreach( $this->getContext()->getConfig()->get( $path, ['address', 'group', 'lists', 'property'] ) as $domain ) { |
|
235 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
234 | + foreach ($this->getContext()->getConfig()->get($path, ['address', 'group', 'lists', 'property']) as $domain) { |
|
235 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @param array $ids List of IDs |
244 | 244 | */ |
245 | - public function deleteItems( array $ids ) |
|
245 | + public function deleteItems(array $ids) |
|
246 | 246 | { |
247 | 247 | $service = $this->getContext()->getEzUserService(); |
248 | 248 | |
249 | - foreach( $ids as $id ) { |
|
250 | - $service->deleteUser( $service->loadUser( $id ) ); |
|
249 | + foreach ($ids as $id) { |
|
250 | + $service->deleteUser($service->loadUser($id)); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | * @param boolean $withsub Return also attributes of sub-managers if true |
259 | 259 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
260 | 260 | */ |
261 | - public function getSearchAttributes( $withsub = true ) |
|
261 | + public function getSearchAttributes($withsub = true) |
|
262 | 262 | { |
263 | 263 | $path = 'mshop/customer/manager/submanagers'; |
264 | 264 | |
265 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, ['address', 'group', 'lists', 'property'], $withsub ); |
|
265 | + return $this->getSearchAttributesBase($this->searchConfig, $path, ['address', 'group', 'lists', 'property'], $withsub); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
274 | 274 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
275 | 275 | */ |
276 | - public function getSubManager( $manager, $name = null ) |
|
276 | + public function getSubManager($manager, $name = null) |
|
277 | 277 | { |
278 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
278 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Ezpublish' : $name)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | |
@@ -286,96 +286,96 @@ discard block |
||
286 | 286 | * @param boolean $fetch True if the new ID should be returned in the item |
287 | 287 | * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID |
288 | 288 | */ |
289 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
289 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
290 | 290 | { |
291 | - self::checkClass( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $item ); |
|
291 | + self::checkClass('\\Aimeos\\MShop\\Customer\\Item\\Iface', $item); |
|
292 | 292 | |
293 | - if( !$item->isModified() ) |
|
293 | + if (!$item->isModified()) |
|
294 | 294 | { |
295 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
296 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
297 | - return $this->saveListItems( $item, 'customer' ); |
|
295 | + $item = $this->savePropertyItems($item, 'customer'); |
|
296 | + $item = $this->saveAddressItems($item, 'customer'); |
|
297 | + return $this->saveListItems($item, 'customer'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | $context = $this->getContext(); |
301 | 301 | |
302 | 302 | $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
303 | - if( !is_a( $context, $class ) ) { |
|
304 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
303 | + if (!is_a($context, $class)) { |
|
304 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $class)); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | $service = $context->getEzUserService(); |
308 | 308 | $email = $item->getPaymentAddress()->getEmail(); |
309 | 309 | |
310 | - if( $item->getId() !== null ) |
|
310 | + if ($item->getId() !== null) |
|
311 | 311 | { |
312 | 312 | $struct = $service->newUserUpdateStruct(); |
313 | 313 | $struct->password = $item->getPassword(); |
314 | 314 | $struct->enabled = $item->getStatus(); |
315 | 315 | $struct->email = $email; |
316 | 316 | |
317 | - $user = $service->loadUser( $item->getId() ); |
|
318 | - $service->updateUser( $user, $struct ); |
|
317 | + $user = $service->loadUser($item->getId()); |
|
318 | + $service->updateUser($user, $struct); |
|
319 | 319 | } |
320 | 320 | else |
321 | 321 | { |
322 | - $struct = $service->newUserCreateStruct( $item->getCode(), $email, $item->getPassword(), 'eng-GB' ); |
|
322 | + $struct = $service->newUserCreateStruct($item->getCode(), $email, $item->getPassword(), 'eng-GB'); |
|
323 | 323 | $struct->enabled = $item->getStatus(); |
324 | 324 | |
325 | - $user = $service->createUser( $struct, [] ); |
|
326 | - $item->setId( $user->getUserId() ); |
|
325 | + $user = $service->createUser($struct, []); |
|
326 | + $item->setId($user->getUserId()); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | $dbm = $context->getDatabaseManager(); |
330 | 330 | $dbname = $this->getResourceName(); |
331 | - $conn = $dbm->acquire( $dbname ); |
|
331 | + $conn = $dbm->acquire($dbname); |
|
332 | 332 | |
333 | 333 | try |
334 | 334 | { |
335 | - $date = date( 'Y-m-d H:i:s' ); |
|
336 | - $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
335 | + $date = date('Y-m-d H:i:s'); |
|
336 | + $ctime = ($item->getTimeCreated() ? $item->getTimeCreated() : $date); |
|
337 | 337 | $billingAddress = $item->getPaymentAddress(); |
338 | 338 | |
339 | 339 | $path = 'mshop/customer/manager/ezpublish/update'; |
340 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
341 | - |
|
342 | - $stmt->bind( 1, $billingAddress->getCompany() ); |
|
343 | - $stmt->bind( 2, $billingAddress->getVatID() ); |
|
344 | - $stmt->bind( 3, $billingAddress->getSalutation() ); |
|
345 | - $stmt->bind( 4, $billingAddress->getTitle() ); |
|
346 | - $stmt->bind( 5, $billingAddress->getFirstname() ); |
|
347 | - $stmt->bind( 6, $billingAddress->getLastname() ); |
|
348 | - $stmt->bind( 7, $billingAddress->getAddress1() ); |
|
349 | - $stmt->bind( 8, $billingAddress->getAddress2() ); |
|
350 | - $stmt->bind( 9, $billingAddress->getAddress3() ); |
|
351 | - $stmt->bind( 10, $billingAddress->getPostal() ); |
|
352 | - $stmt->bind( 11, $billingAddress->getCity() ); |
|
353 | - $stmt->bind( 12, $billingAddress->getState() ); |
|
354 | - $stmt->bind( 13, $billingAddress->getCountryId() ); |
|
355 | - $stmt->bind( 14, $billingAddress->getLanguageId() ); |
|
356 | - $stmt->bind( 15, $billingAddress->getTelephone() ); |
|
357 | - $stmt->bind( 16, $billingAddress->getTelefax() ); |
|
358 | - $stmt->bind( 17, $billingAddress->getWebsite() ); |
|
359 | - $stmt->bind( 18, $item->getBirthday() ); |
|
360 | - $stmt->bind( 19, $item->getDateVerified() ); |
|
361 | - $stmt->bind( 20, $date ); // Modification time |
|
362 | - $stmt->bind( 21, $context->getEditor() ); |
|
363 | - $stmt->bind( 22, $ctime ); // Creation time |
|
364 | - $stmt->bind( 23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
340 | + $stmt = $this->getCachedStatement($conn, $path); |
|
341 | + |
|
342 | + $stmt->bind(1, $billingAddress->getCompany()); |
|
343 | + $stmt->bind(2, $billingAddress->getVatID()); |
|
344 | + $stmt->bind(3, $billingAddress->getSalutation()); |
|
345 | + $stmt->bind(4, $billingAddress->getTitle()); |
|
346 | + $stmt->bind(5, $billingAddress->getFirstname()); |
|
347 | + $stmt->bind(6, $billingAddress->getLastname()); |
|
348 | + $stmt->bind(7, $billingAddress->getAddress1()); |
|
349 | + $stmt->bind(8, $billingAddress->getAddress2()); |
|
350 | + $stmt->bind(9, $billingAddress->getAddress3()); |
|
351 | + $stmt->bind(10, $billingAddress->getPostal()); |
|
352 | + $stmt->bind(11, $billingAddress->getCity()); |
|
353 | + $stmt->bind(12, $billingAddress->getState()); |
|
354 | + $stmt->bind(13, $billingAddress->getCountryId()); |
|
355 | + $stmt->bind(14, $billingAddress->getLanguageId()); |
|
356 | + $stmt->bind(15, $billingAddress->getTelephone()); |
|
357 | + $stmt->bind(16, $billingAddress->getTelefax()); |
|
358 | + $stmt->bind(17, $billingAddress->getWebsite()); |
|
359 | + $stmt->bind(18, $item->getBirthday()); |
|
360 | + $stmt->bind(19, $item->getDateVerified()); |
|
361 | + $stmt->bind(20, $date); // Modification time |
|
362 | + $stmt->bind(21, $context->getEditor()); |
|
363 | + $stmt->bind(22, $ctime); // Creation time |
|
364 | + $stmt->bind(23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
365 | 365 | |
366 | 366 | $stmt->execute()->finish(); |
367 | 367 | |
368 | - $dbm->release( $conn, $dbname ); |
|
368 | + $dbm->release($conn, $dbname); |
|
369 | 369 | } |
370 | - catch( \Exception $e ) |
|
370 | + catch (\Exception $e) |
|
371 | 371 | { |
372 | - $dbm->release( $conn, $dbname ); |
|
372 | + $dbm->release($conn, $dbname); |
|
373 | 373 | throw $e; |
374 | 374 | } |
375 | 375 | |
376 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
377 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
378 | - return $this->saveListItems( $item, 'customer' ); |
|
376 | + $item = $this->savePropertyItems($item, 'customer'); |
|
377 | + $item = $this->saveAddressItems($item, 'customer'); |
|
378 | + return $this->saveListItems($item, 'customer'); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -387,11 +387,11 @@ discard block |
||
387 | 387 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
388 | 388 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
389 | 389 | */ |
390 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
390 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
391 | 391 | { |
392 | 392 | $dbm = $this->getContext()->getDatabaseManager(); |
393 | 393 | $dbname = $this->getResourceName(); |
394 | - $conn = $dbm->acquire( $dbname ); |
|
394 | + $conn = $dbm->acquire($dbname); |
|
395 | 395 | $map = []; |
396 | 396 | |
397 | 397 | try |
@@ -399,34 +399,34 @@ discard block |
||
399 | 399 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
400 | 400 | $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
401 | 401 | $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
402 | - $required = array( 'customer' ); |
|
402 | + $required = array('customer'); |
|
403 | 403 | |
404 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
404 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
405 | 405 | |
406 | - while( ( $row = $results->fetch() ) !== false ) |
|
406 | + while (($row = $results->fetch()) !== false) |
|
407 | 407 | { |
408 | - $map[ $row['customer.id'] ] = $row; |
|
409 | - $map[ $row['customer.id'] ]['groups'] = []; |
|
408 | + $map[$row['customer.id']] = $row; |
|
409 | + $map[$row['customer.id']]['groups'] = []; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | |
413 | 413 | $path = 'mshop/customer/manager/ezpublish/groups'; |
414 | - $stmt = $conn->create( $this->getGroupSql( array_keys( $map ), $path ) ); |
|
414 | + $stmt = $conn->create($this->getGroupSql(array_keys($map), $path)); |
|
415 | 415 | $results = $stmt->execute(); |
416 | 416 | |
417 | - while( ( $row = $results->fetch() ) !== false ) { |
|
418 | - $map[ $row['contentobject_id'] ]['groups'][] = $row['role_id']; |
|
417 | + while (($row = $results->fetch()) !== false) { |
|
418 | + $map[$row['contentobject_id']]['groups'][] = $row['role_id']; |
|
419 | 419 | } |
420 | 420 | |
421 | - $dbm->release( $conn, $dbname ); |
|
421 | + $dbm->release($conn, $dbname); |
|
422 | 422 | } |
423 | - catch( \Exception $e ) |
|
423 | + catch (\Exception $e) |
|
424 | 424 | { |
425 | - $dbm->release( $conn, $dbname ); |
|
425 | + $dbm->release($conn, $dbname); |
|
426 | 426 | throw $e; |
427 | 427 | } |
428 | 428 | |
429 | - return $this->buildItems( $map, $ref, 'customer' ); |
|
429 | + return $this->buildItems($map, $ref, 'customer'); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | |
@@ -439,11 +439,11 @@ discard block |
||
439 | 439 | * @param array $addresses List of address items of the customer item |
440 | 440 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
441 | 441 | */ |
442 | - protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [], |
|
443 | - array $addresses = [], array $propItems = [] ) |
|
442 | + protected function createItemBase(array $values = [], array $listItems = [], array $refItems = [], |
|
443 | + array $addresses = [], array $propItems = []) |
|
444 | 444 | { |
445 | - if( !isset( $this->addressManager ) ) { |
|
446 | - $this->addressManager = $this->getObject()->getSubManager( 'address' ); |
|
445 | + if (!isset($this->addressManager)) { |
|
446 | + $this->addressManager = $this->getObject()->getSubManager('address'); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | $address = $this->addressManager->createItem(); |
@@ -462,18 +462,18 @@ discard block |
||
462 | 462 | * @param string $cfgpath Configuration path to the SQL statement |
463 | 463 | * @return string SQL statement ready for execution |
464 | 464 | */ |
465 | - protected function getGroupSql( array $ids, $cfgpath ) |
|
465 | + protected function getGroupSql(array $ids, $cfgpath) |
|
466 | 466 | { |
467 | - if( empty( $ids ) ) { return '1=1'; } |
|
467 | + if (empty($ids)) { return '1=1'; } |
|
468 | 468 | |
469 | 469 | $search = $this->getObject()->createSearch(); |
470 | - $search->setConditions( $search->compare( '==', 'id', $ids ) ); |
|
470 | + $search->setConditions($search->compare('==', 'id', $ids)); |
|
471 | 471 | |
472 | - $types = array( 'id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
473 | - $translations = array( 'id' => '"contentobject_id"' ); |
|
472 | + $types = array('id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
473 | + $translations = array('id' => '"contentobject_id"'); |
|
474 | 474 | |
475 | - $cond = $search->getConditionSource( $types, $translations ); |
|
475 | + $cond = $search->getConditionSource($types, $translations); |
|
476 | 476 | |
477 | - return str_replace( ':cond', $cond, $this->getSqlConfig( $cfgpath ) ); |
|
477 | + return str_replace(':cond', $cond, $this->getSqlConfig($cfgpath)); |
|
478 | 478 | } |
479 | 479 | } |