Merge pull request #9380 from jibees/9068-bulk-product-update-creating-new-on_demand-variant

Admin, Products list: fix variant creation when unit is not well formatted and on_demand is checked or on_hand is filled
This commit is contained in:
Filipe
2022-07-07 22:39:23 +01:00
committed by GitHub
5 changed files with 113 additions and 45 deletions

View File

@@ -5,15 +5,16 @@ angular.module("admin.utils").factory "ErrorsParser", ->
return defaultContent unless errors?
errorsString = ""
if errors.length > 0
if Array.isArray(errors)
# it is an array of errors
errorsString = errors.join("\n") + "\n"
else
else if typeof errors == "object"
# it is a hash of errors
keys = Object.keys(errors)
for key in keys
errorsString += errors[key].join("\n") + "\n"
else # string
errorsString = errors
this.defaultIfEmpty(errorsString, defaultContent)
defaultIfEmpty: (content, defaultContent) =>