Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 15682dc4

Von Moritz Bunkus vor fast 18 Jahren hinzugefügt

  • ID 15682dc47316fcc2deab66730045cd38afec001f
  • Vorgänger f27a8a8f
  • Nachfolger 8e206587

Drop-Down-Auswahlboxen für Ansprechpartner und Lieferadresse bei jedem Maskenaufbau aus der Datenbank aufbauen. Für den HTML-Code wird jetzt das CGI-Modul verwendet.

Unterschiede anzeigen:

bin/mozilla/oe.pl
407 407
  #quote select[customer|vendor] Bug 133
408 408
  $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
409 409

  
410
  #build contacts
411
  if ($form->{all_contacts}) {
412

  
413
    $form->{selectcontact} = "<option></option>";
414
    foreach $item (@{ $form->{all_contacts} }) {
415
      my $department = ($item->{cp_abteilung}) ? "--$item->{cp_abteilung}" : "";
416
      if ($form->{cp_id} == $item->{cp_id}) {
417
        $form->{selectcontact} .=
418
          "<option value=$item->{cp_id} selected>$item->{cp_name}$department</option>";
419
      } else {
420
        $form->{selectcontact} .= "<option value=$item->{cp_id}>$item->{cp_name}$department</option>";
421
      }
422
    }
423
  } else {
424
    $form->{selectcontact} =~ s/ selected//g;
425
    if ($form->{cp_id} ne "") {
426
      $form->{selectcontact} =~ s/value=$form->{cp_id}/value=$form->{cp_id} selected/;
427
    }
428
  }
410
  $form->get_lists("contacts" => "ALL_CONTACTS",
411
                   "shipto" => "ALL_SHIPTO");
429 412

  
413
  my (%labels, @values);
414
  foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
415
    push(@values, $item->{"cp_id"});
416
    $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
417
      ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
418
  }
419
  my $contact =
420
    $cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
421
                     '-labels' => \%labels, '-default' => $form->{"cp_id"});
430 422

  
431
  if (@{ $form->{SHIPTO} }) {
432
    $form->{selectshipto} = "<option value=0></option>";
433
    foreach $item (@{ $form->{SHIPTO} }) {
434
      if ($item->{shipto_id} == $form->{shipto_id}) {
435
        $form->{selectshipto} .=
436
          "<option value=$item->{shipto_id} selected>$item->{shiptoname} $item->{shiptodepartment_1}</option>";
437
      } else {
438
        $form->{selectshipto} .=
439
          "<option value=$item->{shipto_id}>$item->{shiptoname} $item->{shiptodepartment}</option>";
440
      }
441

  
442
    }
443
  } else {
444
    $form->{selectshipto} = $form->unquote($form->{selectshipto});
445
    $form->{selectshipto} =~ s/ selected//g;
446
    if ($form->{shipto_id} ne "") {
447
      $form->{selectshipto} =~ s/value=$form->{shipto_id}/value=$form->{shipto_id} selected/;
448
    }
423
  %labels = ();
424
  @values = ("");
425
  foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
426
    push(@values, $item->{"shipto_id"});
427
    $labels{$item->{"shipto_id"}} =
428
      $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
449 429
  }
450 430

  
451
  $shipto = qq|
431
  my $shipto = qq|
452 432
		<th align=right>| . $locale->text('Shipping Address') . qq|</th>
453
		<td><select name=shipto_id style="width:200px;">$form->{selectshipto}</select></td>|;
454
  $form->{selectshipto} = $form->quote($form->{selectshipto});
455
  $shipto .= qq| <input type=hidden name=selectshipto value="$form->{selectshipto}">|;
456

  
457

  
433
		<td>| .
434
    $cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
435
                     '-labels' => \%labels, '-default' => $form->{"shipto_id"})
436
    . qq|</td>|;
458 437

  
459 438
  $form->{exchangerate} =
460 439
    $form->format_amount(\%myconfig, $form->{exchangerate});
......
470 449
  $form->{creditremaining} =
471 450
    $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
472 451

  
473
  $contact =
474
    ($form->{selectcontact})
475
    ? qq|<select name=cp_id>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
476
    : qq|<input name=contact value="$form->{contact}" size=35>|;
477

  
478 452
  $exchangerate = qq|
479 453
<input type=hidden name=forex value=$form->{forex}>
480 454
|;

Auch abrufbar als: Unified diff