X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Foe.pl;h=e076691a1b326263f13d93e0606ddbc42ec78d2c;hb=4f3393f4faf9b531d48bb97056468eaf5d0676c8;hp=abf4bf60e4ad6f1f4e3a71ca5f6415d0b5b3bd50;hpb=d946f59b7c4c8069ecb83834ed34251056155e53;p=kivitendo-erp.git
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index abf4bf60e..e076691a1 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;
@@ -120,19 +120,19 @@ sub edit {
# editing without stuff to edit? try adding it first
if ($form->{rowcount}) {
- map { $id++ if $form->{"id_$_"} } (1 .. $form->{rowcount});
+ map { $id++ if $form->{"multi_id_$_"} } (1 .. $form->{rowcount});
if (!$id) {
# reset rowcount
undef $form->{rowcount};
&add;
+ $lxdebug->leave_sub();
return;
}
- } else {
- if (!$form->{id}) {
- &add;
- return;
- }
+ } elsif (!$form->{id}) {
+ &add;
+ $lxdebug->leave_sub();
+ return;
}
if ($form->{print_and_save}) {
@@ -167,6 +167,8 @@ sub order_links {
# set jscalendar
$form->{jscalendar} = $jscalendar;
+ my $editing = $form->{id};
+
OE->retrieve(\%myconfig, \%$form);
if ($form->{payment_id}) {
@@ -179,6 +181,8 @@ sub order_links {
$taxzone_id = $form->{taxzone_id};
}
+ $salesman_id = $form->{salesman_id} if ($editing);
+
# if multiple rowcounts (== collective order) then check if the
# there were more than one customer (in that case OE::retrieve removes
@@ -245,7 +249,8 @@ sub order_links {
if (@{ $form->{"all_$form->{vc}"} }) {
$form->{ $form->{vc} } =
qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
- map { $form->{"select$form->{vc}"} .= "\n" }
(@{ $form->{"all_$form->{vc}"} });
}
@@ -255,7 +260,7 @@ sub order_links {
$form->{defaultcurrency} = $curr[0];
$form->{currency} = $form->{defaultcurrency} unless $form->{currency};
- map { $form->{selectcurrency} .= "\n" } @curr;
$form->{taxincluded} = $taxincluded if ($form->{id});
@@ -266,7 +271,7 @@ sub order_links {
map {
$form->{selectdepartment} .=
- "\n"
} (@{ $form->{all_departments} });
}
@@ -275,13 +280,15 @@ sub order_links {
# sales staff
if (@{ $form->{all_employees} }) {
$form->{selectemployee} = "";
- map { $form->{selectemployee} .= "\n" }
(@{ $form->{all_employees} });
}
# forex
$form->{forex} = $form->{exchangerate};
+ $form->{salesman_id} = $salesman_id if ($editing);
+
$lxdebug->leave_sub();
}
@@ -354,12 +361,12 @@ sub form_header {
# with JavaScript Calendar
$button1 = qq|
-
{transdate}> |
+ {transdate} onBlur=\"check_right_date_format(this)\"> |
text('button') . qq|> |
|;
$button2 = qq|
- {reqdate}> |
+ {reqdate} onBlur=\"check_right_date_format(this)\"> |
text('button') . qq|> |
|;
@@ -373,28 +380,30 @@ sub form_header {
# without JavaScript Calendar
$button1 = qq|
- {transdate}> | |;
+ {transdate} onBlur=\"check_right_date_format(this)\"> | |;
$button2 = qq|
- {reqdate}> | |;
+ {reqdate} onBlur=\"check_right_date_format(this)\"> | |;
}
- if ($form->{id}) {
- $openclosed = qq|
-
-
-
-
-|;
+ my @tmp;
- if (($form->{"type"} eq "sales_order") ||
- ($form->{"type"} eq "purchase_order")) {
- $openclosed .= qq|
+ if (($form->{"type"} eq "sales_order") ||
+ ($form->{"type"} eq "purchase_order")) {
+ push(@tmp, qq|
-
-|;
- }
+ |);
+ }
+ if ($form->{id}) {
+ push(@tmp, qq|
+
+ |);
+ }
+
+ if (@tmp) {
$openclosed .= qq|
+ |
+ | . join("\n", @tmp) . qq|
|
|;
@@ -410,6 +419,9 @@ sub form_header {
#quote select[customer|vendor] Bug 133
$form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
+ #substitute \n and \r to \s (bug 543)
+ $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g;
+
my @old_project_ids = ($form->{"globalproject_id"});
map({ push(@old_project_ids, $form->{"project_id_$_"})
if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
@@ -418,9 +430,12 @@ sub form_header {
"shipto" => "ALL_SHIPTO",
"projects" => { "key" => "ALL_PROJECTS",
"all" => 0,
- "old_id" => \@old_project_ids });
+ "old_id" => \@old_project_ids },
+ "employees" => "ALL_SALESMEN",
+ "taxzones" => "ALL_TAXZONES");
- my (%labels, @values);
+ my %labels;
+ my @values = (undef);
foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
push(@values, $item->{"cp_id"});
$labels{$item->{"cp_id"}} = $item->{"cp_name"} .
@@ -456,6 +471,42 @@ sub form_header {
'-labels' => \%labels,
'-default' => $form->{"globalproject_id"}));
+ $salesman = "";
+ 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};
+ }
+
+ $salesman =
+ qq|
+ | . $locale->text('Salesman') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
+ '-values' => \@values, '-labels' => \%labels))
+ . qq| |
+
|;
+ }
+
+
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"description"};
+ }
+
+ $taxzone = qq|
+
+ | . $locale->text('Steuersatz') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ |
+
|;
+
$form->{exchangerate} =
$form->format_amount(\%myconfig, $form->{exchangerate});
@@ -527,34 +578,6 @@ sub form_header {
|;
}
- if (@{ $form->{TAXZONE} }) {
- $form->{selecttaxzone} = "";
- foreach $item (@{ $form->{TAXZONE} }) {
- if ($item->{id} == $form->{taxzone_id}) {
- $form->{selecttaxzone} .=
- "";
- } else {
- $form->{selecttaxzone} .=
- "";
- }
-
- }
- } else {
- $form->{selecttaxzone} =~ s/ selected//g;
- if ($form->{taxzone_id} ne "") {
- $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}>/value=$form->{taxzone_id} selected>/;
- }
- }
-
- $taxzone = qq|
-
- | . $locale->text('Steuersatz') . qq| |
- |
-
-
|;
-
-
if ($form->{type} !~ /_quotation$/) {
$ordnumber = qq|
@@ -644,7 +667,10 @@ sub form_header {
$vc =
($form->{"select$form->{vc}"})
- ? qq|\n{vc}"}">|
+ ? qq|\n{vc}"}) . qq|">|
: qq|{vc} value="$form->{$form->{vc}}" size=35>|;
$department = qq|
@@ -665,7 +691,7 @@ sub form_header {
$employee = qq|
{customer_klass}>
- | . $locale->text('Salesperson') . qq| |
+ | . $locale->text('Employee') . qq| |
|
|
@@ -689,14 +715,17 @@ sub form_header {
} elsif ($form->{resubmit}) {
$onload = qq|document.oe.submit()|;
} else {
- $onload = "fokus()";
+ $onload = "focus()";
}
$credittext = $locale->text('Credit Limit exceeded!!!');
if ($creditwarning) {
$onload = qq|alert('$credittext')|;
}
-
+
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
+
$form->{"javascript"} .= qq||;
# show history button js
$form->{javascript} .= qq||;
@@ -803,6 +832,7 @@ print qq|
$openclosed
$employee
+ $salesman
$ordnumber
| . $locale->text('Project Number') . qq| |
@@ -967,7 +997,7 @@ sub form_footer {
$intnotes |
| . $locale->text('Payment Terms') . qq| |
- |
@@ -1028,7 +1058,7 @@ sub form_footer {
|;
- &print_options;
+ print_options();
print qq|
|
@@ -1123,7 +1153,6 @@ sub form_footer {
-{path}>
{login}>
{password}>
@@ -1297,7 +1326,7 @@ sub search {
$form->{vc} = 'customer';
$ordlabel = $locale->text('Order Number');
$ordnumber = 'ordnumber';
- $employee = $locale->text('Salesperson');
+ $employee = $locale->text('Employee');
}
if ($form->{type} eq 'sales_quotation') {
@@ -1312,7 +1341,7 @@ 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};
@@ -1323,7 +1352,7 @@ sub search {
$vc =
($vc)
- ? qq|{vc}>|
+ ? qq|{vc}>|
: qq|{vc} size=35>|;
# departments
@@ -1332,7 +1361,7 @@ sub search {
map {
$form->{selectdepartment} .=
- "\n"
} (@{ $form->{all_departments} });
}
@@ -1363,12 +1392,12 @@ sub search {
# with JavaScript Calendar
$button1 = qq|
-
+ |
text('button') . qq|> |
|;
$button2 = qq|
-
+ |
text('button') . qq|> |
|;
@@ -1381,9 +1410,9 @@ sub search {
# without JavaScript Calendar
$button1 = qq|
- | |;
+ | |;
$button2 = qq|
- | |;
+ | |;
}
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
@@ -1416,7 +1445,7 @@ sub search {
$vclabel |
- $vc |
+ $vc |
$department
@@ -1488,7 +1517,6 @@ $jsscript
-{path}>
{login}>
{password}>
{vc}>
@@ -1522,7 +1550,7 @@ sub orders {
# construct href
$href =
- "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department";
+ "$form->{script}?action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department";
# construct callback
$number = $form->escape($form->{$ordnumber}, 1);
@@ -1530,7 +1558,7 @@ sub orders {
$department = $form->escape($form->{department}, 1);
$callback =
- "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department";
+ "$form->{script}?action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department";
@columns =
$form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
@@ -1576,11 +1604,10 @@ sub orders {
if ($form->{vc} eq 'customer') {
if ($form->{type} eq 'sales_order') {
$form->{title} = $locale->text('Sales Orders');
- $employee = $locale->text('Salesperson');
} else {
$form->{title} = $locale->text('Quotations');
- $employee = $locale->text('Employee');
}
+ $employee = $locale->text('Employee');
$name = $locale->text('Customer');
}
@@ -1727,13 +1754,13 @@ sub orders {
$subtotalamount += $oe->{amount};
$column_data{ids} =
- qq| | |;
+ qq| | |;
$column_data{id} = "$oe->{id} | ";
$column_data{transdate} = "$oe->{transdate} | ";
$column_data{reqdate} = "$oe->{reqdate} | ";
$column_data{$ordnumber} =
- "{path}&action=$action&type=$form->{type}&id=$oe->{id}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback_escaped>$oe->{$ordnumber} | ";
+ "{type}&id=$oe->{id}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback_escaped>$oe->{$ordnumber} | ";
$column_data{name} = "$oe->{name} | ";
$column_data{employee} = "$oe->{employee} | ";
@@ -1801,7 +1828,6 @@ sub orders {
if ($form->{type} =~ /sales_order/) {
print qq|
-
@@ -1824,7 +1850,6 @@ sub orders {
{type}>
{vc}>
-{path}>
{login}>
{password}>
@@ -1942,6 +1967,7 @@ sub save_and_close {
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
$form->save_history($form->dbconnect(\%myconfig));
}
@@ -2023,6 +2049,7 @@ sub save {
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
$form->save_history($form->dbconnect(\%myconfig));
}
@@ -2094,6 +2121,7 @@ sub yes {
$form->redirect($msg);
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "DELETED";
$form->save_history($form->dbconnect(\%myconfig));
}
@@ -2207,7 +2235,7 @@ sub invoice {
# locale messages
$locale = new Locale "$myconfig{countrycode}", "$script";
- require "$form->{path}/$form->{script}";
+ require "bin/mozilla/$form->{script}";
map { $form->{"select$_"} = "" } ($form->{vc}, currency);
@@ -2288,7 +2316,6 @@ sub backorder_exchangerate {
print qq|
-{path}>
{login}>
{password}>
@@ -2442,6 +2469,10 @@ sub purchase_order {
OE->close_order(\%myconfig, \%$form);
}
+ if ($form->{type} =~ /^sales_/) {
+ delete($form->{ordnumber});
+ }
+
$form->{cp_id} *= 1;
$form->{title} = $locale->text('Add Purchase Order');
@@ -2461,6 +2492,10 @@ sub sales_order {
OE->close_order(\%myconfig, $form);
}
+ if ($form->{type} eq "purchase_order") {
+ delete($form->{ordnumber});
+ }
+
$form->{cp_id} *= 1;
$form->{title} = $locale->text('Add Sales Order');
@@ -2512,22 +2547,22 @@ sub poso {
sub e_mail {
$lxdebug->enter_sub();
- $form->{saveasnew} = 1;
- $form->{closed} = 0;
$form->{print_and_save} = 1;
- map { delete $form->{$_} } qw(printed emailed queued);
- # 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";
- if ($form->{saved_xyznumber} &&
- ($form->{saved_xyznumber} eq $form->{$idx})) {
- delete($form->{$idx});
- }
+ if (!$form->{id}) {
+ $print_post = 1;
- &save;
+ my $saved_form = save_form();
+
+ save();
+
+ my %saved_vars;
+ map({ $saved_vars{$_} = $form->{$_}; } qw(id ordnumber quonumber));
+ restore_form($saved_form);
+ map({ $form->{$_} = $saved_vars{$_}; } qw(id ordnumber quonumber));
+ }
- &edit_e_mail;
+ edit_e_mail();
$lxdebug->leave_sub();
}