1 # @tag: defaults_feature
 
   2 # @description: Einstellen der Feature vom Config-File in die DB verlagern.
 
   3 # @depends: release_3_0_0
 
   4 package SL::DBUpgrade2::defaults_feature;
 
   8 use parent qw(SL::DBUpgrade2::Base);
 
  14   # this query will fail if column already exist (new database)
 
  15   $self->db_query(qq|ALTER TABLE defaults ADD COLUMN webdav              boolean DEFAULT false|);
 
  16   $self->db_query(qq|ALTER TABLE defaults ADD COLUMN webdav_documents    boolean DEFAULT false|);
 
  17   $self->db_query(qq|ALTER TABLE defaults ADD COLUMN vertreter           boolean DEFAULT false|);
 
  18   $self->db_query(qq|ALTER TABLE defaults ADD COLUMN parts_show_image    boolean DEFAULT true|);
 
  19   $self->db_query(qq|ALTER TABLE defaults ADD COLUMN parts_listing_image boolean DEFAULT true|);
 
  20   $self->db_query(qq|ALTER TABLE defaults ADD COLUMN parts_image_css     text    DEFAULT 'border:0;float:left;max-width:250px;margin-top:20px:margin-right:10px;margin-left:10px;'|);
 
  22   # check current configuration and set default variables accordingly, so that
 
  23   # kivitendo's behaviour isn't changed by this update
 
  24   my %old_defaults = ( parts_show_image => 1 );
 
  26   foreach my $check (qw(webdav vertreter parts_show_image parts_listing_image)) {
 
  27     my $check_set = exists $::lx_office_conf{features}->{$check} ? $::lx_office_conf{features}->{$check} : $old_defaults{$check};
 
  28     $self->db_query("UPDATE defaults SET $check = ?", bind => [ $check_set ? 1 : 0 ]);
 
  31   if (exists $::lx_office_conf{features}->{parts_image_css}) {
 
  32     my $update_column = "UPDATE defaults SET parts_image_css = ?";
 
  33     $self->db_query($update_column, bind => [ $::lx_office_conf{features}->{parts_image_css} ]);