From: Peter Schulgin Date: Tue, 7 Jan 2014 16:03:23 +0000 (+0100) Subject: Sammelrechnung: Auftragsnummer und Bestelnummer aus Lieferscheinen übernehmen X-Git-Tag: release-3.1.0beta1~22^2~25^2~3 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=65e5f16ab7ec7bb55ef7130665f96112e0f92f77;p=kivitendo-erp.git Sammelrechnung: Auftragsnummer und Bestelnummer aus Lieferscheinen übernehmen Behebt #1784 Beim erstellen einer Rechnung aus mehreren Lieferscheinen werden nun die jeweiligen Auftragsnummern und "Bestellnummer der Kunden" als Leerzeichengetrennte Liste in die Rechnung übernommen (analog zu Lieferscheinnummern). --- 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);