fix welcome emails being sent to signup server declined accounts, closes: Bug#743
authorivan <ivan>
Wed, 3 Mar 2004 13:42:08 +0000 (13:42 +0000)
committerivan <ivan>
Wed, 3 Mar 2004 13:42:08 +0000 (13:42 +0000)
FS/FS/ClientAPI/Signup.pm
FS/FS/cust_main.pm
FS/FS/cust_pkg.pm
FS/FS/queue.pm
FS/FS/svc_Common.pm
FS/FS/svc_acct.pm
FS/FS/svc_broadband.pm
FS/FS/svc_domain.pm
FS/FS/svc_external.pm
FS/FS/svc_forward.pm
FS/FS/svc_www.pm

index 375958b..4655b09 100644 (file)
@@ -4,6 +4,7 @@ use strict;
 use Tie::RefHash;
 use FS::Conf;
 use FS::Record qw(qsearch qsearchs dbdef);
+use FS::Msgcat qw(gettext);
 use FS::agent;
 use FS::cust_main_county;
 use FS::part_pkg;
@@ -12,7 +13,7 @@ use FS::cust_main;
 use FS::cust_pkg;
 use FS::svc_acct;
 use FS::acct_snarf;
-use FS::Msgcat qw(gettext);
+use FS::queue;
 
 use FS::ClientAPI; #hmm
 FS::ClientAPI->register_handlers(
@@ -171,7 +172,8 @@ sub new_customer {
 
   my @acct_snarf;
   my $snarfnum = 1;
-  while ( length($packet->{"snarf_machine$snarfnum"}) ) {
+  while (    exists($packet->{"snarf_machine$snarfnum"})
+          && length($packet->{"snarf_machine$snarfnum"}) ) {
     my $acct_snarf = new FS::acct_snarf ( {
       'machine'   => $packet->{"snarf_machine$snarfnum"},
       'protocol'  => $packet->{"snarf_protocol$snarfnum"},
@@ -189,12 +191,28 @@ sub new_customer {
   $error = $svc_acct->check;
   return { 'error' => $error } if $error;
 
+  #setup a job dependancy to delay provisioning
+  my $placeholder = new FS::queue ( {
+    'job'    => 'FS::ClientAPI::Signup::__placeholder',
+    'status' => 'locked',
+  } );
+  $error = $placeholder->insert;
+  return { 'error' => $error } if $error;
+
   use Tie::RefHash;
   tie my %hash, 'Tie::RefHash';
   %hash = ( $cust_pkg => [ $svc_acct ] );
   #msgcat
-  $error = $cust_main->insert( \%hash, \@invoicing_list, 'noexport' => 1 );
-  return { 'error' => $error } if $error;
+  $error = $cust_main->insert(
+    \%hash,
+    \@invoicing_list,
+    'depend_jobnum' => $placeholder->jobnum,
+  );
+  if ( $error ) {
+    my $perror = $placeholder->delete;
+    $error .= " (Additionally, error removing placeholder: $perror)" if $perror;
+    return { 'error' => $error };
+  }
 
   if ( $conf->exists('signup_server-realtime') ) {
 
@@ -222,11 +240,20 @@ sub new_customer {
       local $FS::svc_Common::noexport_hack = 1;
       $cust_main->cancel('quiet'=>1);
 
+      my $perror = $placeholder->depended_delete;
+      warn "error removing provisioning jobs after decline: $perror" if $perror;
+      unless ( $perror ) {
+        $perror = $placeholder->delete;
+        warn "error removing placeholder after decline: $perror" if $perror;
+      }
+
       return { 'error' => '_decline' };
     }
 
   }
-  $cust_main->reexport;
+
+  $error = $placeholder->delete;
+  return { 'error' => $error } if $error;
 
   return { error => '' };
 
index 6ca3287..a9fcb2b 100644 (file)
@@ -1,7 +1,7 @@
 package FS::cust_main;
 
 use strict;
-use vars qw( @ISA $conf $Debug $import );
+use vars qw( @ISA $conf $DEBUG $import );
 use vars qw( $realtime_bop_decline_quiet ); #ugh
 use Safe;
 use Carp;
@@ -42,8 +42,8 @@ use FS::Msgcat qw(gettext);
 
 $realtime_bop_decline_quiet = 0;
 
-$Debug = 0;
-#$Debug = 1;
+$DEBUG = 0;
+#$DEBUG = 1;
 
 $import = 0;
 
@@ -232,10 +232,16 @@ invoicing_list destination to the newly-created svc_acct.  Here's an example:
 
   $cust_main->insert( {}, [ $email, 'POST' ] );
 
-Currently available options are: I<noexport>
+Currently available options are: I<depend_jobnum> and I<noexport>.
 
-If I<noexport> is set true, no provisioning jobs (exports) are scheduled.
-(You can schedule them later with the B<reexport> method.)
+If I<depend_jobnum> is set, all provisioning jobs will have a dependancy
+on the supplied jobnum (they will not run until the specific job completes).
+This can be used to defer provisioning until some action completes (such
+as running the customer's credit card sucessfully).
+
+The I<noexport> option is deprecated.  If I<noexport> is set true, no
+provisioning jobs (exports) are scheduled.  (You can schedule them later with
+the B<reexport> method.)
 
 =cut
 
@@ -244,6 +250,9 @@ sub insert {
   my $cust_pkgs = @_ ? shift : {};
   my $invoicing_list = @_ ? shift : '';
   my %options = @_;
+  warn "FS::cust_main::insert called with options ".
+       join(', ', map { "$_: $options{$_}" } keys %options ). "\n"
+    if $DEBUG;
 
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
@@ -295,7 +304,6 @@ sub insert {
   }
 
   # packages
-  #local $FS::svc_Common::noexport_hack = 1 if $options{'noexport'};
   $error = $self->order_pkgs($cust_pkgs, \$seconds, %options);
   if ( $error ) {
     $dbh->rollback if $oldAutoCommit;
@@ -330,7 +338,7 @@ sub insert {
 
 }
 
-=item order_pkgs HASHREF, [ , OPTION => VALUE ... ] ]
+=item order_pkgs HASHREF, [ SECONDSREF, [ , OPTION => VALUE ... ] ]
 
 Like the insert method on an existing record, this method orders a package
 and included services atomicaly.  Pass a Tie::RefHash data structure to this
@@ -343,14 +351,20 @@ be a better explanation of this, but until then, here's an example:
     $cust_pkg => [ $svc_acct ],
     ...
   );
-  $cust_main->order_pkgs( \%hash, 'noexport'=>1 );
+  $cust_main->order_pkgs( \%hash, \'0', 'noexport'=>1 );
+
+Currently available options are: I<depend_jobnum> and I<noexport>.
 
-Currently available options are: I<noexport>
+If I<depend_jobnum> is set, all provisioning jobs will have a dependancy
+on the supplied jobnum (they will not run until the specific job completes).
+This can be used to defer provisioning until some action completes (such
+as running the customer's credit card sucessfully).
 
-If I<noexport> is set true, no provisioning jobs (exports) are scheduled.
-(You can schedule them later with the B<reexport> method for each
-cust_pkg object.  Using the B<reexport> method on the cust_main object is not
-recommended, as existing services will also be reexported.)
+The I<noexport> option is deprecated.  If I<noexport> is set true, no
+provisioning jobs (exports) are scheduled.  (You can schedule them later with
+the B<reexport> method for each cust_pkg object.  Using the B<reexport> method
+on the cust_main object is not recommended, as existing services will also be
+reexported.)
 
 =cut
 
@@ -359,6 +373,12 @@ sub order_pkgs {
   my $cust_pkgs = shift;
   my $seconds = shift;
   my %options = @_;
+  my %svc_options = ();
+  $svc_options{'depend_jobnum'} = $options{'depend_jobnum'}
+    if exists $options{'depend_jobnum'};
+  warn "FS::cust_main::order_pkgs called with options ".
+       join(', ', map { "$_: $options{$_}" } keys %options ). "\n"
+    if $DEBUG;
 
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
@@ -386,7 +406,7 @@ sub order_pkgs {
         $svc_something->seconds( $svc_something->seconds + $$seconds );
         $$seconds = 0;
       }
-      $error = $svc_something->insert;
+      $error = $svc_something->insert(%svc_options);
       if ( $error ) {
         $dbh->rollback if $oldAutoCommit;
         #return "inserting svc_ (transaction rolled back): $error";
@@ -401,6 +421,9 @@ sub order_pkgs {
 
 =item reexport
 
+This method is deprecated.  See the I<depend_jobnum> option to the insert and
+order_pkgs methods for a better way to defer provisioning.
+
 Re-schedules all exports by calling the B<reexport> method of all associated
 packages (see L<FS::cust_pkg>).  If there is an error, returns the error;
 otherwise returns false.
@@ -410,6 +433,9 @@ otherwise returns false.
 sub reexport {
   my $self = shift;
 
+  carp "warning: FS::cust_main::reexport is deprectated; ".
+       "use the depend_jobnum option to insert or order_pkgs to delay export";
+
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
   local $SIG{QUIT} = 'IGNORE';
@@ -1474,7 +1500,7 @@ sub collect {
   my $dbh = dbh;
 
   my $balance = $self->balance;
-  warn "collect customer". $self->custnum. ": balance $balance" if $Debug;
+  warn "collect customer". $self->custnum. ": balance $balance" if $DEBUG;
   unless ( $balance > 0 ) { #redundant?????
     $dbh->rollback if $oldAutoCommit; #hmm
     return '';
@@ -1500,7 +1526,7 @@ sub collect {
     last if $self->balance <= 0;
 
     warn "invnum ". $cust_bill->invnum. " (owed ". $cust_bill->owed. ")"
-      if $Debug;
+      if $DEBUG;
 
     foreach my $part_bill_event (
       sort {    $a->seconds   <=> $b->seconds
@@ -1521,7 +1547,7 @@ sub collect {
            || $self->balance   <= 0; # or if balance<=0
 
       warn "calling invoice event (". $part_bill_event->eventcode. ")\n"
-        if $Debug;
+        if $DEBUG;
       my $cust_main = $self; #for callback
 
       my $error;
@@ -1659,7 +1685,7 @@ I<quiet> can be set true to surpress email decline notices.
 
 sub realtime_bop {
   my( $self, $method, $amount, %options ) = @_;
-  if ( $Debug ) {
+  if ( $DEBUG ) {
     warn "$self $method $amount\n";
     warn "  $_ => $options{$_}\n" foreach keys %options;
   }
index c218211..d60e95b 100644 (file)
@@ -669,6 +669,9 @@ sub transfer {
 
 =item reexport
 
+This method is deprecated.  See the I<depend_jobnum> option to the insert and
+order_pkgs methods in FS::cust_main for a better way to defer provisioning.
+
 =cut
 
 sub reexport {
index 634f7f4..9dcb2e3 100644 (file)
@@ -1,7 +1,7 @@
 package FS::queue;
 
 use strict;
-use vars qw( @ISA @EXPORT_OK $conf $jobnums);
+use vars qw( @ISA @EXPORT_OK $DEBUG $conf $jobnums);
 use Exporter;
 use FS::UID;
 use FS::Conf;
@@ -14,6 +14,9 @@ use FS::cust_svc;
 @ISA = qw(FS::Record);
 @EXPORT_OK = qw( joblisting );
 
+$DEBUG = 0;
+#$DEBUG = 1;
+
 $FS::UID::callback{'FS::queue'} = sub {
   $conf = new FS::Conf;
 };
@@ -120,7 +123,10 @@ sub insert {
     }
   }
 
-  push @$jobnums, $self->jobnum if $jobnums;
+  if ( $jobnums ) {
+    warn "jobnums global is active: $jobnums\n" if $DEBUG;
+    push @$jobnums, $self->jobnum;
+  }
 
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
 
@@ -239,6 +245,7 @@ sub cust_svc {
 =item queue_depend
 
 Returns the FS::queue_depend objects associated with this job, if any.
+(Dependancies that must complete before this job can be run).
 
 =cut
 
@@ -247,7 +254,6 @@ sub queue_depend {
   qsearch('queue_depend', { 'jobnum' => $self->jobnum } );
 }
 
-
 =item depend_insert OTHER_JOBNUM
 
 Inserts a dependancy for this job - it will not be run until the other job
@@ -268,6 +274,39 @@ sub depend_insert {
   $queue_depend->insert;
 }
 
+=item queue_depended
+
+Returns the FS::queue_depend objects that associate other jobs with this job,
+if any.  (The jobs that are waiting for this job to complete before they can
+run).
+
+=cut
+
+sub queue_depended {
+  my $self = shift;
+  qsearch('queue_depend', { 'depend_jobnum' => $self->jobnum } );
+}
+
+=item depended_delete
+
+Deletes the other queued jobs (FS::queue objects) that are waiting for this
+job, if any.  If there is an error, returns the error, otherwise returns false.
+
+=cut
+
+sub depended_delete {
+  my $self = shift;
+  my $error;
+  foreach my $job (
+    map { qsearchs('queue', { 'jobnum' => $_->jobnum } ) } $self->queue_depended
+  ) {
+    $error = $job->depended_delete;
+    return $error if $error;
+    $error = $job->delete;
+    return $error if $error
+  }
+}
+
 =back
 
 =head1 SUBROUTINES
@@ -385,7 +424,7 @@ END
 
 =head1 VERSION
 
-$Id: queue.pm,v 1.16 2003-08-05 00:20:46 khoff Exp $
+$Id: queue.pm,v 1.17 2004-03-03 13:42:08 ivan Exp $
 
 =head1 BUGS
 
index a154f3f..a223266 100644 (file)
@@ -1,7 +1,7 @@
 package FS::svc_Common;
 
 use strict;
-use vars qw( @ISA $noexport_hack );
+use vars qw( @ISA $noexport_hack $DEBUG );
 use FS::Record qw( qsearch qsearchs fields dbh );
 use FS::cust_svc;
 use FS::part_svc;
@@ -9,6 +9,9 @@ use FS::queue;
 
 @ISA = qw( FS::Record );
 
+$DEBUG = 0;
+#$DEBUG = 1;
+
 =head1 NAME
 
 FS::svc_Common - Object method for all svc_ records
@@ -82,7 +85,7 @@ sub check {
   $self->SUPER::check;
 }
 
-=item insert [ JOBNUM_ARRAYREF [ OBJECTS_ARRAYREF ] ]
+=item insert [ , OPTION => VALUE ... ]
 
 Adds this record to the database.  If there is an error, returns the error,
 otherwise returns false.
@@ -90,19 +93,36 @@ 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.
 
-If an arrayref is passed as parameter, the B<jobnum>s of any export jobs will
-be added to the array.
+Currently available options are: I<jobnums>, I<child_objects> and
+I<depend_jobnum>.
+
+If I<jobnum> is set to an array reference, the jobnums of any export jobs will
+be added to the referenced array.
+
+If I<child_objects> is set to an array reference of FS::tablename objects (for
+example, FS::acct_snarf objects), they will have their svcnum fieldsset and
+will be inserted after this record, but before any exports are run.
 
-If an arrayref of FS::tablename objects (for example, FS::acct_snarf objects)
-is passed as the optional second parameter, they will have their svcnum fields
-set and will be inserted after this record, but before any exports are run.
+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)).
 
 =cut
 
 sub insert {
   my $self = shift;
-  local $FS::queue::jobnums = shift if @_;
-  my $objects = scalar(@_) ? shift : [];
+  my %options = @_;
+  warn "FS::svc_Common::insert called with options ".
+     join(', ', map { "$_: $options{$_}" } keys %options ). "\n"
+  if $DEBUG;
+
+  my @jobnums = ();
+  local $FS::queue::jobnums = \@jobnums;
+  warn "FS::svc_Common::insert: set \$FS::queue::jobnums to $FS::queue::jobnums"
+    if $DEBUG;
+  my $objects = $options{'child_objects'} || [];
+  my $depend_jobnums = $options{'depend_jobnum'} || [];
+  $depend_jobnums = [ $depend_jobnums ] unless ref($depend_jobnums);
   my $error;
 
   local $SIG{HUP} = 'IGNORE';
@@ -162,6 +182,10 @@ sub insert {
 
   #new-style exports!
   unless ( $noexport_hack ) {
+
+    warn "FS::svc_Common::insert: \$FS::queue::jobnums is $FS::queue::jobnums"
+      if $DEBUG;
+
     foreach my $part_export ( $self->cust_svc->part_svc->part_export ) {
       my $error = $part_export->export_insert($self);
       if ( $error ) {
@@ -170,6 +194,26 @@ sub insert {
                " (transaction rolled back): $error";
       }
     }
+
+    foreach my $depend_jobnum ( @$depend_jobnums ) {
+      warn "inserting dependancies on supplied job $depend_jobnum\n"
+        if $DEBUG;
+      foreach my $jobnum ( @jobnums ) {
+        my $queue = qsearchs('queue', { 'jobnum' => $jobnum } );
+        warn "inserting dependancy for job $jobnum on $depend_jobnum\n"
+          if $DEBUG;
+        my $error = $queue->depend_insert($depend_jobnum);
+        if ( $error ) {
+          $dbh->rollback if $oldAutoCommit;
+          return "error queuing job dependancy: $error";
+        }
+      }
+    }
+
+  }
+
+  if ( exists $options{'jobnums'} ) {
+    push @{ $options{'jobnums'} }, @jobnums;
   }
 
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
index 32d8720..d84240f 100644 (file)
@@ -33,6 +33,7 @@ use FS::Msgcat qw(gettext);
 @ISA = qw( FS::svc_Common );
 
 $DEBUG = 0;
+#$DEBUG = 1;
 $me = '[FS::svc_acct]';
 
 #ask FS::UID to run this stuff for us later
@@ -176,7 +177,7 @@ Creates a new account.  To add the account to the database, see L<"insert">.
 
 sub table { 'svc_acct'; }
 
-=item insert
+=item insert [ , OPTION => VALUE ... ]
 
 Adds this account to the database.  If there is an error, returns the error,
 otherwise returns false.
@@ -193,15 +194,21 @@ should contain an arrayref of FS::tablename objects.  They will have their
 svcnum fields set and will be inserted after this record, but before any
 exports are run.
 
+Currently available options are: I<depend_jobnum>
+
+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)).
+
 (TODOC: L<FS::queue> and L<freeside-queued>)
 
 (TODOC: new exports!)
 
-
 =cut
 
 sub insert {
   my $self = shift;
+  my %options = @_;
   my $error;
 
   local $SIG{HUP} = 'IGNORE';
@@ -325,7 +332,11 @@ sub insert {
   #see?  i told you it was more complicated
 
   my @jobnums;
-  $error = $self->SUPER::insert(\@jobnums, $self->child_objects || [] );
+  $error = $self->SUPER::insert(
+    'jobnums'       => \@jobnums,
+    'child_objects' => $self->child_objects,
+    %options,
+  );
   if ( $error ) {
     $dbh->rollback if $oldAutoCommit;
     return $error;
@@ -395,6 +406,22 @@ sub insert {
           return "error queuing welcome email: $error";
         }
 
+        if ( $options{'depend_jobnum'} ) {
+          warn "$me depend_jobnum found; adding to welcome email dependancies"
+            if $DEBUG;
+          if ( ref($options{'depend_jobnum'}) ) {
+            warn "$me adding jobs ". join(', ', @{$options{'depend_jobnum'}} ).
+                 "to welcome email dependancies"
+              if $DEBUG;
+            push @jobnums, @{ $options{'depend_jobnum'} };
+          } else {
+            warn "$me adding job $options{'depend_jobnum'} ".
+                 "to welcome email dependancies"
+              if $DEBUG;
+            push @jobnums, $options{'depend_jobnum'};
+          }
+        }
+
         foreach my $jobnum ( @jobnums ) {
           my $error = $wqueue->depend_insert($jobnum);
           if ( $error ) {
@@ -1264,6 +1291,9 @@ counterintuitive.
 radius_usergroup_selector?  putting web ui components in here?  they should
 probably live somewhere else...
 
+insertion of RADIUS group stuff in insert could be done with child_objects now
+(would probably clean up export of them too)
+
 =head1 SEE ALSO
 
 L<FS::svc_Common>, edit/part_svc.cgi from an installed web interface,
index 7789806..aaac891 100755 (executable)
@@ -87,7 +87,7 @@ points to.  You can ask the object for a copy with the I<hash> method.
 
 sub table { 'svc_broadband'; }
 
-=item insert
+=item insert [ , OPTION => VALUE ... ]
 
 Adds this record to the database.  If there is an error, returns the error,
 otherwise returns false.
@@ -95,6 +95,12 @@ otherwise returns false.
 The additional fields pkgnum and svcpart (see FS::cust_svc) should be 
 defined.  An FS::cust_svc record will be created and inserted.
 
+Currently available options are: I<depend_jobnum>
+
+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)).
+
 =cut
 
 # Standard FS::svc_Common::insert
index 10d5d8f..c88b3e6 100644 (file)
@@ -86,7 +86,7 @@ Creates a new domain.  To add the domain to the database, see L<"insert">.
 
 sub table { 'svc_domain'; }
 
-=item insert
+=item insert [ , OPTION => VALUE ... ]
 
 Adds this domain to the database.  If there is an error, returns the error,
 otherwise returns false.
@@ -112,6 +112,12 @@ If any records are defined in the I<defaultrecords> configuration file,
 appropriate records are added to the domain_record table (see
 L<FS::domain_record>).
 
+Currently available options are: I<depend_jobnum>
+
+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)).
+
 =cut
 
 sub insert {
@@ -145,7 +151,7 @@ sub insert {
     return "Domain not found (see whois)";
   }
 
-  $error = $self->SUPER::insert;
+  $error = $self->SUPER::insert(@_);
   if ( $error ) {
     $dbh->rollback if $oldAutoCommit;
     return $error;
index fe4ea1d..b97e12b 100644 (file)
@@ -69,7 +69,7 @@ points to.  You can ask the object for a copy with the I<hash> method.
 
 sub table { 'svc_external'; }
 
-=item insert
+=item insert [ , OPTION => VALUE ... ]
 
 Adds this external service to the database.  If there is an error, returns the
 error, otherwise returns false.
@@ -77,17 +77,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.
 
-=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
 
@@ -95,15 +101,15 @@ Delete this record from the database.
 
 =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
@@ -113,15 +119,15 @@ returns the error, otherwise returns false.
 
 =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
 
index b9e8ff8..b8d55fe 100644 (file)
@@ -68,7 +68,7 @@ database, see L<"insert">.
 
 sub table { 'svc_forward'; }
 
-=item insert
+=item insert [ , OPTION => VALUE ... ]
 
 Adds this mail forwarding alias to the database.  If there is an error, returns
 the error, otherwise returns false.
@@ -76,6 +76,12 @@ the 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.
 
+Currently available options are: I<depend_jobnum>
+
+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)).
+
 =cut
 
 sub insert {
@@ -96,7 +102,7 @@ sub insert {
   $error = $self->check;
   return $error if $error;
 
-  $error = $self->SUPER::insert;
+  $error = $self->SUPER::insert(@_);
   if ($error) {
     $dbh->rollback if $oldAutoCommit;
     return $error;
index 7e89083..6c276a1 100644 (file)
@@ -74,7 +74,7 @@ points to.  You can ask the object for a copy with the I<hash> method.
 
 sub table { 'svc_www'; }
 
-=item insert
+=item insert [ , OPTION => VALUE ... ]
 
 Adds this record to the database.  If there is an error, returns the error,
 otherwise returns false.
@@ -82,6 +82,13 @@ 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.
 
+Currently available options are: I<depend_jobnum>
+
+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)).
+
+
 =cut
 
 sub insert {
@@ -124,7 +131,7 @@ sub insert {
     $self->recnum($domain_record->recnum);
   }
 
-  $error = $self->SUPER::insert;
+  $error = $self->SUPER::insert(@_);
   if ( $error ) {
     $dbh->rollback if $oldAutoCommit;
     return $error;