Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4070dbf3

Von Sven Schöling vor mehr als 12 Jahren hinzugefügt

  • ID 4070dbf38e04b168fe43bd3a6e5a3f28f77e986d
  • Vorgänger 8545bbce
  • Nachfolger 5104dee4

Suche nach Ansprechpartnern

Merge aus zwei verschiedenen Implementierungen der gleichen Funktionalität

Features:
- behandelt Ansprechparter als direkte Suchziele wie Kunden und Lieferanten (1)
- Suche ähnlich den bekannten Suchmasken (1)
- Suche nach direktem Suchwort (2)
- Verlinkung einer Schnellsuche in der menunew header Leiste (2)

Unterschiede anzeigen:

bin/mozilla/ct.pl
49 49

  
50 50
use SL::CT;
51 51
use SL::CVar;
52
use SL::Request qw(flatten);
52 53
use SL::DB::Business;
53 54
use SL::DB::Default;
54 55
use SL::Helper::Flash;
......
110 111
  $main::lxdebug->leave_sub();
111 112
}
112 113

  
114
sub search_contact {
115
  $::lxdebug->enter_sub;
116
  $::auth->assert('customer_vendor_edit');
117

  
118
  $::form->{fokus}    = 'Form.name';
119

  
120
  $::form->header;
121
  print $::form->parse_html_template('ct/search_contact');
122

  
123
  $::lxdebug->leave_sub;
124
}
125

  
113 126
sub list_names {
114 127
  $main::lxdebug->enter_sub();
115 128

  
......
268 281
  $main::lxdebug->leave_sub();
269 282
}
270 283

  
284
sub list_contacts {
285
  $::lxdebug->enter_sub;
286
  $::auth->assert('customer_vendor_edit');
287

  
288
  $::form->{sortdir} = 1 unless defined $::form->{sortdir};
289

  
290
  my @contacts     = CT->search_contacts(
291
    search_term => $::form->{search_term},
292
    filter      => $::form->{filter},
293
  );
294

  
295
  my @columns      = qw(
296
    cp_id vcname vcnumber cp_name cp_givenname cp_street cp_phone1 cp_phone2
297
    cp_mobile1 cp_mobile2 cp_email cp_abteilung cp_birthday cp_gender
298
  );
299

  
300
  my @visible_columns;
301
  if ($::form->{l}) {
302
    @visible_columns = grep { $::form->{l}{$_} } @columns;
303
    push @visible_columns, qw(cp_phone1 cp_phone2)   if $::form->{l}{cp_phone};
304
    push @visible_columns, qw(cp_mobile1 cp_mobile2) if $::form->{l}{cp_mobile};
305
  } else {
306
   @visible_columns = qw(vcname vcnumber cp_name cp_givenname cp_phone1 cp_phone2 cp_mobile1 cp_email);
307
  }
308

  
309
  my %column_defs  = (
310
    'cp_id'        => { 'text' => $::locale->text('ID'), },
311
    'vcname'       => { 'text' => $::locale->text('Customer/Vendor'), },
312
    'vcnumber'     => { 'text' => $::locale->text('Customer/Vendor Number'), },
313
    'cp_name'      => { 'text' => $::locale->text('Name'), },
314
    'cp_givenname' => { 'text' => $::locale->text('Given Name'), },
315
    'cp_street'    => { 'text' => $::locale->text('Street'), },
316
    'cp_phone1'    => { 'text' => $::locale->text('Phone1'), },
317
    'cp_phone2'    => { 'text' => $::locale->text('Phone2'), },
318
    'cp_mobile1'   => { 'text' => $::locale->text('Mobile 1'), },
319
    'cp_mobile2'   => { 'text' => $::locale->text('Mobile 2'), },
320
    'cp_email'     => { 'text' => $::locale->text('E-mail'), },
321
    'cp_abteilung' => { 'text' => $::locale->text('Department'), },
322
    'cp_birthday'  => { 'text' => $::locale->text('Birthday'), },
323
    'cp_gender'    => { 'text' => $::locale->text('Gender'), },
324
  );
325

  
326
  map { $column_defs{$_}->{visible} = 1 } @visible_columns;
327

  
328
  my @hidden_variables  = (qw(search_term filter l));
329
  my $hide_vars         = { map { $_ => $::form->{$_} } @hidden_variables };
330
  my @hidden_nondefault = grep({ $::form->{$_} } @hidden_variables);
331
  my $callback          = build_std_url('action=list_contacts', join '&', map { E($_->[0]) . '=' . E($_->[1]) } @{ flatten($hide_vars) });
332
  $::form->{callback}     = "$callback&sort=" . E($::form->{sort});
333

  
334
  map { $column_defs{$_}->{link} = "${callback}&sort=${_}&sortdir=" . ($::form->{sort} eq $_ ? 1 - $::form->{sortdir} : $::form->{sortdir}) } @columns;
335

  
336
  $::form->{title} = $::locale->text('Contacts');
337

  
338
  my $report     = SL::ReportGenerator->new(\%::myconfig, $::form);
339

  
340
  my @options    = $::locale->text('Search term') . ': ' . $::form->{search_term};
341

  
342
  $report->set_options('top_info_text'       => join("\n", @options),
343
                       'output_format'       => 'HTML',
344
                       'title'               => $::form->{title},
345
                       'attachment_basename' => $::locale->text('contact_list') . strftime('_%Y%m%d', localtime time),
346
    );
347
  $report->set_options_from_form;
348

  
349
  $report->set_columns(%column_defs);
350
  $report->set_column_order(@columns);
351

  
352
  $report->set_export_options('list_contacts', @hidden_variables);
353

  
354
  $report->set_sort_indicator($::form->{sort}, $::form->{sortdir});
355

  
356
  foreach my $ref (@contacts) {
357
    my $row = { map { $_ => { 'data' => $ref->{$_} } } @columns };
358

  
359
    $row->{vcname}->{link}   = build_std_url('action=edit', 'id=' . E($ref->{vcid}), 'db=' . E($ref->{db}), 'callback', @hidden_nondefault);
360
    $row->{vcnumber}->{link} = $row->{vcname}->{link};
361
    $row->{cp_email}->{link} = 'mailto:' . E($ref->{cp_email});
362

  
363
    $report->add_data($row);
364
  }
365

  
366
  $report->generate_with_headers;
367

  
368
  $::lxdebug->leave_sub;
369
}
370

  
271 371
sub edit {
272 372
  $main::lxdebug->enter_sub();
273 373

  

Auch abrufbar als: Unified diff