Company account with multiple users#15
Conversation
Miroslav-Stopka
commented
Sep 6, 2018
| Q | A |
|---|---|
| Description, reason for the PR | |
| The administrator needs to be able to create user accounts grouped under one company account. Individual company users have separate login credentials but they will share some attributes - for example a billing address. | |
| New feature | Yes |
| BC breaks | No |
| Fixes issues | |
| Standards and tests pass | Yes |
| Have you read and signed our License Agreement for contributions? | Yes |
8c443e2 to
7f584b4
Compare
vitek-rostislav
left a comment
There was a problem hiding this comment.
Hi, the review is done 🙂 Hats off to you! 🥇
| * | ||
| * New state: | ||
| * - Mapping of child class property is overriden only if: | ||
| * - or mapping of child class property is equal to mapping of parent class property |
There was a problem hiding this comment.
I would remove the first "or" 🙂
There was a problem hiding this comment.
Will be change to either.
| $overriddingClassReflection = new \ReflectionClass($class); | ||
| $overiddingClassProperties = $overriddingClassReflection->getProperties(); | ||
|
|
||
| $isOverridenPropertyInChildClass = $this->checkIsOverridenPropertyInChildClass($overiddingClassProperties, $name, $class); |
There was a problem hiding this comment.
the word is correctly spelled "overridden" - both in the variable and the private method name...
#nitpick 😇
There was a problem hiding this comment.
...and in the comment above the method
| * @param \Shopsys\ShopBundle\Model\Customer\User[] $users | ||
| * @return \Shopsys\ShopBundle\Model\Customer\UserData[] | ||
| */ | ||
| public function createMultipleUserDataFromUsers(array $users) |
There was a problem hiding this comment.
this method is never used
There was a problem hiding this comment.
Right and removed
There was a problem hiding this comment.
Wrong and returned :D It is used in CustomerController :D
| use Shopsys\FrameworkBundle\Model\Order\Item\OrderProduct; | ||
| use Shopsys\FrameworkBundle\Model\Order\Item\OrderTransport; | ||
| use Shopsys\FrameworkBundle\Model\Order\Order; | ||
| use Shopsys\FrameworkBundle\Model\Order\Order as ExtendedOrder; |
There was a problem hiding this comment.
was it not working before?
There was a problem hiding this comment.
Im thinking, both ways are functional. Should I change to ShopBundle?
vitek-rostislav
left a comment
There was a problem hiding this comment.
Hi, just a few final notes from CR, please check them out.
I also tested it and:
- when dynamically adding new company users in admin, javascript validation does not work for the fields (
Shopsys.register.registerCallbackandShopsys.register.registerNewContentshould help you here 🙂 ) - there is an unhandled exception (
UniqueConstraintViolationException) when trying to add new company user with already registered email - company users created on company edit page are not visible in the customers list
admin/customer/list/- is this intended? How can I get on an admin detail page of those customers? - is it ok that a particular company customer sees all company orders (even those that were not created by himself?) (on FE
customer/orders/)
|
|
||
| if (!$('.js-is-company-with-multiple-users').prop('checked')) { | ||
| Shopsys.companyData.changeSetUpCompanyWithMultipleUsers(false); | ||
| Shopsys.companyData.unsetUpCompanyWithMultipleUsers(); |
There was a problem hiding this comment.
could you please rename to unsetCompanyWithMultipleUsers? That "Up" is weird there 😇
|
|
||
| Shopsys\FrameworkBundle\Model\Customer\CustomerFacade: '@Shopsys\ShopBundle\Model\Customer\CustomerFacade' | ||
|
|
||
| Shopsys\ShopBundle\Model\Customer\UserRepository: ~ |
There was a problem hiding this comment.
you can remove OrderRepository as well 🙂
- after the change it is possible to overwrite the already existing property of an entity even with the possibility of overwriting the orm associations of this property - before the change the final associations of the new property were automatically taken over from the original property
…t is a company with multiple users - customer with a billing address that belongs to a company with multiple users, can not edit the billing address in a personal data or in the order
- billing address represents a company, so multiple customers of the same billing address mean multiple users of the same company
…des all the orders of the customers from the same company
- customer section in admin displays list of billing addresses instead of users because on billing address can have multiple users - customers list in admin is simplified because of company accounts with multiple users - in the case of request for standard account - isCompanyWithMultipleUsers === false - is displayed standard edit form for customer - in the case of request for multiple users companz account - isCompanyWithMultipleUsers === true - is displayed company edit form for with list of company users - UserData contains new property id to allow efective and clear manipulation with entries of users in the list of company users - in the case of cancellation of setup of company with multiple users, they are removed all company users except one for preserving company account - js code is part of twig templates because of problems with adding new custom js for admin
- EntityExtensionTest merge original extension map with tested custom extended entities
…rs() to isCompanyWithMultipleUsers()
1712d09 to
91e7938
Compare