From: G. Richardson Date: Tue, 27 Dec 2016 10:25:01 +0000 (+0100) Subject: Zahlungsbedingungen obsolet setzen X-Git-Tag: release-3.5.4~1779 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=77807bf531a9c3f945b2de1fc970439be5e95e70;p=kivitendo-erp.git Zahlungsbedingungen obsolet setzen Damit können alte und ungenutzte Zahlungsbedingungen für neue Belege/CV/Artikel ausgeblendet werden. Außerdem Umstellung von generic/multibox auf L.select_tag in den Masken --- diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index 325fa58bb..5404373f4 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -901,7 +901,8 @@ sub _pre_render { $self->{all_salesmen} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $self->{cv}->salesman_id, deleted => 0 ] ]); } - $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all(); + $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all_sorted(where => [ or => [ id => $self->{cv}->payment_id, + obsolete => 0 ] ]); $self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all(); diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 82b8a2ab0..5562b1ea8 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -1047,7 +1047,9 @@ sub _pre_render { $self->{all_projects} = SL::DB::Manager::Project->get_all(where => [ or => [ id => $self->order->globalproject_id, active => 1 ] ], sort_by => 'projectnumber'); - $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all_sorted(); + $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all_sorted(where => [ or => [ id => $self->order->payment_id, + obsolete => 0 ] ]); + $self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all_sorted(); $self->{current_employee_id} = SL::DB::Manager::Employee->current->id; diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index 9458a83f3..6b40493f4 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -895,7 +895,8 @@ sub init_all_units { } sub init_all_payment_terms { - SL::DB::Manager::PaymentTerm->get_all_sorted; + my ($self) = @_; + SL::DB::Manager::PaymentTerm->get_all_sorted(query => [ or => [ id => $self->part->payment_id, obsolete => 0 ] ]); } sub init_all_price_factors { diff --git a/SL/DB/MetaSetup/PaymentTerm.pm b/SL/DB/MetaSetup/PaymentTerm.pm index ed52a9149..eb7647113 100644 --- a/SL/DB/MetaSetup/PaymentTerm.pm +++ b/SL/DB/MetaSetup/PaymentTerm.pm @@ -16,7 +16,8 @@ __PACKAGE__->meta->columns( id => { type => 'integer', not_null => 1, sequence => 'id' }, itime => { type => 'timestamp', default => 'now()' }, mtime => { type => 'timestamp' }, - percent_skonto => { type => 'float', precision => 4, scale => 4 }, + obsolete => { type => 'boolean', default => 'false' }, + percent_skonto => { type => 'float', scale => 4 }, ranking => { type => 'integer' }, sortkey => { type => 'integer', not_null => 1 }, terms_netto => { type => 'integer' }, diff --git a/SL/Form.pm b/SL/Form.pm index 7a9c54e41..4c8f3d702 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2531,9 +2531,9 @@ sub all_vc { # get payment terms $query = qq|SELECT id, description FROM payment_terms - ORDER BY sortkey|; - - $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query); + WHERE ( obsolete IS FALSE OR id = ? ) + ORDER BY sortkey |; + $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query, $self->{payment_id} || undef); $main::lxdebug->leave_sub(); } @@ -2575,6 +2575,9 @@ sub mtime_ischanged { } } +# language_payment duplicates some of the functionality of all_vc (language, +# printer, payment_terms), and at least in the case of sales invoices both +# all_vc and language_payment are called when adding new invoices sub language_payment { $main::lxdebug->enter_sub(); @@ -2598,9 +2601,9 @@ sub language_payment { # get payment terms $query = qq|SELECT id, description FROM payment_terms - ORDER BY sortkey|; - - $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query); + WHERE ( obsolete IS FALSE OR id = ? ) + ORDER BY sortkey |; + $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query, $self->{payment_id} || undef); # get buchungsgruppen $query = qq|SELECT id, description diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 83cf28fe1..5e6f81020 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -50,6 +50,7 @@ use Data::Dumper; use SL::DB::Customer; use SL::DB::TaxZone; +use SL::DB::PaymentTerm; require "bin/mozilla/io.pl"; require "bin/mozilla/arap.pl"; @@ -352,11 +353,11 @@ sub form_header { my $vc = $form->{vc} eq "customer" ? "customers" : "vendors"; $form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"), - "payments" => "ALL_PAYMENTS", "currencies" => "ALL_CURRENCIES", $vc => { key => "ALL_" . uc($vc), limit => $myconfig{vclimit} + 1 }, "price_factors" => "ALL_PRICE_FACTORS"); + $form->{ALL_PAYMENTS} = SL::DB::Manager::PaymentTerm->get_all( where => [ or => [ obsolete => 0, id => $form->{payment_id} || undef ] ]); $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all; diff --git a/sql/Pg-upgrade2/payment_terms_obsolete.sql b/sql/Pg-upgrade2/payment_terms_obsolete.sql new file mode 100644 index 000000000..a72ab45a9 --- /dev/null +++ b/sql/Pg-upgrade2/payment_terms_obsolete.sql @@ -0,0 +1,7 @@ +-- @tag: payment_terms_obsolete +-- @description: Zahlungsbedingungen ungültig setzen +-- @charset: UTF-8 +-- @depends: release_3_4_1 +-- @ignore: 0 + +ALTER TABLE payment_terms ADD COLUMN obsolete BOOLEAN DEFAULT FALSE; diff --git a/templates/webpages/is/form_footer.html b/templates/webpages/is/form_footer.html index 9101d2c14..caadf3e85 100644 --- a/templates/webpages/is/form_footer.html +++ b/templates/webpages/is/form_footer.html @@ -24,15 +24,7 @@ - diff --git a/templates/webpages/oe/form_footer.html b/templates/webpages/oe/form_footer.html index 6c6072e84..86910e0ab 100644 --- a/templates/webpages/oe/form_footer.html +++ b/templates/webpages/oe/form_footer.html @@ -27,15 +27,7 @@ - + diff --git a/templates/webpages/payment_term/form.html b/templates/webpages/payment_term/form.html index 6cd81c89d..db7fdb17e 100755 --- a/templates/webpages/payment_term/form.html +++ b/templates/webpages/payment_term/form.html @@ -44,6 +44,14 @@ + [% IF SELF.payment_term.id %] + + + + + + [% END %] + diff --git a/templates/webpages/payment_term/list.html b/templates/webpages/payment_term/list.html index 782a06763..7bedec8f4 100644 --- a/templates/webpages/payment_term/list.html +++ b/templates/webpages/payment_term/list.html @@ -21,6 +21,7 @@ + @@ -39,6 +40,7 @@ + [%- END %]
[% 'Payment Terms' | $T8 %] - [%- INCLUDE 'generic/multibox.html' - name = 'payment_id', - style = 'width: 250px', - DATA = payment_terms, - id_key = 'id', - label_key = 'description', - show_empty = 1 - allow_textbox = 0 -%] + [% L.select_tag('payment_id', payment_terms, default = payment_id, title_key = 'description', with_empty = 1, style="width: 250px") %]
[% 'Payment Terms' | $T8 %] - [%- INCLUDE 'generic/multibox.html' - name = 'payment_id', - style = 'width: 250px', - DATA = ALL_PAYMENTS, - id_key = 'id', - label_key = 'description', - show_empty = 1 -%] - [% L.select_tag('payment_id', ALL_PAYMENTS, default = payment_id, title_key = 'description', with_empty = 1, style="width: 250px") %]
[% 'Delivery Terms' | $T8 %]
[% 'Obsolete' | $T8 %][% L.checkbox_tag('payment_term.obsolete', checked = SELF.payment_term.obsolete, for_submit=1) %]
[% LxERP.t8("Texts for quotations & orders") %][%- 'Netto Terms' | $T8 %] [%- 'Skonto Terms' | $T8 %] [%- 'Skonto' | $T8 %][%- 'Obsolete' | $T8 %]
[%- HTML.escape(payment_term.terms_netto_as_number) %] [%- HTML.escape(payment_term.terms_skonto_as_number) %] [%- HTML.escape(payment_term.percent_skonto_as_percent) %] %[%- HTML.escape(payment_term.obsolete) %]