X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=899d263f08d59b827425f8d00b769e43bee10479;hb=09335d0f463d5fff5b1b620ffc61f3ad48ab793a;hp=640fb37e5d7e3905cedcf29954cab01a68848baa;hpb=d52e2ffc5a084a39f3442311bc8c02b114aa128a;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 640fb37e5..899d263f0 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -162,9 +162,8 @@ sub order_links { ($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}; @@ -331,36 +330,24 @@ sub form_header { shiptophone shiptofax shiptodepartment_1 shiptodepartment_2); # use JavaScript Calendar or not - $form->{jsscript} = $form->{jscalendar}; + $form->{jsscript} = 1; $jsscript = ""; - 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; @@ -403,6 +390,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", @@ -411,11 +399,9 @@ sub form_header { "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")); - + "currencies" => "ALL_CURRENCIES", + $vc => "ALL_" . uc($vc)); + my %labels; my @values = (undef); foreach my $item (@{ $form->{"ALL_CONTACTS"} }) { @@ -423,9 +409,19 @@ 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 = (); @@ -435,14 +431,17 @@ 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| + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq| + {vc}"}) . qq|">|; @@ -456,7 +455,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||; @@ -464,16 +463,19 @@ 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 = 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 = (""); @@ -533,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| |; @@ -544,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| | . @@ -554,7 +558,7 @@ sub form_header { '-values' => \@values, '-labels' => \%labels)) . qq| |; - + } $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); @@ -593,32 +597,25 @@ sub form_header { 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| + + |; } @@ -652,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 { @@ -712,7 +700,7 @@ sub form_header { $department = qq| | . $locale->text('Department') . qq| - + | if $form->{selectdepartment}; @@ -751,41 +739,26 @@ sub form_header { # 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| @@ -800,10 +773,7 @@ sub form_header {
$vc - - - + $contact $creditremaining $business $dunning @@ -1070,9 +1040,7 @@ sub form_footer { print $webdav_list; } - print qq| -{jscalendar}> -|; + print qq| - |; - $button2 = qq| - - |; - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3", - "transdateto", "BL", "trigger4"); - } else { - # without JavaScript Calendar - $button1 = qq| - |; - $button2 = qq| - |; - } + $button1 = qq| + + |; + $button2 = qq| + + |; + + #write Trigger + $jsscript = + Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3", + "transdateto", "BL", "trigger4"); + + 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 = (""); @@ -1441,6 +1402,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| @@ -1457,7 +1436,8 @@ sub search {
| - . $locale->text('Contact Person') . qq|$contact
@@ -1399,37 +1367,30 @@ sub search { } # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; - if ($form->{jsscript}) { - - # with JavaScript Calendar - $button1 = qq| - - text('button') . qq|> - text('button') . qq|> + text('button') . qq|> + text('button') . qq|> - $vc + + $department @@ -1556,12 +1536,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 @@ -1569,11 +1543,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", @@ -1927,6 +1908,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!")); @@ -2018,6 +2003,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!")); @@ -2495,6 +2484,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