X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Foe.pl;h=32fe7a11fb6d7402a5dd1dd248f435f13dab1b72;hb=f06a2509037f88f8361d989b1bc638665c367558;hp=2537eaf229cfa1865019fbff06b46303235ae1f6;hpb=1936914faa606aa5114592851c0d94913f6a005d;p=kivitendo-erp.git
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index 2537eaf22..32fe7a11f 100644
--- a/bin/mozilla/oe.pl
+++ b/bin/mozilla/oe.pl
@@ -30,15 +30,19 @@
# Order entry module
# Quotation module
#======================================================================
-use Data::Dumper;
+
+use POSIX qw(strftime);
use SL::OE;
use SL::IR;
use SL::IS;
use SL::PE;
+use SL::ReportGenerator;
+use List::Util qw(max);
-require "$form->{path}/io.pl";
-require "$form->{path}/arap.pl";
+require "bin/mozilla/io.pl";
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
@@ -98,7 +102,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,26 +114,29 @@ sub add {
sub edit {
$lxdebug->enter_sub();
+ # show history button
+ $form->{javascript} = qq||;
+ #/show hhistory button
$form->{simple_save} = 0;
set_headings("edit");
# editing without stuff to edit? try adding it first
- if ($form->{rowcount}) {
- map { $id++ if $form->{"id_$_"} } (1 .. $form->{rowcount});
+ if ($form->{rowcount} && !$form->{print_and_save}) {
+ 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}) {
@@ -154,15 +161,15 @@ 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};
OE->retrieve(\%myconfig, \%$form);
@@ -176,6 +183,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 +214,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 +223,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
@@ -224,6 +233,7 @@ sub order_links {
}
$form->{cp_id} = $cp_id;
+
if ($payment_id) {
$form->{payment_id} = $payment_id;
}
@@ -233,7 +243,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,18 +252,11 @@ 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}"} });
}
- # currencies
- @curr = split(/:/, $form->{currencies});
- chomp $curr[0];
- $form->{defaultcurrency} = $curr[0];
- $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
-
- map { $form->{selectcurrency} .= "\n"
} (@{ $form->{all_departments} });
}
$form->{employee} = "$form->{employee}--$form->{employee_id}";
- # sales staff
- if (@{ $form->{all_employees} }) {
- $form->{selectemployee} = "";
- map { $form->{selectemployee} .= "|;
- 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|
-