From 833f083eae2a4547c49f8f92a2fdca6ba4dfe5f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 30 Sep 2014 11:28:18 +0200 Subject: [PATCH] =?utf8?q?Konfigurierbares=20Angebotsg=C3=BCltigkeits-Inte?= =?utf8?q?rvall=20hinzugef=C3=BCgt=20Standardm=C3=A4ssig=20ist=20ein=20Ver?= =?utf8?q?kaufsangebot=20bis=20zum=20n=C3=A4chsten=20Werktag=20g=C3=BCltig?= =?utf8?q?.=20Dieses=20Intervall=20wird=20dann=20noch=20hinzugerechnet,=20?= =?utf8?q?bspw.=20n=C3=A4chster=20Werktag=20plus=2014,=2028=20etc.=20Falls?= =?utf8?q?=20das=20Intervall=20nicht=20gesetzt=20oder=20wir=20nicht=20den?= =?utf8?q?=20Typ=20sales=5Fquotation=20haben,=20passiert=20nichts.=20Der?= =?utf8?q?=20Datentyp=20ist=20Integer,=20Tippfehler=20werden=20bisher=20nu?= =?utf8?q?r=20dort=20abgefangen=20(Wird=20wahrscheinlich=20nur=20einmalig?= =?utf8?q?=20von=20einem=20Kunden=20gesetzt).?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/MetaSetup/Default.pm | 1 + SL/OE.pm | 5 +++++ bin/mozilla/oe.pl | 6 +++++- locale/de/all | 2 ++ sql/Pg-upgrade2/defaults_reqdate_interval.pl | 19 +++++++++++++++++++ .../client_config/_posting_configuration.html | 5 +++++ 6 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 sql/Pg-upgrade2/defaults_reqdate_interval.pl diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 2822b86b7..6f9ea2b37 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -72,6 +72,7 @@ __PACKAGE__->meta->columns( profit_determination => { type => 'text' }, purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' }, purchase_order_show_delete => { type => 'boolean', default => 'true' }, + reqdate_interval => { type => 'integer', default => '0' }, 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 52a5a61d6..8e746f43c 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -795,6 +795,11 @@ sub retrieve { if (!$form->{id}) { my $wday = (localtime(time))[6]; my $next_workday = $wday == 5 ? 3 : $wday == 6 ? 2 : 1; + + # if we have a client configured interval for sales quotation, we add this + $next_workday += $::instance_conf->get_reqdate_interval if ($::instance_conf->get_reqdate_interval && + $form->{type} eq 'sales_quotation' ); + $query_add = qq|, current_date AS transdate, date(current_date + interval '${next_workday} days') AS reqdate|; } diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 2d64e3456..3f33c7f75 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -240,7 +240,7 @@ sub order_links { # get customer/vendor $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); - # retrieve order/quotation + # retrieve order/quotation and webdav config $form->{webdav} = $::instance_conf->get_webdav; my $editing = $form->{id}; @@ -1629,6 +1629,10 @@ sub save_as_new { my $wday = (localtime(time))[6]; my $next_workday = $wday == 5 ? 3 : $wday == 6 ? 2 : 1; + # if we have a client configured interval for sales quotation, we add this + $next_workday += $::instance_conf->get_reqdate_interval if ($::instance_conf->get_reqdate_interval && + $form->{type} eq 'sales_quotation' ); + my $query = 'SELECT date(current_date + interval \''. $next_workday .' days\') AS reqdate, date(current_date) AS transdate'; diff --git a/locale/de/all b/locale/de/all index 4a48544d1..733048ced 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2033,6 +2033,7 @@ $self->{texts} = { 'Sales Orders' => 'Aufträge', 'Sales Orders deleteable' => 'Kundenaufträge löschbar', 'Sales Price information' => 'Verkaufspreisinformation', + 'Sales Quotation valid interval' => 'Angebotsgültigkeitsintervall', 'Sales Quotations' => 'Angebote', 'Sales Report' => 'Verkaufsbericht', 'Sales and purchase invoices with inventory transactions with taxkeys' => 'Einkaufs- und Verkaufsrechnungen mit Warenbestandsbuchungen mit Steuerschlüsseln', @@ -2763,6 +2764,7 @@ $self->{texts} = { 'Updating the client fields in the database "#1" on host "#2:#3" failed.' => 'Die Aktualisierung der Mandantenfelder in der Datenbank "#1" auf Host "#2:#3" schlug fehl.', 'Uploaded at' => 'Hochgeladen um', 'Uploaded on #1, size #2 kB' => 'Am #1 hochgeladen, Größe #2 kB', + 'Usally the sales quotation is valid until the next working day. This entry will be added to this date (i.e. 14, 28).' => 'Standardmässig ist ein Verkaufsangebot bis zum nächsten Werktag gültig. Dieses Intervall wird dann noch hinzugerechnet, bspw. nächster Werktag plus 14, 28 etc.', 'Use As New' => 'Als neu verwenden', 'Use WebDAV Repository' => 'WebDAV-Ablage verwenden', 'Use existing templates' => 'Vorhandene Druckvorlagen verwenden', diff --git a/sql/Pg-upgrade2/defaults_reqdate_interval.pl b/sql/Pg-upgrade2/defaults_reqdate_interval.pl new file mode 100644 index 000000000..05335c632 --- /dev/null +++ b/sql/Pg-upgrade2/defaults_reqdate_interval.pl @@ -0,0 +1,19 @@ +# @tag: defaults_reqdate_interval +# @description: Einstellen der Angebotsgültigkeit per Intervall (z.B.: +28 Tage) +# @depends: release_3_1_0 +package SL::DBUpgrade2::defaults_reqdate_interval; + +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_interval integer DEFAULT 0|); + return 1; +} + +1; diff --git a/templates/webpages/client_config/_posting_configuration.html b/templates/webpages/client_config/_posting_configuration.html index 8096c8774..2d4733dc7 100644 --- a/templates/webpages/client_config/_posting_configuration.html +++ b/templates/webpages/client_config/_posting_configuration.html @@ -86,5 +86,10 @@ [% 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('Sales Quotation valid interval') %] + [% L.input_tag('defaults.reqdate_interval', LxERP.format_amount(SELF.defaults.reqdate_interval, 0), style=style) %] + [% LxERP.t8('Usally the sales quotation is valid until the next working day. This entry will be added to this date (i.e. 14, 28).') %] + -- 2.20.1