From f552f878c85828a408d7f32afbbc1e714270b85f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 10 Jun 2013 13:33:20 +0200 Subject: [PATCH] =?utf8?q?Buchungen=20in=20unrealistischen=20Zukunfts-Inte?= =?utf8?q?rvallen=20vermeiden=20s.a.=20Trac=201897=20Hinzuf=C3=BCgen=20ein?= =?utf8?q?es=20neuen=20defaults=20"max=5Ffuture=5Fbooking=5Finterval".=20E?= =?utf8?q?ntsprechend=20editierbar=20wie=20closedto?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/MetaSetup/Default.pm | 126 +++++++++--------- SL/Form.pm | 20 ++- SL/InstanceConfiguration.pm | 9 ++ locale/de/all | 4 +- .../defaults_add_max_future_booking_date.sql | 6 + templates/webpages/am/audit_control.html | 4 + 6 files changed, 104 insertions(+), 65 deletions(-) create mode 100644 sql/Pg-upgrade2/defaults_add_max_future_booking_date.sql diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index cbacbf4ee..7d6c7b86d 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -10,77 +10,77 @@ __PACKAGE__->meta->setup( table => 'defaults', columns => [ - inventory_accno_id => { type => 'integer' }, - income_accno_id => { type => 'integer' }, - expense_accno_id => { type => 'integer' }, - fxgain_accno_id => { type => 'integer' }, - fxloss_accno_id => { type => 'integer' }, - invnumber => { type => 'text' }, - sonumber => { type => 'text' }, - weightunit => { type => 'varchar', length => 5 }, - businessnumber => { type => 'text' }, - version => { type => 'varchar', length => 8 }, - closedto => { type => 'date' }, - revtrans => { type => 'boolean', default => 'false' }, - ponumber => { type => 'text' }, - sqnumber => { type => 'text' }, - rfqnumber => { type => 'text' }, - customernumber => { type => 'text' }, - vendornumber => { type => 'text' }, - audittrail => { type => 'boolean', default => 'false' }, - articlenumber => { type => 'text' }, - servicenumber => { type => 'text' }, - coa => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - rmanumber => { type => 'text' }, - cnnumber => { type => 'text' }, - dunning_ar_amount_fee => { type => 'integer' }, - dunning_ar_amount_interest => { type => 'integer' }, - dunning_ar => { type => 'integer' }, - pdonumber => { type => 'text' }, - sdonumber => { type => 'text' }, - ar_paid_accno_id => { type => 'integer' }, - id => { type => 'serial', not_null => 1 }, - language_id => { type => 'integer' }, - accounting_method => { type => 'text' }, - inventory_system => { type => 'text' }, - profit_determination => { type => 'text' }, - datev_check_on_sales_invoice => { type => 'boolean', default => 'true' }, - datev_check_on_purchase_invoice => { type => 'boolean', default => 'true' }, - datev_check_on_ar_transaction => { type => 'boolean', default => 'true' }, - datev_check_on_ap_transaction => { type => 'boolean', default => 'true' }, - datev_check_on_gl_transaction => { type => 'boolean', default => 'true' }, - payments_changeable => { type => 'integer', default => '0', not_null => 1 }, - is_changeable => { type => 'integer', default => 2, not_null => 1 }, - ir_changeable => { type => 'integer', default => 2, not_null => 1 }, - ar_changeable => { type => 'integer', default => 2, not_null => 1 }, - ap_changeable => { type => 'integer', default => 2, not_null => 1 }, - gl_changeable => { type => 'integer', default => 2, not_null => 1 }, - show_bestbefore => { type => 'boolean', default => 'false' }, - sales_order_show_delete => { type => 'boolean', default => 'true' }, - purchase_order_show_delete => { type => 'boolean', default => 'true' }, - sales_delivery_order_show_delete => { type => 'boolean', default => 'true' }, - purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' }, - is_show_mark_as_paid => { type => 'boolean', default => 'true' }, - ir_show_mark_as_paid => { type => 'boolean', default => 'true' }, - ar_show_mark_as_paid => { type => 'boolean', default => 'true' }, - ap_show_mark_as_paid => { type => 'boolean', default => 'true' }, - assemblynumber => { type => 'text' }, - warehouse_id => { type => 'integer' }, - bin_id => { type => 'integer' }, - currency_id => { type => 'integer', not_null => 1 }, - show_weight => { type => 'boolean', default => 'false', not_null => 1 }, + inventory_accno_id => { type => 'integer' }, + income_accno_id => { type => 'integer' }, + expense_accno_id => { type => 'integer' }, + fxgain_accno_id => { type => 'integer' }, + fxloss_accno_id => { type => 'integer' }, + invnumber => { type => 'text' }, + sonumber => { type => 'text' }, + weightunit => { type => 'varchar', length => 5 }, + businessnumber => { type => 'text' }, + version => { type => 'varchar', length => 8 }, + closedto => { type => 'date' }, + revtrans => { type => 'boolean', default => 'false' }, + ponumber => { type => 'text' }, + sqnumber => { type => 'text' }, + rfqnumber => { type => 'text' }, + customernumber => { type => 'text' }, + vendornumber => { type => 'text' }, + audittrail => { type => 'boolean', default => 'false' }, + articlenumber => { type => 'text' }, + servicenumber => { type => 'text' }, + coa => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + rmanumber => { type => 'text' }, + cnnumber => { type => 'text' }, + dunning_ar_amount_fee => { type => 'integer' }, + dunning_ar_amount_interest => { type => 'integer' }, + dunning_ar => { type => 'integer' }, + pdonumber => { type => 'text' }, + sdonumber => { type => 'text' }, + ar_paid_accno_id => { type => 'integer' }, + id => { type => 'serial', not_null => 1 }, + language_id => { type => 'integer' }, + accounting_method => { type => 'text' }, + inventory_system => { type => 'text' }, + profit_determination => { type => 'text' }, + datev_check_on_sales_invoice => { type => 'boolean', default => 'true' }, + datev_check_on_purchase_invoice => { type => 'boolean', default => 'true' }, + datev_check_on_ar_transaction => { type => 'boolean', default => 'true' }, + datev_check_on_ap_transaction => { type => 'boolean', default => 'true' }, + datev_check_on_gl_transaction => { type => 'boolean', default => 'true' }, + payments_changeable => { type => 'integer', default => '0', not_null => 1 }, + is_changeable => { type => 'integer', default => 2, not_null => 1 }, + ir_changeable => { type => 'integer', default => 2, not_null => 1 }, + ar_changeable => { type => 'integer', default => 2, not_null => 1 }, + ap_changeable => { type => 'integer', default => 2, not_null => 1 }, + gl_changeable => { type => 'integer', default => 2, not_null => 1 }, + show_bestbefore => { type => 'boolean', default => 'false' }, + sales_order_show_delete => { type => 'boolean', default => 'true' }, + purchase_order_show_delete => { type => 'boolean', default => 'true' }, + sales_delivery_order_show_delete => { type => 'boolean', default => 'true' }, + purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' }, + is_show_mark_as_paid => { type => 'boolean', default => 'true' }, + ir_show_mark_as_paid => { type => 'boolean', default => 'true' }, + ar_show_mark_as_paid => { type => 'boolean', default => 'true' }, + ap_show_mark_as_paid => { type => 'boolean', default => 'true' }, + max_future_booking_interval => { type => 'integer', default => 360 }, + assemblynumber => { type => 'text' }, + warehouse_id => { type => 'integer' }, + bin_id => { type => 'integer' }, + show_weight => { type => 'boolean', default => 'false', not_null => 1 }, transfer_default => { type => 'boolean', default => 'true' }, transfer_default_use_master_default_bin => { type => 'boolean', default => 'false' }, transfer_default_ignore_onhand => { type => 'boolean', default => 'false' }, warehouse_id_ignore_onhand => { type => 'integer' }, bin_id_ignore_onhand => { type => 'integer' }, - ], + currency_id => { type => 'integer', not_null => 1 }, + ], primary_key_columns => [ 'id' ], - allow_inline_column_values => 1, foreign_keys => [ bin => { class => 'SL::DB::Bin', diff --git a/SL/Form.pm b/SL/Form.pm index 5a2b38df2..07702fbfc 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1,4 +1,4 @@ -#==================================================================== +#========= =========================================================== # LX-Office ERP # Copyright (C) 2004 # Based on SQL-Ledger Version 2.1.9 @@ -1455,6 +1455,24 @@ sub date_closed { return $closed; } +# prevents bookings to the to far away future +sub date_max_future { + $main::lxdebug->enter_sub(); + + my ($self, $date, $myconfig) = @_; + my $dbh = $self->dbconnect($myconfig); + + my $query = "SELECT 1 FROM defaults WHERE ? - current_date > max_future_booking_interval"; + my $sth = prepare_execute_query($self, $dbh, $query, conv_date($date)); + + my ($max_future_booking_interval) = $sth->fetchrow_array; + + $main::lxdebug->leave_sub(); + + return $max_future_booking_interval; +} + + sub update_balance { $main::lxdebug->enter_sub(); diff --git a/SL/InstanceConfiguration.pm b/SL/InstanceConfiguration.pm index 97ece8670..d0b6b3a82 100644 --- a/SL/InstanceConfiguration.pm +++ b/SL/InstanceConfiguration.pm @@ -178,6 +178,12 @@ sub get_transfer_default_ignore_onhand { my ($self) = @_; return ($self->{data}->{transfer_default_ignore_onhand}); } +# currently unused - value is set via audit_control (Bücherkontrolle) +sub get_max_future_booking_interval { + my ($self) = @_; + return ($self->{data}->{max_future_booking_interval}); +} + 1; @@ -320,6 +326,9 @@ current stock quantity Returns the default behavior for the transfer out default feature (true or false) +=item C + +Returns the maximum interval value for future bookings =back diff --git a/locale/de/all b/locale/de/all index a36239bd3..d15ba8161 100755 --- a/locale/de/all +++ b/locale/de/all @@ -388,6 +388,7 @@ $self->{texts} = { 'Cannot post payment for a closed period!' => 'Es können keine Zahlungen für abgeschlossene Bücher gebucht werden!', 'Cannot post payment!' => 'Zahlung kann nicht gebucht werden!', 'Cannot post storno for a closed period!' => 'Für einen geschlossenen Zeitraum können keine Stornos gebucht werden!', + 'Cannot post transaction above the maximum future booking date!' => 'Das Buchungsdatum liegt oberhalb des maximal zulässigen Werts. Bitte korrigieren oder Wert erhöhen', 'Cannot post transaction for a closed period!' => 'Für einen bereits abgeschlossenen Zeitraum kann keine Buchung angelegt werden!', 'Cannot post transaction with a debit and credit entry for the same account!' => 'Kann Soll und Haben nicht auf dasselbe Konto buchen!', 'Cannot post transaction!' => 'Rechnung kann nicht gebucht werden!', @@ -824,7 +825,7 @@ $self->{texts} = { 'Employee' => 'Bearbeiter', 'Employee #1 saved!' => 'Benutzer #1 gespeichert!', 'Employees' => 'Benutzer', - 'Empty selection for warehouse will not be added, even if the old bin is still visible (use back and forth to edit again).' => '', + 'Empty selection for warehouse will not be added, even if the old bin is still visible (use back and forth to edit again).' => 'Leere Lager-Auswahl wird ignoriert, selbst wenn noch ein Lagerplatz ausgewählt ist. Alle Daten können durch zurück und vorwärts korrigiert werden.', 'Empty transaction!' => 'Buchung ist leer!', 'End date' => 'Enddatum', 'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.', @@ -1223,6 +1224,7 @@ $self->{texts} = { 'Master Data' => 'Stammdaten', 'Master Data Bin Text Deleted' => 'Gelöschte Stammdaten Freitext-Lagerplätze', 'Max. Dunning Level' => 'höchste Mahnstufe', + 'Maximum future booking interval' => 'Maximale Anzahl von Tagen an denen Buchungen in der Zukunft erlaubt sind.', 'May' => 'Mai', 'May ' => 'Mai', 'May set the BCC field when sending emails' => 'Beim Verschicken von Emails das Feld \'BCC\' setzen', diff --git a/sql/Pg-upgrade2/defaults_add_max_future_booking_date.sql b/sql/Pg-upgrade2/defaults_add_max_future_booking_date.sql new file mode 100644 index 000000000..ad77a8225 --- /dev/null +++ b/sql/Pg-upgrade2/defaults_add_max_future_booking_date.sql @@ -0,0 +1,6 @@ +-- @tag: defaults_add_max_future_booking_intervall +-- @description: Fehleingaben für Buchungen in der Zukunft verhindern (s.a. 1897) +-- @depends: release_3_0_0 +-- @charset: utf-8 + +ALTER TABLE defaults ADD COLUMN max_future_booking_interval integer DEFAULT 360; diff --git a/templates/webpages/am/audit_control.html b/templates/webpages/am/audit_control.html index 761cc0ee1..bd127f2c3 100644 --- a/templates/webpages/am/audit_control.html +++ b/templates/webpages/am/audit_control.html @@ -12,6 +12,10 @@ [% 'Close Books up to' | $T8 %] [% L.date_tag('closedto', closedto) %] + + [% 'Maximum future booking interval' | $T8 %] + +
-- 2.20.1