From cc8edd18013d3ee0668e5650aeb8a7866641f47a Mon Sep 17 00:00:00 2001 From: Niclas Zimmermann Date: Mon, 1 Oct 2012 15:09:59 +0200 Subject: [PATCH] Lieferdatum, Lieferscheindatum und Liefertermin Im Workflow Auftrag-Lieferschein-Rechnung gab es Probleme mit dem Lieferdatum. Beim Auftrag wurde bisher ein Lieferdatum verlangt, was jetzt in Liefertermin umbenannt wurde, um echtes Lieferdatum und Lieferfrist zu unterscheiden. Der Liefertermin wird jetzt auch in der Ansicht vom Lieferschein angezeigt. Das Lieferscheindatum und das Lieferdatum sind synonym. Somit wird in der Rechnung als Lieferdatum das Datum vom Liefer- schein angegeben. Siehe auch Bug #1958. Dort wird allerdings noch zwischen einem Lieferdatum und Lieferschein unterschieden, was dieser commit noch nicht leistet. --- SL/DO.pm | 15 ++++++++++----- locale/de/all | 2 +- templates/webpages/do/form_header.html | 9 +++++++++ templates/webpages/oe/form_header.html | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/SL/DO.pm b/SL/DO.pm index c4303f442..237d523d9 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -228,7 +228,7 @@ sub save { } my $project_id; - my $reqdate; + my $items_reqdate; $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} }; @@ -284,7 +284,7 @@ sub save { $price_factor = $price_factors{ $form->{"price_factor_id_$i"} } || 1; my $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2); - $reqdate = ($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef; + $items_reqdate = ($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef; do_statement($form, $h_item_id, $q_item_id); my ($item_id) = $h_item_id->fetchrow_array(); @@ -294,7 +294,7 @@ sub save { $form->{"description_$i"}, $form->{"longdescription_$i"}, $form->{"qty_$i"}, $baseqty, $form->{"sellprice_$i"}, $form->{"discount_$i"} / 100, - $form->{"unit_$i"}, conv_date($reqdate), conv_i($form->{"project_id_$i"}), + $form->{"unit_$i"}, conv_date($items_reqdate), conv_i($form->{"project_id_$i"}), $form->{"serialnumber_$i"}, $form->{"ordnumber_$i"}, conv_date($form->{"transdate_$i"}), $form->{"cusordnumber_$i"}, @@ -327,6 +327,8 @@ sub save { $h_item_stock->finish(); + # reqdate is last items reqdate (?: old behaviour) if not already set + $form->{reqdate} ||= $items_reqdate; # save DO record $query = qq|UPDATE delivery_orders SET @@ -341,7 +343,7 @@ sub save { @values = ($form->{donumber}, $form->{ordnumber}, $form->{cusordnumber}, conv_date($form->{transdate}), conv_i($form->{vendor_id}), conv_i($form->{customer_id}), - conv_date($reqdate), $form->{shippingpoint}, $form->{shipvia}, + conv_date($form->{reqdate}), $form->{shippingpoint}, $form->{shipvia}, $form->{notes}, $form->{intnotes}, $form->{closed} ? 't' : 'f', $form->{delivered} ? "t" : "f", conv_i($form->{department_id}), conv_i($form->{language_id}), conv_i($form->{shipto_id}), @@ -573,9 +575,12 @@ sub retrieve { my $mode = !$params{ids} ? 'default' : ref $params{ids} eq 'ARRAY' ? 'multi' : 'single'; if ($mode eq 'default') { - $ref = selectfirst_hashref_query($form, $dbh, qq|SELECT current_date AS transdate, current_date AS reqdate|); + $ref = selectfirst_hashref_query($form, $dbh, qq|SELECT current_date AS transdate|); map { $form->{$_} = $ref->{$_} } keys %$ref; + # if reqdate is not set from oe-workflow, set it to transdate (which is current date) + $form->{reqdate} ||= $form->{transdate}; + # get last name used $form->lastname_used($dbh, $myconfig, $vc) unless $form->{"${vc}_id"}; diff --git a/locale/de/all b/locale/de/all index 9fbd29bbb..78f43c66c 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1553,7 +1553,7 @@ $self->{texts} = { 'Report for' => 'Bericht für', 'Reports' => 'Berichte', 'Representative' => 'Vertreter', - 'Reqdate' => 'Lieferdatum', + 'Reqdate' => 'Liefertermin', 'Request for Quotation' => 'Anfrage', 'Request for Quotations' => 'Anfragen', 'Request quotation' => 'Preisanfrage', diff --git a/templates/webpages/do/form_header.html b/templates/webpages/do/form_header.html index e12f0da9b..848fa898e 100644 --- a/templates/webpages/do/form_header.html +++ b/templates/webpages/do/form_header.html @@ -301,6 +301,15 @@ + + [% 'Reqdate' | $T8 %] + + + + + + [% 'Project Number' | $T8 %] diff --git a/templates/webpages/oe/form_header.html b/templates/webpages/oe/form_header.html index dff98c638..76190766f 100644 --- a/templates/webpages/oe/form_header.html +++ b/templates/webpages/oe/form_header.html @@ -210,7 +210,7 @@ [%- IF is_sales_quo %] [% 'Valid until' | $T8 %] [%- ELSE %] - [% 'Required by' | $T8 %] + [% 'Reqdate' | $T8 %] [%- END %] -- 2.20.1