summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-12-04 10:37:16 -0800
committerIvan Kohler <ivan@freeside.biz>2014-12-04 10:37:16 -0800
commit8dd41f364aaba88969dfd0908feb22709025e7f6 (patch)
tree471cb3796019d873da648413d88ca70a657414ed /httemplate/edit
parenta2df4ef9575be1ae2f1f5b9089f121316f796bac (diff)
parentbf50a8356a7344b4f75c7bc7f952019b98867f26 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/circuit_provider.html21
-rw-r--r--httemplate/edit/circuit_termination.html21
-rw-r--r--httemplate/edit/circuit_type.html21
-rw-r--r--httemplate/edit/credit-cust_bill_pkg.html4
-rwxr-xr-xhttemplate/edit/cust_credit.cgi2
-rw-r--r--httemplate/edit/cust_main/bottomfixup.js22
-rw-r--r--httemplate/edit/elements/part_svc_column.html5
-rw-r--r--httemplate/edit/elements/svc_Common.html46
-rwxr-xr-xhttemplate/edit/part_pkg.cgi5
-rw-r--r--httemplate/edit/process/bulk-part_pkg-fcc.html6
-rw-r--r--httemplate/edit/process/circuit_provider.html11
-rw-r--r--httemplate/edit/process/circuit_termination.html11
-rw-r--r--httemplate/edit/process/circuit_type.html11
-rw-r--r--httemplate/edit/process/credit-cust_bill_pkg.html26
-rwxr-xr-xhttemplate/edit/process/cust_credit.cgi17
-rw-r--r--httemplate/edit/process/elements/svc_Common.html2
-rw-r--r--httemplate/edit/process/part_event.html15
-rw-r--r--httemplate/edit/process/svc_circuit.html11
-rw-r--r--httemplate/edit/svc_circuit.cgi54
-rw-r--r--httemplate/edit/svc_phone.cgi36
20 files changed, 288 insertions, 59 deletions
diff --git a/httemplate/edit/circuit_provider.html b/httemplate/edit/circuit_provider.html
new file mode 100644
index 000000000..6c8dcedac
--- /dev/null
+++ b/httemplate/edit/circuit_provider.html
@@ -0,0 +1,21 @@
+<& elements/edit.html,
+ 'popup' => 1,
+ 'table' => 'circuit_provider',
+ 'name_singular' => 'provider',
+ 'labels' => \%labels,
+ 'fields' => \@fields,
+&>
+<%init>
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my @fields = (
+ 'provider',
+ { field => 'disabled', type => 'checkbox', value => 'Y' }
+);
+my %labels = (
+ 'providernum' => '',
+ 'provider' => 'Provider name',
+ 'disabled' => 'Disabled'
+);
+</%init>
diff --git a/httemplate/edit/circuit_termination.html b/httemplate/edit/circuit_termination.html
new file mode 100644
index 000000000..0317bced5
--- /dev/null
+++ b/httemplate/edit/circuit_termination.html
@@ -0,0 +1,21 @@
+<& elements/edit.html,
+ 'popup' => 1,
+ 'table' => 'circuit_termination',
+ 'name_singular' => 'termination type',
+ 'labels' => \%labels,
+ 'fields' => \@fields,
+&>
+<%init>
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my @fields = (
+ 'termination',
+ { field => 'disabled', type => 'checkbox', value => 'Y' }
+);
+my %labels = (
+ 'termnum' => '',
+ 'termination' => 'Termination type',
+ 'disabled' => 'Disabled'
+);
+</%init>
diff --git a/httemplate/edit/circuit_type.html b/httemplate/edit/circuit_type.html
new file mode 100644
index 000000000..897758897
--- /dev/null
+++ b/httemplate/edit/circuit_type.html
@@ -0,0 +1,21 @@
+<& elements/edit.html,
+ 'popup' => 1,
+ 'table' => 'circuit_type',
+ 'name_singular' => 'circuit type',
+ 'labels' => \%labels,
+ 'fields' => \@fields,
+&>
+<%init>
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my @fields = (
+ 'typename',
+ { field => 'disabled', type => 'checkbox', value => 'Y' }
+);
+my %labels = (
+ 'typenum' => '',
+ 'typename' => 'Circuit type',
+ 'disabled' => 'Disabled'
+);
+</%init>
diff --git a/httemplate/edit/credit-cust_bill_pkg.html b/httemplate/edit/credit-cust_bill_pkg.html
index 40faddc46..85f794317 100644
--- a/httemplate/edit/credit-cust_bill_pkg.html
+++ b/httemplate/edit/credit-cust_bill_pkg.html
@@ -80,9 +80,9 @@
<& /elements/tr-select-reason.html,
'field' => 'reasonnum',
'reason_class' => 'R',
- #XXX reconcile both this and show_taxes wanteding to enable this
+ #XXX reconcile both this and show_taxes wanting to enable this
'id' => 'select_reason',
- 'control_button' => "document.getElementById('credit_button')",
+ 'control_button' => 'credit_button',
'cgi' => $cgi,
&>
diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi
index a3565f125..29801efef 100755
--- a/httemplate/edit/cust_credit.cgi
+++ b/httemplate/edit/cust_credit.cgi
@@ -24,7 +24,7 @@
<& /elements/tr-select-reason.html,
'field' => 'reasonnum',
'reason_class' => 'R',
- 'control_button' => "document.getElementById('confirm_credit_button')",
+ 'control_button' => 'confirm_credit_button',
'cgi' => $cgi,
&>
diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js
index 5a8835f53..6a9deb92a 100644
--- a/httemplate/edit/cust_main/bottomfixup.js
+++ b/httemplate/edit/cust_main/bottomfixup.js
@@ -100,14 +100,13 @@ function copyelement(from, to) {
//alert(from + " (" + from.type + "): " + to.name + " => " + to.value);
}
-% # the value in pre+'censustract' is the confirmed censustract; if it's set,
-% # and the user hasn't changed it manually, skip this
+% # the value in pre+'censustract' is the confirmed censustract (either from
+% # the previous saved record, or from address standardization (if the backend
+% # supports it), or from an aborted previous submit. only need to reconfirm
+% # if it's empty.
function confirm_censustract(pre) {
var cf = document.CustomerForm;
- if ( cf.elements[pre+'censustract'].value == '' ||
- cf.elements[pre+'enter_censustract'].value !=
- cf.elements[pre+'censustract'].value )
- {
+ if ( cf.elements[pre+'censustract'].value == '' ) {
var address_info = form_address_info();
address_info[pre+'latitude'] = cf.elements[pre+'latitude'].value;
address_info[pre+'longitude'] = cf.elements[pre+'longitude'].value;
@@ -116,10 +115,13 @@ function confirm_censustract(pre) {
'<%$p%>/misc/confirm-censustract.html',
'q=' + encodeURIComponent(JSON.stringify(address_info)),
function() {
- overlib( OLresponseAJAX, CAPTION, 'Confirm censustract', STICKY,
- AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH,
- 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399',
- TEXTSIZE, 3 );
+ if ( OLresponseAJAX ) {
+ overlib( OLresponseAJAX, CAPTION, 'Confirm censustract', STICKY,
+ AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH,
+ 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399',
+ TEXTSIZE, 3 );
+ } else
+ submit_continue();
},
0);
} else submit_continue();
diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html
index 64901a80f..6dcb602fe 100644
--- a/httemplate/edit/elements/part_svc_column.html
+++ b/httemplate/edit/elements/part_svc_column.html
@@ -249,7 +249,10 @@ that field.
</TR>
% }
% # special case: services with attached routers (false laziness...)
-% if ( $svcdb eq 'svc_acct' or $svcdb eq 'svc_broadband' or $svcdb eq 'svc_dsl' ) {
+% if ( $svcdb eq 'svc_acct'
+% or $svcdb eq 'svc_broadband'
+% or $svcdb eq 'svc_dsl'
+% or $svcdb eq 'svc_circuit' ) {
% push @fields, 'has_router';
<TR>
<TD COLSPAN=3 ALIGN="right">
diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html
index fc29327ae..97b630f76 100644
--- a/httemplate/edit/elements/svc_Common.html
+++ b/httemplate/edit/elements/svc_Common.html
@@ -103,10 +103,42 @@
my $flag = $columndef->columnflag;
if ( $flag eq 'F' ) { #fixed
- $f->{'type'} = length($columndef->columnvalue)
- ? 'fixed'
- : 'hidden';
$f->{'value'} = $columndef->columnvalue;
+ if (length($columndef->columnvalue)) {
+
+ if ( $f->{'type'} =~ /^select-?(.*)/ ) {
+ # try to display this in a user-friendly manner
+ if ( $f->{'table'} ) { # find matching records
+ $f->{'value_col'} ||=
+ dbdef->table($f->{'table'})->primary_key;
+
+ my @values = split(',', $f->{'value'});
+ my @recs;
+ foreach (@values) {
+ push @recs, qsearchs( $f->{'table'},
+ { $f->{'value_col'} => $_ }
+ );
+ }
+ if ( @recs ) {
+ my $method = $f->{'name_col'};
+ if ( $f->{'multiple'} ) {
+ $f->{'formatted_value'} = [
+ map { $_->method } @recs
+ ];
+ } else { # there shouldn't be more than one...
+ $f->{'formatted_value'} = $recs[0]->$method;
+ }
+ } # if not, then just let tr-fixed display the
+ # values as-is
+
+ } # other select types probably don't matter
+ } # if it's a select
+
+ $f->{'type'} = 'fixed';
+
+ } else { # fixed, null
+ $f->{'type'} = 'hidden';
+ }
} elsif ( $flag eq 'A' ) { #auto assign from inventory
$f->{'type'} = 'hidden';
@@ -127,16 +159,14 @@
};
} elsif ( $flag eq 'S' #selectable choice
- && $f->{type} !~ /^select-svc(-domain|_pbx)$/ ) {
+ && $f->{type} !~ /^select-svc/ ) {
$f->{type} = 'select';
$f->{options} = [ split( /\s*,\s*/,
$columndef->columnvalue)
];
- }
+ } # shouldn't this be enforced for all 'S' fields?
- if ( $f->{'type'} eq 'select-svc_pbx'
- || $f->{'type'} eq 'select-svc-domain'
- )
+ if ( $f->{'type'} =~ /^select-svc/ )
{
$f->{'include_opt_callback'} =
sub { ( 'pkgnum' => $pkgnum,
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index af69f71f9..2ae9df3ec 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -895,6 +895,11 @@ my $javascript = <<'END';
}
}
+ function finish_edit_fcc(id) {
+ cClick();
+ show_fcc_options(id); // refresh the display
+ }
+
END
my $warning =
diff --git a/httemplate/edit/process/bulk-part_pkg-fcc.html b/httemplate/edit/process/bulk-part_pkg-fcc.html
index 4a0fb2a22..8ef330829 100644
--- a/httemplate/edit/process/bulk-part_pkg-fcc.html
+++ b/httemplate/edit/process/bulk-part_pkg-fcc.html
@@ -17,7 +17,7 @@
% }
<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?redirect='.$session) %>
% } else {
-<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?classnum='.$classnum) %>
+<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?classnum='.$classnum.$jump) %>
% }
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
@@ -40,4 +40,8 @@ foreach my $param ($cgi->param) {
my $classnum = $cgi->param('classnum');
+my $jump = '';
+if ( $cgi->param('jump') =~ /^pkgpart(\d+)$/ ) {
+ $jump = '#'.$1;
+}
</%init>
diff --git a/httemplate/edit/process/circuit_provider.html b/httemplate/edit/process/circuit_provider.html
new file mode 100644
index 000000000..0a91a178d
--- /dev/null
+++ b/httemplate/edit/process/circuit_provider.html
@@ -0,0 +1,11 @@
+<& elements/process.html,
+ 'table' => 'circuit_provider',
+ 'viewall_dir' => 'browse',
+ 'popup_reload' => 'Updating',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/process/circuit_termination.html b/httemplate/edit/process/circuit_termination.html
new file mode 100644
index 000000000..94d29c05c
--- /dev/null
+++ b/httemplate/edit/process/circuit_termination.html
@@ -0,0 +1,11 @@
+<& elements/process.html,
+ 'table' => 'circuit_termination',
+ 'viewall_dir' => 'browse',
+ 'popup_reload' => 'Updating',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/process/circuit_type.html b/httemplate/edit/process/circuit_type.html
new file mode 100644
index 000000000..58f461e2c
--- /dev/null
+++ b/httemplate/edit/process/circuit_type.html
@@ -0,0 +1,11 @@
+<& elements/process.html,
+ 'table' => 'circuit_type',
+ 'viewall_dir' => 'browse',
+ 'popup_reload' => 'Updating',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/process/credit-cust_bill_pkg.html b/httemplate/edit/process/credit-cust_bill_pkg.html
index 8e66368d4..75900bde5 100644
--- a/httemplate/edit/process/credit-cust_bill_pkg.html
+++ b/httemplate/edit/process/credit-cust_bill_pkg.html
@@ -27,19 +27,35 @@ foreach my $billpkgnum_setuprecur (@billpkgnum_setuprecurs) {
push @amounts, $amount;
}
-my $error = FS::cust_credit->credit_lineitems(
+my $reasonnum = $cgi->param('reasonnum');
+$reasonnum =~ /^(-?\d+)$/ or die "Illegal reasonnum";
+$reasonnum = $1;
+
+my $error;
+if ($reasonnum == -1) {
+ my $new_reason = FS::reason->new({
+ map { $_ => scalar( $cgi->param("select_reason_new_$_") ) }
+ qw( reason_type reason )
+ });
+ $error = $new_reason->insert;
+ $reasonnum = $new_reason->reasonnum;
+}
+
+if ( !$reasonnum ) {
+ $error ||= 'Reason required'
+}
+
+$error ||= FS::cust_credit->credit_lineitems(
#the lineitems to credit
'billpkgnums' => \@billpkgnums,
'setuprecurs' => \@setuprecurs,
'amounts' => \@amounts,
'apply' => ( $cgi->param('apply') eq 'yes' ),
+ 'reasonnum' => $reasonnum,
- #the credit
- 'newreasonnum' => scalar($cgi->param('newreasonnum')),
- 'newreasonnum_type' => scalar($cgi->param('newreasonnumT')),
map { $_ => scalar($cgi->param($_)) }
#fields('cust_credit')
- qw( custnum _date amount reason reasonnum addlinfo ), #pkgnum eventnum
+ qw( custnum _date amount addlinfo ), #pkgnum eventnum
);
</%init>
diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi
index 245f31af7..e442d7fa6 100755
--- a/httemplate/edit/process/cust_credit.cgi
+++ b/httemplate/edit/process/cust_credit.cgi
@@ -1,5 +1,4 @@
%if ( $error ) {
-% $cgi->param('reasonnum', $reasonnum);
% $cgi->param('error', $error);
% $dbh->rollback if $oldAutoCommit;
%
@@ -37,19 +36,11 @@ my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
-my $error = '';
-if ($reasonnum == -1) {
-
- $error = 'Enter a new reason (or select an existing one)'
- unless $cgi->param('newreasonnum') !~ /^\s*$/;
- my $reason = new FS::reason {
- 'reason_type' => scalar($cgi->param('newreasonnumT')),
- 'reason' => scalar($cgi->param('newreasonnum')),
- };
- $error ||= $reason->insert;
- $cgi->param('reasonnum', $reason->reasonnum)
- unless $error;
+my ($reasonnum, $error) = $m->comp('/misc/process/elements/reason');
+if (!$reasonnum) {
+ $error ||= 'Reason required'
}
+$cgi->param('reasonnum', $reasonnum) unless $error;
unless ($error) {
my $new = new FS::cust_credit ( {
diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html
index 55ecc5f79..ca336a126 100644
--- a/httemplate/edit/process/elements/svc_Common.html
+++ b/httemplate/edit/process/elements/svc_Common.html
@@ -29,7 +29,7 @@ my $args_callback = sub {
map { $_ => $cgi->param("router_$_") }
qw( routernum routername blocknum )
});
- if (length($router->routername) == 0) {
+ if ($router->blocknum and length($router->routername) == 0) {
#sensible default
$router->set('routername', $svc->label);
}
diff --git a/httemplate/edit/process/part_event.html b/httemplate/edit/process/part_event.html
index 481439d53..bac69241c 100644
--- a/httemplate/edit/process/part_event.html
+++ b/httemplate/edit/process/part_event.html
@@ -62,12 +62,17 @@
my $value = join(',', $cgi->param( "$prefix$option" ) );
if ( $option eq 'reasonnum' && $value == -1 ) {
- $value = {
- 'typenum' => scalar( $cgi->param( "new$prefix${option}T" ) ),
- 'reason' => scalar( $cgi->param( "new$prefix${option}" ) ),
- };
+ my $reason_prefix = $object->action . '_' . $option . '_new_';
+ my $new_reason = FS::reason->new;
+ foreach ( qw( reason_type reason unsuspend pkgpart
+ unsuspend_hold unused_credit ) ) {
+ $new_reason->set($_, $cgi->param("$reason_prefix$_"));
+ }
+ warn Dumper $new_reason;
+ my $error = $new_reason->insert;
+ die "error creating reason: $error" if $error;
+ $value = $new_reason->reasonnum;
}
-
( $option => $value );
}
@{ $object->option_fields_listref };
diff --git a/httemplate/edit/process/svc_circuit.html b/httemplate/edit/process/svc_circuit.html
new file mode 100644
index 000000000..d28f91329
--- /dev/null
+++ b/httemplate/edit/process/svc_circuit.html
@@ -0,0 +1,11 @@
+<& elements/svc_Common.html,
+ table => 'svc_circuit',
+ edit_ext => 'html',
+ redirect => popurl(3)."view/svc_circuit.html?",
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
+
+</%init>
diff --git a/httemplate/edit/svc_circuit.cgi b/httemplate/edit/svc_circuit.cgi
new file mode 100644
index 000000000..3f9bad5b1
--- /dev/null
+++ b/httemplate/edit/svc_circuit.cgi
@@ -0,0 +1,54 @@
+<& elements/svc_Common.html,
+ 'table' => 'svc_circuit',
+ 'fields' => \@fields,
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
+
+my $conf = new FS::Conf;
+my $date_format = $conf->config('date_format') || '%m/%d/%Y';
+
+my @fields = (
+ { field => 'providernum',
+ type => 'select-table',
+ table => 'circuit_provider',
+ name_col => 'provider',
+ disable_empty => 1,
+ },
+ { field => 'typenum',
+ type => 'select-table',
+ table => 'circuit_type',
+ name_col => 'typename',
+ disable_empty => 1,
+ },
+ { field => 'termnum',
+ type => 'select-table',
+ table => 'circuit_termination',
+ name_col => 'termination',
+ disable_empty => 1,
+ },
+ { field => 'circuit_id',
+ size => 40,
+ },
+ { field => 'desired_due_date',
+ type => 'input-date-field',
+ },
+ { field => 'due_date',
+ type => 'input-date-field',
+ },
+ 'vendor_order_id',
+ 'vendor_qual_id',
+ 'vendor_order_status',
+ 'endpoint_ip_addr',
+ { field => 'endpoint_mac_addr',
+ type => 'input-mac_addr',
+ },
+);
+
+# needed: a new_callback to migrate vendor quals over to circuits
+
+#my ($svc_new_callback, $svc_edit_callback, $svc_error_callback);
+
+</%init>
diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi
index f8582057e..f9c0d4005 100644
--- a/httemplate/edit/svc_phone.cgi
+++ b/httemplate/edit/svc_phone.cgi
@@ -2,17 +2,12 @@
'table' => 'svc_phone',
'fields' => [],
'begin_callback' => $begin_callback,
- 'svc_new_callback' => sub {
- my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_;
- $svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg;
- },
- 'svc_edit_callback' => sub {
- my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt) = @_;
- my $conf = new FS::Conf;
- $svc_x->sip_password('*HIDDEN*') unless $conf->exists('showpasswords');
- },
+ 'svc_new_callback' => $svc_callback,
+ 'svc_edit_callback' => $svc_callback,
+ 'svc_error_callback' => $svc_callback,
&>
<%init>
+my $conf = new FS::Conf;
my $begin_callback = sub {
my( $cgi, $fields, $opt ) = @_;
@@ -25,8 +20,6 @@ my $begin_callback = sub {
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right($right);
- my $conf = new FS::Conf;
-
push @$fields,
'countrycode',
{ field => 'phonenum',
@@ -149,7 +142,26 @@ my $begin_callback = sub {
}
-};
+}; # begin_callback
+# svc_edit_callback / svc_new_callback
+my $svc_callback = sub {
+ my ($cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt) = @_;
+ push @$fields, {
+ field => 'circuit_svcnum',
+ type => 'select-svc_circuit',
+ cust_pkg => $cust_pkg,
+ part_svc => $part_svc,
+ };
+
+ if ( $cust_pkg and not $svc_x->svcnum ) {
+ # new service, default to package location
+ $svc_x->set('locationnum', $cust_pkg->locationnum);
+ }
+
+ if ( not $conf->exists('showpasswords') and $svc_x->svcnum ) {
+ $svc_x->sip_password('*HIDDEN*');
+ }
+};
</%init>