X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=b5cd79d636621c7baad5e47d73daca7b742a4c9a;hb=4536d0a7bc1b0b014cdac7211dcc171973678dbf;hp=f08daabfde2218e79c95bc7b3327eae3faa28aa2;hpb=2fda509c7dc417aad28ed072e91e8ffe2396314d;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index f08daabfd..b5cd79d63 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -157,7 +157,6 @@ sub edit { sub order_links { $lxdebug->enter_sub(); - # get customer/vendor $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); @@ -231,6 +230,7 @@ sub order_links { } $form->{cp_id} = $cp_id; + if ($payment_id) { $form->{payment_id} = $payment_id; } @@ -334,14 +334,6 @@ sub form_header { $form->{jsscript} = $form->{jscalendar}; $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 @@ -411,6 +403,7 @@ 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", @@ -418,11 +411,10 @@ sub form_header { "old_id" => \@old_project_ids }, "employees" => "ALL_SALESMEN", "taxzones" => "ALL_TAXZONES", - "currencies" => "ALL_CURRENCIES"); - ($form->{vc} eq "customer" - ? $form->get_lists("customers" => "ALL_CUSTOMERS") - : $form->get_lists("vendors" => "ALL_VENDORS")); - + "payments" => "ALL_PAYMENTS", + "currencies" => "ALL_CURRENCIES", + $vc => "ALL_" . uc($vc)); + my %labels; my @values = (undef); foreach my $item (@{ $form->{"ALL_CONTACTS"} }) { @@ -442,17 +434,33 @@ sub form_header { $labels{$item->{"id"}} = $item->{name}.qq|--|.$item->{"id"}; } - my $vc = qq| + $vc = qq| + {vc}_id"}) . qq|"> + {vc}"}) . qq|"> | . $locale->text(ucfirst($form->{vc})) . qq| | . - (($myconfig{vclimit} == 1 ) - ? 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)))) . 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, + '-labels' => \%labels, '-default' => $form->{payment_id})) + . qq||; + %labels = (); @values = (""); foreach my $item (@{ $form->{"ALL_SHIPTO"} }) { @@ -1008,10 +1016,10 @@ sub form_footer { $notes $intnotes - | . $locale->text('Payment Terms') . qq| - - + + $payments + + $taxincluded @@ -1184,9 +1192,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 @@ -1413,8 +1429,11 @@ sub search { |; } + my $vc = $form->{vc} eq "customer" ? "customers" : "vendors"; + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", - "all" => 1 }); + "all" => 1 }, + $vc => "ALL_" . uc($vc)); my %labels = (); my @values = (""); @@ -1426,6 +1445,24 @@ sub search { NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values, '-labels' => \%labels)); + %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_label = $form->{vc} eq "customer" ? $locale->text('Customer') : $locale->text('Vendor'); + $vc = + $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)); + $form->header; print qq| @@ -1442,7 +1479,8 @@ sub search { - $vc + + $department @@ -1541,12 +1579,6 @@ $jsscript sub orders { $lxdebug->enter_sub(); - # split vendor / customer - ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = - split(/--/, $form->{ $form->{vc} }); - - OE->transactions(\%myconfig, \%$form); - $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber"; # construct href @@ -1554,11 +1586,18 @@ sub orders { qw(type vc login password transdatefrom transdateto open closed notdelivered delivered department transaction_description); + push @fields, $form->{vc}; $href = "$form->{script}?action=orders&" . join("&", map { "${_}=" . E($form->{$_}) } @fields) . "&${ordnumber}=" . E($form->{$ordnumber}); $callback = $href; + # split vendor / customer + ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = + split(/--/, $form->{ $form->{vc} }); + + OE->transactions(\%myconfig, \%$form); + @columns = ( "transdate", "reqdate", "id", "$ordnumber", @@ -1912,6 +1951,10 @@ sub save_and_close { $form->isblank("transdate", $locale->text('Quotation Date missing!')); } + my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"; + $form->{$idx} =~ s/^\s*//g; + $form->{$idx} =~ s/\s*$//g; + $msg = ucfirst $form->{vc}; $form->isblank($form->{vc}, $locale->text($msg . " missing!")); @@ -1922,9 +1965,16 @@ sub save_and_close { if ($form->{currency} ne $form->{defaultcurrency}); &validate_items; - + + if($form->{payment_id}) { + $payment_id = $form->{payment_id}; + } + # if the name changed get new values if (&check_name($form->{vc})) { + if($form->{payment_id} eq "") { + $form->{payment_id} = $payment_id; + } &update; exit; } @@ -1996,6 +2046,10 @@ sub save { $form->isblank("transdate", $locale->text('Quotation Date missing!')); } + my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"; + $form->{$idx} =~ s/^\s*//g; + $form->{$idx} =~ s/\s*$//g; + $msg = ucfirst $form->{vc}; $form->isblank($form->{vc}, $locale->text($msg . " missing!")); @@ -2006,9 +2060,16 @@ sub save { if ($form->{currency} ne $form->{defaultcurrency}); &validate_items; - + + if($form->{payment_id}) { + $payment_id = $form->{payment_id}; + } + # if the name changed get new values if (&check_name($form->{vc})) { + if($form->{payment_id} eq "") { + $form->{payment_id} = $payment_id; + } &update; exit; } @@ -2161,9 +2222,16 @@ sub invoice { $form->{ordnumber} = ""; $form->{quodate} = $form->{transdate}; } - + + if($form->{payment_id}) { + $payment_id = $form->{payment_id}; + } + # if the name changed get new values if (&check_name($form->{vc})) { + if($form->{payment_id} eq "") { + $form->{payment_id} = $payment_id; + } &update; exit; } @@ -2459,6 +2527,8 @@ sub save_as_new { # Let Lx-Office assign a new order number if the user hasn't changed the # previous one. If it has been changed manually then use it as-is. my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"; + $form->{$idx} =~ s/^\s*//g; + $form->{$idx} =~ s/\s*$//g; if ($form->{saved_xyznumber} && ($form->{saved_xyznumber} eq $form->{$idx})) { delete($form->{$idx});
$vc_label$vc