Freeside:4:Documentation:Developer/FS/m2name Common

From Freeside
Jump to: navigation, search


FS::m2name_Common - Mixin class for tables with a related table listing names


   use base qw( FS::m2name_Common FS::Record );


FS::m2name_Common is intended as a mixin class for classes which have a related table that lists names.


process_m2name OPTION => VALUE, ...
Available options:
link_table (required) - Table into which the records are inserted.
num_col (optional) - Column in link_table which links to the primary key of the base table. If not specified, it is assumed this has the same name.
name_col (required) - Name of the column in link_table that stores the string names.
names_list (required) - List reference of the possible string name values.
params (required) - Hashref of keys and values, often passed as scalar($cgi-Vars)> from a form. Processing is controlled by the param_style param option.
param_style (required) - Controls processing of params. link_table.value checkboxes specifies that parameters keys are in the form, and the values are booleans controlling whether or not to insert that name into link_table. name_colN values specifies that parameter keys are in the form name_col0, name_col1, and so on, and values are the names inserted into link_table.
args_callback (optional) - Coderef. Optional callback that may modify arguments for insert and replace operations. The callback is run with four arguments: the first argument is object being inserted or replaced (i.e. FS::link_table object), the second argument is a prefix to use when retreiving CGI arguements from the params hashref, the third argument is the params hashref (see above), and the final argument is a listref of arguments that the callback should modify.