From ed9253ea9ea732fa3c827b10bbadf0ff7784c0b2 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 13 Feb 2004 18:58:47 +0000 Subject: postfix export --- bin/postfix.export | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/postfix.export b/bin/postfix.export index 7894a3ad7..64d973837 100755 --- a/bin/postfix.export +++ b/bin/postfix.export @@ -107,7 +107,7 @@ foreach my $export ( @exports ) { dest => "$user\@$machine:". $export->option('virtual'), } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); # warn $rsync->out; - + ssh("$user\@$machine", "postmap hash:/etc/postfix/virtual"); ssh("$user\@$machine", "postfix reload"); } -- cgit v1.2.1 From b5fa7c0c1953139f1fbe0dabf3930871646016b8 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 23 Feb 2004 08:12:47 +0000 Subject: implement fallback suspension code --- FS/FS/part_export.pm | 10 +++++++--- FS/FS/svc_Common.pm | 24 ++++++++++++++++++++++++ FS/FS/svc_acct.pm | 28 ++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 0d9196171..8423da299 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -468,18 +468,22 @@ sub _export_delete { return "_export_delete: unknown export type ". $self->exporttype; } -#fallbacks providing null operations +#call svcdb-specific fallbacks sub _export_suspend { my $self = shift; #warn "warning: _export_suspened unimplemented for". ref($self); - ''; + my $svc_x = shift; + my $new = $svc_x->clone_suspended; + $self->_export_replace( $new, $svc_x ); } sub _export_unsuspend { my $self = shift; #warn "warning: _export_unsuspend unimplemented for ". ref($self); - ''; + my $svc_x = shift; + my $old = $svc_x->clone_kludge_unsuspend; + $self->_export_replace( $svc_x, $old ); } =back diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm index cadb997da..a154f3f85 100644 --- a/FS/FS/svc_Common.pm +++ b/FS/FS/svc_Common.pm @@ -430,6 +430,30 @@ methods. Called by the cancel method of FS::cust_pkg (see L). sub cancel { ''; } +=item clone_suspended + +Constructor used by FS::part_export::_export_suspend fallback. Stub returning +same object for svc_ classes which don't implement a suspension fallback +(everything except svc_acct at the moment). Document better. + +=cut + +sub clone_suspended { + shift; +} + +=item clone_kludge_unsuspend + +Constructor used by FS::part_export::_export_unsuspend fallback. Stub returning +same object for svc_ classes which don't implement a suspension fallback +(everything except svc_acct at the moment). Document better. + +=cut + +sub clone_kludge_unsuspend { + shift; +} + =back =head1 BUGS diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 9d8566d77..32d87202e 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -1061,6 +1061,34 @@ sub radius_groups { } } +=item clone_suspended + +Constructor used by FS::part_export::_export_suspend fallback. Document +better. + +=cut + +sub clone_suspended { + my $self = shift; + my %hash = $self->hash; + $hash{_password} = join('',map($pw_set[ int(rand $#pw_set) ], (0..7) ) ); + new FS::svc_acct \%hash; +} + +=item clone_kludge_unsuspend + +Constructor used by FS::part_export::_export_unsuspend fallback. Document +better. + +=cut + +sub clone_kludge_unsuspend { + my $self = shift; + my %hash = $self->hash; + $hash{_password} = ''; + new FS::svc_acct \%hash; +} + =back =head1 SUBROUTINES -- cgit v1.2.1 From e386fc15be6edadc7068dcb3e48fc81e37b3774b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 25 Feb 2004 03:50:08 +0000 Subject: formatting --- httemplate/docs/install.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 266708b1e..c223394e9 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -139,7 +139,7 @@ PerlHandler Apache::ASP $MLDBM::RemoveTaint = 1; </Perl> PerlSetVar Global /usr/local/etc/freeside/asp-global/ -PerlSetVar Debug 2 +PerlSetVar Debug 2 </Directory> -- cgit v1.2.1 From 0952f0a9264d575752393a0be1a3d3c6480f96ed Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 25 Feb 2004 04:56:40 +0000 Subject: query strings get passed through sometimes? --- FS/FS/CGI.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/FS/FS/CGI.pm b/FS/FS/CGI.pm index f6153761b..86121f02e 100644 --- a/FS/FS/CGI.pm +++ b/FS/FS/CGI.pm @@ -215,6 +215,7 @@ sub popurl { my($up)=@_; my $cgi = &FS::UID::cgi; my $url = new URI::URL ( $cgi->isa('Apache') ? $cgi->uri : $cgi->url ); + $url->query(''); my(@path)=$url->path_components; splice @path, 0-$up; $url->path_components(@path); -- cgit v1.2.1 From 23c97b258b9b60d558af333166940f11c229f71c Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 25 Feb 2004 05:00:11 +0000 Subject: oops, not the right way to blank them --- FS/FS/CGI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS/FS/CGI.pm b/FS/FS/CGI.pm index 86121f02e..6c7ab78c9 100644 --- a/FS/FS/CGI.pm +++ b/FS/FS/CGI.pm @@ -215,7 +215,7 @@ sub popurl { my($up)=@_; my $cgi = &FS::UID::cgi; my $url = new URI::URL ( $cgi->isa('Apache') ? $cgi->uri : $cgi->url ); - $url->query(''); + $url->query(undef); my(@path)=$url->path_components; splice @path, 0-$up; $url->path_components(@path); -- cgit v1.2.1 From be4f8ca23c7d32350737887144796264b90c4e9d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 25 Feb 2004 05:04:36 +0000 Subject: third time's the charm --- FS/FS/CGI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS/FS/CGI.pm b/FS/FS/CGI.pm index 6c7ab78c9..8c9b3260a 100644 --- a/FS/FS/CGI.pm +++ b/FS/FS/CGI.pm @@ -215,7 +215,7 @@ sub popurl { my($up)=@_; my $cgi = &FS::UID::cgi; my $url = new URI::URL ( $cgi->isa('Apache') ? $cgi->uri : $cgi->url ); - $url->query(undef); + $url->query(); my(@path)=$url->path_components; splice @path, 0-$up; $url->path_components(@path); -- cgit v1.2.1 From 91ae03f4b1254614ce089dc587cfd7620528384f Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 25 Feb 2004 05:11:09 +0000 Subject: kludge around it completely --- FS/FS/CGI.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FS/FS/CGI.pm b/FS/FS/CGI.pm index 8c9b3260a..905189e2e 100644 --- a/FS/FS/CGI.pm +++ b/FS/FS/CGI.pm @@ -214,8 +214,9 @@ Returns current URL with LEVEL levels of path removed from the end (default 0). sub popurl { my($up)=@_; my $cgi = &FS::UID::cgi; - my $url = new URI::URL ( $cgi->isa('Apache') ? $cgi->uri : $cgi->url ); - $url->query(); + my $url_string = $cgi->isa('Apache') ? $cgi->uri : $cgi->url; + $url_string =~ s/\?.*//; + my $url = new URI::URL ( $url_string ); my(@path)=$url->path_components; splice @path, 0-$up; $url->path_components(@path); -- cgit v1.2.1 From 395e0a932b6728326f8f5242f7f0a82e2dac919d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 25 Feb 2004 10:37:22 +0000 Subject: fix up forward editing for new svc_forward.src field --- FS/FS/cust_svc.pm | 11 +++-- httemplate/edit/svc_forward.cgi | 104 ++++++++++++++++++++-------------------- 2 files changed, 59 insertions(+), 56 deletions(-) diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index b74cfd685..0d8a12114 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -281,10 +281,15 @@ sub label { if ( $svcdb eq 'svc_acct' ) { $tag = $svc_x->email; } elsif ( $svcdb eq 'svc_forward' ) { - my $svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $svc_x->srcsvc } ); - $tag = $svc_acct->email. '->'; + if ( $svc_x->srcsvc ) { + my $svc_acct = $svc_x->srcsvc_acct; + $tag = $svc_acct->email; + } else { + $tag = $svc_x->src; + } + $tag .= '->'; if ( $svc_x->dstsvc ) { - $svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $svc_x->dstsvc } ); + my $svc_acct = $svc_x->dstsvc_acct; $tag .= $svc_acct->email; } else { $tag .= $svc_x->dst; diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index 0d815b9e5..c323fa29e 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -58,20 +58,17 @@ if ( $cgi->param('error') ) { my $action = $svc_forward->svcnum ? 'Edit' : 'Add'; my %email; + +#starting with those currently attached +foreach my $method (qw( srcsvc_acct dstsvc_acct )) { + my $svc_acct = $svc_forward->$method(); + $email{$svc_acct->svcnum} = $svc_acct->email if $svc_acct; +} + if ($pkgnum) { #find all possible user svcnums (and emails) - #starting with those currently attached - if ( $svc_forward->srcsvc ) { - my $svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $svc_forward->srcsvc } ); - $email{$svc_forward->srcsvc} = $svc_acct->email; - } - if ( $svc_forward->dstsvc ) { - my $svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $svc_forward->dstsvc } ); - $email{$svc_forward->dstsvc} = $svc_acct->email; - } - #and including the rest for this customer my($u_part_svc,@u_acct_svcparts); foreach $u_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_acct'}) ) { @@ -98,15 +95,7 @@ if ($pkgnum) { } } -} elsif ( $action eq 'Edit' ) { - - my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$svc_forward->srcsvc}); - $email{$svc_forward->srcsvc} = $svc_acct->email; - - $svc_acct=qsearchs('svc_acct',{'svcnum'=>$svc_forward->dstsvc}); - $email{$svc_forward->dstsvc} = $svc_acct->email; - -} else { +} elsif ( $action eq 'Add' ) { die "\$action eq Add, but \$pkgnum is null!\n"; } @@ -115,6 +104,7 @@ my($srcsvc,$dstsvc,$dst)=( $svc_forward->dstsvc, $svc_forward->dst, ); +my $src = $svc_forward->dbdef_table->column('src') ? $svc_forward->src : ''; #display @@ -130,46 +120,54 @@ my($srcsvc,$dstsvc,$dst)=( Service #<%= $svcnum ? "$svcnum" : " (NEW)" %>
Service: <%= $part_svc->svc %>

-
+ + + + + + <%= ntable("#cccccc",2) %> -Email to <% foreach $_ (keys %email) { %> VALUE="<%= $_ %>"><%= $email{$_} %> <% } %> - - -<% - tie my %tied_email, 'Tie::IxHash', - '' => 'SELECT DESTINATION', - %email, - '0' => '(other email address)'; - my $widget = new HTML::Widgets::SelectLayers( - 'selected_layer' => $dstsvc, - 'options' => \%tied_email, - 'form_name' => 'dummy', - 'form_action' => 'process/svc_forward.cgi', - 'form_select' => ['srcsvc'], - 'html_between' => '', - 'layer_callback' => sub { - my $layer = shift; - my $html = qq!!. - qq!!. - qq!!. - qq!!; - if ( $layer eq '0' ) { - $html .= ntable("#cccccc",2). - 'Destination email'. - qq!!. - ''; - } - $html .= '
'; - $html; - }, - ); -%> +<% if ( $svc_forward->dbdef_table->column('src') ) { %> + +<% } %> + +<% if ( $svc_forward->dbdef_table->column('src') ) { %> +> +<% } %> + Forwards to -<%= $widget->html %> + +> + + +
+ -- cgit v1.2.1 From 1fe4c2f04162ea5082ded078ee9c1b8b4a86c4af Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 26 Feb 2004 03:32:16 +0000 Subject: allow replace with no arguments --- FS/FS/Record.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index b950e306b..4a3cbe791 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -806,7 +806,24 @@ returns the error, otherwise returns false. =cut sub replace { - my ( $new, $old ) = ( shift, shift ); + my $new = shift; + + my $old; + if ( @_ ) { + $old = shift; + } else { + warn "[debug]$me replace called with no arguments; autoloading old record\n" + if $DEBUG; + my $primary_key = $new->dbdef_table->primary_key; + if ( $primary_key ) { + $old = qsearchs($new->table, { $primary_key => $new->$primary_key() } ) + or croak "can't find ". $new->table. ".$primary_key ". + $new->$primary_key(); + } else { + croak $new->table. " has no primary key; pass old record as argument"; + } + } + warn "[debug]$me $new ->replace $old\n" if $DEBUG; return "Records not in same table!" unless $new->table eq $old->table; -- cgit v1.2.1 From 8d581f6199c27147f417f73cc9f58260efabf327 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 26 Feb 2004 04:01:30 +0000 Subject: double quotes are not ASP --- httemplate/edit/svc_forward.cgi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index c323fa29e..2e6c5f1a0 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -121,9 +121,9 @@ Service #<%= $svcnum ? "$svcnum" : " (NEW)" %>
Service: <%= $part_svc->svc %>

- - - + + +