From 65e5f16ab7ec7bb55ef7130665f96112e0f92f77 Mon Sep 17 00:00:00 2001 From: Peter Schulgin Date: Tue, 7 Jan 2014 17:03:23 +0100 Subject: [PATCH] =?utf8?q?Sammelrechnung:=20Auftragsnummer=20und=20Besteln?= =?utf8?q?ummer=20aus=20Lieferscheinen=20=C3=BCbernehmen=20Behebt=20#1784?= =?utf8?q?=20Beim=20erstellen=20einer=20Rechnung=20aus=20mehreren=20Liefer?= =?utf8?q?scheinen=20werden=20nun=20die=20jeweiligen=20Auftragsnummern=20u?= =?utf8?q?nd=20"Bestellnummer=20der=20Kunden"=20als=20Leerzeichengetrennte?= =?utf8?q?=20Liste=20in=20die=20Rechnung=20=C3=BCbernommen=20(analog=20zu?= =?utf8?q?=20Lieferscheinnummern).?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DO.pm | 23 +++++++++++++++++++++-- bin/mozilla/do.pl | 7 +++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/SL/DO.pm b/SL/DO.pm index 41903835a..3d4cb23bf 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -63,7 +63,7 @@ sub transactions { my $vc = $form->{vc} eq "customer" ? "customer" : "vendor"; my $query = - qq|SELECT dord.id, dord.donumber, dord.ordnumber, + qq|SELECT dord.id, dord.donumber, dord.ordnumber, dord.cusordnumber, dord.transdate, dord.reqdate, ct.${vc}number, ct.name, dord.${vc}_id, dord.globalproject_id, dord.closed, dord.delivered, dord.shippingpoint, dord.shipvia, @@ -415,7 +415,9 @@ sub save { my $rc = $dbh->commit(); $form->{saved_donumber} = $form->{donumber}; - + $form->{saved_ordnumber} = $form->{ordnumber}; + $form->{saved_cusordnumber} = $form->{cusordnumber}; + Common::webdav_folder($form); $main::lxdebug->leave_sub(); @@ -604,6 +606,9 @@ sub retrieve { $sth = prepare_execute_query($form, $dbh, $query, @do_ids); delete $form->{"${vc}_id"}; + my $pos = 0; + $form->{ordnumber_array} = ' '; + $form->{cusordnumber_array} = ' '; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { if ($form->{"${vc}_id"} && ($ref->{"${vc}_id"} != $form->{"${vc}_id"})) { $sth->finish(); @@ -614,12 +619,26 @@ sub retrieve { map { $form->{$_} = $ref->{$_} } keys %$ref if ($ref); $form->{donumber_array} .= $form->{donumber} . ' '; + $pos = index($form->{ordnumber_array},' ' . $form->{ordnumber} . ' '); + if ($pos == -1) { + $form->{ordnumber_array} .= $form->{ordnumber} . ' '; + } + $pos = index($form->{cusordnumber_array},' ' . $form->{cusordnumber} . ' '); + if ($pos == -1) { + $form->{cusordnumber_array} .= $form->{cusordnumber} . ' '; + } } $sth->finish(); $form->{donumber_array} =~ s/\s*$//g; + $form->{ordnumber_array} =~ s/ //; + $form->{ordnumber_array} =~ s/\s*$//g; + $form->{cusordnumber_array} =~ s/ //; + $form->{cusordnumber_array} =~ s/\s*$//g; $form->{saved_donumber} = $form->{donumber}; + $form->{saved_ordnumber} = $form->{ordnumber}; + $form->{saved_cusordnumber} = $form->{cusordnumber}; # if not given, fill transdate with current_date $form->{transdate} = $form->current_date($myconfig) unless $form->{transdate}; diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 21e8d3255..e633b424e 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -491,7 +491,7 @@ sub orders { my @columns = qw( ids transdate reqdate id donumber - ordnumber customernumber + ordnumber customernumber cusordnumber name employee salesman shipvia globalprojectnumber transaction_description department @@ -508,7 +508,7 @@ sub orders { my $report = SL::ReportGenerator->new(\%myconfig, $form); my @hidden_variables = map { "l_${_}" } @columns; - push @hidden_variables, $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered donumber ordnumber serialnumber + push @hidden_variables, $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered donumber ordnumber serialnumber cusordnumber transaction_description transdatefrom transdateto reqdatefrom reqdateto type vc employee_id salesman_id project_id); @@ -522,6 +522,7 @@ sub orders { 'donumber' => { 'text' => $locale->text('Delivery Order'), }, 'ordnumber' => { 'text' => $locale->text('Order'), }, 'customernumber' => { 'text' => $locale->text('Customer Number'), }, + 'cusordnumber' => { 'text' => $locale->text('Customer Order Number'), }, 'name' => { 'text' => $form->{vc} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), }, 'employee' => { 'text' => $locale->text('Employee'), }, 'salesman' => { 'text' => $locale->text('Salesman'), }, @@ -867,6 +868,8 @@ sub invoice_multi { # Hinweis: delete gibt den wert zurueck und loescht danach das element (nett und einfach) # $shell: perldoc perlunc; /delete EXPR $form->{donumber} = delete $form->{donumber_array}; + $form->{ordnumber} = delete $form->{ordnumber_array}; + $form->{cusordnumber} = delete $form->{cusordnumber_array}; $form->{deliverydate} = $form->{transdate}; $form->{transdate} = $form->current_date(\%myconfig); $form->{duedate} = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1); -- 2.20.1