UnitsCtrl can interpret unit_value_with_description without a separating space

This commit is contained in:
Rob Harrington
2015-04-24 12:15:35 +10:00
parent 05c350b5ff
commit ed7b763ecf
2 changed files with 13 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ angular.module("admin.products")
$scope.processUnitValueWithDescription = ->
if $scope.product.master.hasOwnProperty("unit_value_with_description")
match = $scope.product.master.unit_value_with_description.match(/^([\d\.]+(?= |$)|)( |)(.*)$/)
match = $scope.product.master.unit_value_with_description.match(/^([\d\.]+(?= *|$)|)( *)(.*)$/)
if match
$scope.product.master.unit_value = parseFloat(match[1])
$scope.product.master.unit_value = null if isNaN($scope.product.master.unit_value)