summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-03-10 22:28:34 -0700
committerIvan Kohler <ivan@freeside.biz>2013-03-10 22:28:34 -0700
commit57c5cf47f41739b57c563ddac09d0bd49d6d67b4 (patch)
tree187f1fdd593bbaeea03dfb2bd473a4dfe502f775
parentf37b4c3e04f6dfc56ba967e270b5b49edafe81f6 (diff)
hide svc_phone.sip_password like svc_acct._password unless showpasswords config is on, RT#20862
-rw-r--r--httemplate/edit/process/elements/process.html3
-rw-r--r--httemplate/edit/process/svc_phone.html10
-rw-r--r--httemplate/edit/svc_phone.cgi5
-rw-r--r--httemplate/view/elements/svc_Common.html12
-rw-r--r--httemplate/view/svc_cert.cgi8
-rw-r--r--httemplate/view/svc_hardware.cgi6
-rw-r--r--httemplate/view/svc_phone.cgi13
7 files changed, 43 insertions, 14 deletions
diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html
index 2d39e9dce..fb1ee7a27 100644
--- a/httemplate/edit/process/elements/process.html
+++ b/httemplate/edit/process/elements/process.html
@@ -263,6 +263,9 @@ foreach my $value ( @values ) {
if ( !$error ) {
if ( $old_pkey ) {
+
+ &{ $opt{'edit_callback'} }( $new, $old ) if $opt{'edit_callback'};
+
$error = $new->replace($old, @args);
} else {
$error = $new->insert(@args);
diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html
index 611b5142b..27e975568 100644
--- a/httemplate/edit/process/svc_phone.html
+++ b/httemplate/edit/process/svc_phone.html
@@ -2,6 +2,7 @@
'table' => 'svc_phone',
'args_callback' => $args_callback,
'value_callback' => $value_callback,
+ 'edit_callback' => $edit_callback,
%opt,
&>
<%init>
@@ -51,8 +52,13 @@ my $args_callback = sub {
};
my $value_callback = sub {
- my ($field, $value) = @_;
- ($field =~ /_date$/) ? parse_datetime($value) : $value;
+ my ($field, $value) = @_;
+ ($field =~ /_date$/) ? parse_datetime($value) : $value;
+};
+
+my $edit_callback = sub {
+ my( $new, $old ) = @_;
+ $new->sip_password( $old->sip_password ) if $new->sip_password eq '*HIDDEN*';
};
</%init>
diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi
index 8ee71b82d..13bbe82a1 100644
--- a/httemplate/edit/svc_phone.cgi
+++ b/httemplate/edit/svc_phone.cgi
@@ -6,6 +6,11 @@
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');
+ },
&>
<%init>
diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html
index 46b9c28fa..a7f8f6df4 100644
--- a/httemplate/view/elements/svc_Common.html
+++ b/httemplate/view/elements/svc_Common.html
@@ -59,16 +59,20 @@ function areyousure(href) {
% foreach my $f ( @$fields ) {
%
-% my($field, $type, $value, $hack_strict_refs);
+% my($field, $type, $value);
% if ( ref($f) ) {
% $field = $f->{'field'};
-% $hack_strict_refs = \&{ $f->{'value'} } if $f->{'value'};
-% $value = $f->{'value'} ? &$hack_strict_refs($svc_x) : $svc_x->$field;
% $type = $f->{'type'} || 'text';
+% if ( $f->{'value_callback'} ) {
+% my $hack_strict_refs = \&{ $f->{'value_callback'} };
+% $value = &$hack_strict_refs($svc_x);
+% } else {
+% $value = exists($f->{'value'}) ? $f->{'value'} : $svc_x->$field;
+% }
% } else {
% $field = $f;
-% $value = $svc_x->$field;
% $type = 'text';
+% $value = $svc_x->$field;
% }
%
% my $columndef = $part_svc->part_svc_column($field);
diff --git a/httemplate/view/svc_cert.cgi b/httemplate/view/svc_cert.cgi
index 0cd66b422..964b808ab 100644
--- a/httemplate/view/svc_cert.cgi
+++ b/httemplate/view/svc_cert.cgi
@@ -17,7 +17,7 @@ my %labels = map { $_ => ( ref($fields->{$_})
my @fields = (
{ field=>'privatekey',
- value=> sub {
+ value_callback=> sub {
my $svc_cert = shift;
if ( $svc_cert->privatekey && $svc_cert->check_privatekey ) {
'<FONT COLOR="#33ff33">Verification OK</FONT>';
@@ -31,7 +31,7 @@ my @fields = (
qw( common_name organization organization_unit city state country cert_contact
),
{ 'field'=>'csr',
- 'value'=> sub {
+ 'value_callback'=> sub {
my $svc_cert = shift;
if ( $svc_cert->csr ) {
@@ -67,7 +67,7 @@ my @fields = (
},
},
{ 'field'=>'certificate',
- 'value'=> sub {
+ 'value_callback'=> sub {
my $svc_cert = shift;
if ( $svc_cert->certificate ) {
@@ -137,7 +137,7 @@ my @fields = (
},
},
{ 'field'=>'cacert',
- 'value'=> sub {
+ 'value_callback'=> sub {
my $svc_cert = shift;
if ( $svc_cert->cacert ) {
diff --git a/httemplate/view/svc_hardware.cgi b/httemplate/view/svc_hardware.cgi
index 7f5e889d8..aa3ff0091 100644
--- a/httemplate/view/svc_hardware.cgi
+++ b/httemplate/view/svc_hardware.cgi
@@ -15,15 +15,15 @@ my %labels = map { $_ => ( ref($fields->{$_})
} keys %$fields;
my $model = { field => 'typenum',
type => 'text',
- value => sub { $_[0]->hardware_type->description }
+ value_callback => sub { $_[0]->hardware_type->description }
};
my $status = { field => 'statusnum',
type => 'text',
- value => sub { $_[0]->status_label }
+ value_callback => sub { $_[0]->status_label }
};
my $note = { field => 'note',
type => 'text',
- value => sub { encode_entities($_[0]->note) }
+ value_callback => sub { encode_entities($_[0]->note) }
};
my @fields = (
diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi
index e956e7d49..ed95c4cea 100644
--- a/httemplate/view/svc_phone.cgi
+++ b/httemplate/view/svc_phone.cgi
@@ -18,7 +18,18 @@ my %labels = map { $_ => ( ref($fields->{$_})
my @fields = qw( countrycode phonenum sim_imsi );
push @fields, 'domain' if $conf->exists('svc_phone-domain');
-push @fields, qw( pbx_title sip_password pin phone_name forwarddst email );
+push @fields, qw( pbx_title );
+
+if ( $conf->exists('showpasswords') ) {
+ push @fields, qw( sip_password );
+} else {
+ push @fields, { 'field' => 'sip_password', #'_HIDDEN_sip_password',
+ 'type' => 'fixed',
+ 'value' => '<I>('. mt('hidden') .')</I>',
+ };
+}
+
+push @fields, qw( pin phone_name forwarddst email );
if ( $conf->exists('svc_phone-lnp') ) {
push @fields, 'lnp_status',