X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=c9cb92e0a559d1f4aa85386c2f99f97a37f3d26b;hb=e6ef45f2d8a980a68bd54df8c2afce4e0203c289;hp=899d263f08d59b827425f8d00b769e43bee10479;hpb=e06a7e08648363ef8c8ef14678ab853ae7bdd670;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 899d263f0..c9cb92e0a 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -374,7 +374,7 @@ sub form_header { } # set option selected - foreach $item ($form->{vc}, currency, department, employee, ($form->{vc} eq "customer" ? customer : vendor)) { + 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}/; @@ -396,7 +396,8 @@ sub form_header { "projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, - "employees" => "ALL_SALESMEN", + "employees" => "ALL_EMPLOYEES", + "salesmen" => "ALL_SALESMEN", "taxzones" => "ALL_TAXZONES", "payments" => "ALL_PAYMENTS", "currencies" => "ALL_CURRENCIES", @@ -427,8 +428,8 @@ sub form_header { @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"}; + push(@values, $item->{"name"}.qq|--|.$item->{"id"}); + $labels{$item->{"name"}.qq|--|.$item->{"id"}} = $item->{name}; } $vc = qq| @@ -437,7 +438,7 @@ sub form_header { | . $locale->text(ucfirst($form->{vc})) . qq| | . (($myconfig{vclimit} <= scalar(@values)) - ? qq|{vc}"}) . qq|" name="$form->{vc}">| + ? 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| @@ -487,21 +488,20 @@ 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| |; @@ -509,16 +509,16 @@ sub form_header { %labels = (); @values = (); - foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { + foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"name"}; + $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; } - my $employees = qq| + my $employee = qq| | . $locale->text('Employee') . qq| | . - NTI($cgi->popup_menu('-name' => 'employee', '-default' => $form->{"employee"}, + NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"}, '-values' => \@values, '-labels' => \%labels)) . qq| |; @@ -707,16 +707,12 @@ sub form_header { if ($form->{type} eq 'sales_order') { if ($form->{selectemployee}) { - $employee = qq| - {customer_klass}> - $employees -|; + $employee .= qq| + |; } } else { - $employee = qq| - {customer_klass}> - $employees -|; + $employee .= qq| + |; } if ($form->{resubmit} && ($form->{format} eq "html")) { $onload = @@ -821,7 +817,7 @@ print qq| $openclosed $employee - $salesman + $salesmen $ordnumber @@ -1390,6 +1386,7 @@ sub search { $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, + "employees" => "ALL_EMPLOYEES", $vc => "ALL_" . uc($vc)); my %labels = (); @@ -1402,24 +1399,41 @@ sub search { NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values, '-labels' => \%labels)); + #employees + %labels = (); + @values = (""); + foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; + } + + my $employee_block = qq| + + + + |; + %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"}; + $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"}; } my $vc_label = $form->{vc} eq "customer" ? $locale->text('Customer') : $locale->text('Vendor'); $vc = $myconfig{vclimit} <= scalar(@values) - ? qq|{vc}"}) . qq|" name="$form->{vc}">| + ? 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| @@ -1444,6 +1458,7 @@ sub search { + $employee_block @@ -1480,7 +1495,7 @@ sub search { . $locale->text('Required by') . qq| - + @@ -2122,8 +2137,11 @@ sub delete {

$msg $form->{$ordnumber}

+ + @@ -2133,7 +2151,7 @@ sub delete { $lxdebug->leave_sub(); } -sub yes { +sub delete_order_quotation { $lxdebug->enter_sub(); if ($form->{type} =~ /_order$/) { @@ -2144,7 +2162,6 @@ sub yes { $err = $locale->text('Cannot delete quotation!'); } if (OE->delete(\%myconfig, \%$form, $spool)){ - $form->redirect($msg); # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; @@ -2152,6 +2169,8 @@ sub yes { $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history + $form->info($msg); + exit(); } $form->error($err); @@ -2496,9 +2515,61 @@ sub save_as_new { $lxdebug->leave_sub(); } +sub check_for_direct_delivery_yes { + $lxdebug->enter_sub(); + + $form->{direct_delivery_checked} = 1; + delete @{$form}{grep /^shipto/, keys %{ $form }}; + map { s/^CFDD_//; $form->{$_} = $form->{"CFDD_${_}"} } grep /^CFDD_/, keys %{ $form }; + $form->{shipto} = 1; + purchase_order(); + $lxdebug->leave_sub(); +} + +sub check_for_direct_delivery_no { + $lxdebug->enter_sub(); + + $form->{direct_delivery_checked} = 1; + delete @{$form}{grep /^shipto/, keys %{ $form }}; + purchase_order(); + + $lxdebug->leave_sub(); +} + +sub check_for_direct_delivery { + $lxdebug->enter_sub(); + + if ($form->{direct_delivery_checked} + || (!$form->{shiptoname} && !$form->{shiptostreet} && !$form->{shipto_id})) { + $lxdebug->leave_sub(); + return; + } + + if ($form->{shipto_id}) { + Common->get_shipto_by_id(\%myconfig, $form, $form->{shipto_id}, "CFDD_"); + + } else { + map { $form->{"CFDD_${_}"} = $form->{$_ } } grep /^shipto/, keys %{ $form }; + } + + delete $form->{action}; + $form->{VARIABLES} = [ map { { "key" => $_, "value" => $form->{$_} } } grep { ref $_ eq "" } keys %{ $form } ]; + + $form->header(); + print $form->parse_html_template("oe/check_for_direct_delivery"); + + $lxdebug->leave_sub(); + + exit 0; +} + sub purchase_order { $lxdebug->enter_sub(); + if ($form->{type} eq 'sales_order') { + check_for_direct_delivery(); + } + if ( $form->{type} eq 'sales_quotation' || $form->{type} eq 'request_quotation') { OE->close_order(\%myconfig, \%$form); @@ -2602,3 +2673,10 @@ sub e_mail { $lxdebug->leave_sub(); } +sub yes { + call_sub($form->{yes_nextsub}); +} + +sub no { + call_sub($form->{no_nextsub}); +}

| . $locale->text('Project Number') . qq|
| . $locale->text('Employee') . qq|| . + NTI($cgi->popup_menu('-name' => 'employee_id', + '-values' => \@values, + '-labels' => \%labels)) . qq| +
$ordlabel
| . $locale->text('Transaction description') . qq|
ucfirst($form->{vc}) $vc_label $employee | . $locale->text('Ship via') . qq|