input and output on data volume fields specified with k,m,g,or t
[freeside.git] / FS / FS / part_pkg.pm
index 73413f8..3110c1c 100644 (file)
@@ -14,7 +14,7 @@ use FS::type_pkgs;
 use FS::part_pkg_option;
 use FS::pkg_class;
 
-@ISA = qw( FS::Record ); # FS::option_Common ); # this can use option_Common
+@ISA = qw( FS::m2m_Common FS::Record ); # FS::option_Common ); # this can use option_Common
                                                 # when all the plandata bs is
                                                 # gone
 
@@ -600,6 +600,7 @@ sub freqs_href {
     '3'   => 'quarterly (every 3 months)',
     '6'   => 'semiannually (every 6 months)',
     '12'  => 'annually',
+    '13'  => 'every 13 months (annually +1 month)',
     '24'  => 'biannually (every 2 years)',
     '36'  => 'triannually (every 3 years)',
     '48'  => '(every 4 years)',
@@ -816,6 +817,39 @@ sub plan_info {
   \%plans;
 }
 
+=item format OPTION DATA
+
+Returns data formatted according to the function 'format' described
+in the plan info.  Returns DATA if no such function exists.
+
+=cut
+
+sub format {
+  my ($self, $option, $data) = (shift, shift, shift);
+  if (exists($plans{$self->plan}->{fields}->{$option}{format})) {
+    &{$plans{$self->plan}->{fields}->{$option}{format}}($data);
+  }else{
+    $data;
+  }
+}
+
+=item prase OPTION DATA
+
+Returns data parsed according to the function 'parse' described
+in the plan info.  Returns DATA if no such function exists.
+
+=cut
+
+sub parse {
+  my ($self, $option, $data) = (shift, shift, shift);
+  if (exists($plans{$self->plan}->{fields}->{$option}{parse})) {
+    &{$plans{$self->plan}->{fields}->{$option}{parse}}($data);
+  }else{
+    $data;
+  }
+}
+
+
 =back
 
 =head1 NEW PLAN CLASSES