X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Foe.pl;h=e076691a1b326263f13d93e0606ddbc42ec78d2c;hb=4f3393f4faf9b531d48bb97056468eaf5d0676c8;hp=e810854bb9688f4d840e5f2bba409a4b7e8364a4;hpb=b08a61d7381fd830fdb7fd0c343ce1dcf60776bf;p=kivitendo-erp.git
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index e810854bb..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;
@@ -110,6 +110,9 @@ sub add {
sub edit {
$lxdebug->enter_sub();
+ # show history button
+ $form->{javascript} = qq||;
+ #/show hhistory button
$form->{simple_save} = 0;
@@ -117,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}) {
@@ -164,6 +167,8 @@ sub order_links {
# set jscalendar
$form->{jscalendar} = $jscalendar;
+ my $editing = $form->{id};
+
OE->retrieve(\%myconfig, \%$form);
if ($form->{payment_id}) {
@@ -176,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
@@ -205,7 +212,7 @@ sub order_links {
$intnotes = $form->{intnotes};
# get customer / vendor
- if ($form->{type} =~ /(purchase_order|request_quotation|receive_order)/) {
+ if ($form->{type} =~ /(purchase_order|request_quotation)/) {
IR->get_vendor(\%myconfig, \%$form);
#quote all_vendor Bug 133
@@ -214,7 +221,7 @@ sub order_links {
}
}
- if ($form->{type} =~ /(sales|ship)_(order|quotation)/) {
+ if ($form->{type} =~ /sales_(order|quotation)/) {
IS->get_customer(\%myconfig, \%$form);
#quote all_vendor Bug 133
@@ -233,7 +240,7 @@ sub order_links {
if ($taxzone_id) {
$form->{taxzone_id} = $taxzone_id;
}
- $form->{intnotes} = $intnotes;
+ $form->{intnotes} = $intnotes if $intnotes;
($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
$form->{"old$form->{vc}"} =
qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
@@ -242,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}"} });
}
@@ -252,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});
@@ -263,7 +271,7 @@ sub order_links {
map {
$form->{selectdepartment} .=
- "\n"
} (@{ $form->{all_departments} });
}
@@ -272,24 +280,22 @@ 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();
}
sub prepare_order {
$lxdebug->enter_sub();
- $form->{format} = "pdf" unless ($form->{print_and_save} && $form->{format});
- $form->{media} = "screen";
$form->{formname} = $form->{type} unless $form->{formname};
- map { $form->{$_} =~ s/\"/"/g }
- qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact);
my $i = 0;
foreach $ref (@{ $form->{form_details} }) {
$form->{rowcount} = ++$i;
@@ -331,8 +337,13 @@ sub prepare_order {
sub form_header {
$lxdebug->enter_sub();
- $checkedopen = ($form->{closed}) ? "" : "checked";
- $checkedclosed = ($form->{closed}) ? "checked" : "";
+ my $checkedclosed = $form->{"closed"} ? "checked" : "";
+ my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
+
+ map { $form->{$_} =~ s/\"/"/g }
+ qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
+ shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
+ shiptophone shiptofax shiptodepartment_1 shiptodepartment_2);
# use JavaScript Calendar or not
$form->{jsscript} = $form->{jscalendar};
@@ -350,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|> |
|;
@@ -369,24 +380,31 @@ 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)\"> | |;
+ }
+
+ my @tmp;
+
+ if (($form->{"type"} eq "sales_order") ||
+ ($form->{"type"} eq "purchase_order")) {
+ push(@tmp, qq|
+
+ |);
}
if ($form->{id}) {
- $openclosed = qq|
+ push(@tmp, qq|
+
+ |);
+ }
+
+ if (@tmp) {
+ $openclosed .= qq|
-
-
- |
+ | . join("\n", @tmp) . qq|
+ |
|;
}
@@ -401,53 +419,93 @@ sub form_header {
#quote select[customer|vendor] Bug 133
$form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
- #build contacts
- if ($form->{all_contacts}) {
-
- $form->{selectcontact} = "";
- foreach $item (@{ $form->{all_contacts} }) {
- my $department = ($item->{cp_abteilung}) ? "--$item->{cp_abteilung}" : "";
- if ($form->{cp_id} == $item->{cp_id}) {
- $form->{selectcontact} .=
- "";
- } else {
- $form->{selectcontact} .= "";
- }
- }
- } else {
- $form->{selectcontact} =~ s/ selected//g;
- if ($form->{cp_id} ne "") {
- $form->{selectcontact} =~ s/value=$form->{cp_id}/value=$form->{cp_id} selected/;
+ #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"}));
+
+ $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");
+
+ my %labels;
+ my @values = (undef);
+ foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
+ push(@values, $item->{"cp_id"});
+ $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"}));
+
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
+ push(@values, $item->{"shipto_id"});
+ $labels{$item->{"shipto_id"}} =
+ $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"}))
+ . qq| | |;
+
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+ my $globalprojectnumber =
+ NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
+ '-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};
}
- }
-
- if (@{ $form->{SHIPTO} }) {
- $form->{selectshipto} = "";
- foreach $item (@{ $form->{SHIPTO} }) {
- if ($item->{shipto_id} == $form->{shipto_id}) {
- $form->{selectshipto} .=
- "";
- } else {
- $form->{selectshipto} .=
- "";
- }
-
- }
- } else {
- $form->{selectshipto} =~ s/ selected//g;
- if ($form->{shipto_id} ne "") {
- $form->{selectshipto} =~ s/value=$form->{shipto_id}/value=$form->{shipto_id} selected/;
- }
+ $salesman =
+ qq|
+ | . $locale->text('Salesman') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
+ '-values' => \@values, '-labels' => \%labels))
+ . qq| |
+
|;
}
- $shipto = qq|
- | . $locale->text('Shipping Address') . 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});
@@ -463,11 +521,6 @@ sub form_header {
$form->{creditremaining} =
$form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
- $contact =
- ($form->{selectcontact})
- ? qq|\n|
- : qq||;
-
$exchangerate = qq|
{forex}>
|;
@@ -491,13 +544,7 @@ sub form_header {
$vclabel = ucfirst $form->{vc};
$vclabel = $locale->text($vclabel);
- $terms = qq|
-
- | . $locale->text('Terms: Net') . qq| |
- {terms}> |
- . $locale->text('days') . qq| |
-
-|;
+
if ($form->{business}) {
$business = qq|
@@ -531,39 +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/;
- }
- }
-
- if ($form->{rowcount} >0) {
- $form->{selecttaxzone} =~ /