@@ -243,13 +243,13 @@ discard block |
||
| 243 | 243 | * |
| 244 | 244 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 245 | 245 | */ |
| 246 | - public function cleanup( array $siteids ) |
|
| 246 | + public function cleanup(array $siteids) |
|
| 247 | 247 | { |
| 248 | 248 | $path = 'mshop/customer/manager/submanagers'; |
| 249 | 249 | $default = ['address', 'group', 'lists', 'property']; |
| 250 | 250 | |
| 251 | - foreach( $this->getContext()->getConfig()->get( $path, $default ) as $domain ) { |
|
| 252 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 251 | + foreach ($this->getContext()->getConfig()->get($path, $default) as $domain) { |
|
| 252 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | * |
| 260 | 260 | * @param array $ids List of IDs |
| 261 | 261 | */ |
| 262 | - public function deleteItems( array $ids ) |
|
| 262 | + public function deleteItems(array $ids) |
|
| 263 | 263 | { |
| 264 | 264 | $path = 'mshop/customer/manager/fosuser/delete'; |
| 265 | - $this->deleteItemsBase( $ids, $path, false ); |
|
| 265 | + $this->deleteItemsBase($ids, $path, false); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
@@ -272,12 +272,12 @@ discard block |
||
| 272 | 272 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 273 | 273 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 274 | 274 | */ |
| 275 | - public function getSearchAttributes( $withsub = true ) |
|
| 275 | + public function getSearchAttributes($withsub = true) |
|
| 276 | 276 | { |
| 277 | 277 | $path = 'mshop/customer/manager/submanagers'; |
| 278 | 278 | $default = ['address', 'group', 'lists', 'property']; |
| 279 | 279 | |
| 280 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, $default, $withsub ); |
|
| 280 | + return $this->getSearchAttributesBase($this->searchConfig, $path, $default, $withsub); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | public function createItem() |
| 290 | 290 | { |
| 291 | - return $this->createItemBase( ['customer.siteid' => $this->getContext()->getLocale()->getSiteId()] ); |
|
| 291 | + return $this->createItemBase(['customer.siteid' => $this->getContext()->getLocale()->getSiteId()]); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
@@ -299,32 +299,32 @@ discard block |
||
| 299 | 299 | * @param boolean $fetch True if the new ID should be returned in the item |
| 300 | 300 | * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID |
| 301 | 301 | */ |
| 302 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 302 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 303 | 303 | { |
| 304 | 304 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\FosUser'; |
| 305 | - if( !( $item instanceof $iface ) ) { |
|
| 306 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 305 | + if (!($item instanceof $iface)) { |
|
| 306 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - if( !$item->isModified() ) |
|
| 309 | + if (!$item->isModified()) |
|
| 310 | 310 | { |
| 311 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
| 312 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
| 313 | - return $this->saveRefItems( $item, 'customer' ); |
|
| 311 | + $item = $this->savePropertyItems($item, 'customer'); |
|
| 312 | + $item = $this->saveAddressItems($item, 'customer'); |
|
| 313 | + return $this->saveRefItems($item, 'customer'); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | $context = $this->getContext(); |
| 317 | 317 | $dbm = $context->getDatabaseManager(); |
| 318 | 318 | $dbname = $this->getResourceName(); |
| 319 | - $conn = $dbm->acquire( $dbname ); |
|
| 319 | + $conn = $dbm->acquire($dbname); |
|
| 320 | 320 | |
| 321 | 321 | try |
| 322 | 322 | { |
| 323 | 323 | $id = $item->getId(); |
| 324 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 324 | + $date = date('Y-m-d H:i:s'); |
|
| 325 | 325 | $billingAddress = $item->getPaymentAddress(); |
| 326 | 326 | |
| 327 | - if( $id === null ) |
|
| 327 | + if ($id === null) |
|
| 328 | 328 | { |
| 329 | 329 | /** mshop/customer/manager/fosuser/insert |
| 330 | 330 | * Inserts a new customer record into the database table |
@@ -388,51 +388,51 @@ discard block |
||
| 388 | 388 | $path = 'mshop/customer/manager/fosuser/update'; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 392 | - |
|
| 393 | - $stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 394 | - $stmt->bind( 2, $item->getCode() ); // canonical username |
|
| 395 | - $stmt->bind( 3, $item->getCode() ); // username |
|
| 396 | - $stmt->bind( 4, $billingAddress->getCompany() ); |
|
| 397 | - $stmt->bind( 5, $billingAddress->getVatID() ); |
|
| 398 | - $stmt->bind( 6, $billingAddress->getSalutation() ); |
|
| 399 | - $stmt->bind( 7, $billingAddress->getTitle() ); |
|
| 400 | - $stmt->bind( 8, $billingAddress->getFirstname() ); |
|
| 401 | - $stmt->bind( 9, $billingAddress->getLastname() ); |
|
| 402 | - $stmt->bind( 10, $billingAddress->getAddress1() ); |
|
| 403 | - $stmt->bind( 11, $billingAddress->getAddress2() ); |
|
| 404 | - $stmt->bind( 12, $billingAddress->getAddress3() ); |
|
| 405 | - $stmt->bind( 13, $billingAddress->getPostal() ); |
|
| 406 | - $stmt->bind( 14, $billingAddress->getCity() ); |
|
| 407 | - $stmt->bind( 15, $billingAddress->getState() ); |
|
| 408 | - $stmt->bind( 16, $billingAddress->getCountryId() ); |
|
| 409 | - $stmt->bind( 17, $billingAddress->getLanguageId() ); |
|
| 410 | - $stmt->bind( 18, $billingAddress->getTelephone() ); |
|
| 411 | - $stmt->bind( 19, $billingAddress->getEmail() ); |
|
| 412 | - $stmt->bind( 20, $billingAddress->getEmail() ); |
|
| 413 | - $stmt->bind( 21, $billingAddress->getTelefax() ); |
|
| 414 | - $stmt->bind( 22, $billingAddress->getWebsite() ); |
|
| 415 | - $stmt->bind( 23, $billingAddress->getLongitude() ); |
|
| 416 | - $stmt->bind( 24, $billingAddress->getLatitude() ); |
|
| 417 | - $stmt->bind( 25, $item->getBirthday() ); |
|
| 418 | - $stmt->bind( 26, ( $item->getStatus() > 0 ? true : false ), \Aimeos\MW\DB\Statement\Base::PARAM_BOOL ); |
|
| 419 | - $stmt->bind( 27, $item->getDateVerified() ); |
|
| 420 | - $stmt->bind( 28, $item->getPassword() ); |
|
| 421 | - $stmt->bind( 29, $date ); // Modification time |
|
| 422 | - $stmt->bind( 30, $context->getEditor() ); |
|
| 423 | - $stmt->bind( 31, serialize( $item->getRoles() ) ); |
|
| 424 | - $stmt->bind( 32, $item->getSalt() ); |
|
| 425 | - |
|
| 426 | - if( $id !== null ) { |
|
| 427 | - $stmt->bind( 33, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 428 | - $item->setId( $id ); |
|
| 391 | + $stmt = $this->getCachedStatement($conn, $path); |
|
| 392 | + |
|
| 393 | + $stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 394 | + $stmt->bind(2, $item->getCode()); // canonical username |
|
| 395 | + $stmt->bind(3, $item->getCode()); // username |
|
| 396 | + $stmt->bind(4, $billingAddress->getCompany()); |
|
| 397 | + $stmt->bind(5, $billingAddress->getVatID()); |
|
| 398 | + $stmt->bind(6, $billingAddress->getSalutation()); |
|
| 399 | + $stmt->bind(7, $billingAddress->getTitle()); |
|
| 400 | + $stmt->bind(8, $billingAddress->getFirstname()); |
|
| 401 | + $stmt->bind(9, $billingAddress->getLastname()); |
|
| 402 | + $stmt->bind(10, $billingAddress->getAddress1()); |
|
| 403 | + $stmt->bind(11, $billingAddress->getAddress2()); |
|
| 404 | + $stmt->bind(12, $billingAddress->getAddress3()); |
|
| 405 | + $stmt->bind(13, $billingAddress->getPostal()); |
|
| 406 | + $stmt->bind(14, $billingAddress->getCity()); |
|
| 407 | + $stmt->bind(15, $billingAddress->getState()); |
|
| 408 | + $stmt->bind(16, $billingAddress->getCountryId()); |
|
| 409 | + $stmt->bind(17, $billingAddress->getLanguageId()); |
|
| 410 | + $stmt->bind(18, $billingAddress->getTelephone()); |
|
| 411 | + $stmt->bind(19, $billingAddress->getEmail()); |
|
| 412 | + $stmt->bind(20, $billingAddress->getEmail()); |
|
| 413 | + $stmt->bind(21, $billingAddress->getTelefax()); |
|
| 414 | + $stmt->bind(22, $billingAddress->getWebsite()); |
|
| 415 | + $stmt->bind(23, $billingAddress->getLongitude()); |
|
| 416 | + $stmt->bind(24, $billingAddress->getLatitude()); |
|
| 417 | + $stmt->bind(25, $item->getBirthday()); |
|
| 418 | + $stmt->bind(26, ($item->getStatus() > 0 ? true : false), \Aimeos\MW\DB\Statement\Base::PARAM_BOOL); |
|
| 419 | + $stmt->bind(27, $item->getDateVerified()); |
|
| 420 | + $stmt->bind(28, $item->getPassword()); |
|
| 421 | + $stmt->bind(29, $date); // Modification time |
|
| 422 | + $stmt->bind(30, $context->getEditor()); |
|
| 423 | + $stmt->bind(31, serialize($item->getRoles())); |
|
| 424 | + $stmt->bind(32, $item->getSalt()); |
|
| 425 | + |
|
| 426 | + if ($id !== null) { |
|
| 427 | + $stmt->bind(33, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 428 | + $item->setId($id); |
|
| 429 | 429 | } else { |
| 430 | - $stmt->bind( 33, $date ); // Creation time |
|
| 430 | + $stmt->bind(33, $date); // Creation time |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | $stmt->execute()->finish(); |
| 434 | 434 | |
| 435 | - if( $id === null && $fetch === true ) |
|
| 435 | + if ($id === null && $fetch === true) |
|
| 436 | 436 | { |
| 437 | 437 | /** mshop/customer/manager/fosuser/newid |
| 438 | 438 | * Retrieves the ID generated by the database when inserting a new record |
@@ -465,22 +465,22 @@ discard block |
||
| 465 | 465 | * @see mshop/customer/manager/fosuser/count |
| 466 | 466 | */ |
| 467 | 467 | $path = 'mshop/customer/manager/fosuser/newid'; |
| 468 | - $item->setId( $this->newId( $conn, $path ) ); |
|
| 468 | + $item->setId($this->newId($conn, $path)); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - $dbm->release( $conn, $dbname ); |
|
| 471 | + $dbm->release($conn, $dbname); |
|
| 472 | 472 | } |
| 473 | - catch( \Exception $e ) |
|
| 473 | + catch (\Exception $e) |
|
| 474 | 474 | { |
| 475 | - $dbm->release( $conn, $dbname ); |
|
| 475 | + $dbm->release($conn, $dbname); |
|
| 476 | 476 | throw $e; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - $this->addGroups( $item ); |
|
| 479 | + $this->addGroups($item); |
|
| 480 | 480 | |
| 481 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
| 482 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
| 483 | - return $this->saveRefItems( $item, 'customer' ); |
|
| 481 | + $item = $this->savePropertyItems($item, 'customer'); |
|
| 482 | + $item = $this->saveAddressItems($item, 'customer'); |
|
| 483 | + return $this->saveRefItems($item, 'customer'); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | |
@@ -492,11 +492,11 @@ discard block |
||
| 492 | 492 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
| 493 | 493 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
| 494 | 494 | */ |
| 495 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
| 495 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
| 496 | 496 | { |
| 497 | 497 | $dbm = $this->getContext()->getDatabaseManager(); |
| 498 | 498 | $dbname = $this->getResourceName(); |
| 499 | - $conn = $dbm->acquire( $dbname ); |
|
| 499 | + $conn = $dbm->acquire($dbname); |
|
| 500 | 500 | $map = []; |
| 501 | 501 | |
| 502 | 502 | try |
@@ -504,32 +504,32 @@ discard block |
||
| 504 | 504 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 505 | 505 | $cfgPathSearch = 'mshop/customer/manager/fosuser/search'; |
| 506 | 506 | $cfgPathCount = 'mshop/customer/manager/fosuser/count'; |
| 507 | - $required = array( 'customer' ); |
|
| 507 | + $required = array('customer'); |
|
| 508 | 508 | |
| 509 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 510 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 511 | - $map[ $row['customer.id'] ] = $row; |
|
| 509 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
| 510 | + while (($row = $results->fetch()) !== false) { |
|
| 511 | + $map[$row['customer.id']] = $row; |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - $dbm->release( $conn, $dbname ); |
|
| 514 | + $dbm->release($conn, $dbname); |
|
| 515 | 515 | } |
| 516 | - catch( \Exception $e ) |
|
| 516 | + catch (\Exception $e) |
|
| 517 | 517 | { |
| 518 | - $dbm->release( $conn, $dbname ); |
|
| 518 | + $dbm->release($conn, $dbname); |
|
| 519 | 519 | throw $e; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | $addrItems = []; |
| 523 | - if( in_array( 'customer/address', $ref, true ) ) { |
|
| 524 | - $addrItems = $this->getAddressItems( array_keys( $map ), 'customer' ); |
|
| 523 | + if (in_array('customer/address', $ref, true)) { |
|
| 524 | + $addrItems = $this->getAddressItems(array_keys($map), 'customer'); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | $propItems = []; |
| 528 | - if( in_array( 'customer/property', $ref, true ) ) { |
|
| 529 | - $propItems = $this->getPropertyItems( array_keys( $map ), 'customer' ); |
|
| 528 | + if (in_array('customer/property', $ref, true)) { |
|
| 529 | + $propItems = $this->getPropertyItems(array_keys($map), 'customer'); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems ); |
|
| 532 | + return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | |
@@ -540,9 +540,9 @@ discard block |
||
| 540 | 540 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 541 | 541 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 542 | 542 | */ |
| 543 | - public function getSubManager( $manager, $name = null ) |
|
| 543 | + public function getSubManager($manager, $name = null) |
|
| 544 | 544 | { |
| 545 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'FosUser' : $name ) ); |
|
| 545 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'FosUser' : $name)); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | |
@@ -556,15 +556,15 @@ discard block |
||
| 556 | 556 | * @param array $propItems List of property items of the customer item |
| 557 | 557 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
| 558 | 558 | */ |
| 559 | - protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [], |
|
| 560 | - array $addresses = [], array $propItems = [] ) |
|
| 559 | + protected function createItemBase(array $values = [], array $listItems = [], array $refItems = [], |
|
| 560 | + array $addresses = [], array $propItems = []) |
|
| 561 | 561 | { |
| 562 | - if( !isset( $this->addressManager ) ) { |
|
| 563 | - $this->addressManager = $this->getObject()->getSubManager( 'address' ); |
|
| 562 | + if (!isset($this->addressManager)) { |
|
| 563 | + $this->addressManager = $this->getObject()->getSubManager('address'); |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - if( isset( $values['roles'] ) ) { |
|
| 567 | - $values['roles'] = unserialize( $values['roles'] ); |
|
| 566 | + if (isset($values['roles'])) { |
|
| 567 | + $values['roles'] = unserialize($values['roles']); |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | $helper = $this->getPasswordHelper(); |