X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fcontact.html;h=308b846bcea9e28bfd87049fa427174a1e73f775;hp=5588890c892ccd01046b632a3faad7c7bf2c60a2;hb=f48ffc61601d08024aeff19ecd07d7420fc4e5b3;hpb=8ca45ec1f1ab960ee1e262ee764f05d214728d05
diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html
index 5588890c8..308b846bc 100644
--- a/httemplate/elements/contact.html
+++ b/httemplate/elements/contact.html
@@ -1,4 +1,6 @@
-% unless ( $opt{'js_only'} ) {
+% if ( $opt{'js_only'} ) {
+<% $js %>
+% } else {
@@ -75,23 +77,8 @@
VALUE = ""
placeholder = "<% $value |h %>"
>
-% my $contactnum = $curr_value ? $curr_value : '0';
-
-
-
% } elsif ( $field eq 'invoice_dest' || $field eq 'message_dest' ) {
% my $curr_value = $cgi->param($name . '_' . $field);
@@ -116,7 +103,7 @@
<% $label{$field} %>
% if ( $field eq 'password' ) {
-
+
% }
% }
@@ -136,6 +123,7 @@ my $name = $opt{'element_name'} || $opt{'field'} || 'contactnum';
my $id = $opt{'id'} || 'contactnum';
my $curr_value = $opt{'curr_value'} || $opt{'value'};
+my $contactnum = $curr_value ? $curr_value : '0';
my $onchange = '';
if ( $opt{'onchange'} ) {
@@ -192,7 +180,7 @@ unless ($opt{'for_prospect'}) {
}
my $first = 0;
-foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) {
+foreach my $phone_type ( FS::phone_type->get_phone_types() ) {
next if $phone_type->typename =~ /^(Home|Fax)$/;
my $f = 'phonetypenum'.$phone_type->phonetypenum;
$label{$f} = $phone_type->typename. ' phone';
@@ -203,4 +191,21 @@ $label{'comment'} = 'Comment';
my @fields = $opt{'name_only'} ? qw( first last ) : keys %label;
+my $submitid = $opt{'submit_id'} ? $opt{'submit_id'} : 'submit';
+
+my $js = qq(
+ add_password_validation('changepw$id\_password', '$submitid', '', '$contactnum');
+
+ var selfService = document.getElementById("$id\_selfservice_access").value;
+
+ if (selfService !== "Y") { document.getElementById("changepw$id\_password").disabled = 'true'; }
+ document.getElementById("$id\_selfservice_access").onchange = function() {
+ if (this.value == "P" || this.value == "E" || this.value =="Y") {
+ document.getElementById("changepw$id\_password").disabled = '';
+ }
+ else { document.getElementById("changepw$id\_password").disabled = 'true'; }
+ return false;
+ }
+) unless $opt{'for_prospect'};
+
%init>