SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
741 stars 388 forks source link

Purchase limit codes can collide between b2bUnits because the code has to be unique #13900

Open mateuszo opened 3 years ago

mateuszo commented 3 years ago

Describe the bug Purchase limit code is a unique identifier across the whole database. As a result, a user might have difficulties finding a unique code for a new purchase limit. Additionally, if a user picks a code that exists under another company the error message is vague: "Server validation error".

Tell us the version of Spartacus

To Reproduce Steps to reproduce the behavior:

  1. Go to /organization/purchase-limits/create
  2. Log in as linda.wolf@pronto-hw.com
  3. Set code to some code that exists under another company (e.g. Rustic_0K_USD_ORDER) click save.
  4. See error

Expected behavior Ideally, the code should be unique per b2b unit. However, it can be solved in many different ways. E.g. the user does not edit the code but some name and the code is generated by the back-end.

Screenshots image

Xymmer commented 3 years ago

Spartacus could handle "duplicate name" error if returned by backend, we will request backend team update api to give us a better error and then change Spartacus to handle it.