$ss = '';
$stateid = '';
- $cgi->param('tagnum', FS::part_tag->default_tags);
-
if ( $cgi->param('qualnum') =~ /^(\d+)$/ ) {
my $qualnum = $1;
my $qual = qsearchs('qual', { 'qualnum' => $qualnum } )
%# tags
<& /elements/tr-select-cust_tag.html,
'custnum' => $custnum,
+ 'default' => { map { $_=>1 } FS::part_tag->default_tags },
'cgi' => $cgi,
&>
$new->setfield('credit_limit', '');
}
-$new->tagnum( [ $cgi->param('tagnum') ] );
+#$new->tagnum( [ $cgi->param('tagnum') ] );
+my $params = $cgi->Vars;
+$new->tagnum( [
+ map { /^tagnum(\d+)/ && $1 }
+ grep { /^tagnum(\d+)/ && $cgi->param($_) } keys %$params
+] );
$error ||= $new->set_national_id_from_cgi( $cgi );
% 'select' => $opt{'target_table'}. '.*',
% 'addl_from' => "LEFT JOIN $opt{'link_table'} USING ( $target_pkey )",
% 'extra_sql' => $extra_sql,
+% 'order_by' => $opt{'order_by'},
% })
% ) {
%
%
% } elsif ( !$sourcenum ) { # newly created object, has no links yet
%
-% $checked = $opt{'default'} ? 'CHECKED' : ''
+% if ( ref($opt{'default'}) ) {
+% $checked = $opt{'default'}->{$targetnum} ? 'CHECKED' : '';
+% } else {
+% $checked = $opt{'default'} ? 'CHECKED' : ''
+% }
%
% } else {
%
%
%
-
- <INPUT TYPE="checkbox" NAME="<% $target_pkey. $targetnum %>" <% $checked %> VALUE="ON">
+% my $color_col = $opt{'color_col'};
+ <INPUT TYPE="checkbox" NAME="<% $target_pkey. $targetnum %>" <% $checked %> VALUE="ON"><DIV STYLE="display:inline; background-color: #<% $color_col ? $target_obj->$color_col : '' %>">
% if ( $opt{'target_link'} ) {
-
-
<A HREF="<% $opt{'target_link'} %><% $targetnum %>">
-%
-%
% }
%
-<% $targetnum %>:
% if ( $opt{'name_callback'} ) {
%
- <% $target_obj->$name_col() %><% $opt{'target_link'} ? '</A>' : '' %>
+ <% $target_obj->$name_col() %></DIV><% $opt{'target_link'} ? '</A>' : '' %>
% }
% if ( $opt{'disable-able'} ) {
-<% include( '/elements/select-table.html',
- 'table' => 'part_tag',
+<% include( '/elements/checkboxes-table.html',
+ 'target_table' => 'part_tag',
+ 'link_table' => 'cust_tag',
'name_col' => 'tagname', #tagname - tagdesc??
- 'multiple' => 1,
- #'value' => $agentnum || '',
- #'agent_virt' => 1,
- 'hashref' => { 'disabled' => '' },
+ 'color_col' => 'tagcolor',
+ 'disable-able' => 1,
'order_by' => ' ORDER BY tagname',
+ 'source_table' => 'cust_main',
+ 'sourcenum' => $opt{'custnum'},
%opt,
)
%>
<TH ALIGN="right"><% $opt{'label'} || 'Tags' %></TD>
<TD>
<% include( '/elements/select-cust_tag.html',
- 'curr_value' => \@curr_tagnum,
- 'part_tag' => \@part_tag,
%opt,
)
%>
my $extra_sql = "WHERE disabled IS NULL OR disabled = '' ";
$extra_sql .= ' OR tagnum IN ('. join(',', @curr_tagnum). ')' if @curr_tagnum;
+#now kind of inefficient (we only want to know if there are any), but since
+# its an edit control its not significant
my @part_tag = qsearch({
'table' => 'part_tag',
'hashref' => {},