use HTML::Entities;
use Text::CSV_XS;
use Spreadsheet::WriteExcel;
+use OLE::Storage_Lite;
use FS::UI::Web::small_custview qw(small_custview); #less doh
use FS::UI::Web;
use FS::UI::bytecount qw( display_bytecount );
} else {
-warn Dumper($p);
-
my $svc_domain = qsearchs('svc_domain', { 'domain' => $p->{'domain'} } )
or return { error => 'Domain '. $p->{'domain'}. ' not found' };
#changing the hidden form values
my $conf = new FS::Conf;
my $fee_display = $conf->config('selfservice_process-display') || 'add';
- my $fee_pkgpart = $conf->config('selfservice_process-pkgpart');
- if ( $fee_display eq 'add' && $fee_pkgpart ) {
+ my $fee_pkgpart = $conf->config('selfservice_process-pkgpart', $cust_main->agentnum);
+ my $fee_skip_first = $conf->exists('selfservice_process-skip_first');
+ if ( $fee_display eq 'add'
+ and $fee_pkgpart
+ and ! $fee_skip_first || scalar($cust_main->cust_pay)
+ )
+ {
my $fee_pkg = qsearchs('part_pkg', { pkgpart=>$fee_pkgpart } );
$amount = sprintf('%.2f', $amount + $fee_pkg->option('setup_fee') );
}
#no error, so order the fee package if applicable...
my $conf = new FS::Conf;
- my $fee_pkgpart = $conf->config('selfservice_process-pkgpart');
- if ( $fee_pkgpart ) {
+ my $fee_pkgpart = $conf->config('selfservice_process-pkgpart', $cust_main->agentnum);
+ my $fee_skip_first = $conf->exists('selfservice_process-skip_first');
+
+ if ( $fee_pkgpart and ! $fee_skip_first || scalar($cust_main->cust_pay) ) {
my $cust_pkg = new FS::cust_pkg { 'pkgpart' => $fee_pkgpart };
$p->{ending} = $end;
}
+ die "illegal beginning" if $p->{beginning} !~ /^\d*$/;
+ die "illegal ending" if $p->{ending} !~ /^\d*$/;
+
my (@usage) = &$callback($svc_x, $p->{beginning}, $p->{ending},
%callback_opt
);