X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fcontact.html;h=3d5177612fecb929bc0187a684f150328476508d;hb=63973c641c4be00765fa27e55c57cc5b9aa4da19;hp=38703bfef6149964918f94927bff29723ce082de;hpb=03ceab71dad1e5eb366865d304e5e459cc905ce4;p=freeside.git diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index 38703bfef..3d5177612 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -2,44 +2,60 @@ - +
- - - - +% if ( @contact_class && ! $opt{name_only} ) { + +% } else { + +% } +% +% foreach my $field ( @fields ) { +% +% my $value = ''; +% if ( $field =~ /^phonetypenum(\d+)$/ ) { +% my $contact_phone = qsearchs('contact_phone', { +% 'contactnum' => $curr_value, +% 'phonetypenum' => $1, +% }); +% if ( $contact_phone ) { +% $value = $contact_phone->phonenum; +% $value .= 'x'.$contact_phone->extension +% if $contact_phone->extension; +% $value = '+'. $contact_phone->countrycode. " $value" +% if $contact_phone->countrycode +% && $contact_phone->countrycode ne '1'; +% } +% } elsif ( $field eq 'emailaddress' ) { +% $value = join(', ', map $_->emailaddress, $contact->contact_email); +% } else { +% $value = $contact->get($field); +% } + + +% }
- - >
- First name -
- - >
- Last name -
- - >
- Title/Position -
- - >
- Comment -
+
+ Type +
+ " + <% $onchange %> + >
+ <% $label{$field} %> +
@@ -62,6 +78,8 @@ if ( $opt{'onchange'} ) { $onchange = 'onChange="'. $onchange. '"'; } +my @contact_class = qsearch('contact_class', { 'disabled' => '' }); + my $contact; if ( $curr_value ) { $contact = qsearchs('contact', { 'contactnum' => $curr_value } ); @@ -69,4 +87,25 @@ if ( $curr_value ) { $contact = new FS::contact {}; } +my %size = ( 'title' => 12 ); + +tie my %label, 'Tie::IxHash', + 'first' => 'First name', + 'last' => 'Last name', + 'title' => 'Title/Position', + 'emailaddress' => 'Email', +; + +my $first = 0; +foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) { + next if $phone_type->typename eq 'Home'; + my $f = 'phonetypenum'.$phone_type->phonetypenum; + $label{$f} = $phone_type->typename. ' phone'; + $size{$f} = $first++ ? 10 : 15; +} + +$label{'comment'} = 'Comment'; + +my @fields = $opt{'name_only'} ? qw( first last ) : keys %label; +