[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.19, 1.20 prorate.pm, 1.13, 1.14 subscription.pm, 1.12, 1.13

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Oct 3 19:07:32 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail:/tmp/cvs-serv13542/FS/FS/part_pkg

Modified Files:
	flat.pm prorate.pm subscription.pm 
Log Message:
support part_pkg option input validation, check bytecounts and allow commas (closes 1863)

Index: prorate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- prorate.pm	18 Sep 2007 06:32:51 -0000	1.13
+++ prorate.pm	4 Oct 2007 02:07:30 -0000	1.14
@@ -26,38 +26,47 @@
 					    },
     '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,
                        },

Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- flat.pm	18 Sep 2007 06:32:50 -0000	1.19
+++ flat.pm	4 Oct 2007 02:07:30 -0000	1.20
@@ -26,40 +26,49 @@
                     },
     '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,
                        },

Index: subscription.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/subscription.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- subscription.pm	18 Sep 2007 06:32:51 -0000	1.12
+++ subscription.pm	4 Oct 2007 02:07:30 -0000	1.13
@@ -22,38 +22,47 @@
                     },
     '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,
                        },



More information about the freeside-commits mailing list