support part_pkg option input validation, check bytecounts and allow commas (closes...
[freeside.git] / FS / FS / part_pkg / prorate.pm
index 6b7c615..967b1eb 100644 (file)
@@ -26,38 +26,47 @@ use FS::part_pkg::flat;
                                            },
     '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,
                        },