From fe6275f8eff9e0bab568cb6eba5ed70662148a88 Mon Sep 17 00:00:00 2001 From: Niclas Zimmermann Date: Mon, 27 May 2013 17:17:15 +0200 Subject: [PATCH] =?utf8?q?Unn=C3=B6tige=20Hiddens=20entfernen=20Anzeigekon?= =?utf8?q?figuration=20von=20Gewichten=20Gewichte=20in=20Druckvorlagen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Durch diesen Commit werden 1. unnötige Hidden-Variablen aus html-templates entfernt, die mit Gewichten zu tun haben. 2. die Anzeige von Gewichten konfigurierbar gemacht. 3. Gewichte in Druckvorlagen zur Verfügung gestellt. Es stehen ein Zeilengewicht (lineweight), Einzelgewicht des Artikels (weight) und Gesamtgewicht (totalweight) zur Verfügung, die letzten beiden auch als unformatierte Variablen (weight_nofmt und totalweight_nofmt). --- SL/Controller/ClientConfig.pm | 4 ++++ SL/DB/MetaSetup/Default.pm | 1 + SL/DO.pm | 2 ++ SL/IS.pm | 2 ++ SL/OE.pm | 2 ++ bin/mozilla/io.pl | 14 +++++++------- locale/de/all | 2 ++ templates/webpages/client_config/form.html | 12 ++++++++++++ templates/webpages/do/form_footer.html | 4 +++- templates/webpages/ir/form_footer.html | 4 ++-- templates/webpages/is/form_footer.html | 4 ++-- templates/webpages/oe/form_footer.html | 4 ++-- 12 files changed, 41 insertions(+), 14 deletions(-) diff --git a/SL/Controller/ClientConfig.pm b/SL/Controller/ClientConfig.pm index 41c19ee80..74bc8b597 100644 --- a/SL/Controller/ClientConfig.pm +++ b/SL/Controller/ClientConfig.pm @@ -43,6 +43,8 @@ sub action_edit { map { $self->{$_} = SL::DB::Default->get->$_ } qw(sales_order_show_delete purchase_order_show_delete sales_delivery_order_show_delete purchase_delivery_order_show_delete); + $self->{show_weight} = SL::DB::Default->get->show_weight; + $self->render('client_config/form', title => $::locale->text('Client Configuration')); } @@ -64,6 +66,8 @@ sub action_save { map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(sales_order_show_delete purchase_order_show_delete sales_delivery_order_show_delete purchase_delivery_order_show_delete); + SL::DB::Default->get->update_attributes('show_weight' => $::form->{show_weight}); + flash_later('info', $::locale->text('Client Configuration saved!')); $self->redirect_to(action => 'edit'); diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index bb174ebaa..d45a7cfb4 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -68,6 +68,7 @@ __PACKAGE__->meta->setup( ar_show_mark_as_paid => { type => 'boolean', default => 'true' }, ap_show_mark_as_paid => { type => 'boolean', default => 'true' }, assemblynumber => { type => 'text' }, + show_weight => { type => 'boolean', default => 'false', not_null => 1 }, ], primary_key_columns => [ 'id' ], diff --git a/SL/DO.pm b/SL/DO.pm index 76a0ec075..e47b5d116 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -920,6 +920,8 @@ sub order_details { $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3); $form->{totalweight_nofmt} = $totalweight; + my $defaults = AM->get_defaults(); + $form->{weightunit} = $defaults->{weightunit}; $h_pg->finish(); $h_bin_wh->finish(); diff --git a/SL/IS.pm b/SL/IS.pm index 8a94ec6b4..2db51a5ae 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -376,6 +376,8 @@ sub invoice_details { $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3); $form->{totalweight_nofmt} = $totalweight; + my $defaults = AM->get_defaults(); + $form->{weightunit} = $defaults->{weightunit}; foreach my $item (sort keys %taxaccounts) { $tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2); diff --git a/SL/OE.pm b/SL/OE.pm index 04f93858f..3d6b32837 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1318,6 +1318,8 @@ sub order_details { $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3); $form->{totalweight_nofmt} = $totalweight; + my $defaults = AM->get_defaults(); + $form->{weightunit} = $defaults->{weightunit}; my $tax = 0; foreach $item (sort keys %taxaccounts) { diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index a024cd85d..99b61f31e 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -123,6 +123,10 @@ sub display_row { my ($stock_in_out, $stock_in_out_title); + my $defaults = AM->get_defaults(); + $form->{show_weight} = $defaults->{show_weight}; + $form->{weightunit} = $defaults->{weightunit}; + my $is_purchase = (first { $_ eq $form->{type} } qw(request_quotation purchase_order purchase_delivery_order)) || ($form->{script} eq 'ir.pl'); my $show_min_order_qty = first { $_ eq $form->{type} } qw(request_quotation purchase_order); my $is_delivery_order = $form->{type} =~ /_delivery_order$/; @@ -150,7 +154,7 @@ sub display_row { { id => 'qty', width => 5, value => $locale->text('Qty'), display => 1, }, { id => 'price_factor', width => 5, value => $locale->text('Price Factor'), display => !$is_delivery_order, }, { id => 'unit', width => 5, value => $locale->text('Unit'), display => 1, }, - { id => 'weight', width => 5, value => $locale->text('Weight'), display => 1, }, + { id => 'weight', width => 5, value => $locale->text('Weight'), display => $defaults->{show_weight}, }, { id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, }, { id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, }, { id => 'sellprice', width => 15, value => $locale->text('Price'), display => !$is_delivery_order, }, @@ -208,9 +212,7 @@ sub display_row { _update_custom_variables(); my $totalweight = 0; - my $defaults = AM->get_defaults(); - $form->{weightunit} = $defaults->{weightunit}; # rows my @ROWS; @@ -332,9 +334,7 @@ sub display_row { $column_data{linetotal} = $form->format_amount(\%myconfig, $linetotal, 2); $column_data{bin} = $form->{"bin_$i"}; - $column_data{weight} = $form->format_amount(\%myconfig, $form->{"qty_$i"} * $form->{"weight_$i"}, 3) . ' ' . $defaults->{weightunit}; - #To add the hidden variable lineweight: - $form->{"lineweight_$i"} = $column_data{weight}; + $column_data{weight} = $form->format_amount(\%myconfig, $form->{"qty_$i"} * $form->{"weight_$i"}, 3) . ' ' . $defaults->{weightunit} if $defaults->{show_weight}; if ($is_delivery_order) { $column_data{stock_in_out} = calculate_stock_in_out($i); @@ -430,7 +430,7 @@ sub display_row { map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" } (qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber - longdescription basefactor marge_absolut marge_percent marge_price_factor weight lineweight), @hidden_vars) + longdescription basefactor marge_absolut marge_percent marge_price_factor weight), @hidden_vars) ); map { $form->{"${_}_base"} += $linetotal } (split(/ /, $form->{"taxaccounts_$i"})); diff --git a/locale/de/all b/locale/de/all index ce0bf65ca..716a690a8 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1797,6 +1797,8 @@ $self->{texts} = { 'Show old dunnings' => 'Alte Mahnungen anzeigen', 'Show overdue sales quotations and requests for quotations...' => 'Überfällige Angebote und Preisanfragen anzeigen...', 'Show settings' => 'Einstellungen anzeigen', + 'Show the weights of articles and the total weight in orders, invoices and delivery notes?' => 'Sollen Warengewichte und Gesamtgewicht in Aufträgen, Rechnungen und Lieferscheinen angezeigt werden?', + 'Show weights' => 'Gewichte anzeigen', 'Show your TODO list after loggin in' => 'Aufgabenliste nach dem Anmelden anzeigen', 'Signature' => 'Unterschrift', 'Since bin is not enforced in the parts data, please specify a bin where goods without a specified bin will be put.' => 'Da Lagerplätze kein Pflichtfeld sind, geben Sie bitte einen Lagerplatz an, in dem Waren ohne spezifizierten Lagerplatz eingelagert werden sollen.', diff --git a/templates/webpages/client_config/form.html b/templates/webpages/client_config/form.html index 5fc0c04ac..6a3c0f582 100644 --- a/templates/webpages/client_config/form.html +++ b/templates/webpages/client_config/form.html @@ -177,6 +177,18 @@ + + [% 'Weight' | $T8 %] + + + [% 'Show weights' | $T8 %] + + [% L.yes_no_tag('show_weight', SELF.show_weight) %] + + + [% 'Show the weights of articles and the total weight in orders, invoices and delivery notes?' | $T8 %]
+ +
diff --git a/templates/webpages/do/form_footer.html b/templates/webpages/do/form_footer.html index 6be226888..d87b156ca 100644 --- a/templates/webpages/do/form_footer.html +++ b/templates/webpages/do/form_footer.html @@ -20,6 +20,7 @@ +[%- IF show_weight %] @@ -30,7 +31,6 @@
[% 'Total weight' | $T8 %] [% LxERP.format_amount(totalweight, 3) %] [% HTML.escape(weightunit) %] -
@@ -38,6 +38,8 @@ + +[%- END %]

diff --git a/templates/webpages/ir/form_footer.html b/templates/webpages/ir/form_footer.html index 83ab34abb..66758003d 100644 --- a/templates/webpages/ir/form_footer.html +++ b/templates/webpages/ir/form_footer.html @@ -33,18 +33,18 @@ [%- END %] +[%- IF show_weight %]
[% 'Total weight' | $T8 %] [% LxERP.format_amount(totalweight) %] [% HTML.escape(weightunit) %] - -
+[%- END %] [%- IF taxaccounts %] diff --git a/templates/webpages/is/form_footer.html b/templates/webpages/is/form_footer.html index f389e842a..28fafaa09 100644 --- a/templates/webpages/is/form_footer.html +++ b/templates/webpages/is/form_footer.html @@ -43,18 +43,18 @@ [%- END %] +[%- IF show_weight %]
[% 'Total weight' | $T8 %] [% LxERP.format_amount(totalweight) %] [% HTML.escape(weightunit) %] - -
+[%- END %] diff --git a/templates/webpages/oe/form_footer.html b/templates/webpages/oe/form_footer.html index 24e9f255d..87c1993a7 100644 --- a/templates/webpages/oe/form_footer.html +++ b/templates/webpages/oe/form_footer.html @@ -47,18 +47,18 @@ [%- END %]
+ [%- IF show_weight %]
[% 'Total weight' | $T8 %] [% LxERP.format_amount(totalweight, 3) %] [% HTML.escape(weightunit) %] - -
+ [%- END %] [%- IF is_sales %] -- 2.20.1