diff options
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/select-cust_phone.html | 31 | ||||
-rw-r--r-- | httemplate/elements/select.html | 2 | ||||
-rw-r--r-- | httemplate/elements/tr-select-cust_phone.html | 12 |
3 files changed, 44 insertions, 1 deletions
diff --git a/httemplate/elements/select-cust_phone.html b/httemplate/elements/select-cust_phone.html new file mode 100644 index 000000000..94cd41322 --- /dev/null +++ b/httemplate/elements/select-cust_phone.html @@ -0,0 +1,31 @@ +<SELECT NAME="<% $opt{'field_name'} %>" ID="<% $opt{'field_name'} %>"> + + <OPTION VALUE="" selected="selected">Select a phone number + +% foreach $p (@$phone_types) { + <OPTION VALUE="<% $phones_formatted{$p} %>"><% $p |h%> (<% $cust_phones->$p |h %>) +%} + +</SELECT> + +<%init> + +my %opt = @_; +my $cust_num = $opt{'cust_num'}; +my $phone_types = $opt{'phone_types'}; +my $format = $opt{'format'}; + +my $cust_phones = qsearchs('cust_main', { 'custnum' => $cust_num }) + or die 'unknown custnum' . $cust_num; + +my %phones_formatted = map { + $_ => format_phone_number($cust_phones->$_, $format) +} @$phone_types; + +sub format_phone_number { + my ($n, $f) = @_; + if ($f eq 'xxxxxxxxxx') { $n =~ s/-//g; } + return $n; +} + +</%init>
\ No newline at end of file diff --git a/httemplate/elements/select.html b/httemplate/elements/select.html index 689566e36..100df94d0 100644 --- a/httemplate/elements/select.html +++ b/httemplate/elements/select.html @@ -69,7 +69,7 @@ % % } -</SELECT> +</SELECT> <% $opt{'post_field_label'} %> % } <%init> diff --git a/httemplate/elements/tr-select-cust_phone.html b/httemplate/elements/tr-select-cust_phone.html new file mode 100644 index 000000000..cf88392b0 --- /dev/null +++ b/httemplate/elements/tr-select-cust_phone.html @@ -0,0 +1,12 @@ + <TR> + <TD ALIGN="right"><% $opt{'label'} || 'Customer Phones' %></TD> + <TD> + <% include( '/elements/select-cust_phone.html', %opt ) %> + </TD> + </TR> + +<%init> + +my %opt = @_; + +</%init> |