From: Mark Wells Date: Fri, 16 Jan 2015 04:35:51 +0000 (-0800) Subject: MAC address copying hack for view/ pages, #25599 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=92adf71887c2680f464d660cab727ea112e858a5 MAC address copying hack for view/ pages, #25599 --- diff --git a/httemplate/elements/mac_addr.html b/httemplate/elements/mac_addr.html new file mode 100644 index 000000000..1d867f504 --- /dev/null +++ b/httemplate/elements/mac_addr.html @@ -0,0 +1,53 @@ +% if (!$init) { +% if ($clipboard_hack) { +<& init_overlib.html &> + + +% } # if $clipboard_hack +% $init++; +% } +%# the only part to be included in every instance +<% $value |h %> +<%shared> +my $init = 0; + +<%init> +my $clipboard_hack = + $FS::CurrentUser::CurrentUser->option('enable_mask_clipboard_hack'); +my $value = shift; # no other params + diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 6c5c90201..b7f7a2c63 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -222,6 +222,7 @@ my $format_field = sub { $field = $f; $type = 'text'; } + warn "$field\t$type\t$value\n"; my $columndef = $part_svc->part_svc_column($field); # skip fields that are fixed and empty @@ -273,8 +274,10 @@ my $format_field = sub { $value = time2str("$date_format %H:%M",$value) } elsif ( $type eq 'checkbox' ) { $value = $value eq 'Y' ? emt('Yes') : emt('No'); - } elsif ( $type eq 'mac_addr' and $value =~ /\w/) { - $value .= ' ('. (Net::MAC::Vendor::lookup($value))->[0]. ')' + } elsif ( $type =~ /(input-)?mac_addr/ and $value =~ /\w/) { + my $vendor = Net::MAC::Vendor::lookup($value)->[0]; + $value .= " ($vendor)" if $vendor; + $value = $m->scomp('/elements/mac_addr.html', $value); } # 'link' option