diff options
author | ivan <ivan> | 2010-07-16 23:45:24 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-07-16 23:45:24 +0000 |
commit | 556b8e9650155e74416496238cfc0e4abe64c53a (patch) | |
tree | 26a6cac98ec8a944361a0d913392eab6abd53b6a /httemplate/elements/tr-select-cust_tag.html | |
parent | 9414a814e49a86a832e4f56ec1a6bcc927f55e6b (diff) |
customer tags, RT#9192
Diffstat (limited to 'httemplate/elements/tr-select-cust_tag.html')
-rw-r--r-- | httemplate/elements/tr-select-cust_tag.html | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/httemplate/elements/tr-select-cust_tag.html b/httemplate/elements/tr-select-cust_tag.html new file mode 100644 index 0000000..d88f3a8 --- /dev/null +++ b/httemplate/elements/tr-select-cust_tag.html @@ -0,0 +1,46 @@ +% if ( $curuser->access_right('Edit customer tags') && @part_tag ) { + + <TR> + <TD ALIGN="right"><% $opt{'label'} || 'Tags' %></TD> + <TD> + <% include( '/elements/select-cust_tag.html', + 'curr_value' => \@curr_tagnum, + 'part_tag' => \@part_tag, + %opt, + ) + %> + </TD> + </TR> + +% } else { + +% foreach my $tagnum (@curr_tagnum) { + <INPUT TYPE="hidden" NAME="tagnum" VALUE="<% $tagnum %>"> +% } + +% } +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +my %opt = @_; +my $cgi = $opt{'cgi'}; + +my @curr_tagnum = (); +if ( $cgi->param('error') ) { + @curr_tagnum = $cgi->param('tagnum'); +} elsif ( $opt{'custnum'} ) { + @curr_tagnum = map $_->tagnum, + qsearch('cust_tag', { 'custnum' => $opt{'custnum'} } ); +} + +my $extra_sql = "WHERE disabled IS NULL OR disabled = '' "; +$extra_sql .= ' OR tagnum IN ('. join(',', @curr_tagnum). ')' if @curr_tagnum; + +my @part_tag = qsearch({ + 'table' => 'part_tag', + 'hashref' => {}, + 'extra_sql' => $extra_sql, +}); + +</%init> |