1 # @tag: defaults_show_bestbefore
2 # @description: Einstellung, ob Mindesthaltbarkeitsdatum angezeigt wird, vom Config-File in die DB verlagern.
3 # @depends: release_2_7_0
9 die("This script cannot be run from the command line.") unless ($main::form);
13 die($dbup_locale->text("Database update error:") .
14 "<br>$msg<br>" . $DBI::errstr);
18 my ($query, $may_fail) = @_;
20 if (!$dbh->do($query)) {
21 mydberror($query) unless ($may_fail);
29 # this query will fail if column already exist (new database)
30 do_query(qq|ALTER TABLE defaults ADD COLUMN show_bestbefore boolean DEFAULT false|, 1);
32 # check current configuration and set default variables accordingly, so that
33 # Lx-Office behaviour isn't changed by this update
34 # if show_best_before is not set in config set it to 0
35 my $show_bestbefore = 0;
36 if ($::lx_office_conf{features}->{show_best_before}) {
40 my $update_column = "UPDATE defaults SET show_bestbefore = '$show_bestbefore';";
41 do_query($update_column);