[freeside] Freeside 1.4.1rc3 svc_forward export issues

ivan at 420.am ivan at 420.am
Tue Jun 24 17:58:25 PDT 2003


Index: forward_shellcommands.pm
===================================================================
RCS file:
/home/cvs/cvsroot/freeside/FS/FS/part_export/forward_shellcommands.pm,v
retrieving revision 1.2
diff -u -r1.2 forward_shellcommands.pm
--- forward_shellcommands.pm    24 Jun 2003 14:12:31 -0000      1.2
+++ forward_shellcommands.pm    25 Jun 2003 00:55:52 -0000
@@ -2,9 +2,7 @@
 
 use strict;
 use vars qw(@ISA);
-use FS::Record qw(qsearchs);
 use FS::part_export;
-use FS::svc_acct;
 
 @ISA = qw(FS::part_export);
 
@@ -31,13 +29,13 @@
     ${$_} = $svc_forward->getfield($_) foreach $svc_forward->fields;
   }
 
-  my $svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $self->srcsvc } );
+  my $svc_acct = $svc_forward->srcsvc_acct;
   $username = $svc_acct->username;
   $domain = $svc_acct->domain;
-  if ($self->dstsvc) {
-    $destination = $self->dstsvc_acct->email;
+  if ($svc_forward->dstsvc_acct) {
+    $destination = $svc_forward->dstsvc_acct->email;
   } else {
-    $destination = $self->dst;
+    $destination = $svc_forward->dst;
   }
 
   #done setting variables for the command
@@ -61,22 +59,22 @@
     ${"new_$_"} = $new->getfield($_) foreach $new->fields;
   }
 
-  my $old_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $self->srcsvc } );
+  my $old_svc_acct = $old->srcsvc_acct;
   $old_username = $old_svc_acct->username;
   $old_domain = $old_svc_acct->domain;
-  if ($self->dstsvc) {
-    $old_destination = $self->dstsvc_acct->email;
+  if ($old->dstsvc_acct) {
+    $old_destination = $old->dstsvc_acct->email;
   } else {
-    $old_destination = $self->dst;
+    $old_destination = $old->dst;
   }
 
-  my $new_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $self->srcsvc } );
+  my $new_svc_acct = $new->srcsvc_acct;
   $new_username = $new_svc_acct->username;
   $new_domain = $new_svc_acct->domain;
-  if ($self->dstsvc) {
-    $new_destination = $self->dstsvc_acct->email;
+  if ($new->dstsvc) {
+    $new_destination = $new->dstsvc_acct->email;
   } else {
-    $new_destination = $self->dst;
+    $new_destination = $new->dst;
   }
 


On Tue, Jun 24, 2003 at 04:06:46PM -0400, Stephen D. Bechard wrote:
> Much better, but still some errors:
> 
> Errors Output
> Can't call method "username" on an undefined value at
> /usr/local/lib/perl5/site_perl/5.6.1//FS/part_export/forward_shellcommands.p
> m line 65. , /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1491
> 
> Debug Output
> Can't call method "username" on an undefined value at
> /usr/local/lib/perl5/site_perl/5.6.1//FS/part_export/forward_shellcommands.p
> m line 65. , /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1491
> 
> 
> Thanks,
> Steve
> 
> ----- Original Message ----- 
> From: <ivan at 420.am>
> To: <ivan-freeside at sisd.com>
> Sent: Tuesday, June 24, 2003 10:09 AM
> Subject: Re: [freeside] Freeside 1.4.1rc3 svc_forward export issues
> 
> 
> > try this
> >
> > Index: forward_shellcommands.pm
> > ===================================================================
> > RCS file:
> > /home/cvs/cvsroot/freeside/FS/FS/part_export/forward_shellcommands.pm,v
> > retrieving revision 1.1
> > diff -u -r1.1 forward_shellcommands.pm
> > --- forward_shellcommands.pm    22 Apr 2003 04:39:40 -0000      1.1
> > +++ forward_shellcommands.pm    24 Jun 2003 14:08:47 -0000
> > @@ -2,7 +2,9 @@
> >
> >  use strict;
> >  use vars qw(@ISA);
> > +use FS::Record qw(qsearchs);
> >  use FS::part_export;
> > +use FS::svc_acct;
> >
> >  @ISA = qw(FS::part_export);
> >
> >
> >
> > On Tue, Jun 24, 2003 at 09:39:59AM -0400, Stephen D. Bechard wrote:
> > > I am having issues trying to setup the svc_forward with exports.
> > > I am currently running Freeside version 1.4.1rc3 and everything
> > > else seems to work great.
> > >
> > > Here is what I have configured for my svc_forward:
> > >
> > > srcsvc Default
> > > dstsvc Default  0
> > > dst Default
> > >
> > > Here is what I have configured for my forward_shellcommands:
> > >
> > > useradd freeside-virtuser.sh insert $domain $username $destination
> > > usermod freeside-virtuser.sh modify $new_domain $new_username
> > > $new_destination
> > > user root
> > > userdel freeside-virtuser.sh delete $domain $username $destination
> > >
> > > (freeside-virtuser.sh is a custom script I wrote to handle the
> > >  virtusertable on our customized sendmail installation.)
> > >
> > > It doesn't appear to matter what I put in the forward_shellcommands
> > > I always get errors, please see the output below. If I remove the
> > > forward_shellcommands export everything seems to work fine.
> > >
> > > I have attempted to decipher the errors without any luck!
> > >
> > > Thanks,
> > > Steve
> > >
> > > PS
> > > Yes, I know I still haven't submitted any of my diffs from last time. ;)
> > >
> >
> > --------------------------------------------------------------------------
> --
> > > -----------------------
> > >
> > > Errors Output
> > >
> > > errant AUTOLOAD qsearchs for svc_acct (arg HASH(0x94a08d8)) at
> > > /usr/local/lib/perl5/site_perl/5.6.1//FS/Record.pm line 430
> > > FS::Record::AUTOLOAD('svc_acct', 'HASH(0x94a08d8)') called at
> > >
> /usr/local/lib/perl5/site_perl/5.6.1//FS/part_export/forward_shellcommands.p
> > > m line 32
> > >
> > >
> FS::part_export::forward_shellcommands::_export_command('FS::part_export::fo
> > > rward_shellcommands=HASH(0x94a0670)', 'useradd',
> > > 'FS::svc_forward=HASH(0x90e2024)') called at
> > >
> /usr/local/lib/perl5/site_perl/5.6.1//FS/part_export/forward_shellcommands.p
> > > m line 13
> > >
> > >
> FS::part_export::forward_shellcommands::_export_insert('FS::part_export::for
> > > ward_shellcommands=HASH(0x94a0670)', 'FS::svc_forward=HASH(0x90e2024)')
> > > called at /usr/local/lib/perl5/site_perl/5.6.1//FS/part_export.pm line
> 407
> > >
> FS::part_export::export_insert('FS::part_export::forward_shellcommands=HASH(
> > > 0x94a0670)', 'FS::svc_forward=HASH(0x90e2024)') called at
> > > /usr/local/lib/perl5/site_perl/5.6.1//FS/svc_Common.pm line 96
> > >
> > > FS::svc_Common::insert('FS::svc_forward=HASH(0x90e2024)') called at
> > > /usr/local/lib/perl5/site_perl/5.6.1//FS/svc_forward.pm line 97
> > > FS::svc_forward::insert('FS::svc_forward=HASH(0x90e2024)') called at
> > > /usr/local/www/data/aspdocs/edit/process/svc_forward.cgi line 18
> > >
> Apache::ASP::Compiles::__ASP__usr_local_etc_freeside_asp_global_x1740c41f4a1
> > >
> 56eda78caec4c47748752::__ASP_spdocs_edit_process_svc_forward_cgix7a89bfe5f5e
> > > 0e04c8e6a1b63a6e53882xINC() called at
> > > /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1487
> > >
> > > eval {...} called at /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm
> line
> > > 1487
> > >
> > > Apache::ASP::Execute('Apache::ASP=HASH(0x9445aac)',
> > > 'Apache::ASP::Compiles::__ASP__usr_local_etc_freeside_asp_global_...')
> > > called at /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1449
> > >
> > > eval {...} called at /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm
> line
> > > 1447
> > >
> > > Apache::ASP::Run('Apache::ASP=HASH(0x9445aac)') called at
> > > /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 177
> > > Apache::ASP::handler('Apache=SCALAR(0x93b5754)') called at /dev/null
> line 0
> > >
> > > eval {...} called at /dev/null line 0 ,
> > > /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1491
> > >
> > > Debug Output
> > >
> > > errant AUTOLOAD qsearchs for svc_acct (arg HASH(0x94a08d8)) at
> > > /usr/local/lib/perl5/site_perl/5.6.1//FS/Record.pm line 430
> > > FS::Record::AUTOLOAD('svc_acct', 'HASH(0x94a08d8)') called at
> > >
> /usr/local/lib/perl5/site_perl/5.6.1//FS/part_export/forward_shellcommands.p
> > > m line 32
> > >
> FS::part_export::forward_shellcommands::_export_command('FS::part_export::fo
> > > rward_shellcommands=HASH(0x94a0670)', 'useradd',
> > > 'FS::svc_forward=HASH(0x90e2024)') called at
> > >
> /usr/local/lib/perl5/site_perl/5.6.1//FS/part_export/forward_shellcommands.p
> > > m line 13
> > >
> FS::part_export::forward_shellcommands::_export_insert('FS::part_export::for
> > > ward_shellcommands=HASH(0x94a0670)', 'FS::svc_forward=HASH(0x90e2024)')
> > > called at /usr/local/lib/perl5/site_perl/5.6.1//FS/part_export.pm line
> 407
> > >
> > >
> FS::part_export::export_insert('FS::part_export::forward_shellcommands=HASH(
> > > 0x94a0670)', 'FS::svc_forward=HASH(0x90e2024)') called at
> > > /usr/local/lib/perl5/site_perl/5.6.1//FS/svc_Common.pm line 96
> > >
> > > FS::svc_Common::insert('FS::svc_forward=HASH(0x90e2024)') called at
> > > /usr/local/lib/perl5/site_perl/5.6.1//FS/svc_forward.pm line 97
> > >
> > > FS::svc_forward::insert('FS::svc_forward=HASH(0x90e2024)') called at
> > > /usr/local/www/data/aspdocs/edit/process/svc_forward.cgi line 18
> > >
> > >
> Apache::ASP::Compiles::__ASP__usr_local_etc_freeside_asp_global_x1740c41f4a1
> > >
> 56eda78caec4c47748752::__ASP_spdocs_edit_process_svc_forward_cgix7a89bfe5f5e
> > > 0e04c8e6a1b63a6e53882xINC() called at
> > > /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1487
> > >
> > > eval {...} called at /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm
> line
> > > 1487
> > >
> > > Apache::ASP::Execute('Apache::ASP=HASH(0x9445aac)',
> > > 'Apache::ASP::Compiles::__ASP__usr_local_etc_freeside_asp_global_...')
> > > called at /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1449
> > >
> > > eval {...} called at /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm
> line
> > > 1447
> > >
> > > Apache::ASP::Run('Apache::ASP=HASH(0x9445aac)') called at
> > > /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 177
> > >
> > >  Apache::ASP::handler('Apache=SCALAR(0x93b5754)') called at /dev/null
> line 0
> > > eval {...} called at /dev/null line 0 ,
> > >
> > >  /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1491
> > > ASP to Perl Script
> > >
> > >   -: no strict;;use vars qw($Application $Session $Response $Server
> > > $Request);;
> > >   -: #line 1 /usr/local/www/data/aspdocs/edit/process/svc_forward.cgi
> > >   1: ;;
> > >   2:
> > >   3: $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
> > >   4: my $svcnum =$1;
> > >   5:
> > >   6: my $old = qsearchs('svc_forward',{'svcnum'=>$svcnum}) if $svcnum;
> > >   7:
> > >   8: my $new = new FS::svc_forward ( {
> > >   9:   map {
> > >  10:     ($_, scalar($cgi->param($_)));
> > >  11:   } ( fields('svc_forward'), qw( pkgnum svcpart ) )
> > >  12: } );
> > >  13:
> > >  14: my $error = '';
> > >  15: if ( $svcnum ) {
> > >  16:   $error = $new->replace($old);
> > >  17: } else {
> > >  18:   $error = $new->insert;
> > >  19:   $svcnum = $new->getfield('svcnum');
> > >  20: }
> > >  21:
> > >  22: if ($error) {
> > >  23:   $cgi->param('error', $error);
> > >  24:   print $cgi->redirect(popurl(2). "svc_forward.cgi?".
> > > $cgi->query_string );
> > >  25: } else {
> > >  26:   print $cgi->redirect(popurl(3). "view/svc_forward.cgi?$svcnum");
> > >  27: }
> > >  28:
> > >  29: ;
> > >
> > >
> > >
> >
> > -- 
> > _ivan
> >
> >
> 




More information about the freeside-users mailing list