Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a2aca2e1

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID a2aca2e1d8136681d2a95fefd240d509581c8bc8
  • Vorgänger c654c46b
  • Nachfolger dde9d68d

Sortierung in Berichten über Kunden und Lieferanten auch auf- und absteigbar sortierbar gemacht.

Unterschiede anzeigen:

SL/CT.pm
682 682
  my %allowed_sort_columns =
683 683
    map({ $_, 1 } qw(id customernumber vendornumber name address contact phone fax email
684 684
                     taxnumber sic_code business invnumber ordnumber quonumber));
685
  $sortorder =
686
    $form->{sort} && $allowed_sort_columns{$form->{sort}} ?
687
    $form->{sort} : "name";
685
  $sortorder    = $form->{sort} && $allowed_sort_columns{$form->{sort}} ? $form->{sort} : "name";
688 686
  $form->{sort} = $sortorder;
687
  my $sortdir   = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC';
689 688

  
690 689
  if ($sortorder eq "address") {
691
    $sortorder = "lower(country), lower(city), lower(street)";
690
    $sortorder = "lower(country) ${sortdir}, lower(city) ${sortdir}, lower(street) ${sortdir}";
692 691
  } elsif ($sortorder ne 'id') {
693
    $sortorder = "lower($sortorder)";
692
    $sortorder = "lower($sortorder) ${sortdir}";
693
  } else {
694
    $sortorder .= " ${sortdir}";
694 695
  }
695 696

  
696 697
  if ($form->{"${cv}number"}) {
bin/mozilla/ct.pl
108 108

  
109 109
  $form->{IS_CUSTOMER} = $form->{db} eq 'customer';
110 110

  
111
  report_generator_set_default_sort('name', 1);
112

  
111 113
  CT->search(\%myconfig, \%$form);
112 114

  
113 115
  my $cvar_configs = CVar->get_configs('module' => 'CT');
......
159 161
  my @hidden_variables  = (qw(db status obsolete), map { "l_$_" } @columns);
160 162
  my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables);
161 163
  my $callback          = build_std_url('action=list_names', grep { $form->{$_} } @hidden_variables);
162
  $form->{callback}     = "$callback&sort=" . E($form->{sort});
164
  $form->{callback}     = "$callback&sort=" . E($form->{sort}) . "&sortdir=" . E($form->{sortdir});
163 165

  
164
  map { $column_defs{$_}->{link} = "${callback}&sort=${_}" } @columns;
166
  foreach (@columns) {
167
    my $sortdir              = $form->{sort} eq $_ ? 1 - $form->{sortdir} : $form->{sortdir};
168
    $column_defs{$_}->{link} = "${callback}&sort=${_}&sortdir=${sortdir}";
169
  }
165 170

  
166 171
  my ($ordertype, $quotationtype, $attachment_basename);
167 172
  if ($form->{IS_CUSTOMER}) {
......
192 197

  
193 198
  $report->set_export_options('list_names', @hidden_variables);
194 199

  
195
  $report->set_sort_indicator($form->{sort}, 1);
200
  $report->set_sort_indicator($form->{sort}, $form->{sortdir});
196 201

  
197 202
  CVar->add_custom_variables_to_report('module'         => 'CT',
198 203
                                       'trans_id_field' => 'id',

Auch abrufbar als: Unified diff