X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Foe.pl;h=f7a52e979f42cd078e6a21dc6d9a29c576511d69;hb=7743b3ab885b485ae317338c55da427b62ab457d;hp=6f12c94d37e156c9bc660ea2b8d0abfabc4d39ec;hpb=f9f5330a26eb3f447677ab2524c823cb9f96723b;p=kivitendo-erp.git
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index 6f12c94d3..f7a52e979 100644
--- a/bin/mozilla/oe.pl
+++ b/bin/mozilla/oe.pl
@@ -44,26 +44,59 @@ require "$form->{path}/arap.pl";
# end of main
-sub add {
+# For locales.pl:
+# $locale->text('Edit the purchase_order');
+# $locale->text('Edit the sales_order');
+# $locale->text('Edit the request_quotation');
+# $locale->text('Edit the sales_quotation');
+
+# $locale->text('Workflow purchase_order');
+# $locale->text('Workflow sales_order');
+# $locale->text('Workflow request_quotation');
+# $locale->text('Workflow sales_quotation');
+
+sub set_headings {
$lxdebug->enter_sub();
+ my ($action) = @_;
+
if ($form->{type} eq 'purchase_order') {
- $form->{title} = $locale->text('Add Purchase Order');
- $form->{vc} = 'vendor';
+ $form->{title} = $action eq "edit" ?
+ $locale->text('Edit Purchase Order') :
+ $locale->text('Add Purchase Order');
+ $form->{heading} = $locale->text('Purchase Order');
+ $form->{vc} = 'vendor';
}
if ($form->{type} eq 'sales_order') {
- $form->{title} = $locale->text('Add Sales Order');
- $form->{vc} = 'customer';
+ $form->{title} = $action eq "edit" ?
+ $locale->text('Edit Sales Order') :
+ $locale->text('Add Sales Order');
+ $form->{heading} = $locale->text('Sales Order');
+ $form->{vc} = 'customer';
}
if ($form->{type} eq 'request_quotation') {
- $form->{title} = $locale->text('Add Request for Quotation');
- $form->{vc} = 'vendor';
+ $form->{title} = $action eq "edit" ?
+ $locale->text('Edit Request for Quotation') :
+ $locale->text('Add Request for Quotation');
+ $form->{heading} = $locale->text('Request for Quotation');
+ $form->{vc} = 'vendor';
}
if ($form->{type} eq 'sales_quotation') {
- $form->{title} = $locale->text('Add Quotation');
- $form->{vc} = 'customer';
+ $form->{title} = $action eq "edit" ?
+ $locale->text('Edit Quotation') :
+ $locale->text('Add Quotation');
+ $form->{heading} = $locale->text('Quotation');
+ $form->{vc} = 'customer';
}
+ $lxdebug->leave_sub();
+}
+
+sub add {
+ $lxdebug->enter_sub();
+
+ set_headings("add");
+
$form->{callback} =
"$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&path=$form->{path}&password=$form->{password}"
unless $form->{callback};
@@ -78,6 +111,10 @@ sub add {
sub edit {
$lxdebug->enter_sub();
+ $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});
@@ -95,29 +132,21 @@ sub edit {
}
}
- if ($form->{type} eq 'purchase_order') {
- $form->{title} = $locale->text('Edit Purchase Order');
- $form->{heading} = $locale->text('Purchase Order');
- $form->{vc} = 'vendor';
- }
- if ($form->{type} eq 'sales_order') {
- $form->{title} = $locale->text('Edit Sales Order');
- $form->{heading} = $locale->text('Sales Order');
- $form->{vc} = 'customer';
- }
- if ($form->{type} eq 'request_quotation') {
- $form->{title} = $locale->text('Edit Request for Quotation');
- $form->{heading} = $locale->text('Request for Quotation');
- $form->{vc} = 'vendor';
- }
- if ($form->{type} eq 'sales_quotation') {
- $form->{title} = $locale->text('Edit Quotation');
- $form->{heading} = $locale->text('Quotation');
- $form->{vc} = 'customer';
+ if ($form->{print_and_save}) {
+ $form->{action} = "print";
+ $form->{resubmit} = 1;
+ $language_id = $form->{language_id};
+ $printer_id = $form->{printer_id};
}
+ set_headings("edit");
+
&order_links;
&prepare_order;
+ if ($form->{print_and_save}) {
+ $form->{language_id} = $language_id;
+ $form->{printer_id} = $printer_id;
+ }
&display_form;
$lxdebug->leave_sub();
@@ -132,12 +161,22 @@ sub order_links {
# retrieve order/quotation
$form->{webdav} = $webdav;
-
# set jscalendar
$form->{jscalendar} = $jscalendar;
OE->retrieve(\%myconfig, \%$form);
+ if ($form->{payment_id}) {
+ $payment_id = $form->{payment_id};
+ }
+ if ($form->{language_id}) {
+ $language_id = $form->{language_id};
+ }
+ if ($form->{taxzone_id}) {
+ $taxzone_id = $form->{taxzone_id};
+ }
+
+
# if multiple rowcounts (== collective order) then check if the
# there were more than one customer (in that case OE::retrieve removes
# the content from the field)
@@ -185,7 +224,15 @@ sub order_links {
}
$form->{cp_id} = $cp_id;
-
+ if ($payment_id) {
+ $form->{payment_id} = $payment_id;
+ }
+ if ($language_id) {
+ $form->{language_id} = $language_id;
+ }
+ if ($taxzone_id) {
+ $form->{taxzone_id} = $taxzone_id;
+ }
$form->{intnotes} = $intnotes;
($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
$form->{"old$form->{vc}"} =
@@ -200,7 +247,7 @@ sub order_links {
}
# currencies
- @curr = split /:/, $form->{currencies};
+ @curr = split(/:/, $form->{currencies});
chomp $curr[0];
$form->{defaultcurrency} = $curr[0];
$form->{currency} = $form->{defaultcurrency} unless $form->{currency};
@@ -237,13 +284,9 @@ sub order_links {
sub prepare_order {
$lxdebug->enter_sub();
- $form->{format} = "pdf";
- $form->{media} = "screen";
- $form->{formname} = $form->{type};
-
- map { $form->{$_} =~ s/\"/"/g }
- qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact);
+ $form->{formname} = $form->{type} unless $form->{formname};
+ my $i = 0;
foreach $ref (@{ $form->{form_details} }) {
$form->{rowcount} = ++$i;
@@ -284,13 +327,26 @@ 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};
$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
@@ -323,21 +379,26 @@ sub form_header {
$openclosed = qq|