- push(@tmp, qq|
- <input name="closed" id="closed" type="checkbox" class="checkbox" value="1" $checkedclosed>
- <label for="closed">| . $locale->text('Closed') . qq|</label>|);
- }
-
- if (@tmp) {
- $openclosed .= qq|
- <tr>
- <td colspan=| . (2 * scalar(@tmp)) . qq| align=center>| . join("\n", @tmp) . qq|
- </td>
- </tr>
-|;
- }
-
- # set option selected
- foreach $item ($form->{vc}, currency, department, employee, ($form->{vc} eq "customer" ? customer : vendor)) {
- $form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~
- s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
- }
-
- #quote select[customer|vendor] Bug 133
- $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
-
- #substitute \n and \r to \s (bug 543)
- $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g;
-
- my @old_project_ids = ($form->{"globalproject_id"});
- map({ push(@old_project_ids, $form->{"project_id_$_"})
- if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
-
- $form->get_lists("contacts" => "ALL_CONTACTS",
- "shipto" => "ALL_SHIPTO",
- "projects" => { "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids },
- "employees" => "ALL_SALESMEN",
- "taxzones" => "ALL_TAXZONES",
- "payments" => "ALL_PAYMENTS",
- "currencies" => "ALL_CURRENCIES");
- ($form->{vc} eq "customer"
- ? $form->get_lists("customers" => "ALL_CUSTOMERS")
- : $form->get_lists("vendors" => "ALL_VENDORS"));
-
- my %labels;
- my @values = (undef);
- foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
- push(@values, $item->{"cp_id"});
- $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
- ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
- }
- my $contact =
- NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
- '-labels' => \%labels, '-default' => $form->{"cp_id"}));
-
- %labels = ();
- @values = ();
-
- foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) {
- push(@values, $item->{name}.qq|--|.$item->{"id"});
- $labels{$item->{"id"}} = $item->{name}.qq|--|.$item->{"id"};
- }
-
- my $vc = qq|
- <input type="hidden" name="old$form->{vc}" value="| . H($form->{"old$form->{vc}"}) . qq|">
- <th align="right">| . $locale->text(ucfirst($form->{vc})) . qq|</th>
- <td>| .
- (($myconfig{vclimit} <= scalar(@values))
- ? qq|<input type="text" value="| . H($form->{"old$form->{vc}"}) . qq|" name="$form->{vc}">|
- : (NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"},
- '-onChange' => 'document.getElementById(\'update_button\').click();',
- '-values' => \@values, '-labels' => \%labels)))) . qq|
- </td><input type=hidden name="select$form->{vc}" value="| .
- Q($form->{"select$form->{vc}"}) . qq|">|;
-
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{"ALL_PAYMENTS"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"description"};
- }
-
- $payments = qq|
- <th align="right">| . $locale->text('Payment Terms') . qq|</th>
- <td>| .
- NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values,
- '-labels' => \%labels, '-default' => $form->{payment_id}))
- . qq|</td>|;
-
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
- push(@values, $item->{"shipto_id"});
- $labels{$item->{"shipto_id"}} =
- $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
- }
-
- my $shipto = qq|
- <th align=right>| . $locale->text('Shipping Address') . qq|</th>
- <td>| .
- NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
- '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
- . qq|</td>|;
-
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"projectnumber"};
- }
- my $globalprojectnumber =
- NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
- '-labels' => \%labels,
- '-default' => $form->{"globalproject_id"}));
-
- $salesman = "";
- if ($form->{type} =~ /^sales_/) {
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{ALL_SALESMEN} }) {
- push(@values, $item->{id});
- $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
- }
-
- $salesman =
- qq|<tr>
- <th align="right">| . $locale->text('Salesman') . qq|</th>
- <td>| .
- NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
- '-values' => \@values, '-labels' => \%labels))
- . qq|</td>
- </tr>|;
- }
-
- %labels = ();
- @values = ();
- foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"name"};
- }
-
- my $employees = qq|
- <tr>
- <th align="right">| . $locale->text('Employee') . qq|</th>
- <td>| .
- NTI($cgi->popup_menu('-name' => 'employee', '-default' => $form->{"employee"},
- '-values' => \@values, '-labels' => \%labels)) . qq|
- </td>
- </tr>|;
-
- %labels = ();
- @values = ();
- foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"description"};
- }
-
- $taxzone = qq|
- <tr>
- <th align="right">| . $locale->text('Steuersatz') . qq|</th>
- <td>| .
- NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
- '-values' => \@values, '-labels' => \%labels)) . qq|
- </td>
- </tr>|;
-
- %labels = ();
- @values = ();
- my $i = 0;
- foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
- push(@values, $item);
- $labels{$item} = $item;
- }
-
- $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
- my $currencies = qq|
- <tr>
- <th align="right">| . $locale->text('Currency') . qq|</th>
- <td>| .
- NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
- '-values' => \@values, '-labels' => \%labels)) . qq|
- </td>
- </tr>|;
-
-
- $form->{exchangerate} =
- $form->format_amount(\%myconfig, $form->{exchangerate});
-
- if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
- $creditwarning = 1;
- } else {
- $creditwarning = 0;
- }
-
- $form->{creditlimit} =
- $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
- $form->{creditremaining} =
- $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");