From 9ae7f1f9554c44bb7146be17c31acf224c249c7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 10 Jan 2012 16:24:28 +0100 Subject: [PATCH] =?utf8?q?Drucken=20von=20Lieferscheinen=20=C3=BCber=20die?= =?utf8?q?=20Warteschlange?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/BP.pm | 24 +++++++++++++++++++----- bin/mozilla/bp.pl | 5 ++++- templates/webpages/bp/search.html | 6 ++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/SL/BP.pm b/SL/BP.pm index f2d0201d7..c8b4a3ddd 100644 --- a/SL/BP.pm +++ b/SL/BP.pm @@ -149,6 +149,7 @@ sub get_spoolfiles { } else { $arap = "ar"; my $invoice = "a.invoice"; + my $quonumber = "a.quonumber"; if ($form->{type} =~ /_(order|quotation)$/) { $invnumber = "ordnumber"; @@ -156,16 +157,29 @@ sub get_spoolfiles { $invoice = '0'; } + if ($form->{type} eq 'packing_list') { + $invnumber = "donumber"; + $arap = "delivery_orders"; + $invoice = '0'; + $quonumber = '0'; + } + $query = - qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, a.quonumber, | . + qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, $quonumber, | . qq| a.transdate, $invoice AS invoice, '$arap' AS module, vc.name, | . qq| s.spoolfile | . qq|FROM $arap a, ${vc} vc, status s | . qq|WHERE s.trans_id = a.id | . qq| AND s.spoolfile IS NOT NULL | . - qq| AND s.formname = ? | . + ($form->{type} eq 'packing_list' + ? qq| AND s.formname IN (?, ?) | + : qq| AND s.formname = ? |) . qq| AND a.${vc}_id = vc.id|; @values = ($form->{type}); + + if ($form->{type} eq 'packing_list') { + @values = qw(sales_delivery_order purchase_delivery_order); + } } if ($form->{"${vc}_id"}) { @@ -175,14 +189,14 @@ sub get_spoolfiles { $query .= " AND vc.name ILIKE ?"; push(@values, $form->like($form->{ $vc })); } - foreach my $column (qw(invnumber ordnumber quonumber)) { + foreach my $column (qw(invnumber ordnumber quonumber donumber)) { if ($form->{$column}) { $query .= " AND a.$column ILIKE ?"; push(@values, $form->like($form->{$column})); } } - if ($form->{type} =~ /(invoice|sales_order|sales_quotation|puchase_order|request_quotation)$/) { + if ($form->{type} =~ /(invoice|sales_order|sales_quotation|puchase_order|request_quotation|packing_list)$/) { if ($form->{transdatefrom}) { $query .= " AND a.transdate >= ?"; push(@values, $form->{transdatefrom}); @@ -197,7 +211,7 @@ sub get_spoolfiles { my $sortorder = join ', ', $form->sort_columns(@a); if (grep({ $_ eq $form->{sort} } - qw(transdate invnumber ordnumber quonumber name))) { + qw(transdate invnumber ordnumber quonumber donumber name))) { $sortorder = $form->{sort}; } diff --git a/bin/mozilla/bp.pl b/bin/mozilla/bp.pl index 1d9d79fae..d8180a630 100644 --- a/bin/mozilla/bp.pl +++ b/bin/mozilla/bp.pl @@ -49,6 +49,7 @@ sub assert_bp_access { 'sales_order' => 'sales_order_edit', 'sales_quotation' => 'sales_quotation_edit', 'purchase_order' => 'purchase_order_edit', + 'packing_list' => 'sales_delivery_order_edit|purchase_delivery_order_edit', 'request_quotation' => 'request_quotation_edit', 'check' => 'cash', 'receipt' => 'cash', @@ -76,6 +77,7 @@ sub search { purchase_order => { title => $::locale->text('Purchase Orders'), ordnumber => 1, }, sales_quotation => { title => $::locale->text('Quotations'), quonumber => 1, }, request_quotation => { title => $::locale->text('RFQs'), quonumber => 1, }, + packing_list => { title => $::locale->text('Delivery Orders'), donumber => 1, ordnumber => 1 }, check => { title => $::locale->text('Checks'), chknumber => 1, }, receipt => { title => $::locale->text('Receipts'), rctnumber => 1, }, ); @@ -161,12 +163,13 @@ sub list_spool { invnumber => sub { $::locale->text('Invoice Number') . " : $::form->{invnumber}" }, ordnumber => sub { $::locale->text('Order Number') . " : $::form->{ordnumber}" }, quonumber => sub { $::locale->text('Quotation Number') . " : $::form->{quonumber}" }, + donumber => sub { $::locale->text('Delivery Order Number') . " : $::form->{donumber}" }, transdatefrom => sub { $::locale->text('From') . " " . $::locale->date(\%::myconfig, $::form->{transdatefrom}, 1) }, transdateto => sub { $::locale->text('To') . " " . $::locale->date(\%::myconfig, $::form->{transdateto}, 1) }, ); my @options; - for my $key ($::form->{vc}, qw(account invnumber ordnumber quonumber transdatefrom transdateto)) { + for my $key ($::form->{vc}, qw(account invnumber ordnumber quonumber donumber transdatefrom transdateto)) { next unless $::form->{$key}; push @href_options, $key; push @options, $option_texts{$key} ? $option_texts{$key}->() : ''; diff --git a/templates/webpages/bp/search.html b/templates/webpages/bp/search.html index d8f68002f..bf94eea0d 100644 --- a/templates/webpages/bp/search.html +++ b/templates/webpages/bp/search.html @@ -51,6 +51,12 @@ [% L.input_tag('quonumber', '', size=20) %] [%- END %] +[%- IF label.$type.donumber %] + + [% 'Delivery Order Number' | $T8 %] + [% L.input_tag('donumber', '', size=20) %] + +[%- END %] [%- IF label.$type.chknumber %] [% 'Reference' | $T8 %] -- 2.20.1