Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dde9d68d

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID dde9d68d7704edcaa4334356cec15ef7ce4f380f
  • Vorgänger a2aca2e1
  • Nachfolger aa589686

Bericht über Mahnungen sortierbar gemacht.

Unterschiede anzeigen:

SL/DN.pm
598 598
    push(@values, $form->{dunningto});
599 599
  }
600 600

  
601
  $query =
601
  my %sort_columns = (
602
    'dunning_description' => [ qw(dn.dunning_description customername invnumber) ],
603
    'customername'        => [ qw(customername invnumber) ],
604
    'invnumber'           => [ qw(a.invnumber) ],
605
    'transdate'           => [ qw(a.transdate a.invnumber) ],
606
    'duedate'             => [ qw(a.duedate a.invnumber) ],
607
    'dunning_date'        => [ qw(dunning_date a.invnumber) ],
608
    'dunning_duedate'     => [ qw(dunning_duedate a.invnumber) ],
609
    );
610

  
611
  my $sortdir   = !defined $form->{sortdir}    ? 'ASC'         : $form->{sortdir} ? 'ASC' : 'DESC';
612
  my $sortkey   = $sort_columns{$form->{sort}} ? $form->{sort} : 'customername';
613
  my $sortorder = join ', ', map { "$_ $sortdir" } @{ $sort_columns{$sortkey} };
614

  
615
  my $query =
602 616
    qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount,
603 617
         ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee,
604 618
         da.interest, dn.dunning_description, da.transdate AS dunning_date,
......
607 621
       JOIN customer ct ON (a.customer_id = ct.id), dunning da
608 622
       LEFT JOIN dunning_config dn ON (da.dunning_config_id = dn.id)
609 623
       $where
610
       ORDER BY name, a.id|;
624
       ORDER BY $sortorder|;
611 625

  
612 626
  $form->{DUNNINGS} = selectall_hashref_query($form, $dbh, $query, @values);
613 627

  

Auch abrufbar als: Unified diff