summaryrefslogtreecommitdiff
path: root/httemplate/edit/svc_phone.cgi
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-11-27 15:21:29 -0800
committerMark Wells <mark@freeside.biz>2014-11-27 15:21:29 -0800
commit1af8ff7f48f7259fc99f090c301c84b9680fdb4d (patch)
treee21d72df5e6dd2eddebc8debc3b954bf2e0830e8 /httemplate/edit/svc_phone.cgi
parent0f0bc1ef7aafc6b3869c0f71ee2528c1c9897ce6 (diff)
svc_circuit, #23879, #25933, #30830
Diffstat (limited to 'httemplate/edit/svc_phone.cgi')
-rw-r--r--httemplate/edit/svc_phone.cgi36
1 files changed, 24 insertions, 12 deletions
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>