support part_pkg option input validation, check bytecounts and allow commas (closes...
[freeside.git] / FS / FS / part_pkg / flat.pm
index 471f216..f5ccd01 100644 (file)
@@ -26,40 +26,49 @@ use FS::part_pkg;
                     },
     'seconds'       => { 'name' => 'Time limit for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*$/ },
                        },
     'upbytes'       => { 'name' => 'Upload limit for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*$/ },
                          'format' => \&FS::UI::bytecount::display_bytecount,
                          'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
     'downbytes'     => { 'name' => 'Download limit for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*$/ },
                          'format' => \&FS::UI::bytecount::display_bytecount,
                          'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
     'totalbytes'    => { 'name' => 'Transfer limit for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*$/ },
                          'format' => \&FS::UI::bytecount::display_bytecount,
                          'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
     'recharge_amount'       => { 'name' => 'Cost of recharge for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*(\.\d{2})?$/ },
                        },
     'recharge_seconds'      => { 'name' => 'Recharge time for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*$/ },
                        },
     'recharge_upbytes'      => { 'name' => 'Recharge upload for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*$/ },
                          'format' => \&FS::UI::bytecount::display_bytecount,
                          'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
     'recharge_downbytes'    => { 'name' => 'Recharge download for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*$/ },
                          'format' => \&FS::UI::bytecount::display_bytecount,
                          'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
     'recharge_totalbytes'   => { 'name' => 'Recharge transfer for this package',
                          'default' => '',
+                         'check' => sub { shift =~ /^\d*$/ },
                          'format' => \&FS::UI::bytecount::display_bytecount,
                          'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },