From 7f596996a8925fb6fa32c51f9dd4c32a24728c99 Mon Sep 17 00:00:00 2001 From: Thomas Heck Date: Mon, 10 Sep 2012 17:12:06 +0200 Subject: [PATCH] Umstellung der Kunden-Eigenschaft '"Steuer im Preis inbegriffen" als Default' auf den Datentyp boolean. Siehe Commit: 7bff84cbc6daa65a74b9f5c83415c98856eb30a1 --- SL/CT.pm | 2 +- SL/DB/MetaSetup/Customer.pm | 2 +- bin/mozilla/is.pl | 8 +------- bin/mozilla/oe.pl | 8 +------- sql/Pg-upgrade2/customer_add_taxincluded_checked_2.sql | 8 ++++++++ templates/webpages/ct/form_header.html | 2 +- 6 files changed, 13 insertions(+), 17 deletions(-) create mode 100644 sql/Pg-upgrade2/customer_add_taxincluded_checked_2.sql diff --git a/SL/CT.pm b/SL/CT.pm index 45745f42d..fbdd4ba11 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -363,7 +363,7 @@ sub save_customer { $form->{c_vendor_id}, conv_i($form->{klass}), substr($form->{currency}, 0, 3), - $form->{taxincluded_checked}, + $form->{taxincluded_checked} ne '' ? $form->{taxincluded_checked} : undef, $form->{id} ); do_query( $form, $dbh, $query, @values ); diff --git a/SL/DB/MetaSetup/Customer.pm b/SL/DB/MetaSetup/Customer.pm index a1d1dec5f..51779f377 100644 --- a/SL/DB/MetaSetup/Customer.pm +++ b/SL/DB/MetaSetup/Customer.pm @@ -54,7 +54,7 @@ __PACKAGE__->meta->setup( bic => { type => 'varchar', length => 100 }, direct_debit => { type => 'boolean', default => 'false' }, curr => { type => 'character', length => 3 }, - taxincluded_checked => { type => 'varchar', length => 1 }, + taxincluded_checked => { type => 'boolean' }, ], primary_key_columns => [ 'id' ], diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 9d48cf2d8..20b497c31 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -408,13 +408,7 @@ sub form_footer { IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/; if ( $form->{vc} eq 'customer' && !$form->{taxincluded_changed_by_user} ) { - if ( $form->{taxincluded_checked} eq 'y' ) { - $form->{taxincluded} = 1; - } elsif ( $form->{taxincluded_checked} eq 'n' ) { - $form->{taxincluded} = 0; - } else { - $form->{taxincluded} = $myconfig{taxincluded_checked}; - } + $form->{taxincluded} = defined($form->{taxincluded_checked}) ? $form->{taxincluded_checked} : $myconfig{taxincluded_checked}; } foreach my $item (@{ $form->{taxaccounts_array} }) { diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 72ad0d799..4eab4dce3 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -478,13 +478,7 @@ sub form_footer { IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/; if ( $form->{vc} eq 'customer' && !$form->{taxincluded_changed_by_user} ) { - if ( $form->{taxincluded_checked} eq 'y' ) { - $form->{taxincluded} = 1; - } elsif ( $form->{taxincluded_checked} eq 'n' ) { - $form->{taxincluded} = 0; - } else { - $form->{taxincluded} = $myconfig{taxincluded_checked}; - } + $form->{taxincluded} = defined($form->{taxincluded_checked}) ? $form->{taxincluded_checked} : $myconfig{taxincluded_checked}; } if (!$form->{taxincluded}) { diff --git a/sql/Pg-upgrade2/customer_add_taxincluded_checked_2.sql b/sql/Pg-upgrade2/customer_add_taxincluded_checked_2.sql new file mode 100644 index 000000000..900eee0bb --- /dev/null +++ b/sql/Pg-upgrade2/customer_add_taxincluded_checked_2.sql @@ -0,0 +1,8 @@ +-- @tag: customer_add_taxincluded_checked_2 +-- @description: Datentype von taxincluded_checked ändern +-- @encoding: utf-8 +-- @depends: customer_add_taxincluded_checked + +ALTER TABLE customer DROP COLUMN taxincluded_checked; + +ALTER TABLE customer ADD COLUMN taxincluded_checked boolean; diff --git a/templates/webpages/ct/form_header.html b/templates/webpages/ct/form_header.html index d2e5c3508..26e71b139 100644 --- a/templates/webpages/ct/form_header.html +++ b/templates/webpages/ct/form_header.html @@ -285,7 +285,7 @@ [% 'taxincluded checked' | $T8 %] - [% L.select_tag('taxincluded_checked', [[undef, LxERP.t8('use user config')], ['y', LxERP.t8('Yes')], ['n', LxERP.t8('No')]], default = taxincluded_checked) %] + [% L.select_tag('taxincluded_checked', [[undef, LxERP.t8('use user config')], ['1', LxERP.t8('Yes')], ['0', LxERP.t8('No')]], default = taxincluded_checked) %] -- 2.20.1