fix TeleAPI import (what kind of crack was Christopher smoking that he couldn't fix...
[freeside.git] / FS / FS / svc_external.pm
index fe4ea1d..338fdbc 100644 (file)
@@ -1,16 +1,11 @@
 package FS::svc_external;
 
 use strict;
 package FS::svc_external;
 
 use strict;
-use vars qw(@ISA); # $conf
-use FS::UID;
-#use FS::Record qw( qsearch qsearchs dbh);
-use FS::svc_Common;
+use vars qw(@ISA);
+use FS::Conf;
+use FS::svc_External_Common;
 
 
-@ISA = qw( FS::svc_Common );
-
-#FS::UID::install_callback( sub {
-#  $conf = new FS::Conf;
-#};
+@ISA = qw( FS::svc_External_Common );
 
 =head1 NAME
 
 
 =head1 NAME
 
@@ -39,9 +34,9 @@ FS::svc_external - Object methods for svc_external records
 
 =head1 DESCRIPTION
 
 
 =head1 DESCRIPTION
 
-An FS::svc_external object represents a externally tracked service.
-FS::svc_external inherits from FS::svc_Common.  The following fields are
-currently supported:
+An FS::svc_external object represents a generic externally tracked service.
+FS::svc_external inherits from FS::svc_External_Common (and FS::svc_Common).
+The following fields are currently supported:
 
 =over 4
 
 
 =over 4
 
@@ -67,9 +62,45 @@ points to.  You can ask the object for a copy with the I<hash> method.
 
 =cut
 
 
 =cut
 
+sub table_info {
+  {
+    'name' => 'External service',
+    'sorts' => 'id',
+    'display_weight' => 90,
+    'cancel_weight'  => 10,
+    'fields' => {
+      'id'    => { label => 'Unique number of external record',
+                   type  => 'text',
+                   disable_default => 1,
+                   disable_fixed   => 1,
+                 },
+      'title' => { label => 'Printed on invoice line items',
+                   type  => 'text',
+                   #disable_inventory => 1,
+                 },
+    },
+  };
+}
+
 sub table { 'svc_external'; }
 
 sub table { 'svc_external'; }
 
-=item insert
+# oh!  this should be moved to svc_artera_turbo or something now
+sub label {
+  my $self = shift;
+  my $conf = new FS::Conf;
+  if (    $conf->exists('svc_external-display_type')
+       && $conf->config('svc_external-display_type') eq 'artera_turbo' )
+  {
+    sprintf('%010d', $self->id). '-'.
+      substr('0000000000'.uc($self->title), -10);
+  } else {
+    #$self->SUPER::label;
+    return $self->id unless $self->title =~ /\S/;
+    $self->id. ' - '. $self->title;
+  }
+}
+
+=item insert [ , OPTION => VALUE ... ]
 
 Adds this external service to the database.  If there is an error, returns the
 error, otherwise returns false.
 
 Adds this external service to the database.  If there is an error, returns the
 error, otherwise returns false.
@@ -77,17 +108,23 @@ error, otherwise returns false.
 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be 
 defined.  An FS::cust_svc record will be created and inserted.
 
 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be 
 defined.  An FS::cust_svc record will be created and inserted.
 
-=cut
+Currently available options are: I<depend_jobnum>
 
 
-sub insert {
-  my $self = shift;
-  my $error;
+If I<depend_jobnum> is set (to a scalar jobnum or an array reference of
+jobnums), all provisioning jobs will have a dependancy on the supplied
+jobnum(s) (they will not run until the specific job(s) complete(s)).
 
 
-  $error = $self->SUPER::insert;
-  return $error if $error;
+=cut
 
 
-  '';
-}
+#sub insert {
+#  my $self = shift;
+#  my $error;
+#
+#  $error = $self->SUPER::insert(@_);
+#  return $error if $error;
+#
+#  '';
+#}
 
 =item delete
 
 
 =item delete
 
@@ -95,15 +132,15 @@ Delete this record from the database.
 
 =cut
 
 
 =cut
 
-sub delete {
-  my $self = shift;
-  my $error;
-
-  $error = $self->SUPER::delete;
-  return $error if $error;
-
-  '';
-}
+#sub delete {
+#  my $self = shift;
+#  my $error;
+#
+#  $error = $self->SUPER::delete;
+#  return $error if $error;
+#
+#  '';
+#}
 
 
 =item replace OLD_RECORD
 
 
 =item replace OLD_RECORD
@@ -113,15 +150,15 @@ returns the error, otherwise returns false.
 
 =cut
 
 
 =cut
 
-sub replace {
-  my ( $new, $old ) = ( shift, shift );
-  my $error;
-
-  $error = $new->SUPER::replace($old);
-  return $error if $error;
-
-  '';
-}
+#sub replace {
+#  my ( $new, $old ) = ( shift, shift );
+#  my $error;
+#
+#  $error = $new->SUPER::replace($old);
+#  return $error if $error;
+#
+#  '';
+#}
 
 =item suspend
 
 
 =item suspend
 
@@ -139,25 +176,19 @@ Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
 
 Checks all fields to make sure this is a valid external service.  If there is
 an error, returns the error, otherwise returns false.  Called by the insert
 
 Checks all fields to make sure this is a valid external service.  If there is
 an error, returns the error, otherwise returns false.  Called by the insert
-and repalce methods.
+and replace methods.
 
 =cut
 
 
 =cut
 
-sub check {
-  my $self = shift;
-
-  my $x = $self->setfixed;
-  return $x unless ref($x);
-  my $part_svc = $x;
-
-  my $error = 
-    $self->ut_numbern('svcnum')
-    || $self->ut_number('id')
-    || $self->ut_textn('title')
-  ;
-
-  $self->SUPER::check;
-}
+#sub check {
+#  my $self = shift;
+#  my $error;
+#
+#  $error = $self->SUPER::delete;
+#  return $error if $error;
+#
+#  '';
+#}
 
 =back
 
 
 =back
 
@@ -165,8 +196,8 @@ sub check {
 
 =head1 SEE ALSO
 
 
 =head1 SEE ALSO
 
-L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
-L<FS::cust_pkg>, schema.html from the base documentation.
+L<FS::svc_External_Common>, L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>,
+L<FS::part_svc>, L<FS::cust_pkg>, schema.html from the base documentation.
 
 =cut
 
 
 =cut