summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-10-04 20:25:37 -0700
committerIvan Kohler <ivan@freeside.biz>2012-10-04 20:25:37 -0700
commit0af38652da3b3be7da2d35b048285ef6f2194e1a (patch)
treec43e871e406a11ad9ddca7f5af225f8e5e507000 /httemplate/edit
parenta8e1cb65cd92239721b8e81ef9fdf99f60fb3c3c (diff)
parent51b5bd15c154065a9a0f521565bd6187609c8348 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/agent.cgi46
-rwxr-xr-xhttemplate/edit/cust_main.cgi8
-rw-r--r--httemplate/edit/cust_main/billing.html11
-rw-r--r--httemplate/edit/cust_main/birthdate.html47
-rwxr-xr-xhttemplate/edit/cust_refund.cgi2
-rw-r--r--httemplate/edit/discount.html14
-rw-r--r--httemplate/edit/nas.html2
-rw-r--r--httemplate/edit/part_export.cgi74
-rwxr-xr-xhttemplate/edit/part_pkg.cgi4
-rwxr-xr-xhttemplate/edit/part_svc.cgi7
-rw-r--r--httemplate/edit/payment_gateway.html3
-rw-r--r--httemplate/edit/prepay_credit.cgi1
-rwxr-xr-xhttemplate/edit/process/agent.cgi41
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi7
-rw-r--r--httemplate/edit/process/cust_pkg_discount.html3
-rwxr-xr-xhttemplate/edit/process/cust_refund.cgi2
-rw-r--r--httemplate/edit/process/part_export.cgi5
-rw-r--r--httemplate/edit/process/quick-cust_pkg.cgi151
-rwxr-xr-xhttemplate/edit/process/svc_acct.cgi27
-rw-r--r--httemplate/edit/process/svc_broadband.cgi7
-rw-r--r--httemplate/edit/radius_group.html12
-rw-r--r--httemplate/edit/reason.html116
-rwxr-xr-xhttemplate/edit/svc_acct.cgi6
23 files changed, 452 insertions, 144 deletions
diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi
index 6707d66a4..b043d1efe 100755
--- a/httemplate/edit/agent.cgi
+++ b/httemplate/edit/agent.cgi
@@ -19,9 +19,12 @@
</SCRIPT>
<INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agent->agentnum %>">
-Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
-<% &ntable("#cccccc", 2, '') %>
+<FONT CLASS="fsinnerbox-title">
+ Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
+</FONT>
+
+<TABLE CLASS="fsinnerbox">
<TR>
<TH ALIGN="right">Agent</TH>
@@ -117,8 +120,13 @@ Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
</TR>
% }
+</TABLE>
+<BR>
+
+<FONT CLASS="fsinnerbox-title"><% mt('Access Groups') |h %></FONT>
+<TABLE CLASS="fsinnerbox">
+
<TR>
- <TD ALIGN="right">Access Groups</TD>
<TD><% include('/elements/checkboxes-table.html',
'source_obj' => $agent,
'link_table' => 'access_groupagent',
@@ -131,6 +139,38 @@ Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
</TR>
</TABLE>
+<BR>
+
+<FONT CLASS="fsinnerbox-title"><% mt('Commissions') |h %></FONT>
+<TABLE CLASS="fsinnerbox">
+
+% #surprising amount of false laziness w/ edit/process/agent.cgi
+% my @pkg_class = qsearch('pkg_class', { 'disabled'=>'' });
+% foreach my $pkg_class ( '', @pkg_class ) {
+% my %agent_pkg_class = ( 'agentnum' => $agent->agentnum,
+% 'classnum' => $pkg_class ? $pkg_class->classnum : ''
+% );
+% my $agent_pkg_class =
+% qsearchs( 'agent_pkg_class', \%agent_pkg_class )
+% || new FS::agent_pkg_class \%agent_pkg_class;
+% my $param = 'classnum'. $agent_pkg_class{classnum};
+
+ <TR>
+ <TD><INPUT TYPE = "text"
+ NAME = "<% $param %>"
+ VALUE = "<% $cgi->param($param) || $agent_pkg_class->commission_percent |h %>"
+ SIZE = 6
+ MAXLENGTH = 7
+ >%
+ </TD>
+ <TD><% $pkg_class ? $pkg_class->classname : mt('(no package class)') |h %>
+ </TD>
+ </TR>
+
+% }
+
+</TABLE>
+
<BR>
<INPUT TYPE="submit" VALUE="<% $agent->agentnum ? "Apply changes" : "Add agent" %>">
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index ef81ebab1..e3e812f19 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -28,8 +28,10 @@
<& cust_main/top_misc.html, $cust_main, 'custnum' => $custnum &>
%# birthdate
-% if ( $conf->exists('cust_main-enable_birthdate')
+% if ( $conf->config('national_id-country')
+% || $conf->exists('cust_main-enable_birthdate')
% || $conf->exists('cust_main-enable_spouse_birthdate')
+% || $conf->exists('cust_main-enable_anniversary_date')
% )
% {
<BR>
@@ -51,6 +53,7 @@
<& /elements/location.html,
object => $cust_main->bill_location,
prefix => 'bill_',
+ enable_coords => 1,
&>
<& cust_main/after_bill_location.html, $cust_main &>
</TABLE>
@@ -75,6 +78,7 @@
prefix => 'ship_',
enable_censustract => 1,
enable_district => 1,
+ enable_coords => 1,
&>
</TABLE>
<TABLE CLASS="fsinnerbox" ID="table_ship_location_blank"
@@ -246,6 +250,8 @@ if ( $cgi->param('error') ) {
$stateid = $cust_main->stateid; # don't mask an entered value on errors
$payinfo = $cust_main->payinfo; # don't mask an entered value on errors
+ $cust_main->national_id( $cgi->param('national_id1') || $cgi->param('national_id2') );
+
$prospectnum = $cgi->param('prospectnum') || '';
$pkgpart_svcpart = $cgi->param('pkgpart_svcpart') || '';
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index d7082f23a..2925ca87c 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -522,6 +522,17 @@
</TR>
% }
+% if ( $conf->exists('cust_main-select-prorate_day') ) {
+ <TR>
+ <TD ALIGN="right" WIDTH="200"><% mt('Prorate day (1-28)') |h %> </TD>
+ <TD>
+ <INPUT TYPE="text" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>" SIZE=3 MAXLENGTH=2>
+ </TD>
+ </TR>
+% } else {
+ <INPUT TYPE="hidden" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>">
+% }
+
<TR>
<TD ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
<TD WIDTH="408">
diff --git a/httemplate/edit/cust_main/birthdate.html b/httemplate/edit/cust_main/birthdate.html
index 5d6a123b1..e1adbd3bd 100644
--- a/httemplate/edit/cust_main/birthdate.html
+++ b/httemplate/edit/cust_main/birthdate.html
@@ -1,5 +1,38 @@
<% ntable("#cccccc", 2) %>
+
% # maybe put after the contact names?
+
+% my $id_country = $conf->config('national_id-country');
+% if ( $id_country ) {
+% if ( $id_country eq 'MY' ) {
+% my($old, $nric) = ( '', '');
+% if ( $cust_main->national_id =~ /^\d{6}\-\d{2}\-\d{4}$/ ) {
+% $nric = $cust_main->national_id;
+% } else { # elsif ( $cust_main->national_id =~ /^\w\d{9}$/ ) {
+% $old = $cust_main->national_id;
+% #} else {
+% # warn "unknown national_id format";
+%# <INPUT TYPE="hidden" NAME="national_id0" VALUE="<% $cust_main->national_id |h %>">
+% }
+
+ <% include( '/elements/tr-input-text.html',
+ 'field' => 'national_id1',
+ 'value' => $nric,
+ 'label' => 'NRIC',
+ )
+ %>
+ <% include( '/elements/tr-input-text.html',
+ 'field' => 'national_id2',
+ 'value' => $old,
+ 'label' => 'Old IC/Passport',
+ )
+ %>
+
+% } else {
+% warn "unknown national_id-country $id_country";
+% }
+% }
+
% if ( $conf->exists('cust_main-enable_birthdate') ) {
<% include( '/elements/tr-input-date-field.html', {
'name' => 'birthdate',
@@ -11,6 +44,7 @@
})
%>
% }
+
% if ( $conf->exists('cust_main-enable_spouse_birthdate') ) {
<% include( '/elements/tr-input-date-field.html', {
'name' => 'spouse_birthdate',
@@ -22,6 +56,19 @@
})
%>
% }
+
+% if ( $conf->exists('cust_main-enable_anniversary_date') ) {
+ <% include( '/elements/tr-input-date-field.html', {
+ 'name' => 'anniversary_date',
+ 'value' => $cust_main->anniversary_date,
+ 'label' => 'Anniversary Date',
+ 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ),
+ 'usedatetime' => 1,
+ 'noinit' => $noinit++,
+ })
+ %>
+% }
+
</TABLE>
<%init>
diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi
index ba9304066..1ef69fdae 100755
--- a/httemplate/edit/cust_refund.cgi
+++ b/httemplate/edit/cust_refund.cgi
@@ -141,7 +141,7 @@ my $reason = $cgi->param('reason');
my $link = $cgi->param('popup') ? 'popup' : '';
my @rights = ();
-push @rights, 'Post refund' if $payby =~ /^(BILL|CASH)$/;
+push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD)$/;
push @rights, 'Post check refund' if $payby eq 'BILL';
push @rights, 'Post cash refund ' if $payby eq 'CASH';
push @rights, 'Refund payment' if $payby =~ /^(CARD|CHEK)$/;
diff --git a/httemplate/edit/discount.html b/httemplate/edit/discount.html
index b195eb37b..9bcd1e724 100644
--- a/httemplate/edit/discount.html
+++ b/httemplate/edit/discount.html
@@ -22,6 +22,7 @@
postfix => '<BR><FONT SIZE="-1"><I>(blank for non-expiring discount)</I></FONT>',
},
{ field => 'setup', type => 'checkbox', value=>'Y', },
+ #{ field => 'linked', type => 'checkbox', value=>'Y', },
],
'labels' => {
'discountnum' => 'Discount #',
@@ -32,6 +33,7 @@
'percent' => 'Percentage&nbsp;',
'months' => 'Duration (months)',
'setup' => 'Apply to setup fees',
+ #'linked' => 'Apply to add-on packages',
},
'viewall_dir' => 'browse',
'new_callback' => $new_callback,
@@ -114,6 +116,10 @@ my $javascript = <<END;
document.getElementById('percent_label').style.visibility = 'hidden';
document.getElementById('percent_input0').style.display = 'none';
document.getElementById('percent_input0').style.visibility = 'hidden';
+// document.getElementById('linked_label').style.display = 'none';
+// document.getElementById('linked_label').style.visibility = 'hidden';
+// document.getElementById('linked').style.display = 'none';
+// document.getElementById('linked').style.visibility = 'hidden';
} else if ( _type == 'Amount' ) {
document.getElementById('amount_label').style.display = '';
document.getElementById('amount_label').style.visibility = '';
@@ -123,6 +129,10 @@ my $javascript = <<END;
document.getElementById('percent_label').style.visibility = 'hidden';
document.getElementById('percent_input0').style.display = 'none';
document.getElementById('percent_input0').style.visibility = 'hidden';
+// document.getElementById('linked_label').style.display = 'none';
+// document.getElementById('linked_label').style.visibility = 'hidden';
+// document.getElementById('linked').style.display = 'none';
+// document.getElementById('linked').style.visibility = 'hidden';
} else if ( _type == 'Percentage' ) {
document.getElementById('amount_label').style.display = 'none';
document.getElementById('amount_label').style.visibility = 'hidden';
@@ -132,6 +142,10 @@ my $javascript = <<END;
document.getElementById('percent_label').style.visibility = '';
document.getElementById('percent_input0').style.display = '';
document.getElementById('percent_input0').style.visibility = '';
+// document.getElementById('linked_label').style.display = '';
+// document.getElementById('linked_label').style.visibility = '';
+// document.getElementById('linked').style.display = '';
+// document.getElementById('linked').style.visibility = '';
}
}
diff --git a/httemplate/edit/nas.html b/httemplate/edit/nas.html
index 2e66fc3be..8e6232cdb 100644
--- a/httemplate/edit/nas.html
+++ b/httemplate/edit/nas.html
@@ -49,7 +49,7 @@ sub html_bottom {
'link_table' => 'export_nas',
'target_table' => 'part_export',
'hashref' => { 'exporttype' =>
- { op => 'LIKE', value => '%sqlradius' }
+ { op => 'LIKE', value => '%sqlradius%' }
},
'name_callback' => sub { $_[0]->label },
'default' => 'yes',
diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi
index d7219b74a..0407ee77b 100644
--- a/httemplate/edit/part_export.cgi
+++ b/httemplate/edit/part_export.cgi
@@ -13,12 +13,6 @@
</TD>
</TR>
<TR>
- <TD ALIGN="right">Export host</TD>
- <TD>
- <INPUT TYPE="text" NAME="machine" VALUE="<% $part_export->machine %>">
- </TD>
-</TR>
-<TR>
<TD ALIGN="right">Export</TD>
<TD><% $widget->html %>
@@ -63,7 +57,7 @@ my $widget = new HTML::Widgets::SelectLayers(
'options' => \%layers,
'form_name' => 'dummy',
'form_action' => 'process/part_export.cgi',
- 'form_text' => [qw( exportnum exportname machine )],
+ 'form_text' => [qw( exportnum exportname )],
# 'form_checkbox' => [qw()],
'html_between' => "</TD></TR></TABLE>\n",
'layer_callback' => sub {
@@ -71,9 +65,69 @@ my $widget = new HTML::Widgets::SelectLayers(
my $html = qq!<INPUT TYPE="hidden" NAME="exporttype" VALUE="$layer">!.
ntable("#cccccc",2);
- $html .= '<TR><TD ALIGN="right">Description</TD><TD BGCOLOR=#ffffff>'.
- $exports->{$layer}{notes}. '</TD></TR>'
- if $layer;
+ if ( $layer ) {
+ $html .= '<TR><TD ALIGN="right">Description</TD><TD BGCOLOR=#ffffff>'.
+ $exports->{$layer}{notes}. '</TD></TR>';
+
+ if ( $exports->{$layer}{no_machine} ) {
+ $html .= '<INPUT TYPE="hidden" NAME="machine" VALUE="">'.
+ '<INPUT TYPE="hidden" NAME="svc_machine" VALUE=N">';
+ } else {
+ $html .= '<TR><TD ALIGN="right">Hostname or IP</TD><TD>';
+ my $machine = $part_export->machine;
+ if ( $exports->{$layer}{svc_machine} ) {
+ my( $N_CHK, $Y_CHK) = ( 'CHECKED', '' );
+ my( $machine_DISABLED, $pem_DISABLED) = ( '', 'DISABLED' );
+ my $part_export_machine = '';
+ if ( $cgi->param('svc_machine') eq 'Y'
+ || $machine eq '_SVC_MACHINE'
+ )
+ {
+ $Y_CHK = 'CHECKED';
+ $N_CHK = 'CHECKED';
+ $machine_DISABLED = 'DISABLED';
+ $pem_DISABLED = '';
+ $machine = '';
+ $part_export_machine =
+ $cgi->param('part_export_machine')
+ || join "\n",
+ map $_->machine,
+ grep ! $_->disabled,
+ $part_export->part_export_machine;
+ }
+ my $oc = qq(onChange="${layer}_svc_machine_changed(this)");
+ $html .= qq[
+ <INPUT TYPE="radio" NAME="svc_machine" VALUE="N" $N_CHK $oc>
+ <INPUT TYPE="text" NAME="machine" ID="${layer}_machine" VALUE="$machine" $machine_DISABLED>
+ <BR>
+ <INPUT TYPE="radio" NAME="svc_machine" VALUE="Y" $Y_CHK $oc>
+ Selected in each customer service from these choices
+ <TEXTAREA NAME="part_export_machine" ID="${layer}_part_export_machine" $pem_DISABLED>$part_export_machine</TEXTAREA>
+
+ <SCRIPT TYPE="text/javascript">
+ function ${layer}_svc_machine_changed (what) {
+ if ( what.checked ) {
+ var machine = document.getElementById("${layer}_machine");
+ var part_export_machine = document.getElementById("${layer}_part_export_machine");
+ if ( what.value == 'Y' ) {
+ machine.disabled = true;
+ part_export_machine.disabled = false;
+ } else if ( what.value == 'N' ) {
+ machine.disabled = false;
+ part_export_machine.disabled = true;
+ }
+ }
+ }
+ </SCRIPT>
+ ];
+ } else {
+ $html .= qq(<INPUT TYPE="text" NAME="machine" VALUE="$machine">).
+ '<INPUT TYPE="hidden" NAME="svc_machine" VALUE=N">';
+ }
+ $html .= "</TD></TR>";
+ }
+
+ }
foreach my $option ( keys %{$exports->{$layer}{options}} ) {
my $optinfo = $exports->{$layer}{options}{$option};
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index cd0731370..f3ad8f52d 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -55,6 +55,7 @@
'svc_dst_pkgpart' => 'Include services of package',
'report_option' => 'Report classes',
'fcc_ds0s' => 'Voice-grade equivalents',
+ 'fcc_voip_class' => 'Category',
},
'fields' => [
@@ -196,6 +197,9 @@
{ type => 'tablebreak-tr-title',
value => 'FCC Form 477 information',
},
+ { field=>'fcc_voip_class',
+ type=>'select-voip_class',
+ },
{ field=>'fcc_ds0s', type=>'text', size=>6 },
)
: ()
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index 4bd083798..007c24629 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -144,12 +144,7 @@
% && qsearchs( 'export_svc', {
% exportnum => $part_export->exportnum,
% svcpart => $clone || $part_svc->svcpart });
-% $html .= '>'.$part_export->exportnum. ': ';
-% $html .= $part_export->exportname . '<DIV ALIGN="right"><FONT SIZE=-1>'
-% if ( $part_export->exportname );
-% $html .= $part_export->exporttype. ' to '. $part_export->machine;
-% $html .= '</FONT></DIV>' if ( $part_export->exportname );
-% $html .= '</TD>';
+% $html .= '>'. $part_export->label_html. '</TD>';
% $count++;
% $html .= '</TR><TR>' unless $count % $columns;
% }
diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html
index e5897b035..dfe52f109 100644
--- a/httemplate/edit/payment_gateway.html
+++ b/httemplate/edit/payment_gateway.html
@@ -91,6 +91,7 @@ my %modules = (
'KeyBank' => 'Business::BatchPayment',
'Paymentech' => 'Business::BatchPayment',
+ 'TD_EFT' => 'Business::BatchPayment',
);
my %modules_for_namespace;
@@ -141,7 +142,7 @@ my $fields = [
{
field => 'gateway_options',
type => 'textarea',
- rows => '8',
+ rows => '12',
cols => '40',
curr_value_callback => sub { my($cgi, $object, $fref) = @_;
join("\r", $object->options );
diff --git a/httemplate/edit/prepay_credit.cgi b/httemplate/edit/prepay_credit.cgi
index c03bbf990..3f0d6ba1d 100644
--- a/httemplate/edit/prepay_credit.cgi
+++ b/httemplate/edit/prepay_credit.cgi
@@ -22,6 +22,7 @@ characters each
<& /elements/select-agent.html,
'empty_label' => '(any agent)',
+ 'curr_value' => $agentnum,
&>
<TABLE>
diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi
index e776d281c..034c4cc50 100755
--- a/httemplate/edit/process/agent.cgi
+++ b/httemplate/edit/process/agent.cgi
@@ -1,11 +1,12 @@
<% include( 'elements/process.html',
- 'table' => 'agent',
- 'viewall_dir' => 'browse',
- 'viewall_ext' => 'cgi',
- 'process_m2m' => { 'link_table' => 'access_groupagent',
- 'target_table' => 'access_group',
- },
- 'edit_ext' => 'cgi',
+ 'table' => 'agent',
+ 'viewall_dir' => 'browse',
+ 'viewall_ext' => 'cgi',
+ 'process_m2m' => { 'link_table' => 'access_groupagent',
+ 'target_table' => 'access_group',
+ },
+ 'edit_ext' => 'cgi',
+ 'noerror_callback' => $process_agent_pkg_class,
)
%>
<%init>
@@ -18,4 +19,30 @@ if ( FS::Conf->new->exists('disable_acl_changes') ) {
die "shouldn't be reached";
}
+my $process_agent_pkg_class = sub {
+ my( $cgi, $agent ) = @_;
+
+ #surprising amount of false laziness w/ edit/agent.cgi
+ my @pkg_class = qsearch('pkg_class', { 'disabled'=>'' });
+ foreach my $pkg_class ( '', @pkg_class ) {
+ my %agent_pkg_class = ( 'agentnum' => $agent->agentnum,
+ 'classnum' => $pkg_class ? $pkg_class->classnum : ''
+ );
+ my $agent_pkg_class =
+ qsearchs( 'agent_pkg_class', \%agent_pkg_class )
+ || new FS::agent_pkg_class \%agent_pkg_class;
+
+ my $param = 'classnum'. $agent_pkg_class{classnum};
+
+ $agent_pkg_class->commission_percent( $cgi->param($param) );
+
+ my $method = $agent_pkg_class->agentpkgclassnum ? 'replace' : 'insert';
+
+ my $error = $agent_pkg_class->$method;
+ die $error if $error; #XXX push this down into agent.pm w/better/transactional error handling
+
+ }
+
+};
+
</%init>
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 5ee553b32..31ec4ab12 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -110,11 +110,16 @@ if ( $cgi->param('no_credit_limit') ) {
$new->tagnum( [ $cgi->param('tagnum') ] );
+$error ||= $new->set_national_id_from_cgi( $cgi );
+
my %usedatetime = ( 'birthdate' => 1,
'spouse_birthdate' => 1,
+ 'anniversary_date' => 1,
);
-foreach my $dfield (qw( birthdate spouse_birthdate signupdate )) {
+foreach my $dfield (qw(
+ signupdate birthdate spouse_birthdate anniversary_date
+)) {
if ( $cgi->param($dfield) && $cgi->param($dfield) =~ /^([ 0-9\-\/]{0,10})$/) {
diff --git a/httemplate/edit/process/cust_pkg_discount.html b/httemplate/edit/process/cust_pkg_discount.html
index 6f97a791e..4a71f6975 100644
--- a/httemplate/edit/process/cust_pkg_discount.html
+++ b/httemplate/edit/process/cust_pkg_discount.html
@@ -39,7 +39,8 @@ my $cust_pkg_discount = new FS::cust_pkg_discount {
'amount' => scalar($cgi->param('discountnum_amount')),
'percent' => scalar($cgi->param('discountnum_percent')),
'months' => scalar($cgi->param('discountnum_months')),
- 'setup' => scalar($cgi->param('discountnum_setup')),
+ 'setup' => scalar($cgi->param('discountnum_setup')),
+ #'linked' => scalar($cgi->param('discountnum_linked')),
#'disabled' => $self->discountnum_disabled,
};
my $error = $cust_pkg_discount->insert;
diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi
index f4cce6535..bde40727a 100755
--- a/httemplate/edit/process/cust_refund.cgi
+++ b/httemplate/edit/process/cust_refund.cgi
@@ -31,7 +31,7 @@ my $link = $cgi->param('popup') ? 'popup' : '';
my $payby = $cgi->param('payby');
my @rights = ();
-push @rights, 'Post refund' if $payby =~ /^(BILL|CASH)$/;
+push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD)$/;
push @rights, 'Post check refund' if $payby eq 'BILL';
push @rights, 'Post cash refund ' if $payby eq 'CASH';
push @rights, 'Refund payment' if $payby =~ /^(CARD|CHEK)$/;
diff --git a/httemplate/edit/process/part_export.cgi b/httemplate/edit/process/part_export.cgi
index 21150ef67..6432d6b15 100644
--- a/httemplate/edit/process/part_export.cgi
+++ b/httemplate/edit/process/part_export.cgi
@@ -28,6 +28,11 @@ my $new = new FS::part_export ( {
} fields('part_export')
} );
+if ( $cgi->param('svc_machine') eq 'Y' ) {
+ $new->machine('_SVC_MACHINE');
+ $new->part_export_machine_textarea( $cgi->param('part_export_machine') );
+}
+
my $error;
if ( $exportnum ) {
#warn $old;
diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi
index 306319869..2dadbccdc 100644
--- a/httemplate/edit/process/quick-cust_pkg.cgi
+++ b/httemplate/edit/process/quick-cust_pkg.cgi
@@ -2,19 +2,24 @@
% $cgi->param('error', $error);
<% $cgi->redirect(popurl(3). 'misc/order_pkg.html?'. $cgi->query_string ) %>
%} else {
-% my $frag = "cust_pkg". $cust_pkg->pkgnum;
% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
% ? ''
% : ';show=packages';
-% my $redir_url = popurl(3)
-% ."view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag";
+%
+% my $redir_url = popurl(3);
+% if ( $svcpart ) { # for going straight to service provisining after ordering
+% $redir_url .= 'edit/'.$part_svc->svcdb.'.cgi?'.
+% 'pkgnum='.$cust_pkg->pkgnum. ";svcpart=$svcpart";
+% $redir_url .= ";qualnum=$qualnum" if $qualnum;
+% } elsif ( $quotationnum ) {
+% $redir_url .= "view/quotation.html?quotationnum=$quotationnum";
+% } else {
+% my $custnum = $cust_main->custnum;
+% my $frag = "cust_pkg". $cust_pkg->pkgnum;
+% $redir_url .=
+% "view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag";
+% }
%
-% # for going right to a provision service after ordering a package
-% if ( $svcpart ) {
-% $redir_url = popurl(3)."edit/".$part_svc->svcdb.".cgi?".
-% "pkgnum=".$cust_pkg->pkgnum. ";svcpart=$svcpart";
-% $redir_url .= ";qualnum=$qualnum" if $qualnum;
-% }
<% header('Package ordered') %>
<SCRIPT TYPE="text/javascript">
// XXX fancy ajax rebuild table at some point, but a page reload will do for now
@@ -33,16 +38,27 @@ my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
unless $curuser->access_right('Order customer package');
-#untaint custnum (probably not necessary, searching for it is escape enough)
-$cgi->param('custnum') =~ /^(\d+)$/
- or die 'illegal custnum '. $cgi->param('custnum');
-my $custnum = $1;
-my $cust_main = qsearchs({
- 'table' => 'cust_main',
- 'hashref' => { 'custnum' => $custnum },
- 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
-});
-die 'unknown custnum' unless $cust_main;
+my $cust_main;
+if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
+ my $custnum = $1;
+ $cust_main = qsearchs({
+ 'table' => 'cust_main',
+ 'hashref' => { 'custnum' => $custnum },
+ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+ });
+}
+
+my $prospect_main;
+if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
+ my $prospectnum = $1;
+ $prospect_main = qsearchs({
+ 'table' => 'prospect_main',
+ 'hashref' => { 'prospectnum' => $prospectnum },
+ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+ });
+}
+
+die 'no custnum or prospectnum' unless $cust_main || $prospect_main;
#probably not necessary, taken care of by cust_pkg::check
$cgi->param('pkgpart') =~ /^(\d+)$/
@@ -72,47 +88,70 @@ if ( $cgi->param('svcpart') ) {
}
my $qualnum = '';
-if ( $cgi->param('qualnum') ) {
- $cgi->param('qualnum') =~ /^(\d+)$/ or die 'illegal qualnum';
+if ( $cgi->param('qualnum') =~ /^(\d+)$/ ) {
$qualnum = $1;
}
+my $quotationnum = '';
+if ( $cgi->param('quotationnum') =~ /^(\d+)$/ ) {
+ $quotationnum = $1;
+}
+# verify this quotation is visible to this user
+my $cust_pkg = '';
+my $quotation_pkg = '';
+my $error = '';
-my $cust_pkg = new FS::cust_pkg {
- 'custnum' => $custnum,
- 'pkgpart' => $pkgpart,
- 'quantity' => $quantity,
- 'start_date' => ( scalar($cgi->param('start_date'))
- ? parse_datetime($cgi->param('start_date'))
- : ''
- ),
- 'no_auto' => scalar($cgi->param('no_auto')),
- 'refnum' => $refnum,
- 'locationnum' => $locationnum,
- 'discountnum' => $discountnum,
- #for the create a new discount case
- 'discountnum__type' => scalar($cgi->param('discountnum__type')),
- 'discountnum_amount' => scalar($cgi->param('discountnum_amount')),
- 'discountnum_percent' => scalar($cgi->param('discountnum_percent')),
- 'discountnum_months' => scalar($cgi->param('discountnum_months')),
- 'discountnum_setup' => scalar($cgi->param('discountnum_setup')),
- 'contract_end' => ( scalar($cgi->param('contract_end'))
- ? parse_datetime($cgi->param('contract_end'))
- : ''
- ),
- 'waive_setup' => ( $cgi->param('waive_setup') eq 'Y' ? 'Y' : '' ),
-};
-
-my %opt = ( 'cust_pkg' => $cust_pkg );
-
-if ( $locationnum == -1 ) {
- my $cust_location = new FS::cust_location {
- map { $_ => scalar($cgi->param($_)) }
- qw( custnum address1 address2 city county state zip country geocode )
- };
- $opt{'cust_location'} = $cust_location;
-}
+my %hash = (
+ 'pkgpart' => $pkgpart,
+ 'quantity' => $quantity,
+ 'start_date' => ( scalar($cgi->param('start_date'))
+ ? parse_datetime($cgi->param('start_date'))
+ : ''
+ ),
+ 'refnum' => $refnum,
+ 'locationnum' => $locationnum,
+ 'discountnum' => $discountnum,
+ #for the create a new discount case
+ 'discountnum__type' => scalar($cgi->param('discountnum__type')),
+ 'discountnum_amount' => scalar($cgi->param('discountnum_amount')),
+ 'discountnum_percent' => scalar($cgi->param('discountnum_percent')),
+ 'discountnum_months' => scalar($cgi->param('discountnum_months')),
+ 'discountnum_setup' => scalar($cgi->param('discountnum_setup')),
+ 'contract_end' => ( scalar($cgi->param('contract_end'))
+ ? parse_datetime($cgi->param('contract_end'))
+ : ''
+ ),
+ 'waive_setup' => ( $cgi->param('waive_setup') eq 'Y' ? 'Y' : '' ),
+);
+$hash{'custnum'} = $cust_main->custnum if $cust_main;
+
+if ( $quotationnum ) {
+
+ $quotation_pkg = new FS::quotation_pkg \%hash;
+ $quotation_pkg->quotationnum($quotationnum);
+ $quotation_pkg->prospectnum($prospect_main->prospectnum) if $prospect_main;
-my $error = $cust_main->order_pkg( \%opt );
+ #XXX handle new location
+ $error = $quotation_pkg->insert;
+
+} else {
+
+ $cust_pkg = new FS::cust_pkg \%hash;
+
+ $cust_pkg->no_auto( scalar($cgi->param('no_auto')) );
+
+ my %opt = ( 'cust_pkg' => $cust_pkg );
+
+ if ( $locationnum == -1 ) {
+ my $cust_location = new FS::cust_location {
+ map { $_ => scalar($cgi->param($_)) }
+ qw( custnum address1 address2 city county state zip country geocode )
+ };
+ $opt{'cust_location'} = $cust_location;
+ }
+
+ $error = $cust_main->order_pkg( \%opt );
+
+}
</%init>
diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi
index a7d5136fb..41aca65ee 100755
--- a/httemplate/edit/process/svc_acct.cgi
+++ b/httemplate/edit/process/svc_acct.cgi
@@ -56,13 +56,14 @@ my $new = new FS::svc_acct ( \%hash );
my $error = '';
+my $part_svc = $svcnum ?
+ $old->part_svc :
+ qsearchs( 'part_svc',
+ { 'svcpart' => $cgi->param('svcpart') }
+ );
+
# google captcha auth
if ( $cgi->param('captcha_response') ) {
- my $part_svc = $svcnum ?
- $old->part_svc :
- qsearchs( 'part_svc',
- { 'svcpart' => $cgi->param('svcpart') }
- );
my ($export) = $part_svc->part_export('acct_google');
if ( $export and
! $export->captcha_auth($cgi->param('captcha_response')) ) {
@@ -79,6 +80,18 @@ if ( $cgi->param('clear_password') eq '*HIDDEN*'
}
if ( ! $error ) {
+
+ my $export_info = FS::part_export::export_info();
+
+ my @svc_export_machine =
+ map FS::svc_export_machine->new({
+ 'svcnum' => $svcnum,
+ 'exportnum' => $_->exportnum,
+ 'machinenum' => scalar($cgi->param('exportnum'.$_->exportnum.'machinenum')),
+ }),
+ grep { $_->machine eq '_SVC_MACHINE' }
+ $part_svc->part_export;
+
if ( $svcnum ) {
foreach ( grep { $old->$_ != $new->$_ }
qw( seconds upbytes downbytes totalbytes )
@@ -92,9 +105,9 @@ if ( ! $error ) {
$error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes
last; #once is enough
}
- $error ||= $new->replace($old);
+ $error ||= $new->replace($old, 'child_objects'=>\@svc_export_machine);
} else {
- $error ||= $new->insert;
+ $error ||= $new->insert('child_objects'=>\@svc_export_machine);
$svcnum = $new->svcnum;
}
}
diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi
index 90eab4aad..25644e547 100644
--- a/httemplate/edit/process/svc_broadband.cgi
+++ b/httemplate/edit/process/svc_broadband.cgi
@@ -1,11 +1,10 @@
<& elements/svc_Common.html,
- table => 'svc_broadband',
- fields => [ fields('svc_broadband'), fields('nas'), 'usergroup' ],
+ table => 'svc_broadband',
+ fields => [ fields('svc_broadband'), fields('nas'), 'usergroup' ],
precheck_callback => \&precheck,
&>
<%init>
-# for historical reasons, process_m2m for usergroup tables is done
-# in the svc_x::insert/replace/delete methods, not here
+
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
diff --git a/httemplate/edit/radius_group.html b/httemplate/edit/radius_group.html
index 0c99b4c4c..d3ef40c5d 100644
--- a/httemplate/edit/radius_group.html
+++ b/httemplate/edit/radius_group.html
@@ -7,6 +7,8 @@
'description' => 'Description',
'attrnum' => 'Attribute',
'priority' => 'Priority',
+ 'speed_down' => 'Download speed',
+ 'speed_up' => 'Upload speed',
},
'viewall_dir' => 'browse',
'menubar' => \@menubar,
@@ -28,6 +30,16 @@
'size' => 2,
'colspan' => 6, # just to not interfere with radius_attr columns
},
+ { 'field' => 'speed_down',
+ 'type' => 'text',
+ 'size' => 8,
+ 'colspan' => 6,
+ },
+ { 'field' => 'speed_up',
+ 'type' => 'text',
+ 'size' => 8,
+ 'colspan' => 6,
+ },
{
'field' => 'attrnum',
'type' => 'radius_attr',
diff --git a/httemplate/edit/reason.html b/httemplate/edit/reason.html
index 620a2ea15..78d044755 100644
--- a/httemplate/edit/reason.html
+++ b/httemplate/edit/reason.html
@@ -1,50 +1,78 @@
-%
-% $cgi->param('class') =~ /^(\w)$/ or die "illegal class";
-% my $class=$1;
-%
-% my $classname = $FS::reason_type::class_name{$class};
-%
-% my (@types) = qsearch( 'reason_type', { 'class' => $class } );
-%
-% unless (scalar(@types)) {
-% print $cgi->redirect( "reason_type.html?class=$class" );
-% }
-<% include( 'elements/edit.html',
- 'name' => ucfirst($classname) . ' Reason',
- 'table' => 'reason',
- 'labels' => {
- 'reasonnum' => ucfirst($classname) . ' Reason',
- 'reason_type' => ucfirst($classname) . ' Reason type',
- 'reason' => ucfirst($classname) . ' Reason',
- 'disabled' => 'Disabled',
- 'class' => '',
- },
- 'fields' => [
- { 'field' => 'reason_type',
- 'type' => 'select',
- #XXX use something more sane than a hashref
- #then fix tr-select.html
- 'value' => { 'vcolumn' => 'typenum',
- 'ccolumn' => 'type',
- 'values' => \@types,
- },
- },
- 'reason',
- { 'field' => 'class',
- 'type' => 'hidden',
- 'value' => $class,
- },
- { 'field' => 'disabled',
- 'type' => 'checkbox',
- 'value' => 'Y'
- },
- ],
- 'viewall_url' => $p . "browse/reason.html?class=$class",
- )
-%>
+<& elements/edit.html,
+ 'menubar'=> [ "View all $classname Reasons" =>
+ $p.'browse/reason.html?class='.$class,
+ "View $classname Reason Types" =>
+ $p.'browse/reason_type.html?class='.$class,
+ ],
+ 'name' => ucfirst($classname) . ' Reason',
+
+ 'table' => 'reason',
+ 'labels' => {
+ 'reasonnum' => $classname . ' Reason',
+ 'reason_type' => $classname . ' Reason type',
+ 'reason' => $classname . ' Reason',
+ 'disabled' => 'Disabled',
+ 'class' => '',
+ 'unsuspend_pkgpart' => 'Unsuspension fee',
+ 'unsuspend_hold' => 'Delay until next bill',
+ },
+ 'fields' => \@fields,
+&>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+$cgi->param('class') =~ /^(\w)$/ or die "illegal class";
+my $class=$1;
+
+my $classname = ucfirst($FS::reason_type::class_name{$class});
+
+my (@types) = qsearch( 'reason_type', { 'class' => $class } );
+
+unless (scalar(@types)) {
+ print $cgi->redirect( "reason_type.html?class=$class" );
+}
+
+my @fields = (
+ { 'field' => 'reason_type',
+ 'type' => 'select-table',
+ 'table' => 'reason_type',
+ 'name_col' => 'type',
+ 'value_col' => 'typenum',
+ 'hashref' => { 'class' => $class },
+ 'disable_empty' => 1,
+# #then fix tr-select.html
+#
+# 'value' => { 'vcolumn' => 'typenum',
+# 'ccolumn' => 'type',
+# 'values' => \@types,
+# },
+# # that wasn't so hard...did this do something else that I'm missing?
+ },
+ 'reason',
+ { 'field' => 'class',
+ 'type' => 'hidden',
+ 'value' => $class,
+ },
+ { 'field' => 'disabled',
+ 'type' => 'checkbox',
+ 'value' => 'Y'
+ },
+);
+
+push @fields,
+ { 'field' => 'unsuspend_pkgpart',
+ 'type' => 'select-part_pkg',
+ 'hashref' => { 'disabled' => '',
+ 'freq' => 0 }, # one-time charges only
+ },
+ { 'field' => 'unsuspend_hold',
+ 'type' => 'checkbox',
+ 'value' => 'Y',
+ },
+ if ( $class eq 'S' );
+
+
+
</%init>
diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi
index 38567ef67..142c11150 100755
--- a/httemplate/edit/svc_acct.cgi
+++ b/httemplate/edit/svc_acct.cgi
@@ -173,6 +173,12 @@ function randomPass() {
<INPUT TYPE="hidden" NAME="sectornum" VALUE="<% $svc_acct->sectornum %>">
%}
+<& /elements/tr-svc_export_machine.html,
+ 'svc' => $svc_acct,
+ 'part_svc' => $part_svc,
+ 'cgi' => $cgi,
+&>
+
% #uid/gid
% foreach my $xid (qw( uid gid )) {
%