1 # @tag: custom_variables_convert_width_height_to_pixels
2 # @description: Benutzerdefinierte Variablen: Optionen »WIDTH« & »HEIGHT« nach Pixel konvertieren
3 # @depends: release_3_5_8
4 package SL::DBUpgrade2::custom_variables_convert_width_height_to_pixels;
9 use parent qw(SL::DBUpgrade2::Base);
18 FROM custom_variable_configs
19 WHERE (COALESCE(options, '') ~ 'WIDTH=|HEIGHT=')
20 AND (type = 'textfield')
23 return selectall_hashref_query($::form, $self->dbh, $sql);
27 my ($self, $configs) = @_;
30 UPDATE custom_variable_configs
35 my $update_h = prepare_query($::form, $self->dbh, $sql);
37 # Old defaults: 30 columns, 5 rows
38 # New defaults: 225px width, 90px height
40 foreach my $config (@{ $configs }) {
41 $config->{options} =~ s{WIDTH=(\d+)}{ int($1 * (225 / 30.0)) }eg;
42 $config->{options} =~ s{HEIGHT=(\d+)}{ int($1 * ( 90 / 5.0)) }eg;
44 $update_h->execute(@{$config}{qw(options id)}) || $self->db_error($sql);
53 my $configs = $self->find_configs;
54 $self->fix_configs($configs) if @{ $configs };