X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=ac4dcf5b4c6b425add16835e4316bc20fc507569;hb=f5e0cdb2123962a7ced378468c6fb29c384c0d4a;hp=3c55ee58f60248b7c6e95be9e63c1c421652b71a;hpb=ce3ce404919a3e39c4b966db7b7d02076cd8c7e5;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 3c55ee58f..ac4dcf5b4 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -157,15 +157,13 @@ sub edit { sub order_links { $lxdebug->enter_sub(); - # get customer/vendor $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); # retrieve order/quotation - $form->{webdav} = $webdav; - # set jscalendar - $form->{jscalendar} = $jscalendar; + $form->{webdav} = $webdav; + $form->{jsscript} = 1; my $editing = $form->{id}; @@ -231,6 +229,7 @@ sub order_links { } $form->{cp_id} = $cp_id; + if ($payment_id) { $form->{payment_id} = $payment_id; } @@ -269,13 +268,6 @@ sub order_links { $form->{employee} = "$form->{employee}--$form->{employee_id}"; - # sales staff - if (@{ $form->{all_employees} }) { - $form->{selectemployee} = ""; - map { $form->{selectemployee} .= "\n" } - (@{ $form->{all_employees} }); - } - # forex $form->{forex} = $form->{exchangerate}; @@ -338,44 +330,24 @@ sub form_header { shiptophone shiptofax shiptodepartment_1 shiptodepartment_2); # use JavaScript Calendar or not - $form->{jsscript} = $form->{jscalendar}; + $form->{jsscript} = 1; $jsscript = ""; - $payment = qq||; - foreach $item (@{ $form->{payment_terms} }) { - if ($form->{payment_id} eq $item->{id}) { - $payment .= qq||; - } else { - $payment .= qq||; - } - } - if ($form->{jsscript}) { - - # with JavaScript Calendar - $button1 = qq| - - text('button') . qq|> - |; - $button2 = qq| - - text('button') . qq|> - |; - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", - "reqdate", "BL", "trigger2"); - - } else { - - # without JavaScript Calendar - $button1 = qq| - |; - $button2 = qq| - |; - } + $button1 = qq| + + text('button') . qq|> + |; + $button2 = qq| + + text('button') . qq|> + |; + + #write Trigger + $jsscript = + Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", + "reqdate", "BL", "trigger2"); my @tmp; @@ -402,7 +374,7 @@ sub form_header { } # set option selected - foreach $item ($form->{vc}, currency, department, employee) { + foreach $item ($form->{vc}, currency, department, ($form->{vc} eq "customer" ? customer : vendor)) { $form->{"select$item"} =~ s/ selected//; $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; @@ -418,14 +390,18 @@ sub form_header { map({ push(@old_project_ids, $form->{"project_id_$_"}) if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); + my $vc = $form->{vc} eq "customer" ? "customers" : "vendors"; $form->get_lists("contacts" => "ALL_CONTACTS", "shipto" => "ALL_SHIPTO", "projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, - "employees" => "ALL_SALESMEN", + "employees" => "ALL_EMPLOYEES", + "salesmen" => "ALL_SALESMEN", "taxzones" => "ALL_TAXZONES", - "currencies" => "ALL_CURRENCIES"); + "payments" => "ALL_PAYMENTS", + "currencies" => "ALL_CURRENCIES", + $vc => "ALL_" . uc($vc)); my %labels; my @values = (undef); @@ -434,24 +410,73 @@ sub form_header { $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"})); + + my $contact; + if (scalar @values > 1) { + $contact = qq| + + | . $locale->text('Contact Person') . qq| + | . + NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px', + '-labels' => \%labels, '-default' => $form->{"cp_id"})) + . qq| + + |; + } + + %labels = (); + @values = (); + + foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) { + push(@values, $item->{"name"}.qq|--|.$item->{"id"}); + $labels{$item->{"name"}.qq|--|.$item->{"id"}} = $item->{name}; + } + + $vc = qq| + {vc}_id"}) . qq|"> + {vc}"}) . qq|"> + | . $locale->text(ucfirst($form->{vc})) . qq| + | . + (($myconfig{vclimit} <= scalar(@values)) + ? qq|{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, '-style' => 'width: 250px')))) . qq| + + {vc}"}) . qq|">|; + + %labels = (); + @values = (""); + foreach my $item (@{ $form->{"ALL_PAYMENTS"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"description"}; + } + + $payments = qq| + | . $locale->text('Payment Terms') . qq| + | . + NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, '-style' => 'width: 250px', + '-labels' => \%labels, '-default' => $form->{payment_id})) + . qq||; %labels = (); @values = (""); foreach my $item (@{ $form->{"ALL_SHIPTO"} }) { push(@values, $item->{"shipto_id"}); - $labels{$item->{"shipto_id"}} = - $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"}; + $labels{$item->{"shipto_id"}} = join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city); } - my $shipto = qq| - | . $locale->text('Shipping Address') . qq| - | . - NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, - '-labels' => \%labels, '-default' => $form->{"shipto_id"})) + my $shipto; + if (scalar @values > 1) { + $shipto = qq| + + | . $locale->text('Shipping Address') . qq| + | . + NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px', + '-labels' => \%labels, '-default' => $form->{"shipto_id"})) . qq||; + } %labels = (); @values = (""); @@ -463,26 +488,40 @@ sub form_header { NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values, '-labels' => \%labels, '-default' => $form->{"globalproject_id"})); - - $salesman = ""; + + my $salesmen = ""; + %labels = (); + @values = (); 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}; + foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = ($item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}); } - - $salesman = + $salesmen = qq| | . $locale->text('Salesman') . qq| | . - NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id}, + NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{"salesman_id"} ? $form->{"salesman_id"} : $form->{"employee_id"}, '-values' => \@values, '-labels' => \%labels)) . qq| |; } + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; + } + + my $employee = qq| + + | . $locale->text('Employee') . qq| + | . + NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; %labels = (); @values = (); @@ -496,7 +535,7 @@ sub form_header { | . $locale->text('Steuersatz') . qq| | . NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, - '-values' => \@values, '-labels' => \%labels)) . qq| + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq| |; @@ -507,9 +546,11 @@ sub form_header { push(@values, $item); $labels{$item} = $item; } - - $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; - my $currencies = qq| + + $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; + my $currencies; + if (scalar @values) { + $currencies = qq| | . $locale->text('Currency') . qq| | . @@ -517,7 +558,7 @@ sub form_header { '-values' => \@values, '-labels' => \%labels)) . qq| |; - + } $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); @@ -553,40 +594,28 @@ sub form_header { } } - $vclabel = ucfirst $form->{vc}; - $vclabel = $locale->text($vclabel); - - - if ($form->{business}) { $business = qq| - | . $locale->text('Business') . qq| - $form->{business} - | . $locale->text('Trade Discount') . qq| - | + | . ($form->{vc} eq "customer" ? $locale->text('Customer type') : $locale->text('Vendor type')) . qq| + $form->{business}; | . $locale->text('Trade Discount') . qq| | . $form->format_amount(\%myconfig, $form->{tradediscount} * 100) . qq| % - + |; } if ($form->{max_dunning_level}) { $dunning = qq| - - - - - - - - - -
| . $locale->text('Max. Dunning Level') . qq|:$form->{max_dunning_level}| . $locale->text('Dunning Amount') . qq|:| - . $form->format_amount(\%myconfig, $form->{dunning_amount},2) - . qq|
- - + + | . $locale->text('Max. Dunning Level') . qq|: + + $form->{max_dunning_level}; + | . $locale->text('Dunning Amount') . qq|: | + . $form->format_amount(\%myconfig, $form->{dunning_amount},2) + . qq| + + |; } @@ -620,20 +649,11 @@ sub form_header { $n = ($form->{creditremaining} =~ /-/) ? "0" : "1"; $creditremaining = qq| - - - - - - - - - - - -
| . $locale->text('Credit Limit') . qq|$form->{creditlimit}| . $locale->text('Remaining') . qq|$form->{creditremaining}
- - $shipto + $shipto + + | . $locale->text('Credit Limit') . qq| + $form->{creditlimit}; | . $locale->text('Remaining') . qq| $form->{creditremaining} + |; } else { @@ -677,49 +697,22 @@ sub form_header { |; } - $vc = - ($form->{"select$form->{vc}"}) - ? qq|\n{vc}"}) . qq|">| - : qq|{vc} value="$form->{$form->{vc}}" size=35>|; - $department = qq| | . $locale->text('Department') . qq| - + - -| if $form->{selectdepartment}; - - $employee = qq| - -|; + | if $form->{selectdepartment}; if ($form->{type} eq 'sales_order') { if ($form->{selectemployee}) { - $employee = qq| - {customer_klass}> - - | . $locale->text('Employee') . qq| - - - - -|; + $employee .= qq| + |; } } else { - $employee = qq| - {customer_klass}> - - | . $locale->text('Employee') . qq| - - - - -|; + $employee .= qq| + |; } if ($form->{resubmit} && ($form->{format} eq "html")) { $onload = @@ -742,41 +735,26 @@ onchange="document.getElementById('update_button').click();">| . # show history button js $form->{javascript} .= qq||; #/show history button js + $form->{javascript} .= qq||; + $form->header; print qq|
{script}> + +|; -{id}> -{action}> - -{type}> -{formname}> -{media}> -{format}> -{proforma}> - - - - - -{vc}> - - - -{discount}> -{creditlimit}> -{creditremaining}> + $form->hide_form(qw(id action type vc formname media format proforma queued printed emailed + title discount creditlimit creditremaining tradediscount business + max_dunning_level dunning_amount)); -{tradediscount}> -{business}> - + print qq| @@ -790,14 +768,8 @@ onchange="document.getElementById('update_button').click();">| . + $payments + +
- - - {vc}_id value=$form->{"$form->{vc}_id"}> - {vc}"}"> - - - + $vc + $contact $creditremaining $business $dunning @@ -845,7 +817,7 @@ print qq|
$vclabel$vc| - . $locale->text('Contact Person') . qq|$contact
$openclosed $employee - $salesman + $salesmen $ordnumber @@ -1009,10 +981,10 @@ sub form_footer { - - -
| . $locale->text('Project Number') . qq|$notes $intnotes
| . $locale->text('Payment Terms') . qq|
+
$taxincluded @@ -1064,9 +1036,7 @@ sub form_footer { print $webdav_list; } - print qq| -{jscalendar}> -|; + print qq| @@ -1185,9 +1155,17 @@ sub update { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining); $form->{update} = 1; - + + if($form->{payment_id}) { + $payment_id = $form->{payment_id}; + } + &check_name($form->{vc}); - + + if($form->{payment_id} eq "") { + $form->{payment_id} = $payment_id; + } + $buysell = 'buy'; $buysell = 'sell' if ($form->{vc} eq 'vendor'); $form->{exchangerate} = $exchangerate @@ -1354,20 +1332,6 @@ sub search { $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); - map { $vc .= "\n" } - @{ $form->{"all_$form->{vc}"} }; - - $vclabel = ucfirst $form->{vc}; - $vclabel = $locale->text($vclabel); - - # $locale->text('Vendor') - # $locale->text('Customer') - - $vc = - ($vc) - ? qq|| - : qq|{vc} size=35>|; - # departments if (@{ $form->{all_departments} }) { $form->{selectdepartment} = "