X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=0760f4afab0b1e72644168e409467ab79f371286;hb=82ee22347be2f2ee96d09a9fd0b45710f9552582;hp=d9ccd05a886d95c3bdd6442fe0f0d3062ae1b6bd;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index d9ccd05a8..0760f4afa 100644
--- a/bin/mozilla/oe.pl
+++ b/bin/mozilla/oe.pl
@@ -1,4 +1,4 @@
-#=====================================================================
+# #=====================================================================
# LX-Office ERP
# Copyright (C) 2004
# Based on SQL-Ledger Version 2.1.9
@@ -77,6 +77,22 @@ sub add {
sub edit {
$lxdebug->enter_sub();
+ # editing without stuff to edit? try adding it first
+ if ($form->{rowcount}) {
+ map {$id++ if $form->{"id_$_"}} (1 .. $form->{rowcount});
+ if (!$id) {
+ # reset rowcount
+ undef $form->{rowcount};
+ &add;
+ return;
+ }
+ } else {
+ if (!$form->{id}) {
+ &add;
+ return;
+ }
+ }
+
if ($form->{type} eq 'purchase_order') {
$form->{title} = $locale->text('Edit Purchase Order');
$form->{heading} = $locale->text('Purchase Order');
@@ -115,11 +131,20 @@ sub order_links {
# retrieve order/quotation
$form->{webdav} = $webdav;
+
# set jscalendar
$form->{jscalendar} = $jscalendar;
OE->retrieve(\%myconfig, \%$form);
+ # 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)
+ if ($form->{rowcount} && $form->{type} eq 'sales_order' && defined $form->{customer} && $form->{customer} eq '') {
+# $main::lxdebug->message(0, "Detected Edit order with concurrent customers");
+ $form->error($locale->text('Collective Orders only work for orders from one customer!'));
+ }
+
$taxincluded = $form->{taxincluded};
$form->{shipto} = 1 if $form->{id};
@@ -196,31 +221,34 @@ sub prepare_order {
$form->{media} = "screen";
$form->{formname} = $form->{type};
- if ($form->{id}) {
-
map { $form->{$_} =~ s/\"/"/g }
qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact);
foreach $ref (@{ $form->{form_details} }) {
- $i++;
+ $form->{rowcount} = ++$i;
+
map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
- $form->{"discount_$i"} =
+ }
+
+ for my $i (1 .. $form->{rowcount}) {
+ $form->{"discount_$i"} =
$form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
+ ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
$dec = length $dec;
$decimalplaces = ($dec > 2) ? $dec : 2;
$form->{"sellprice_$i"} =
$form->format_amount(\%myconfig, $form->{"sellprice_$i"},
$decimalplaces);
- $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+
+ (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
+ $dec_qty = length $dec_qty;
+ $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
map { $form->{"${_}_$i"} =~ s/\"/"/g }
qw(partnumber description unit);
- $form->{rowcount} = $i;
}
- }
$lxdebug->leave_sub();
}
@@ -241,14 +269,12 @@ sub form_header {
$button1 = qq|
{transdate}> |
text('button')
- . qq|> |
+ . $locale->text('button') . qq|>
|;
$button2 = qq|
{reqdate}> |
text('button')
- . qq|> |
+ . $locale->text('button') . qq|>
|;
#write Trigger
@@ -272,11 +298,9 @@ sub form_header {
@@ -345,8 +369,7 @@ sub form_header {
| . $locale->text('Terms: Net') . qq| |
{terms}> |
- . $locale->text('days')
- . qq| |
+ . $locale->text('days') . qq|
|;
@@ -371,14 +394,12 @@ sub form_header {
|
- . $locale->text('Quotation Number')
- . qq| |
+ . $locale->text('Quotation Number') . qq|
|
|
- . $locale->text('Customer Order Number')
- . qq| |
+ . $locale->text('Customer Order Number') . qq|
|
@@ -419,8 +440,7 @@ sub form_header {
$ordnumber = qq|
|
- . $locale->text('Quotation Number')
- . qq| |
+ . $locale->text('Quotation Number') . qq|
|
@@ -471,6 +491,7 @@ sub form_header {
if ($form->{type} eq 'sales_order') {
if ($form->{selectemployee}) {
$employee = qq|
+ {customer_klass}>
| . $locale->text('Salesperson') . qq| |
|
@@ -481,6 +502,7 @@ sub form_header {
}
} else {
$employee = qq|
+ {customer_klass}>
| . $locale->text('Employee') . qq| |
|
@@ -537,8 +559,7 @@ sub form_header {
{vc}_id value=$form->{"$form->{vc}_id"}>
{vc}"}">
|
- . $locale->text('Contact Person')
- . qq| |
+ . $locale->text('Contact Person') . qq|
$contact |
$creditremaining
@@ -573,7 +594,7 @@ sub form_header {
-
+
$jsscript
@@ -589,7 +610,7 @@ $jsscript
-
+
@@ -633,8 +654,7 @@ sub form_footer {
if ($form->{taxaccounts}) {
$taxincluded = qq|
{taxincluded}> |
- . $locale->text('Tax Included')
- . qq|
+ . $locale->text('Tax Included') . qq|
|;
}
@@ -749,7 +769,7 @@ sub form_footer {
if ($webdav) {
$webdav_list = qq|
-
+
Dokumente im Webdav-Repository |
@@ -758,7 +778,7 @@ sub form_footer {
|;
foreach $file (keys %{ $form->{WEBDAV} }) {
$webdav_list .= qq|
-
+
$file |
$form->{WEBDAV}{$file} |
@@ -813,7 +833,7 @@ Bearbeiten des $form->{heading}
|;
}
- print qq|
+ print qq|
|;
@@ -843,14 +863,23 @@ Bearbeiten des $form->{heading}
. $locale->text('Order') . qq|">
|;
}
+ } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount}) {
+ print qq|
+
Workflow $form->{heading}
+
+
+|;
}
+
if ($form->{menubar}) {
require "$form->{path}/menu.pl";
&menubar;
}
- print qq|
+ print qq|
{rowcount}>
@@ -888,7 +917,9 @@ sub update {
\%myconfig, $form->{currency}, $form->{transdate}, $buysell
)));
- my $i = $form->{rowcount};
+ # for pricegroups
+ $i = $form->{rowcount};
+
$exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
if ( ($form->{"partnumber_$i"} eq "")
@@ -940,6 +971,7 @@ sub update {
$form->{"sellprice_$i"} = $sellprice;
} else {
+ $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
# if there is an exchange rate adjust sellprice
$form->{"sellprice_$i"} /= $exchangerate;
}
@@ -960,7 +992,13 @@ sub update {
$form->format_amount(\%myconfig, $form->{"sellprice_$i"},
$decimalplaces);
$form->{"qty_$i"} =
- $form->format_amount(\%myconfig, $form->{"qty_$i"});
+ $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
+
+ # get pricegroups for parts
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+
+ # build up html code for prices_$i
+ &set_pricegroup($i);
}
&display_form;
@@ -986,6 +1024,8 @@ sub update {
}
}
}
+
+
$lxdebug->leave_sub();
}
@@ -1046,7 +1086,8 @@ sub search {
$form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
map {
- $form->{selectwarehouse} .= "
@@ -1294,6 +1324,11 @@ sub orders {
}
}
+ # only show checkboxes if gotten here via sales_order form.
+ if ($form->{type} =~ /sales_order/) {
+ unshift @column_index, "ids";
+ }
+
if ($form->{l_subtotal} eq 'Y') {
$callback .= "&l_subtotal=Y";
$href .= "&l_subtotal=Y";
@@ -1366,6 +1401,8 @@ sub orders {
$column_header{employee} =
qq|$employee | |;
+ $column_header{ids} = qq| | |;
+
if ($form->{ $form->{vc} }) {
$option = $locale->text(ucfirst $form->{vc});
$option .= " : $form->{$form->{vc}}";
@@ -1405,6 +1442,7 @@ sub orders {
print qq|
+