[freeside-commits] branch master updated. 57c5cf47f41739b57c563ddac09d0bd49d6d67b4

Ivan ivan at 420.am
Sun Mar 10 22:28:45 PDT 2013


The branch, master has been updated
       via  57c5cf47f41739b57c563ddac09d0bd49d6d67b4 (commit)
      from  f37b4c3e04f6dfc56ba967e270b5b49edafe81f6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 57c5cf47f41739b57c563ddac09d0bd49d6d67b4
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Mar 10 22:28:34 2013 -0700

    hide svc_phone.sip_password like svc_acct._password unless showpasswords config is on, RT#20862

diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html
index 2d39e9d..fb1ee7a 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 611b514..27e9755 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 8ee71b8..13bbe82 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 46b9c28..a7f8f6d 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 0cd66b4..964b808 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 7f5e889..aa3ff00 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 e956e7d..ed95c4c 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',

-----------------------------------------------------------------------

Summary of changes:
 httemplate/edit/process/elements/process.html |    3 +++
 httemplate/edit/process/svc_phone.html        |   10 ++++++++--
 httemplate/edit/svc_phone.cgi                 |    5 +++++
 httemplate/view/elements/svc_Common.html      |   12 ++++++++----
 httemplate/view/svc_cert.cgi                  |    8 ++++----
 httemplate/view/svc_hardware.cgi              |    6 +++---
 httemplate/view/svc_phone.cgi                 |   13 ++++++++++++-
 7 files changed, 43 insertions(+), 14 deletions(-)




More information about the freeside-commits mailing list