From 4ac2976f86e7747ecf69a4e7b64f155343e984ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 5 Nov 2012 12:27:04 +0100 Subject: [PATCH] =?utf8?q?=C3=84nderbarkeit=20und=20L=C3=B6schbarkeit=20vo?= =?utf8?q?n=20Belegen=20in=20Mandantenkonfiguration=20einstellbar.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/ClientConfig.pm | 7 ++++ SL/DB/MetaSetup/Default.pm | 5 +++ SL/InstanceConfiguration.pm | 39 +++++++++++++++++++ bin/mozilla/ap.pl | 4 +- bin/mozilla/ar.pl | 4 +- bin/mozilla/gl.pl | 4 +- bin/mozilla/ir.pl | 4 +- bin/mozilla/is.pl | 4 +- locale/de/all | 10 +++++ locale/de_DE/all | 10 +++++ locale/en/all | 10 +++++ .../defaults_posting_records_config.sql | 10 +++++ templates/webpages/client_config/form.html | 34 ++++++++++++++++ 13 files changed, 140 insertions(+), 5 deletions(-) create mode 100644 sql/Pg-upgrade2/defaults_posting_records_config.sql diff --git a/SL/Controller/ClientConfig.pm b/SL/Controller/ClientConfig.pm index 2047077f7..0e424de69 100644 --- a/SL/Controller/ClientConfig.pm +++ b/SL/Controller/ClientConfig.pm @@ -12,6 +12,9 @@ __PACKAGE__->run_before('check_auth'); sub action_edit { my ($self, %params) = @_; + $self->{posting_options} = [ { title => $::locale->text("never"), value => 0 }, + { title => $::locale->text("every time"), value => 1 }, + { title => $::locale->text("on the same day"), value => 2 }, ]; $self->{payment_options} = [ { title => $::locale->text("never"), value => 0 }, { title => $::locale->text("every time"), value => 1 }, { title => $::locale->text("on the same day"), value => 2 }, ]; @@ -22,6 +25,8 @@ sub action_edit { $self->{profit_options} = [ { title => $::locale->text("balance"), value => "balance" }, { title => $::locale->text("income"), value => "income" }, ]; + map { $self->{$_} = SL::DB::Default->get->$_ } qw(is_changeable ir_changeable ar_changeable ap_changeable gl_changeable); + $self->{payments_changeable} = SL::DB::Default->get->payments_changeable; map { $self->{$_} = SL::DB::Default->get->$_ } qw(accounting_method inventory_system profit_determination); @@ -41,6 +46,8 @@ sub action_edit { sub action_save { my ($self, %params) = @_; + map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(is_changeable ir_changeable ar_changeable ap_changeable gl_changeable); + SL::DB::Default->get->update_attributes('payments_changeable' => $::form->{payments_changeable}); map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(accounting_method inventory_system profit_determination); diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 0822368bf..2e543fcc4 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -54,6 +54,11 @@ __PACKAGE__->meta->setup( 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' }, + 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 }, ], primary_key_columns => [ 'id' ], diff --git a/SL/InstanceConfiguration.pm b/SL/InstanceConfiguration.pm index 58025ce57..0f364086f 100644 --- a/SL/InstanceConfiguration.pm +++ b/SL/InstanceConfiguration.pm @@ -49,6 +49,31 @@ sub get_profit_determination { return $self->{data}->{profit_determination}; } +sub get_is_changeable { + my ($self) = @_; + return $self->{data}->{is_changeable}; +} + +sub get_ir_changeable { + my ($self) = @_; + return $self->{data}->{ir_changeable}; +} + +sub get_ar_changeable { + my ($self) = @_; + return $self->{data}->{ar_changeable}; +} + +sub get_ap_changeable { + my ($self) = @_; + return $self->{data}->{ap_changeable}; +} + +sub get_gl_changeable { + my ($self) = @_; + return $self->{data}->{gl_changeable}; +} + sub get_datev_check_on_sales_invoice { my ($self) = @_; return $self->{data}->{datev_check_on_sales_invoice}; @@ -131,6 +156,20 @@ Returns the default inventory system, perpetual or periodic Returns the default profit determination method, balance or income + +=item C + +=item C + +=item C + +=item C + +=item C + +Returns if and when these record types are changeable or deleteable after +posting. 0 means never, 1 means always and 2 means on the same day. + =item C Returns true if datev check should be performed on sales invoices diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 821949b2a..f5f518e07 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -239,7 +239,9 @@ sub form_header { } my $readonly = ($form->{id}) ? "readonly" : ""; - $form->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; + $form->{radier} = ($::instance_conf->get_ap_changeable == 2) + ? ($form->current_date(\%myconfig) eq $form->{gldate}) + : ($::instance_conf->get_ap_changeable == 1); $readonly = ($form->{radier}) ? "" : $readonly; $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'sell'); diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 1bae80b98..834e1b18e 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -252,7 +252,9 @@ sub form_header { #/show history button js $readonly = ($form->{id}) ? "readonly" : ""; - $form->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; + $form->{radier} = ($::instance_conf->get_ar_changeable == 2) + ? ($form->current_date(\%myconfig) eq $form->{gldate}) + : ($::instance_conf->get_ar_changeable == 1); $readonly = ($form->{radier}) ? "" : $readonly; # set option selected diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index a46cad00c..719f22209 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -903,7 +903,9 @@ sub form_footer { $follow_ups_due = sum map { $_->{due} * 1 } @{ $follow_ups || [] }; } - my $radieren = $::form->current_date(\%::myconfig) eq $::form->{gldate}; + my $radieren = ($::instance_conf->get_gl_changeable == 2) + ? ($::form->current_date(\%::myconfig) eq $::form->{gldate}) + : ($::instance_conf->get_gl_changeable == 1); print $::form->parse_html_template('gl/form_footer', { radieren => $radieren, diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 86910c52d..554d2fd4f 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -440,7 +440,9 @@ sub form_footer { totalpaid => $totalpaid, paid_missing => $form->{invtotal} - $totalpaid, show_storno => $form->{id} && !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap") && !$totalpaid, - show_delete => ($form->current_date(\%myconfig) eq $form->{gldate}), + show_delete => ($::instance_conf->get_ir_changeable == 2) + ? ($form->current_date(\%myconfig) eq $form->{gldate}) + : ($::instance_conf->get_ir_changeable == 1), }); ##print $form->parse_html_template('ir/_payments'); # parser ##print $form->parse_html_template('webdav/_list'); # parser diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index bc95adb3b..14c242000 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -472,7 +472,9 @@ sub form_footer { paid_missing => $form->{invtotal} - $totalpaid, print_options => print_options(inline => 1), show_storno => $form->{id} && !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ar") && !$totalpaid, - show_delete => ($form->current_date(\%myconfig) eq $form->{gldate}), + show_delete => ($::instance_conf->get_is_changeable == 2) + ? ($form->current_date(\%myconfig) eq $form->{gldate}) + : ($::instance_conf->get_is_changeable == 1), }); ##print $form->parse_html_template('is/_payments'); # parser ##print $form->parse_html_template('webdav/_list'); # parser diff --git a/locale/de/all b/locale/de/all index 088fe6723..76497b5da 100644 --- a/locale/de/all +++ b/locale/de/all @@ -48,12 +48,14 @@ $self->{texts} = { 'AP Transaction Storno (one letter abbreviation)' => 'S', 'AP Transaction with Storno (abbreviation)' => 'K(S)', 'AP Transactions' => 'Kreditorenbuchungen', + 'AP transactions changeable' => 'Änderbarkeit von Kreditorenbuchungen', 'AP transactions with sales taxkeys and/or AR transactions with input taxkeys' => 'Kreditorenbuchungen mit Umsatzsteuer-Steuerschlüsseln und/oder Debitorenbuchungen mit Vorsteuer-Steuerschlüsseln', 'AR' => 'Verkauf', 'AR Aging' => 'Offene Forderungen', 'AR Transaction' => 'Debitorenbuchung', 'AR Transaction (abbreviation)' => 'D', 'AR Transactions' => 'Debitorenbuchungen', + 'AR transactions changeable' => 'Änderbarkeit von Debitorenbuchungen', 'ASSETS' => 'AKTIVA', 'ATTENTION! If you enabled this feature you can not simply turn it off again without taking care that best_before fields are emptied in the database.' => 'ACHTUNG! Wenn Sie diese Einstellung aktivieren, dann können Sie sie später nicht ohne Weiteres deaktivieren, ohne dafür zu sorgen, dass die Felder der Mindeshaltbarkeitsdaten in der Datenbank leer gemacht werden.', 'ATTENTION! You can not simply change it from periodic to perpetual once you started posting.' => 'ACHTUNG! Es kann nicht ohne Weiteres im laufenden Betrieb von der Aufwandsmethode zur Bestandsmethode gewechselt werden.', @@ -912,6 +914,7 @@ $self->{texts} = { 'Full access to all functions' => 'Vollzugriff auf alle Funktionen', 'Fwd' => 'Vorwärts', 'GL Transaction' => 'Dialogbuchung', + 'GL transactions changeable' => 'Änderbarkeit von Dialogbuchungen', 'Gegenkonto' => 'Gegenkonto', 'Gender' => 'Geschlecht', 'General Ledger' => 'Finanzbuchhaltung', @@ -1504,6 +1507,7 @@ $self->{texts} = { 'Purchase Prices' => 'Einkaufspreise', 'Purchase delivery order' => 'Lieferschein (Einkauf)', 'Purchase invoices' => 'Einkaufsrechnungen', + 'Purchase invoices changeable' => 'Änderbarkeit von Einkaufsrechnunen', 'Purchase net amount' => 'EK-Betrag', 'Purchase price' => 'EK-Preis', 'Purchase price total' => 'EK-Betrag', @@ -1611,6 +1615,7 @@ $self->{texts} = { 'Sales delivery order' => 'Lieferschein (Verkauf)', 'Sales invoice number' => 'Ausgangsrechnungsnummer', 'Sales invoices' => 'Verkaufsrechnungen', + 'Sales invoices changeable' => 'Änderbarkeit von Verkaufsrechnungen', 'Sales margin' => 'Marge', 'Sales margin %' => 'Marge prozentual', 'Sales net amount' => 'VK-Betrag', @@ -1700,7 +1705,12 @@ $self->{texts} = { 'Shipto is in use and was flagged invalid.' => 'Lieferadresse ist noch in Verwendung, und wurde als ungültig markiert.', 'Shopartikel' => 'Shopartikel', 'Short' => 'Knapp', + 'Should ap transactions be and when should they be changeable or deleteable after posting?' => 'Sollen Kreditorenbuchungen nach der Buchung zu ändern oder zu löschen sein?', + 'Should ar transactions be and when should they be changeable or deleteable after posting?' => 'Sollen Debitorenbuchungen nach der Buchung zu ändern oder zu löschen sein?', + 'Should gl transactions be and when should they be changeable or deleteable after posting?' => 'Sollen Dialogbuchungen nach der Buchung zu ändern oder zu löschen sein?', 'Should payments be and when should they be changeable after posting?' => 'Sollen Zahlungen nach dem Buchen änderbar sein, und wenn ja, wann?', + 'Should purchase invoices be and when should they be deleteable after posting?' => 'Sollen Einkaufsrechnungen nach der Buchung zu löschen sein?', + 'Should sales invoices be and when should they be changeable or deleteable after posting?' => 'Sollen Verkaufrechnung nach der Buchung zu ändern oder zu löschen sein?', 'Show' => 'Zeigen', 'Show Bestbefore' => 'Mindesthaltbarkeit anzeigen', 'Show Filter' => 'Filter zeigen', diff --git a/locale/de_DE/all b/locale/de_DE/all index 7bfd9a772..750971999 100644 --- a/locale/de_DE/all +++ b/locale/de_DE/all @@ -48,12 +48,14 @@ $self->{texts} = { 'AP Transaction Storno (one letter abbreviation)' => 'S', 'AP Transaction with Storno (abbreviation)' => 'K(S)', 'AP Transactions' => 'Eingangsrechnungen', + 'AP transactions changeable' => 'Änderbarkeit von Kreditorenbuchungen', 'AP transactions with sales taxkeys and/or AR transactions with input taxkeys' => 'Kreditorenbuchungen mit Umsatzsteuer-Steuerschlüsseln und/oder Debitorenbuchungen mit Vorsteuer-Steuerschlüsseln', 'AR' => 'Verkauf', 'AR Aging' => 'Forderungen', 'AR Transaction' => 'Debitorenbuchung', 'AR Transaction (abbreviation)' => 'D', 'AR Transactions' => 'Debitorenbuchungen', + 'AR transactions changeable' => 'Änderbarkeit von Debitorenbuchungen', 'ASSETS' => 'AKTIVA', 'ATTENTION! If you enabled this feature you can not simply turn it off again without taking care that best_before fields are emptied in the database.' => 'ACHTUNG! Wenn Sie diese Einstellung aktivieren, dann können Sie sie später nicht ohne Weiteres deaktivieren, ohne dafür zu sorgen, dass die Felder der Mindeshaltbarkeitsdaten in der Datenbank leer gemacht werden.', 'ATTENTION! You can not simply change it from periodic to perpetual once you started posting.' => 'ACHTUNG! Es kann nicht ohne Weiteres im laufenden Betrieb von der Aufwandsmethode zur Bestandsmethode gewechselt werden.', @@ -880,6 +882,7 @@ $self->{texts} = { 'Full access to all functions' => 'Vollzugriff auf alle Funktionen', 'Fwd' => 'Vorwärts', 'GL Transaction' => 'Dialogbuchung', + 'GL transactions changeable' => 'Änderbarkeit von Dialogbuchungen', 'Gegenkonto' => 'Gegenkonto', 'Gender' => 'Geschlecht', 'General Ledger' => 'Buchhaltung', @@ -1467,6 +1470,7 @@ $self->{texts} = { 'Purchase Prices' => 'Einkaufspreise', 'Purchase delivery order' => 'Lieferschein (Einkauf)', 'Purchase invoices' => 'Einkaufsrechnungen', + 'Purchase invoices changeable' => 'Änderbarkeit von Einkaufsrechnunen', 'Purchase net amount' => 'EK-Summe', 'Purchase price' => 'EK-Preis', 'Purchase price total' => 'EK-Summe', @@ -1570,6 +1574,7 @@ $self->{texts} = { 'Sales delivery order' => 'Lieferschein (Verkauf)', 'Sales invoice number' => 'Ausgangsrechnungsnummer', 'Sales invoices' => 'Verkaufsrechnungen', + 'Sales invoices changeable' => 'Änderbarkeit von Verkaufsrechnungen', 'Sales margin' => 'Marge', 'Sales margin %' => 'Marge prozentual', 'Sales net amount' => 'VK-Netto', @@ -1655,7 +1660,12 @@ $self->{texts} = { 'Shipto is in use and was flagged invalid.' => 'Lieferadresse ist noch in Verwendung, und wurde als ungültig markiert.', 'Shopartikel' => 'Shopartikel', 'Short' => 'Knapp', + 'Should ap transactions be and when should they be changeable or deleteable after posting?' => 'Sollen Kreditorenbuchungen nach der Buchung zu ändern oder zu löschen sein?', + 'Should ar transactions be and when should they be changeable or deleteable after posting?' => 'Sollen Debitorenbuchungen nach der Buchung zu ändern oder zu löschen sein?', + 'Should gl transactions be and when should they be changeable or deleteable after posting?' => 'Sollen Dialogbuchungen nach der Buchung zu ändern oder zu löschen sein?', 'Should payments be and when should they be changeable after posting?' => 'Sollen Zahlungen nach dem Buchen änderbar sein, und wenn ja, wann?', + 'Should purchase invoices be and when should they be deleteable after posting?' => 'Sollen Einkaufsrechnungen nach der Buchung zu löschen sein?', + 'Should sales invoices be and when should they be changeable or deleteable after posting?' => 'Sollen Verkaufrechnung nach der Buchung zu ändern oder zu löschen sein?', 'Show' => 'Zeigen', 'Show Bestbefore' => 'Mindesthaltbarkeit anzeigen', 'Show Salesman' => 'Verkäufer anzeigen', diff --git a/locale/en/all b/locale/en/all index 915fa3785..faca27b58 100644 --- a/locale/en/all +++ b/locale/en/all @@ -48,12 +48,14 @@ $self->{texts} = { 'AP Transaction Storno (one letter abbreviation)' => '', 'AP Transaction with Storno (abbreviation)' => '', 'AP Transactions' => 'Purchase Transactions', + 'AP transactions changeable' => '', 'AP transactions with sales taxkeys and/or AR transactions with input taxkeys' => '', 'AR' => 'Sales', 'AR Aging' => 'Debtor Aging', 'AR Transaction' => 'Sales Transaction', 'AR Transaction (abbreviation)' => '', 'AR Transactions' => 'Sales Transactions', + 'AR transactions changeable' => '', 'ASSETS' => '', 'ATTENTION! If you enabled this feature you can not simply turn it off again without taking care that best_before fields are emptied in the database.' => '', 'ATTENTION! You can not simply change it from periodic to perpetual once you started posting.' => '', @@ -895,6 +897,7 @@ $self->{texts} = { 'Full access to all functions' => '', 'Fwd' => 'Forward', 'GL Transaction' => '', + 'GL transactions changeable' => '', 'Gegenkonto' => '', 'Gender' => '', 'General Ledger' => '', @@ -1484,6 +1487,7 @@ $self->{texts} = { 'Purchase Prices' => '', 'Purchase delivery order' => '', 'Purchase invoices' => '', + 'Purchase invoices changeable' => '', 'Purchase net amount' => '', 'Purchase price' => '', 'Purchase price total' => '', @@ -1589,6 +1593,7 @@ $self->{texts} = { 'Sales delivery order' => '', 'Sales invoice number' => '', 'Sales invoices' => '', + 'Sales invoices changeable' => '', 'Sales margin' => '', 'Sales margin %' => '', 'Sales net amount' => '', @@ -1677,7 +1682,12 @@ $self->{texts} = { 'Shipto is in use and was flagged invalid.' => '', 'Shopartikel' => '', 'Short' => '', + 'Should ap transactions be and when should they be changeable or deleteable after posting?' => '', + 'Should ar transactions be and when should they be changeable or deleteable after posting?' => '', + 'Should gl transactions be and when should they be changeable or deleteable after posting?' => '', 'Should payments be and when should they be changeable after posting?' => '', + 'Should purchase invoices be and when should they be deleteable after posting?' => '', + 'Should sales invoices be and when should they be changeable or deleteable after posting?' => '', 'Show' => '', 'Show Bestbefore' => '', 'Show Filter' => '', diff --git a/sql/Pg-upgrade2/defaults_posting_records_config.sql b/sql/Pg-upgrade2/defaults_posting_records_config.sql new file mode 100644 index 000000000..d6ef50108 --- /dev/null +++ b/sql/Pg-upgrade2/defaults_posting_records_config.sql @@ -0,0 +1,10 @@ +-- @tag: defaults_posting_records_config +-- @description: Einstellung, ob und wann Belegbuchungen änderbar/löschbar sind. +-- @depends: release_2_7_0 +-- @charset: utf-8 + +ALTER TABLE defaults ADD COLUMN is_changeable integer NOT NULL DEFAULT 2; +ALTER TABLE defaults ADD COLUMN ir_changeable integer NOT NULL DEFAULT 2; +ALTER TABLE defaults ADD COLUMN ar_changeable integer NOT NULL DEFAULT 2; +ALTER TABLE defaults ADD COLUMN ap_changeable integer NOT NULL DEFAULT 2; +ALTER TABLE defaults ADD COLUMN gl_changeable integer NOT NULL DEFAULT 2; diff --git a/templates/webpages/client_config/form.html b/templates/webpages/client_config/form.html index d195e2a1e..2a70a83a7 100644 --- a/templates/webpages/client_config/form.html +++ b/templates/webpages/client_config/form.html @@ -11,11 +11,45 @@ [% 'Posting Configuration' | $T8 %] + + + [% 'Sales invoices changeable' | $T8 %] + [% L.select_tag('is_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.is_changeable) %] + [% 'Should sales invoices be and when should they be changeable or deleteable after posting?' | $T8 %] + + + [% 'Purchase invoices changeable' | $T8 %] + [% L.select_tag('ir_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.ir_changeable) %] + [% 'Should purchase invoices be and when should they be deleteable after posting?' | $T8 %] + + + [% 'AR transactions changeable' | $T8 %] + [% L.select_tag('ar_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.ar_changeable) %] + [% 'Should ar transactions be and when should they be changeable or deleteable after posting?' | $T8 %] + + + [% 'AP transactions changeable' | $T8 %] + [% L.select_tag('ap_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.ap_changeable) %] + [% 'Should ap transactions be and when should they be changeable or deleteable after posting?' | $T8 %] + + + [% 'GL transactions changeable' | $T8 %] + [% L.select_tag('gl_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.gl_changeable) %] + [% 'Should gl transactions be and when should they be changeable or deleteable after posting?' | $T8 %] + + + + + [% 'Payments Changeable' | $T8 %] [% L.select_tag('payments_changeable', SELF.payment_options, value_key => 'value', title_key => 'title', default => SELF.payments_changeable) %] [% 'Should payments be and when should they be changeable after posting?' | $T8 %] + + + + [% 'Accounting method' | $T8 %] [% L.select_tag('accounting_method', SELF.accounting_options, value_key => 'value', title_key => 'title', default => SELF.accounting_method) %] -- 2.20.1