X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/30723c32d3a1d71b665f69777edd93c672f03c04..cac2ae9bcd47fc55d35c37e25dbb03cd6ac6edeb:/SL/Controller/CustomerVendor.pm diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index f2e4ff609..de7749037 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -394,6 +394,8 @@ sub action_search_contact { sub action_get_delivery { my ($self) = @_; + $::auth->assert('sales_all_edit'); + my $dbh = $::form->get_standard_dbh(); my ($arap, $db, $qty_sign); @@ -407,21 +409,24 @@ sub action_get_delivery { $qty_sign = ''; } - my $where = ' WHERE 1=1 '; + my $where = ' WHERE 1=1'; my @values; if ( !$self->is_vendor() && $::form->{shipto_id} && $::form->{shipto_id} ne 'all' ) { - $where .= "AND ${arap}.shipto_id = ?"; + $where .= " AND ${arap}.shipto_id = ?"; push(@values, $::form->{shipto_id}); + } else { + $where .= " AND ${arap}.${db}_id = ?"; + push(@values, $::form->{id}); } if ( $::form->{delivery_from} ) { - $where .= "AND ${arap}.transdate >= ?"; + $where .= " AND ${arap}.transdate >= ?"; push(@values, conv_date($::form->{delivery_from})); } if ( $::form->{delivery_to} ) { - $where .= "AND ${arap}.transdate <= ?"; + $where .= " AND ${arap}.transdate <= ?"; push(@values, conv_date($::form->{delivery_to})); } @@ -807,6 +812,8 @@ sub _pre_render { $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all(); + $self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all(); + $self->{all_pricegroups} = SL::DB::Manager::Pricegroup->get_all(); $query =