X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=ac4dcf5b4c6b425add16835e4316bc20fc507569;hb=f5e0cdb2123962a7ced378468c6fb29c384c0d4a;hp=cfbb216addf9ca53d594189252df2fa77a118313;hpb=fc490063361896eb3b2aa0939fc0df716ae38262;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index cfbb216ad..ac4dcf5b4 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", @@ -416,7 +417,7 @@ sub form_header { | . $locale->text('Contact Person') . qq| | . - NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, + NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px', '-labels' => \%labels, '-default' => $form->{"cp_id"})) . qq| @@ -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,10 +438,10 @@ 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)))) . qq| + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq| {vc}"}) . qq|">|; @@ -455,7 +456,7 @@ sub form_header { $payments = qq| | . $locale->text('Payment Terms') . qq| | . - NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, + NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, '-style' => 'width: 250px', '-labels' => \%labels, '-default' => $form->{payment_id})) . qq||; @@ -463,8 +464,7 @@ sub form_header { @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; @@ -473,7 +473,7 @@ sub form_header { | . $locale->text('Shipping Address') . qq| | . - NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, + NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px', '-labels' => \%labels, '-default' => $form->{"shipto_id"})) . qq||; } @@ -488,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| |; @@ -510,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| |; @@ -536,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| |; @@ -701,23 +700,19 @@ sub form_header { $department = qq| | . $locale->text('Department') . qq| - + | if $form->{selectdepartment}; 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 = @@ -822,7 +817,7 @@ print qq| $openclosed $employee - $salesman + $salesmen $ordnumber @@ -1391,6 +1386,7 @@ sub search { $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, + "employees" => "ALL_EMPLOYEES", $vc => "ALL_" . uc($vc)); my %labels = (); @@ -1403,24 +1399,40 @@ 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| @@ -1445,6 +1457,7 @@ sub search { + $employee_block @@ -1481,7 +1494,7 @@ sub search { . $locale->text('Required by') . qq| - + @@ -2123,8 +2136,11 @@ sub delete {

$msg $form->{$ordnumber}

+ + @@ -2134,7 +2150,7 @@ sub delete { $lxdebug->leave_sub(); } -sub yes { +sub delete_order_quotation { $lxdebug->enter_sub(); if ($form->{type} =~ /_order$/) { @@ -2145,7 +2161,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}; @@ -2153,6 +2168,8 @@ sub yes { $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history + $form->info($msg); + exit(); } $form->error($err); @@ -2497,9 +2514,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); @@ -2603,3 +2672,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', '-default' => $form->{"employee_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| +
$ordlabel
| . $locale->text('Transaction description') . qq|
ucfirst($form->{vc}) $vc_label $employee | . $locale->text('Ship via') . qq|