summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Misc.pm10
-rw-r--r--FS/FS/TicketSystem/RT_Internal.pm2
-rw-r--r--FS/FS/cust_main/Billing.pm2
-rw-r--r--FS/FS/cust_pkg_discount.pm3
-rw-r--r--FS/FS/discount.pm1
-rw-r--r--FS/FS/part_event/Action/pkg_agent_credit.pm3
-rw-r--r--FS/FS/part_export/freeswitch.pm84
-rw-r--r--FS/FS/part_export/shellcommands.pm6
-rw-r--r--FS/FS/rate.pm2
-rw-r--r--FS/FS/svc_Tower_Mixin.pm1
10 files changed, 61 insertions, 53 deletions
diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm
index 2be9ec203..297e39fbc 100644
--- a/FS/FS/Misc.pm
+++ b/FS/FS/Misc.pm
@@ -913,16 +913,6 @@ sub ocr_image {
@lines;
}
-=item spool_formats
-
-Returns a list of the invoice spool formats.
-
-=cut
-
-sub spool_formats {
- qw(default oneline billco bridgestone)
-}
-
=back
=head1 BUGS
diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm
index b09647e18..01e2e2966 100644
--- a/FS/FS/TicketSystem/RT_Internal.pm
+++ b/FS/FS/TicketSystem/RT_Internal.pm
@@ -50,7 +50,7 @@ sub access_right {
sub session {
my( $self, $session ) = @_;
- if ( $session && $session->{'Current_User'} ) { # does this even work?
+ if ( $session && $session->{'CurrentUser'} ) { # does this even work?
warn "$me session: using existing session and CurrentUser: \n".
Dumper($session->{'CurrentUser'})
if $DEBUG;
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 02774c954..11247a28f 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -1255,6 +1255,8 @@ sub _handle_taxes {
$taxhash{'taxclass'} = $part_pkg->taxclass;
+ warn "taxhash:\n". Dumper(\%taxhash) if $DEBUG > 2;
+
my @taxes = (); # entries are cust_main_county objects
my %taxhash_elim = %taxhash;
my @elim = qw( district city county state );
diff --git a/FS/FS/cust_pkg_discount.pm b/FS/FS/cust_pkg_discount.pm
index a20794027..5f4d0dccf 100644
--- a/FS/FS/cust_pkg_discount.pm
+++ b/FS/FS/cust_pkg_discount.pm
@@ -106,7 +106,8 @@ sub insert {
'amount' => $self->amount,
'percent' => $self->percent,
'months' => $self->months,
- 'setup' => $self->setup,
+ 'setup' => $self->setup,
+ #'linked' => $self->linked,
'disabled' => 'Y',
};
my $error = $discount->insert;
diff --git a/FS/FS/discount.pm b/FS/FS/discount.pm
index 88cbdd41c..f6f994599 100644
--- a/FS/FS/discount.pm
+++ b/FS/FS/discount.pm
@@ -136,6 +136,7 @@ sub check {
|| $self->ut_floatn('months') #actually decimal, but this will do
|| $self->ut_enum('disabled', [ '', 'Y' ])
|| $self->ut_enum('setup', [ '', 'Y' ])
+ #|| $self->ut_enum('linked', [ '', 'Y' ])
;
return $error if $error;
diff --git a/FS/FS/part_event/Action/pkg_agent_credit.pm b/FS/FS/part_event/Action/pkg_agent_credit.pm
index 4bcee983b..e1c77be07 100644
--- a/FS/FS/part_event/Action/pkg_agent_credit.pm
+++ b/FS/FS/part_event/Action/pkg_agent_credit.pm
@@ -18,7 +18,7 @@ sub do_action {
my $agent_cust_main = $agent->agent_cust_main;
#? or return "No customer record for agent ". $agent->agent;
- my $amount = $self->_calc_credit($cust_pkg);
+ my $amount = $self->_calc_credit($cust_pkg);
return '' unless $amount > 0;
my $reasonnum = $self->option('reasonnum');
@@ -29,6 +29,7 @@ sub do_action {
'eventnum' => $cust_event->eventnum,
'addlinfo' => 'for customer #'. $cust_main->display_custnum.
': '.$cust_main->name,
+ #'commission_agentnum' => $agent->agentnum,
);
die "Error crediting customer ". $agent_cust_main->custnum.
" for agent commission: $error"
diff --git a/FS/FS/part_export/freeswitch.pm b/FS/FS/part_export/freeswitch.pm
index 7447849c8..eb490fd85 100644
--- a/FS/FS/part_export/freeswitch.pm
+++ b/FS/FS/part_export/freeswitch.pm
@@ -5,7 +5,8 @@ use vars qw( %info ); # $DEBUG );
#use Data::Dumper;
use Tie::IxHash;
use Text::Template;
-#use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearch ); #qsearchs );
+use FS::svc_phone;
#use FS::Schema qw( dbdef );
#$DEBUG = 1;
@@ -15,7 +16,7 @@ tie my %options, 'Tie::IxHash',
'directory' => { label => 'Directory to store FreeSWITCH account XML files',
default => '/usr/local/freeswitch/conf/directory/',
},
- 'domain' => { label => 'Optional fixed SIP domain to use, overrides svc_phone domain', },
+ #'domain' => { label => 'Optional fixed SIP domain to use, overrides svc_phone domain', },
'reload' => { label => 'Reload command',
default => '/usr/local/freeswitch/bin/fs_cli -x reloadxml',
},
@@ -38,9 +39,9 @@ END
'desc' => 'Provision phone services to FreeSWITCH XML configuration files',
'options' => \%options,
'notes' => <<'END',
-Export XML account configuration files to FreeSWITCH, one per phone services.
+Export XML account configuration files to FreeSWITCH, one per domain.
<br><br>
-You will need to
+You will need to enable the svc_phone-domain configuration setting and
<a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.9:Documentation:Administration:SSH_Keys">setup SSH for unattended operation</a>.
END
);
@@ -50,6 +51,33 @@ sub rebless { shift; }
sub _export_insert {
my( $self, $svc_phone ) = ( shift, shift );
+ $self->_export_rebuild_domain($svc_phone);
+
+}
+
+sub _export_replace {
+ my( $self, $new, $old ) = ( shift, shift, shift );
+
+ my $error = $self->_export_rebuild_domain($new);
+ return $error if $error;
+
+ if ( $new->domsvc ne $old->domsvc && $old->domsvc ) {
+ $error = $self->_export_rebuild_domain($old);
+ return $error if $error;
+ }
+
+ '';
+}
+
+sub _export_delete {
+ my( $self, $svc_phone ) = ( shift, shift );
+
+ $self->_export_rebuild_domain($svc_phone);
+}
+
+sub _export_rebuild_domain {
+ my($self, $svc_phone) = ( shift, shift );
+
eval "use Net::SCP;";
die $@ if $@;
@@ -57,24 +85,34 @@ sub _export_insert {
my $tempdir = '%%%FREESIDE_CONF%%%/cache.'. $FS::UID::datasrc;
- my $svcnum = $svc_phone->svcnum;
+ my $domain = $svc_phone->domain or return "domain required";
my $fh = new File::Temp(
- TEMPLATE => "$tempdir/freeswitch.$svcnum.XXXXXXXX",
+ TEMPLATE => "$tempdir/freeswitch.$domain.XXXXXXXX",
DIR => $dir,
#UNLINK => 0,
);
- print $fh $self->freeswitch_template_fillin( $svc_phone, 'user' )
- or die "print to freeswitch template failed: $!";
- close $fh;
+ print $fh qq(<domain name="$domain">\n);
+
+ my @dom_svc_phone = qsearch( 'svc_phone', { 'domsvc'=>$svc_phone->domsvc } );
+
+ foreach my $dom_svc_phone (@dom_svc_phone) {
+
+ print $fh $self->freeswitch_template_fillin( $dom_svc_phone, 'user' )
+ or die "print to freeswitch template failed: $!";
+
+ }
+
+ print $fh qq(</domain>\n);
+ $fh->flush;
my $scp = new Net::SCP;
my $user = $self->option('user')||'root';
my $host = $self->machine;
my $dir = $self->option('directory');
- $scp->scp( $fh->filename, "$user\@$host:$dir/$svcnum.xml" )
+ $scp->scp( $fh->filename, "$user\@$host:$dir/$domain.xml" )
or return $scp->{errstr};
#signal freeswitch to reload config
@@ -84,27 +122,6 @@ sub _export_insert {
}
-sub _export_replace {
- my( $self, $new, $old ) = ( shift, shift, shift );
-
- $self->_export_insert($new, @_);
-}
-
-sub _export_delete {
- my( $self, $svc_phone ) = ( shift, shift );
-
- my $dir = $self->option('directory');
- my $svcnum = $svc_phone->svcnum;
-
- #delete file
- $self->freeswitch_ssh( command => "rm $dir/$svcnum.xml" );
-
- #signal freeswitch to reload config
- $self->freeswitch_ssh( command => $self->option('reload') );
-
- '';
-}
-
sub freeswitch_template_fillin {
my( $self, $svc_phone, $template ) = (shift, shift, shift);
@@ -117,13 +134,8 @@ sub freeswitch_template_fillin {
DELIMITERS => [ '<%', '%>' ],
);
- my $domain = $self->option('domain')
- || $svc_phone->domain
- || '$${sip_profile}';
-
#false lazinessish w/phone_shellcommands::_export_command
my %hash = (
- 'domain' => $domain,
map { $_ => $svc_phone->getfield($_) } $svc_phone->fields
);
diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm
index ca4e52420..f964af31c 100644
--- a/FS/FS/part_export/shellcommands.pm
+++ b/FS/FS/part_export/shellcommands.pm
@@ -490,7 +490,7 @@ sub ssh_cmd { #subroutine, not method
my ($output, $errput) = $ssh->capture2($ssh_opt, $opt->{'command'});
return if $opt->{'ignore_all_errors'};
- die "Error running SSH command: ". $ssh->error if $ssh->error;
+ #die "Error running SSH command: ". $ssh->error if $ssh->error;
if ( ($output || $errput)
&& $opt->{'ignored_errors'} && length($opt->{'ignored_errors'})
@@ -504,7 +504,9 @@ sub ssh_cmd { #subroutine, not method
$errput =~ s/[\s\n]//g;
}
- die "$errput\n" if $errput;
+ die (($errput || $ssh->error). "\n") if $errput || $ssh->error;
+ #die "$errput\n" if $errput;
+
die "$output\n" if $output and $opt->{'fail_on_output'};
'';
}
diff --git a/FS/FS/rate.pm b/FS/FS/rate.pm
index 02d8250eb..a2511cf99 100644
--- a/FS/FS/rate.pm
+++ b/FS/FS/rate.pm
@@ -387,7 +387,7 @@ sub rate_detail {
=item process
-Experimental job-queue processor for web interface adds/edits
+Job-queue processor for web interface adds/edits
=cut
diff --git a/FS/FS/svc_Tower_Mixin.pm b/FS/FS/svc_Tower_Mixin.pm
index 0b5588466..6adbc6f5e 100644
--- a/FS/FS/svc_Tower_Mixin.pm
+++ b/FS/FS/svc_Tower_Mixin.pm
@@ -52,5 +52,4 @@ sub tower_sector_sql {
@where;
}
-
1;