diff options
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/select-cust_tag.html | 20 | ||||
-rw-r--r-- | httemplate/elements/tr-select-cust_tag.html | 46 |
2 files changed, 66 insertions, 0 deletions
diff --git a/httemplate/elements/select-cust_tag.html b/httemplate/elements/select-cust_tag.html new file mode 100644 index 000000000..61d4dca3b --- /dev/null +++ b/httemplate/elements/select-cust_tag.html @@ -0,0 +1,20 @@ +<% include( '/elements/select-table.html', + 'table' => 'part_tag', + 'name_col' => 'tagname', #tagname - tagdesc?? + 'multiple' => 1, + #'value' => $agentnum || '', + #'agent_virt' => 1, + 'hashref' => { 'disabled' => '' }, + 'order_by' => ' ORDER BY tagname', + %opt, + ) +%> +<%init> + +my %opt = @_; +#my $agentnum = $opt{'curr_value'} || $opt{'value'}; + +$opt{'records'} = delete $opt{'part_tag'} + if $opt{'part_tag'}; + +</%init> diff --git a/httemplate/elements/tr-select-cust_tag.html b/httemplate/elements/tr-select-cust_tag.html new file mode 100644 index 000000000..d88f3a894 --- /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> |