X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=sql%2FPg-upgrade2%2Fcustom_variables_convert_width_height_to_pixels.pl;fp=sql%2FPg-upgrade2%2Fcustom_variables_convert_width_height_to_pixels.pl;h=45b22f8b3b5db648325ac56424f4347103145a76;hp=0000000000000000000000000000000000000000;hb=b293ff8ad52fc76ba0c44783e3982418114d6b08;hpb=d4925a8b60f04674885e30d9316dc0263f8b9a84 diff --git a/sql/Pg-upgrade2/custom_variables_convert_width_height_to_pixels.pl b/sql/Pg-upgrade2/custom_variables_convert_width_height_to_pixels.pl new file mode 100644 index 000000000..45b22f8b3 --- /dev/null +++ b/sql/Pg-upgrade2/custom_variables_convert_width_height_to_pixels.pl @@ -0,0 +1,59 @@ +# @tag: custom_variables_convert_width_height_to_pixels +# @description: Benutzerdefinierte Variablen: Optionen »WIDTH« & »HEIGHT« nach Pixel konvertieren +# @depends: release_3_5_8 +package SL::DBUpgrade2::custom_variables_convert_width_height_to_pixels; + +use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); + +use SL::DBUtils; + +sub find_configs { + my ($self) = @_; + + my $sql = <dbh, $sql); +} + +sub fix_configs { + my ($self, $configs) = @_; + + my $sql = <dbh, $sql); + + # Old defaults: 30 columns, 5 rows + # New defaults: 225px width, 90px height + + foreach my $config (@{ $configs }) { + $config->{options} =~ s{WIDTH=(\d+)}{ int($1 * (225 / 30.0)) }eg; + $config->{options} =~ s{HEIGHT=(\d+)}{ int($1 * ( 90 / 5.0)) }eg; + + $update_h->execute(@{$config}{qw(options id)}) || $self->db_error($sql); + } + + $update_h->finish; +} + +sub run { + my ($self) = @_; + + my $configs = $self->find_configs; + $self->fix_configs($configs) if @{ $configs }; + + return 1; +} + +1;