re-work importer to allow new sources and targets to be implemented
[bse.git] / site / cgi-bin / modules / BSE / TB / ProductOption.pm
CommitLineData
58baa27b
TC
1package BSE::TB::ProductOption;
2use strict;
3use base 'Squirrel::Row';
4
5sub columns {
6 return qw/id product_id name type global_ref display_order enabled default_value/;
7}
8
9sub table {
10 "bse_product_options";
11}
12
13sub defaults {
14 return
15 (
16 global_ref => undef,
17 enabled => 1,
18 type => "select",
19 default_value => 0,
20 );
21}
22
23sub values {
24 my ($self) = @_;
25
26 require BSE::TB::ProductOptionValues;
27 return sort { $a->{display_order} <=> $b->{display_order} }
28 BSE::TB::ProductOptionValues->getBy(product_option_id => $self->{id});
29}
30
31sub key {
32 my $self = shift;
33 return "prodopt_" . $self->id;
34}
35
361;