Revision 2eaa3936
Von Jan Büren vor etwa 6 Jahren hinzugefügt
bin/mozilla/common.pl | ||
---|---|---|
332 | 332 |
|
333 | 333 |
# ------------------------------------------------------------------------- |
334 | 334 |
|
335 |
sub cov_selection_internal { |
|
336 |
$main::lxdebug->enter_sub(); |
|
337 |
|
|
338 |
my $form = $main::form; |
|
339 |
my %myconfig = %main::myconfig; |
|
340 |
my $locale = $main::locale; |
|
341 |
|
|
342 |
my $order_by = "name"; |
|
343 |
$order_by = $form->{"order_by"} if (defined($form->{"order_by"})); |
|
344 |
my $order_dir = 1; |
|
345 |
$order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"})); |
|
346 |
|
|
347 |
my $type = $form->{"is_vendor"} ? $locale->text("vendor") : $locale->text("customer"); |
|
348 |
|
|
349 |
my $covs = Common->retrieve_customers_or_vendors(\%myconfig, $form, $order_by, $order_dir, $form->{"is_vendor"}, $form->{"allow_both"}); |
|
350 |
map({ $covs->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$covs})); |
|
351 |
|
|
352 |
if (0 == scalar(@{$covs})) { |
|
353 |
$form->show_generic_information(sprintf($locale->text("No %s was found matching the search parameters."), $type)); |
|
354 |
} elsif (1 == scalar(@{$covs})) { |
|
355 |
$::request->{layout}->add_javascripts_inline("cov_selected('1')"); |
|
356 |
} |
|
357 |
|
|
358 |
my $callback = "$form->{script}?action=cov_selection_internal&"; |
|
359 |
map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } |
|
360 |
(qw(name input_name input_id is_vendor allow_both), grep({ /^[fl]_/ } keys %$form))); |
|
361 | 335 |
|
362 |
my @header_sort = qw(name address contact); |
|
363 |
my %header_title = ( "name" => $locale->text("Name"), |
|
364 |
"address" => $locale->text("Address"), |
|
365 |
"contact" => $locale->text("Contact"), |
|
366 |
); |
|
367 |
|
|
368 |
my @header = |
|
369 |
map(+{ "column_title" => $header_title{$_}, |
|
370 |
"column" => $_, |
|
371 |
"callback" => $callback . "order_by=${_}&order_dir=" . ($order_by eq $_ ? 1 - $order_dir : $order_dir), |
|
372 |
}, |
|
373 |
@header_sort); |
|
374 |
|
|
375 |
foreach my $cov (@{ $covs }) { |
|
376 |
$cov->{address} = "$cov->{street}, $cov->{zipcode} $cov->{city}"; |
|
377 |
$cov->{address} =~ s{^,}{}x; |
|
378 |
$cov->{address} =~ s{\ +}{\ }gx; |
|
379 |
|
|
380 |
$cov->{contact} = join " ", map { $cov->{$_} } qw(cp_gender cp_title cp_givenname cp_name); |
|
381 |
$cov->{contact} =~ s{\ +}{\ }gx; |
|
382 |
} |
|
383 |
|
|
384 |
$form->{"title"} = $form->{is_vendor} ? $locale->text("Select a vendor") : $locale->text("Select a customer"); |
|
385 |
$form->header(); |
|
386 |
print($form->parse_html_template("generic/cov_selection", { "HEADER" => \@header, |
|
387 |
"COVS" => $covs, })); |
|
388 |
|
|
389 |
$main::lxdebug->leave_sub(); |
|
390 |
} |
|
391 | 336 |
|
392 | 337 |
|
393 | 338 |
# Functions to call add routines beneath different reports |
Auch abrufbar als: Unified diff
Toten Code entfernt: customer_or_vendor_selection.js
Bevor es den Customer-Picker gab, bestand die Möglichkeit
über einen Klick auf ein Fragezeichen den Kunden/Lieferanten
rauszusuchen. Die Funktion war noch ein bisschen erweitert,
da der Ansprechpartner noch separat angezeigt wurde (toter Projektcode im
Standard ?), die zusätzlich Auswahl-Funktion hatte keine weitere
Auswirkung. Die aktuelle einzige Stelle, wo der Code noch geladen
wurde ist im Letter-Controller. Das Deaktivieren des js-Codes
zeigt, wie erwartet, keine Unterschiede im Verhalten =>
Alles mittlerweile komplett überflüssig, inkl. edit_part.js (?) in Letter.pm