Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e5ea1c83

Von Sven Schöling vor etwa 15 Jahren hinzugefügt

  • ID e5ea1c8392d571fbac87d9bb79bcc2709f6deb6e
  • Vorgänger cc3a0a33
  • Nachfolger b735f450

Inner Join vermeiden um leere Rechnungen nicht zu verlieren

Fix für Bug 1155

Unterschiede anzeigen:

SL/AP.pm
401 401
    qq|  v.vendornumber, v.country, v.ustid, | .
402 402
    qq|  tz.description AS taxzone, | .
403 403
    qq|  pt.description AS payment_terms, | .
404
    qq{  ch.accno || ' -- ' || ch.description AS charts } .
404
    qq{  ( SELECT ch.accno || ' -- ' || ch.description
405
           FROM acc_trans at
406
           LEFT JOIN chart ch ON ch.id = at.chart_id
407
           WHERE ch.link ~ 'AP[[:>:]]'
408
            AND at.trans_id = a.id
409
            LIMIT 1
410
          ) AS charts } .
405 411
    qq|FROM ap a | .
406 412
    qq|JOIN vendor v ON (a.vendor_id = v.id) | .
407 413
    qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
408 414
    qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id) | .
409 415
    qq|LEFT JOIN tax_zones tz ON (tz.id = v.taxzone_id)| .
410
    qq|LEFT JOIN payment_terms pt ON (pt.id = v.payment_id)| .
411
    qq|LEFT JOIN acc_trans at ON (at.trans_id = a.id)| .
412
    qq|INNER JOIN chart ch ON (ch.id = at.chart_id AND ch.link ~ 'AP[[:>:]]')|;
416
    qq|LEFT JOIN payment_terms pt ON (pt.id = v.payment_id)|;
413 417

  
414 418
  my $where = '';
415 419
  my @values;
SL/AR.pm
424 424
    qq|  e2.name AS salesman, | .
425 425
    qq|  tz.description AS taxzone, | .
426 426
    qq|  pt.description AS payment_terms, | .
427
    qq{  ch.accno || ' -- ' || ch.description AS charts } .
427
    qq{  ( SELECT ch.accno || ' -- ' || ch.description
428
           FROM acc_trans at
429
           LEFT JOIN chart ch ON ch.id = at.chart_id
430
           WHERE ch.link ~ 'AR[[:>:]]'
431
            AND at.trans_id = a.id
432
            LIMIT 1
433
          ) AS charts } .
428 434
    qq|FROM ar a | .
429 435
    qq|JOIN customer c ON (a.customer_id = c.id) | .
430 436
    qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
431 437
    qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | .
432 438
    qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| .
433 439
    qq|LEFT JOIN tax_zones tz ON (tz.id = c.taxzone_id)| .
434
    qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)| .
435
    qq|LEFT JOIN acc_trans at ON (at.trans_id = a.id)| .
436
    qq|INNER JOIN chart ch ON (ch.id = at.chart_id AND ch.link ~ 'AR[[:>:]]')|;
440
    qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)|;
437 441

  
438 442
  my $where = "1 = 1";
439 443
  if ($form->{customer_id}) {

Auch abrufbar als: Unified diff