RT# 81249 - Fixed error where empty field becomes 0.
[freeside.git] / FS / FS / part_pkg.pm
index 1895404..4aa2926 100644 (file)
@@ -695,12 +695,23 @@ sub replace {
 
 sub validate_number {
   my ($option, $valref) = @_;
+
   $$valref = 0 unless $$valref;
   return "Invalid $option"
     unless ($$valref) = ($$valref =~ /^\s*(\d+)\s*$/);
   return '';
 }
 
+sub validate_number_blank {
+  my ($option, $valref) = @_;
+
+  if ($$valref) {
+    return "Invalid $option"
+      unless ($$valref) = ($$valref =~ /^\s*(\d+)\s*$/);
+  }
+  return '';
+}
+
 =item check
 
 Checks all fields to make sure this is a valid package definition.  If