From 2c5603bb853ba7892d98c295e1f00641d7c13ef3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 14 May 2007 13:15:29 +0000 Subject: [PATCH] Den Rest von dn.pl auf die Verwendung von HTML-Vorlagen umgestellt. --- SL/DN.pm | 10 +- SL/Form.pm | 18 + bin/mozilla/dn.pl | 344 ++---------------- locale/de/dn | 20 - templates/webpages/dunning/search_de.html | 136 +++++++ templates/webpages/dunning/search_master.html | 136 +++++++ .../webpages/dunning/show_dunning_de.html | 55 +++ .../webpages/dunning/show_dunning_master.html | 55 +++ 8 files changed, 436 insertions(+), 338 deletions(-) create mode 100644 templates/webpages/dunning/search_de.html create mode 100644 templates/webpages/dunning/search_master.html create mode 100644 templates/webpages/dunning/show_dunning_de.html create mode 100644 templates/webpages/dunning/show_dunning_master.html diff --git a/SL/DN.pm b/SL/DN.pm index 5ffb4ba66..95ff16ac3 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -418,8 +418,6 @@ sub get_dunning { my @values; - $form->{customer_id} = $1 if ($form->{customer} =~ /--(\d+)$/); - if ($form->{customer_id}) { $where .= qq| AND (a.customer_id = ?)|; push(@values, $form->{customer_id}); @@ -429,7 +427,6 @@ sub get_dunning { push(@values, '%' . $form->{customer} . '%'); } - my %columns = ( "ordnumber" => "a.ordnumber", "invnumber" => "a.invnumber", @@ -446,7 +443,12 @@ sub get_dunning { push(@values, conv_i($form->{dunning_level})); } - $form->{minamount} = $form->parse_amount($myconfig,$form->{minamount}); + if ($form->{department_id}) { + $where .= qq| AND a.department_id = ?|; + push @values, conv_i($form->{department_id}); + } + + $form->{minamount} = $form->parse_amount($myconfig, $form->{minamount}); if ($form->{minamount}) { $where .= qq| AND ((a.amount - a.paid) > ?) |; push(@values, $form->{minamount}); diff --git a/SL/Form.pm b/SL/Form.pm index a11122c49..9b5f27973 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1703,6 +1703,20 @@ sub _get_vendors { $main::lxdebug->leave_sub(); } +sub _get_departments { + $main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key = "all_departments" unless ($key); + + my $query = qq|SELECT * FROM department|; + + $self->{$key} = selectall_hashref_query($self, $dbh, $query); + + $main::lxdebug->leave_sub(); +} + sub get_lists { $main::lxdebug->enter_sub(); @@ -1777,6 +1791,10 @@ sub get_lists { $self->_get_payments($dbh, $params{"payments"}); } + if($params{"departments"}) { + $self->_get_departments($dbh, $params{"departments"}); + } + $dbh->disconnect(); $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index c67e37e04..e8e242a61 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -216,178 +216,27 @@ sub set_email { sub search { $lxdebug->enter_sub(); - # setup customer selection - $form->all_vc(\%myconfig, "customer", "AR"); + + $form->get_lists("customers" => "ALL_CUSTOMERS", + "departments" => "ALL_DEPARTMENTS"); DN->get_config(\%myconfig, \%$form); - if (@{ $form->{all_customer} }) { - map { $customer .= "\n" - } (@{ $form->{DUNNING} }); - } - $dunning_level = qq| - - | . $locale->text('Next Dunning Level') . qq| - - - | if $form->{selectdunning_level}; - - # departments - if (@{ $form->{all_departments} }) { - $form->{selectdepartment} = "