optimize invoice rendering with lots of CDRs, RT#15155
[freeside.git] / FS / FS / svc_Common.pm
index 5c6e16b..02e159b 100644 (file)
@@ -985,6 +985,26 @@ sub export_getsettings {
   ( \%settings, \%defaults );
 }
 
+=item export_getstatus
+
+Runs export_getstatus callbacks and returns a two item list consisting of an
+HTML status and a status hashref.
+
+=cut
+
+sub export_getstatus {
+  my $self = shift;
+  my $html = '';
+  my %hash = ();
+  my $error = $self->export('getstatus', \$html, \%hash);
+  if ( $error ) {
+    #XXX bubble this up better
+    warn "error running export_getstatus: $error";
+    return ( '', {} );
+  }
+  ( $html, \%hash );
+}
+
 =item export HOOK [ EXPORT_ARGS ]
 
 Runs the provided export hook (i.e. "suspend", "unsuspend") for this service.
@@ -1118,8 +1138,27 @@ sub find_duplicates {
   return grep { $conflict_svcparts{$_->cust_svc->svcpart} } @dup;
 }
 
+=item getstatus_html
 
+=cut
+
+sub getstatus_html {
+  my $self = shift;
+
+  my $part_svc = $self->cust_svc->part_svc;
+
+  my $html = '';
 
+  foreach my $export ( grep $_->can('export_getstatus'), $part_svc->part_export ) {
+    my $export_html = '';
+    my %hash = ();
+    $export->export_getstatus( $self, \$export_html, \%hash );
+    $html .= $export_html;
+  }
+
+  $html;
+
+}
 
 =back