Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ef294a75

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID ef294a7520ae7e452f6671676d7a8077bf74a9cf
  • Vorgänger 880ae1e5
  • Nachfolger c872d063

Unterscheidung Bankeinzug/Überweisung bei Suchefunktion

Unterschiede anzeigen:

SL/SEPA.pm
230 230

  
231 231
  my $myconfig = \%main::myconfig;
232 232
  my $form     = $main::form;
233
  my $vc       = $params{vc} eq 'customer' ? 'customer' : 'vendor';
234
  my $arap     = $params{vc} eq 'customer' ? 'ar'       : 'ap';
233 235

  
234 236
  my $dbh      = $params{dbh} || $form->get_standard_dbh($myconfig);
235 237

  
......
261 263
  }
262 264

  
263 265
  if ($filter->{invnumber}) {
264
    push @where_sub,  "ap.invnumber ILIKE ?";
266
    push @where_sub,  "arap.invnumber ILIKE ?";
265 267
    push @values_sub, '%' . $filter->{invnumber} . '%';
266
    $joins_sub{ap} = 1;
268
    $joins_sub{$arap} = 1;
267 269
  }
268 270

  
269
  if ($filter->{vendor}) {
270
    push @where_sub,  "v.name ILIKE ?";
271
    push @values_sub, '%' . $filter->{vendor} . '%';
272
    $joins_sub{ap}     = 1;
273
    $joins_sub{vendor} = 1;
271
  if ($filter->{vc}) {
272
    push @where_sub,  "vc.name ILIKE ?";
273
    push @values_sub, '%' . $filter->{vc} . '%';
274
    $joins_sub{$arap} = 1;
275
    $joins_sub{vc}    = 1;
274 276
  }
275 277

  
276 278
  foreach my $type (qw(requested_execution execution)) {
......
283 285

  
284 286
  if (@where_sub) {
285 287
    my $joins_sub  = '';
286
    $joins_sub    .= ' LEFT JOIN ap       ON (items.ap_id  = ap.id)' if ($joins_sub{ap});
287
    $joins_sub    .= ' LEFT JOIN vendor v ON (ap.vendor_id = v.id)'  if ($joins_sub{vendor});
288
    $joins_sub    .= " LEFT JOIN ${arap} arap ON (items.${arap}_id = arap.id)" if ($joins_sub{$arap});
289
    $joins_sub    .= " LEFT JOIN ${vc} vc      ON (arap.${vc}_id   = vc.id)"   if ($joins_sub{vc});
288 290

  
289 291
    my $where_sub  = join(' AND ', map { "(${_})" } @where_sub);
290 292

  
......
297 299
    push @values, @values_sub;
298 300
  }
299 301

  
302
  push @where,  'se.vc = ?';
303
  push @values, $vc;
304

  
300 305
  my $where = ' WHERE ' . join(' AND ', map { "(${_})" } @where) if (@where);
301 306

  
302 307
  my $query =

Auch abrufbar als: Unified diff