[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.13.2.4, 1.13.2.5 prorate.pm, 1.10.2.1, 1.10.2.2 subscription.pm, 1.9.2.1, 1.9.2.2

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


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

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	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.10.2.1
retrieving revision 1.10.2.2
diff -u -d -r1.10.2.1 -r1.10.2.2
--- prorate.pm	8 May 2007 22:44:08 -0000	1.10.2.1
+++ prorate.pm	4 Oct 2007 02:06:53 -0000	1.10.2.2
@@ -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.13.2.4
retrieving revision 1.13.2.5
diff -u -d -r1.13.2.4 -r1.13.2.5
--- flat.pm	8 May 2007 22:10:32 -0000	1.13.2.4
+++ flat.pm	4 Oct 2007 02:06:53 -0000	1.13.2.5
@@ -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.9.2.1
retrieving revision 1.9.2.2
diff -u -d -r1.9.2.1 -r1.9.2.2
--- subscription.pm	8 May 2007 22:44:08 -0000	1.9.2.1
+++ subscription.pm	4 Oct 2007 02:06:53 -0000	1.9.2.2
@@ -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