From: Sven Schöling Date: Wed, 1 Oct 2014 15:08:38 +0000 (+0200) Subject: PriceSource: Konfiguration X-Git-Tag: release-3.2.0beta~159 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5384e5cb7568d04e61bb5c712d7953df046f3a2c;p=kivitendo-erp.git PriceSource: Konfiguration --- diff --git a/SL/Controller/ClientConfig.pm b/SL/Controller/ClientConfig.pm index 2279ef1da..eac695617 100644 --- a/SL/Controller/ClientConfig.pm +++ b/SL/Controller/ClientConfig.pm @@ -14,12 +14,13 @@ use SL::DB::Part; use SL::DB::Unit; use SL::Helper::Flash; use SL::Locale::String qw(t8); +use SL::PriceSource::ALL; use SL::Template; __PACKAGE__->run_before('check_auth'); use Rose::Object::MakeMethods::Generic ( - 'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates h_unit_name + 'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates all_price_sources h_unit_name posting_options payment_options accounting_options inventory_options profit_options accounts balance_startdate_method_options) ], ); @@ -36,6 +37,7 @@ sub action_save { my $defaults = delete($::form->{defaults}) || {}; my $entered_currencies = delete($::form->{currencies}) || []; my $original_currency_id = $self->defaults->currency_id; + $defaults->{disabled_price_sources} ||= []; # undef several fields if an empty value has been selected. foreach (qw(warehouse_id bin_id warehouse_id_ignore_onhand bin_id_ignore_onhand)) { @@ -203,6 +205,12 @@ sub init_accounts { return \%accounts; } +sub init_all_price_sources { + my @classes = SL::PriceSource::ALL->all_price_sources; + + [ map { [ $_->name, $_->description ] } @classes ]; +} + # # filters # @@ -218,6 +226,8 @@ sub check_auth { sub edit_form { my ($self) = @_; + $::request->layout->use_javascript("${_}.js") for qw(jquery.selectboxes jquery.multiselect2side); + $self->render('client_config/form', title => t8('Client Configuration'), make_chart_title => sub { $_[0]->accno . '--' . $_[0]->description }, make_templates_value => sub { 'templates/' . $_[0] }, diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 109aabe48..bf9e89c27 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -42,6 +42,7 @@ __PACKAGE__->meta->columns( datev_check_on_sales_invoice => { type => 'boolean', default => 'true' }, delivery_plan_calculate_transferred_do => { type => 'boolean', default => 'false', not_null => 1 }, delivery_plan_show_value_of_goods => { type => 'boolean', default => 'false', not_null => 1 }, + disabled_price_sources => { type => 'array' }, dunning_ar => { type => 'integer' }, dunning_ar_amount_fee => { type => 'integer' }, dunning_ar_amount_interest => { type => 'integer' }, diff --git a/SL/PriceSource.pm b/SL/PriceSource.pm index 9f7c11090..241ae045e 100644 --- a/SL/PriceSource.pm +++ b/SL/PriceSource.pm @@ -16,7 +16,7 @@ sub all_price_sources { return map { $_->new(record_item => $self->record_item, record => $self->record) - } SL::PriceSource::ALL->all_price_sources + } SL::PriceSource::ALL->all_enabled_price_sources } sub price_from_source { diff --git a/SL/PriceSource/ALL.pm b/SL/PriceSource/ALL.pm index 33a7e447d..3d9813ef7 100644 --- a/SL/PriceSource/ALL.pm +++ b/SL/PriceSource/ALL.pm @@ -17,6 +17,12 @@ my @price_sources_order = qw( makemodel ); +sub all_enabled_price_sources { + my %disabled = map { $_ => 1 } @{ $::instance_conf->get_disabled_price_sources }; + + map { $price_sources_by_name{$_} } grep { !$disabled{$_} } @price_sources_order; +} + sub all_price_sources { map { $price_sources_by_name{$_} } @price_sources_order; } diff --git a/locale/de/all b/locale/de/all index dd175a9c7..c45b0ede4 100755 --- a/locale/de/all +++ b/locale/de/all @@ -205,6 +205,7 @@ $self->{texts} = { 'All groups' => 'Alle Gruppen', 'All of the exports you have selected were already closed.' => 'Alle von Ihnen ausgewählten Exporte sind bereits abgeschlossen.', 'All partsgroups' => 'Alle Warengruppen', + 'All price sources' => 'Alle Preisquellen', 'All reports' => 'Alle Berichte (Kontenübersicht, Summen- u. Saldenliste, GuV, BWA, Bilanz, Projektbuchungen)', 'All the other clients will start with an empty set of WebDAV folders.' => 'Alle anderen Mandanten werden mit einem leeren Satz von WebDAV-Ordnern ausgestattet.', 'All the selected exports have already been closed, or all of their items have already been executed.' => 'Alle ausgewählten Exporte sind als abgeschlossen markiert, oder für alle Einträge wurden bereits Zahlungen verbucht.', @@ -829,6 +830,7 @@ $self->{texts} = { 'Difference' => 'Differenz', 'Dimensions' => 'Abmessungen', 'Directory' => 'Verzeichnis', + 'Disabled Price Sources' => 'Deaktivierte Preisquellen', 'Discard duplicate entries in CSV file' => 'Doppelte Einträge in CSV-Datei verwerfen', 'Discard entries with duplicates in database or CSV file' => 'Einträge aus CSV-Datei verwerfen, die es bereits in der Datenbank oder der CSV-Datei gibt', 'Discount' => 'Rabatt', @@ -1837,6 +1839,7 @@ $self->{texts} = { 'Price Factor' => 'Preisfaktor', 'Price Factors' => 'Preisfaktoren', 'Price Source' => 'Preisquelle', + 'Price Sources to be disabled in this client' => 'Preisquellen die in diesem Mandanten deaktiviert werden sollen', 'Price factor (database ID)' => 'Preisfaktor (Datenbank-ID)', 'Price factor (name)' => 'Preisfaktor (Name)', 'Price factor deleted!' => 'Preisfaktor gelöscht.', @@ -1844,6 +1847,7 @@ $self->{texts} = { 'Price group (database ID)' => 'Preisgruppe (Datenbank-ID)', 'Price group (name)' => 'Preisgruppe (Name) ', 'Price information' => 'Preisinformation', + 'Price sources deactivated in this client' => 'Preisquellen die in diesem Mandanten deaktiviert sind', 'Pricegroup' => 'Preisgruppe', 'Pricegroup deleted!' => 'Preisgruppe gelöscht!', 'Pricegroup missing!' => 'Preisgruppe fehlt!', diff --git a/sql/Pg-upgrade2/price_source_client_config.sql b/sql/Pg-upgrade2/price_source_client_config.sql new file mode 100644 index 000000000..7bcac1aee --- /dev/null +++ b/sql/Pg-upgrade2/price_source_client_config.sql @@ -0,0 +1,6 @@ +-- @tag: price_source_client_config +-- @description: Preisquellen: Preisquellen ausschaltbar per Mandant +-- @depends: release_3_1_0 +-- @encoding: utf-8 + +ALTER TABLE defaults ADD disabled_price_sources TEXT[]; diff --git a/templates/webpages/client_config/_features.html b/templates/webpages/client_config/_features.html index 3be32743a..f081ca261 100644 --- a/templates/webpages/client_config/_features.html +++ b/templates/webpages/client_config/_features.html @@ -124,5 +124,17 @@ [% L.part_picker('defaults.transport_cost_reminder_article_number_id', SELF.defaults.transport_cost_reminder_article_number_id, style=style) %] [% LxERP.t8('Before saving a sales order, this article will be checked and a warning is generated.') %] + + [% LxERP.t8("Disabled Price Sources") %] + + [% 'Price Sources to be disabled in this client' | $T8 %] + +
+ [% L.select_tag("defaults.disabled_price_sources[]", SELF.all_price_sources, id="defaults_price_sources", multiple=1, default=SELF.defaults.disabled_price_sources) %] + [% L.multiselect2side("defaults_price_sources", labelsx=LxERP.t8("All price sources"), labeldx=LxERP.t8("Price sources deactivated in this client")) %] +
+ + +