X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Foe.pl;h=b8d754c5c0f88da233261ff99999dc5b36a6d487;hb=d7f060429e809653d45e93e86b3c5c8d7129e0a9;hp=1e0c8a6c6d38833db7f2bb6de4de3b376f1c8d84;hpb=ddbe3ea5ec297a58acc9ee3afc17156fb97be7f2;p=kivitendo-erp.git
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index 1e0c8a6c6..b8d754c5c 100644
--- a/bin/mozilla/oe.pl
+++ b/bin/mozilla/oe.pl
@@ -37,8 +37,8 @@ use SL::IR;
use SL::IS;
use SL::PE;
-require "$form->{path}/io.pl";
-require "$form->{path}/arap.pl";
+require "bin/mozilla/io.pl";
+require "bin/mozilla/arap.pl";
1;
@@ -98,7 +98,7 @@ sub add {
set_headings("add");
$form->{callback} =
- "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&path=$form->{path}&password=$form->{password}"
+ "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&order_links;
@@ -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;
}
@@ -254,14 +253,6 @@ sub order_links {
(@{ $form->{"all_$form->{vc}"} });
}
- # currencies
- @curr = split(/:/, $form->{currencies});
- chomp $curr[0];
- $form->{defaultcurrency} = $curr[0];
- $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
-
- map { $form->{selectcurrency} .= "\n" } @curr;
-
$form->{taxincluded} = $taxincluded if ($form->{id});
# departments
@@ -277,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};
@@ -346,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|
-
{transdate} onBlur=\"check_right_date_format(this)\"> |
- text('button') . qq|> |
- |;
- $button2 = qq|
- {reqdate} onBlur=\"check_right_date_format(this)\"> |
- text('button') . qq|> |
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
- "reqdate", "BL", "trigger2");
-
- } else {
-
- # without JavaScript Calendar
- $button1 = qq|
- {transdate} onBlur=\"check_right_date_format(this)\"> | |;
- $button2 = qq|
- {reqdate} onBlur=\"check_right_date_format(this)\"> | |;
- }
+ $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;
@@ -410,7 +374,7 @@ sub form_header {
}
# set option selected
- foreach $item ($form->{vc}, currency, department, employee) {
+ foreach $item ($form->{vc}, currency, department, employee, ($form->{vc} eq "customer" ? customer : vendor)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
@@ -426,13 +390,17 @@ 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",
- "taxzones" => "ALL_TAXZONES");
+ "taxzones" => "ALL_TAXZONES",
+ "payments" => "ALL_PAYMENTS",
+ "currencies" => "ALL_CURRENCIES",
+ $vc => "ALL_" . uc($vc));
my %labels;
my @values = (undef);
@@ -441,9 +409,54 @@ 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,
+ '-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->{"id"}} = $item->{name}.qq|--|.$item->{"id"};
+ }
+
+ $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)))) . 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 = ("");
@@ -453,12 +466,16 @@ sub form_header {
$item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
}
- 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,
+ '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
. qq| | |;
+ }
%labels = ();
@values = ("");
@@ -490,6 +507,21 @@ sub form_header {
|;
}
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"name"};
+ }
+
+ my $employees = qq|
+
+ | . $locale->text('Employee') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'employee', '-default' => $form->{"employee"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ |
+
|;
%labels = ();
@values = ();
@@ -507,6 +539,27 @@ sub form_header {
|;
+ %labels = ();
+ @values = ();
+ my $i = 0;
+ foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
+ push(@values, $item);
+ $labels{$item} = $item;
+ }
+
+ $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
+ my $currencies;
+ if (scalar @values) {
+ $currencies = qq|
+
+ | . $locale->text('Currency') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ |
+
|;
+ }
+
$form->{exchangerate} =
$form->format_amount(\%myconfig, $form->{exchangerate});
@@ -541,11 +594,6 @@ sub form_header {
}
}
- $vclabel = ucfirst $form->{vc};
- $vclabel = $locale->text($vclabel);
-
-
-
if ($form->{business}) {
$business = qq|
@@ -665,48 +713,25 @@ 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| |
- |
-
- |
-
+ $employees
|;
}
} else {
$employee = qq|
{customer_klass}>
-
- | . $locale->text('Employee') . qq| |
- |
-
- |
-
+ $employees
|;
}
if ($form->{resubmit} && ($form->{format} eq "html")) {
@@ -778,24 +803,15 @@ onchange="document.getElementById('update_button').click();">| .
|
$taxincluded
@@ -1051,9 +1071,7 @@ sub form_footer {
print $webdav_list;
}
- print qq|
-{jscalendar}>
-|;
+
print qq|
|
@@ -1153,7 +1171,6 @@ sub form_footer {
-{path}>
{login}>
{password}>
@@ -1173,9 +1190,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
@@ -1342,20 +1367,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} = " |