From 77350196300e930abc7de0df7dbf42e8cd6193b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 28 Jan 2015 17:21:49 +0100 Subject: [PATCH] =?utf8?q?Ticket=2029=20Verkn=C3=BCpfte=20Belege=20->=20ke?= =?utf8?q?ine=20Verkn=C3=BCpfung=20von=20Rechnung=20nach=20Auftrag?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Verknüpfung von Rechnung nach Angebot, sowie Auftrag nach Angebot umgesetzt. Ferner ein einfaches delete $form->{variable_die_resettet_wird} foreach an dieser Stelle eingebaut (ohne map). Ferner die Verknüpfung der Belege in eine Schleife gesetzt. --- SL/OE.pm | 27 +++++++++++++++----------- bin/mozilla/io.pl | 10 ++++++++-- templates/webpages/oe/form_header.html | 1 + 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/SL/OE.pm b/SL/OE.pm index 5e2551b2d..55e488346 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -673,23 +673,28 @@ SQL $form->save_status($dbh); # Link this record to the records it was created from. + # check every record type we may link. i am not happy with converting the string to array back + # should be a array from the start (OE.pm -> retrieve). + # and that i need the local array ref for close_quotation_rfqs. better ideas welcome $form->{convert_from_oe_ids} =~ s/^\s+//; $form->{convert_from_oe_ids} =~ s/\s+$//; my @convert_from_oe_ids = split m/\s+/, $form->{convert_from_oe_ids}; delete $form->{convert_from_oe_ids}; - - if (scalar @convert_from_oe_ids) { - RecordLinks->create_links('dbh' => $dbh, - 'mode' => 'ids', - 'from_table' => 'oe', - 'from_ids' => \@convert_from_oe_ids, - 'to_table' => 'oe', - 'to_id' => $form->{id}, - ); - + @{ $form->{convert_from_oe_ids} } = @convert_from_oe_ids; + foreach (qw(ar oe)) { + if ($form->{"convert_from_${_}_ids"}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => $_, + 'from_ids' => $form->{"convert_from_${_}_ids"}, + 'to_table' => 'oe', + 'to_id' => $form->{id}, + ); + delete $form->{"convert_from_${_}_ids"}; + } $self->_close_quotations_rfqs('dbh' => $dbh, 'from_id' => \@convert_from_oe_ids, - 'to_id' => $form->{id}); + 'to_id' => $form->{id}) if $_ eq 'oe'; } if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) { diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index e411fb552..99ba934ff 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -843,7 +843,10 @@ sub order { $form->{old_employee_id} = $form->{employee_id}; $form->{old_salesman_id} = $form->{salesman_id}; - map { delete $form->{$_} } qw(id printed emailed queued); + # link doc invoice -> quotation (single id no multi mode) + $form->{convert_from_ar_ids} = delete $form->{id}; + + delete $form->{$_} foreach (qw(printed emailed queued)); my $buysell; if ($form->{script} eq 'ir.pl' || $form->{type} eq 'request_quotation') { $form->{title} = $locale->text('Add Purchase Order'); @@ -906,10 +909,13 @@ sub quotation { if ($form->{type} =~ /(sales|purchase)_order/) { $form->{"converted_from_orderitems_id_$_"} = delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; } + # link doc order -> quotation (single id no multi mode) + $form->{convert_from_oe_ids} = delete $form->{id}; + if ($form->{second_run}) { $form->{print_and_post} = 0; } - map { delete $form->{$_} } qw(id printed emailed queued); + delete $form->{$_} foreach (qw(printed emailed queued)); my $buysell; if ($form->{script} eq 'ir.pl' || $form->{type} eq 'purchase_order') { diff --git a/templates/webpages/oe/form_header.html b/templates/webpages/oe/form_header.html index 644879c1b..81ed919af 100644 --- a/templates/webpages/oe/form_header.html +++ b/templates/webpages/oe/form_header.html @@ -19,6 +19,7 @@ [%- END %] + -- 2.20.1