6 # 'link_table' => 'table_name',
8 # 'name_col' => 'name_column',
10 # 'name_callback' => sub { },
12 # 'names_list' => [ 'value', 'other value' ],
15 # recommended (required?)
17 # 'source_obj' => $obj,
19 # #'source_table' => 'table_name',
20 # #'sourcenum' => '4', #current value of primary key in source_table
21 # # # (none is okay, just pass it if you have it)
25 # 'num_col' => 'col_name' #if column name is different in link_table than
27 # 'link_static' => { 'column' => 'value' },
31 my( $source_pkey, $sourcenum, $source_obj );
32 if ( $opt{'source_obj'} ) {
34 $source_obj = $opt{'source_obj'};
35 #$source_table = $source_obj->dbdef_table->table;
36 $source_pkey = $source_obj->dbdef_table->primary_key;
37 $sourcenum = $source_obj->$source_pkey();
42 $source_pkey = $opt{'source_table'}
43 ? dbdef->table($opt{'source_table'})->primary_key
45 $sourcenum = $opt{'sourcenum'};
48 $source_pkey = $opt{'num_col'} || $source_pkey;
50 my $link_static = $opt{'link_static'} || {};
54 <% foreach my $name ( @{ $opt{'names_list'} } ) {
57 if ( $cgi->param('error') ) {
59 $checked = $cgi->param($opt{'link_table'}. ".$name" )
66 qsearchs( $opt{'link_table'}, {
67 $source_pkey => $sourcenum,
68 $opt{'name_col'} => $name,
78 <INPUT TYPE="checkbox" NAME="<%= $opt{'link_table'}. ".$name" %>" <%= $checked %> VALUE="ON">