From: Jan Büren Date: Mon, 8 Mar 2021 12:59:37 +0000 (+0100) Subject: Mandantenkonfig: Lieferdatum bei VK-Auftrag und Gültigsdatum bei VK-Angebot X-Git-Tag: kivitendo-mebil_0.1-0~9^2~458 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=bee7d33fe47d29afeb4432b222fb1bf90c19e517;p=kivitendo-erp.git Mandantenkonfig: Lieferdatum bei VK-Auftrag und Gültigsdatum bei VK-Angebot Anstatt diese beiden Werte zu berechnen, gibt es die Möglichkeit diese konfigurativ gar nicht zu setzen. Hoffentlich letzmalig auch für die OE.pm implementiert. --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index ea92d4be9..04ec2e09d 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -71,7 +71,12 @@ sub action_add { $self->order->transdate(DateTime->now_local()); my $extra_days = $self->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : $self->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1; - $self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days)) if !$self->order->reqdate; + + if ( ($self->{type} eq 'sales_order' && $::instance_conf->get_deliverydate_on) + || ($self->{type} eq 'sales_quotation' && $::instance_conf->get_reqdate_on) + && (!$self->order->reqdate)) { + $self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days)); + } $self->pre_render(); @@ -220,11 +225,17 @@ sub action_save_as_new { ? DateTime->today_local : $order->transdate; - # Set new reqdate unless changed + # Set new reqdate unless changed if it is enabled in client config if ($order->reqdate == $saved_order->reqdate) { my $extra_days = $self->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : $self->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1; - $new_attrs{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days); + + if ( ($self->{type} eq 'sales_order' && !$::instance_conf->get_deliverydate_on) + || ($self->{type} eq 'sales_quotation' && !$::instance_conf->get_reqdate_on)) { + $new_attrs{reqdate} = ''; + } else { + $new_attrs{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days); + } } else { $new_attrs{reqdate} = $order->reqdate; } diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 790e054a0..c998dc4d4 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -56,6 +56,7 @@ __PACKAGE__->meta->columns( datev_check_on_sales_invoice => { type => 'boolean', default => 'true' }, datev_export_format => { type => 'enum', check_in => [ 'cp1252', 'cp1252-translit', 'utf-8' ], db_type => 'datev_export_format_enum', default => 'cp1252-translit' }, delivery_date_interval => { type => 'integer', default => '0' }, + deliverydate_on => { type => 'boolean', default => 'true' }, disabled_price_sources => { type => 'array' }, doc_delete_printfiles => { type => 'boolean', default => 'false' }, doc_files => { type => 'boolean', default => 'false' }, @@ -133,6 +134,7 @@ __PACKAGE__->meta->columns( purchase_order_show_delete => { type => 'boolean', default => 'true' }, quick_search_modules => { type => 'array' }, reqdate_interval => { type => 'integer', default => '0' }, + reqdate_on => { type => 'boolean', default => 'true' }, require_transaction_description_ps => { type => 'boolean', default => 'false', not_null => 1 }, requirement_spec_section_order_part_id => { type => 'integer' }, revtrans => { type => 'boolean', default => 'false' }, diff --git a/SL/OE.pm b/SL/OE.pm index a517e05d2..1b640e37b 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -986,7 +986,12 @@ sub _retrieve { if (!$form->{id}) { my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : $form->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1; - $form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo; + if ( ($form->{type} eq 'sales_order' && !$::instance_conf->get_deliverydate_on) + || ($form->{type} eq 'sales_quotation' && !$::instance_conf->get_reqdate_on)) { + $form->{reqdate} = ''; + } else { + $form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo; + } $form->{transdate} = DateTime->today_local->to_kivitendo; } diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 0fe1ffb9a..254d016ee 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1781,11 +1781,16 @@ sub save_as_new { if ( $saved_order && $saved_order->{reqdate} eq $form->{reqdate} && $saved_order->{transdate} eq $form->{transdate} ) { my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : $form->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1; + + if ( ($form->{type} eq 'sales_order' && !$::instance_conf->get_deliverydate_on) + || ($form->{type} eq 'sales_quotation' && !$::instance_conf->get_reqdate_on)) { + $form->{reqdate} = ''; + } else { $form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo; + } $form->{transdate} = DateTime->today_local->to_kivitendo; } } - # update employee $form->get_employee(); diff --git a/doc/changelog b/doc/changelog index 3c8780c86..efec8ec63 100644 --- a/doc/changelog +++ b/doc/changelog @@ -47,6 +47,7 @@ Kleinere neue Features und Detailverbesserungen: eines Loginnamens auch eine E-Mail-Adresse verwendet werden. Es ist nicht nötig, dass diese Adresse einem der Anwenderkonten zugeordnet ist. +- Lieferdatum und Gültigkeitsdatum können optional auch nicht mehr gesetzt werden Bugfixes (Tracker: https://www.kivitendo.de/redmine): 97 Benutzer löschen unter System->Benutzer funktioniert nicht diff --git a/locale/de/all b/locale/de/all index aac14961d..ef2994be6 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1649,6 +1649,8 @@ $self->{texts} = { 'If missing then the start date will be used.' => 'Falls es fehlt, so wird die erste Rechnung für das Startdatum erzeugt.', 'If one or more space separated serial numbers are assigned in a sales invoice, match the charge number of the inventory item. Assumes that Serial Number and Charge Number have 1:1 relation. Otherwise throw a error message for the default sales invoice transfer.' => 'Falls eine oder mehrere Leerzeichen separierte Seriennummern in Verkaufsrechnungen definiert sind, nutz diese als Chargennummern fürs Standard-Auslagern über Rechnung. Seriennummern und eingelagerte Chargen kommen jeweils exakt nur einmal vor. Falls die Chargennummer oder das Mengenverhältnis (1:1) in keinem Lagerort existiert wird eine Fehlermeldung beim Auslagern generiert.', 'If searching a part from a document and no part is found then offer to create a new part.' => 'Wenn bei der Artikelsuche aus einem Dokument heraus kein Artikel gefunden wird, dann wird ermöglicht, von dort aus einen neuen Artikel anzulegen.', + 'If set to no the \'delivery date\' field for sales orders won\'t be set at all.' => 'Falls der Wert auf Nein gesetzt wird, wird überhaupt kein Lieferdatum in Verkaufsaufträgen gesetzt', + 'If set to no the \'valid until\' field for sales quotation won\'t be set at all.' => 'Falls der Wert auf Nein gesetzt wird, wird überhaupt kein Gültigkeitsdatum bei Verkaufs-Angeboten gesetzt', 'If the article type is set to \'mixed\' then a column called \'part_type\' or called \'pclass\' must be present.' => 'Falls der Artikeltyp auf \'mixed\' gesetzt ist muss entweder eine Spalte \'part_type\' oder \'pclass\' im Import vorhanden sein', 'If the automatic creation of invoices for fees and interest is switched on for a dunning level then the following accounts will be used for the invoice.' => 'Wenn das automatische Erstellen einer Rechnung über Mahngebühren und Zinsen für ein Mahnlevel aktiviert ist, so werden die folgenden Konten für die Rechnung benutzt.', 'If the counted quantity differs more than this threshold from the quantity in the database, a warning will be shown. Set to 0 to switch of this feature.' => 'Wenn die gezählte Menge mehr als diesen Schwellenwert von der Menge in der Datenbank abweicht, wird eine Warnmeldung angezeigt. Setzen Sie den Schwellenwert auf 0, um dieses Feature abzuschalten.', @@ -2934,6 +2936,7 @@ $self->{texts} = { 'Set (set to)' => 'Setze', 'Set all source and memo fields' => 'Alle Beleg-/Memo-Felder setzen', 'Set count for one or more of the items to select them' => 'Zum Selektieren bitte Menge für einen oder mehrere Artikel setzen', + 'Set delivery date for Sales Orders' => 'Lieferdatum im Verkaufsauftrag setzen', 'Set eMail text' => 'E-Mail Text eingeben', 'Set fields' => 'Felder setzen', 'Set lastcost' => 'EK-Preis übernehmen', @@ -2941,6 +2944,7 @@ $self->{texts} = { 'Set the invoice duedate as the default execution date for SEPA export.' => 'Das Fälligkeitsdatum des Belegs als Ausführungsdatum im SEPA-Export setzen.', 'Set the invoice skonto date (if exists) as the default execution date for SEPA export.' => 'Das Skonto-Datum des Belegs als Ausführungsdatum im SEPA-Export setzen. Hat Priorität vor dem Fälligkeitsdatum.', 'Set to paid missing' => 'Fehlbetrag setzen', + 'Set valid until date for Sales Quotation' => 'Gültigkeitsdatum bei Verkaufs-Angeboten setzen', 'Settings' => 'Einstellungen', 'Setup Menu' => 'Menü-Variante', 'Ship to (database ID)' => 'Lieferadresse (Datenbank-ID)', diff --git a/locale/en/all b/locale/en/all index c7fe39b99..d79401c4b 100644 --- a/locale/en/all +++ b/locale/en/all @@ -1649,6 +1649,8 @@ $self->{texts} = { 'If missing then the start date will be used.' => '', 'If one or more space separated serial numbers are assigned in a sales invoice, match the charge number of the inventory item. Assumes that Serial Number and Charge Number have 1:1 relation. Otherwise throw a error message for the default sales invoice transfer.' => '', 'If searching a part from a document and no part is found then offer to create a new part.' => '', + 'If set to no the \'delivery date\' field for sales orders won\'t be set at all.' => '', + 'If set to no the \'valid until\' field for sales quotation won\'t be set at all.' => '', 'If the article type is set to \'mixed\' then a column called \'part_type\' or called \'pclass\' must be present.' => '', 'If the automatic creation of invoices for fees and interest is switched on for a dunning level then the following accounts will be used for the invoice.' => '', 'If the counted quantity differs more than this threshold from the quantity in the database, a warning will be shown. Set to 0 to switch of this feature.' => '', @@ -2934,6 +2936,7 @@ $self->{texts} = { 'Set (set to)' => '', 'Set all source and memo fields' => '', 'Set count for one or more of the items to select them' => '', + 'Set delivery date for Sales Orders' => '', 'Set eMail text' => '', 'Set fields' => '', 'Set lastcost' => '', @@ -2941,6 +2944,7 @@ $self->{texts} = { 'Set the invoice duedate as the default execution date for SEPA export.' => '', 'Set the invoice skonto date (if exists) as the default execution date for SEPA export.' => '', 'Set to paid missing' => '', + 'Set valid until date for Sales Quotation' => '', 'Settings' => '', 'Setup Menu' => '', 'Ship to (database ID)' => '', diff --git a/sql/Pg-upgrade2/defaults_req_delivery_date.pl b/sql/Pg-upgrade2/defaults_req_delivery_date.pl new file mode 100644 index 000000000..0ee0c96f2 --- /dev/null +++ b/sql/Pg-upgrade2/defaults_req_delivery_date.pl @@ -0,0 +1,20 @@ +# @tag: defaults_req_delivery_date +# @description: Einstellung ob Liefertermin oder Gültigkeitstermin überhaupt gesetzt werden soll +# @depends: release_3_5_6_1 +package SL::DBUpgrade2::defaults_req_delivery_date; + +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 reqdate_on boolean DEFAULT true|); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN deliverydate_on boolean DEFAULT true|); + return 1; +} + +1; diff --git a/templates/webpages/client_config/_posting_configuration.html b/templates/webpages/client_config/_posting_configuration.html index 824c9393c..91b425799 100644 --- a/templates/webpages/client_config/_posting_configuration.html +++ b/templates/webpages/client_config/_posting_configuration.html @@ -86,11 +86,21 @@ [% L.select_tag('defaults.balance_startdate_method', SELF.balance_startdate_method_options, value_key = 'value', title_key = 'title', default = SELF.defaults.balance_startdate_method) %] [% LxERP.t8('This option controls the method used for determining the startdate for the balance report.') %] + + [% LxERP.t8('Set valid until date for Sales Quotation') %] + [% L.yes_no_tag('defaults.reqdate_on', SELF.defaults.reqdate_on) %] + [% LxERP.t8("If set to no the 'valid until' field for sales quotation won't be set at all.") %] + [% LxERP.t8('Sales Quotation valid interval') %] [% L.input_tag('defaults.reqdate_interval', LxERP.format_amount(SELF.defaults.reqdate_interval, 0), style=style) %] [% LxERP.t8('Usually the sales quotation is valid until the next working day. If a value is set here then the quotation will be valid for at least that many days. The resulting date will be adjusted to the next working day if it ends up on a weekend.') %] + + [% LxERP.t8('Set delivery date for Sales Orders') %] + [% L.yes_no_tag('defaults.deliverydate_on', SELF.defaults.deliverydate_on) %] + [% LxERP.t8("If set to no the 'delivery date' field for sales orders won't be set at all.") %] + [% LxERP.t8('Sales Order delivery date interval') %] [% L.input_tag('defaults.delivery_date_interval', LxERP.format_amount(SELF.defaults.delivery_date_interval, 0), style=style) %]