Line # Revision Author
1 296 ahitrov package promosuite::Voice;
2
3 use strict;
4
5 use Contenido::Globals;
6 use base 'Contenido::Document';
7
8 sub extra_properties
9 {
10 return (
11 )
12 }
13
14 sub class_name
15 {
16 return 'Голос пользователя в опросе';
17 }
18
19 sub class_description
20 {
21 return 'Голос пользователя в опросе';
22 }
23
24 sub class_table
25 {
26 return 'promosuite::SQL::Enquesta';
27 }
28
29 sub pre_store
30 {
31 my $self = shift;
32
33 my $default_section = $project->s_alias->{votes} if ref $project->s_alias eq 'HASH';
34 my $sections = $self->{sections};
35 if ( $default_section ) {
36 if ( ref $sections eq 'ARRAY' && scalar @$sections ) {
37 my @new_sects = grep { $_ != $default_section } @$sections;
38 push @new_sects, $default_section;
39 $self->sections(@new_sects);
40 } elsif ( $sections && !ref $sections && $sections != $default_section ) {
41 my @new_sects = ($default_section, $sections);
42 $self->sections(@new_sects);
43 } else {
44 $self->sections($default_section);
45 }
46 }
47
48 return 1;
49 }
50
51 1;