From: Moritz Bunkus Date: Fri, 15 May 2009 09:03:50 +0000 (+0000) Subject: Das Feld "Gewichtseinheit" in den Einstellungen wieder eingeführt und in den Warensta... X-Git-Tag: release-2.6.0rc1~57 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c14aab2d0918eb56f1c91bca8da6b1984d5e09ec;p=kivitendo-erp.git Das Feld "Gewichtseinheit" in den Einstellungen wieder eingeführt und in den Warenstammdaten- und -berichtsmasken angezeigt. Fix für Bug 963. --- diff --git a/SL/AM.pm b/SL/AM.pm index 5ffb6a1c5..7b3b7368a 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1474,7 +1474,8 @@ sub save_defaults { pdonumber = ?, yearend = ?, curr = ?, - businessnumber = ?|; + businessnumber = ?, + weightunit = ?|; my @values = ($accnos{inventory_accno}, $accnos{income_accno}, $accnos{expense_accno}, $accnos{fxgain_accno}, $accnos{fxloss_accno}, $form->{invnumber}, $form->{cnnumber}, @@ -1484,7 +1485,7 @@ sub save_defaults { $form->{articlenumber}, $form->{servicenumber}, $form->{sdonumber}, $form->{pdonumber}, $form->{yearend}, $currency, - $form->{businessnumber}); + $form->{businessnumber}, $form->{weightunit}); do_query($form, $dbh, $query, @values); $dbh->commit(); @@ -1574,6 +1575,26 @@ sub save_preferences { return $rc; } +sub get_defaults { + $main::lxdebug->enter_sub(); + + my $self = shift; + my %params = @_; + + my $myconfig = \%main::myconfig; + my $form = $main::form; + + my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); + + my $defaults = selectfirst_hashref_query($form, $dbh, qq|SELECT * FROM defaults|) || {}; + + $defaults->{weightunit} ||= 'kg'; + + $main::lxdebug->leave_sub(); + + return $defaults; +} + sub defaultaccounts { $main::lxdebug->enter_sub(); @@ -1587,12 +1608,14 @@ sub defaultaccounts { my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - $form->{defaults} = $sth->fetchrow_hashref(NAME_lc); - $form->{defaults}{IC} = $form->{defaults}{inventory_accno_id}; - $form->{defaults}{IC_income} = $form->{defaults}{income_accno_id}; - $form->{defaults}{IC_expense} = $form->{defaults}{expense_accno_id}; - $form->{defaults}{FX_gain} = $form->{defaults}{fxgain_accno_id}; - $form->{defaults}{FX_loss} = $form->{defaults}{fxloss_accno_id}; + $form->{defaults} = $sth->fetchrow_hashref(NAME_lc); + $form->{defaults}{IC} = $form->{defaults}{inventory_accno_id}; + $form->{defaults}{IC_income} = $form->{defaults}{income_accno_id}; + $form->{defaults}{IC_expense} = $form->{defaults}{expense_accno_id}; + $form->{defaults}{FX_gain} = $form->{defaults}{fxgain_accno_id}; + $form->{defaults}{FX_loss} = $form->{defaults}{fxloss_accno_id}; + + $form->{defaults}{weightunit} ||= 'kg'; $sth->finish; diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index d75436c4a..a373249ac 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -34,6 +34,7 @@ use POSIX qw(strftime); use List::Util qw(max); +use SL::AM; use SL::IC; use SL::ReportGenerator; @@ -1191,6 +1192,8 @@ sub generate_report { my $idx = 0; my $same_item = $form->{parts}[0]{ $form->{sort} } if (scalar @{ $form->{parts} }); + my $defaults = AM->get_defaults(); + # postprocess parts foreach my $ref (@{ $form->{parts} }) { @@ -1223,6 +1226,8 @@ sub generate_report { map { $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}); } qw(onhand rop weight soldtotal); + $row->{weight}->{data} .= ' ' . $defaults->{weightunit}; + if (!$ref->{assemblyitem}) { foreach my $col (@subtotal_columns) { $totals{$col} += $onhand * $ref->{$col}; @@ -1460,7 +1465,7 @@ sub form_header { $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS', 'partsgroup' => 'all_partsgroup', - 'vendors' => 'ALL_VENDORS',); + 'vendors' => 'ALL_VENDORS',); IC->retrieve_buchungsgruppen(\%myconfig, $form); @@ -1472,6 +1477,8 @@ sub form_header { $units = AM->retrieve_units(\%myconfig, $form); $form->{ALL_UNITS} = [ map +{ name => $_ }, sort { $units->{$a}{sortkey} <=> $units->{$b}{sortkey} } keys %$units ]; + $form->{defaults} = AM->get_defaults(); + $form->{fokus} = "ic.partnumber"; $form->header; diff --git a/locale/de/all b/locale/de/all index 7270f78da..81cdf42d5 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1706,6 +1706,7 @@ $self->{texts} = { 'Warnings during template upgrade' => 'Warnungen bei Aktualisierung der Dokumentenvorlagen', 'WebDAV link' => 'WebDAV-Link', 'Weight' => 'Gewicht', + 'Weight unit' => 'Gewichtseinheit', 'What type of item is this?' => 'Was ist dieser Artikel?', 'What\'s the term you\'re looking for?' => 'Nach welchem Begriff wollen Sie suchen?', 'With Extension Of Time' => 'mit Dauerfristverlängerung', diff --git a/templates/webpages/am/edit_defaults_de.html b/templates/webpages/am/edit_defaults_de.html index c4492c7d2..ffd534d5b 100644 --- a/templates/webpages/am/edit_defaults_de.html +++ b/templates/webpages/am/edit_defaults_de.html @@ -135,6 +135,11 @@ + + Gewichtseinheit + + +

diff --git a/templates/webpages/am/edit_defaults_master.html b/templates/webpages/am/edit_defaults_master.html index e7fe5a222..47693c654 100644 --- a/templates/webpages/am/edit_defaults_master.html +++ b/templates/webpages/am/edit_defaults_master.html @@ -135,6 +135,11 @@ + + Weight unit + + +

diff --git a/templates/webpages/ic/form_header_de.html b/templates/webpages/ic/form_header_de.html index a3e8e002c..7a14a5aa3 100644 --- a/templates/webpages/ic/form_header_de.html +++ b/templates/webpages/ic/form_header_de.html @@ -208,6 +208,7 @@ [%- IF is_assembly %] [% LxERP.format_amount(weight) %][%- END %] + [% HTML.escape(defaults.weightunit) %] [%- END %] diff --git a/templates/webpages/ic/form_header_master.html b/templates/webpages/ic/form_header_master.html index b99d6f552..bbb87d3fd 100644 --- a/templates/webpages/ic/form_header_master.html +++ b/templates/webpages/ic/form_header_master.html @@ -208,6 +208,7 @@ [%- IF is_assembly %] [% LxERP.format_amount(weight) %][%- END %] + [% HTML.escape(defaults.weightunit) %] [%- END %]