RT# 75817 - fixed contact password page to be more consistant with svc password page...
[freeside.git] / httemplate / elements / contact.html
index 979c26b..df2107a 100644 (file)
 
         <TD>
 %         if ( $field eq 'selfservice_access' ) {
+
             <SELECT NAME = "<%$name%>_<%$field%>"
                     ID   = "<%$id%>_<%$field%>"
+                    STYLE = "width: 140px"
             >
               <OPTION VALUE="">Disabled
 %             if ( $value || $self_base_url ) {
                 <OPTION VALUE="Y" <% $value eq 'Y' ? 'SELECTED' : '' %>>Enabled
 %               if ( $value eq 'Y' && $self_base_url ) {
                   <OPTION VALUE="R">Re-email
+                  <OPTION VALUE="P"><% $pwd_change_label %>
 %               }
 %             }
             </SELECT>
-
+                  <& /elements/change_password.html,
+                   'contact_num'         => $curr_value,
+                   'custnum'             => $opt{'custnum'},
+                   'curr_value'          => '',
+                   'no_label_display'    => '1',
+                   'noformtag'           => '1',
+                   'pre_pwd_field_label' => $id.'_',
+                  &>
+            <SCRIPT TYPE="text/javascript">
+                    document.getElementById("<%$id%>_<%$field%>").onchange = function() {
+                      if (this.value == "P") { changepw<%$id%>_toggle(true); }
+                      return false
+                    }
+            </SCRIPT>
+%         } elsif ( $field eq 'invoice_dest' ) {
+%           my $curr_value = $cgi->param($name . '_' . $field);
+%           $curr_value = $value if !defined($curr_value);
+            <& select.html,
+                field         => $name . '_' . $field,
+                curr_value    => $curr_value,
+                options       => [ '', 'Y' ],
+                option_labels => { '' => 'no', 'Y' => 'yes' },
+                style         => 'width: 100%',
+            &>
 %         } else {
             <INPUT TYPE  = "text"
                    NAME  = "<%$name%>_<%$field%>"
 my( %opt ) = @_;
 
 my $conf = new FS::Conf;
+
 my $self_base_url = $conf->config('selfservice_server-base_url');
 
 my $name = $opt{'element_name'} || $opt{'field'} || 'contactnum';
@@ -118,7 +145,7 @@ tie my %label, 'Tie::IxHash',
 
 my $first = 0;
 foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) {
-  next if $phone_type->typename eq 'Home';
+  next if $phone_type->typename =~ /^(Home|Fax)$/;
   my $f = 'phonetypenum'.$phone_type->phonetypenum;
   $label{$f} = $phone_type->typename. ' phone';
   $size{$f} = $first++ ? 10 : 15;
@@ -128,4 +155,7 @@ $label{'comment'} = 'Comment';
 
 my @fields = $opt{'name_only'} ? qw( first last ) : keys %label;
 
+my $pwd_change_label = 'Change Password';
+$pwd_change_label = 'Setup Password' unless $contact->_password;
+
 </%init>