From a0da7f1d521283359ccb3bf79ab52157c0cdc043 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 27 Jun 2013 15:53:36 +0200 Subject: [PATCH] "konfigurierbare Feature nach defaults migriert (trac 2300) und Dokumentenbelege (2301) in Webdav speichern" SQL-Upgrade und Edit-Maske. Fehlen noch einige Teile. --- sql/Pg-upgrade2/defaults_feature.pl | 36 +++++++++++++++++++ .../webpages/client_config/_features.html | 35 ++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 sql/Pg-upgrade2/defaults_feature.pl create mode 100644 templates/webpages/client_config/_features.html diff --git a/sql/Pg-upgrade2/defaults_feature.pl b/sql/Pg-upgrade2/defaults_feature.pl new file mode 100644 index 000000000..c46ff3ac3 --- /dev/null +++ b/sql/Pg-upgrade2/defaults_feature.pl @@ -0,0 +1,36 @@ +# @tag: defaults_feature +# @description: Einstellen der Feature vom Config-File in die DB verlagern. +# @depends: release_3_0_0 +package SL::DBUpgrade2::defaults_feature; + +use utf8; + +use parent qw(SL::DBUpgrade2::Base); +use strict; + +sub run { + my ($self) = @_; + + # this query will fail if column already exist (new database) + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN webdav boolean DEFAULT false|); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN webdav_documents boolean DEFAULT false|); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN vertreter boolean DEFAULT false|); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN parts_show_image boolean DEFAULT true|); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN parts_listing_image boolean DEFAULT true|); + $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;'|); + + # check current configuration and set default variables accordingly, so that + # kivitendo's behaviour isn't changed by this update + # if checks are not set in config set it to true + foreach my $check (qw(webdav vertreter parts_show_image parts_listing_image)) { + my $check_set = $::lx_office_conf{features}->{$check} ? 1 : 0; + $self->db_query("UPDATE defaults SET $check = ?", bind => [ $check_set ]); + } + + my $update_column = "UPDATE defaults SET parts_image_css = ?"; + $self->db_query($update_column, bind => [ $::lx_office_conf{features}->{parts_image_css} ]); + + return 1; +} + +1; diff --git a/templates/webpages/client_config/_features.html b/templates/webpages/client_config/_features.html new file mode 100644 index 000000000..0b71500dd --- /dev/null +++ b/templates/webpages/client_config/_features.html @@ -0,0 +1,35 @@ +[%- USE LxERP -%][%- USE L -%] +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% LxERP.t8('Webdav') %][% L.yes_no_tag('defaults.webdav', SELF.defaults.webdav) %][% LxERP.t8('Use Webdav Repository') %]
[% LxERP.t8('Webdav save documents') %][% L.yes_no_tag('defaults.webdav_documents', SELF.defaults.webdav_documents) %][% LxERP.t8('Save document in webdav repository') %]
[% LxERP.t8('Vertreter') %][% L.yes_no_tag('defaults.vertreter', SELF.defaults.vertreter) %][% LxERP.t8('Representative for Customer') %]
[% LxERP.t8('Pictures for parts') %][% L.yes_no_tag('defaults.parts_show_image', SELF.defaults.parts_show_image) %][% LxERP.t8('Show the picture in the part form') %]
[% LxERP.t8('Pictures for search parts') %][% L.yes_no_tag('defaults.parts_listing_image', SELF.defaults.parts_listing_image) %][% LxERP.t8('Show the pictures in the result for search parts') %]
[% LxERP.t8('CSS style for pictures') %] [% L.input_tag('defaults.parts_image_css', SELF.defaults.parts_image_css, style=style) %][% LxERP.t8('Style the picture with the following CSS code') %]
+
-- 2.20.1