From a8d9f325b9a5d7b7336b8c6f16f12080a5bdba39 Mon Sep 17 00:00:00 2001
From: Philip Reetz
Date: Thu, 10 Nov 2005 15:18:18 +0000
Subject: [PATCH] Fehler bei Drucken und Buchen und Preisgruppen behoben,
Preisgruppen Quelltext ein wenig modifiziert
---
bin/mozilla/io.pl | 49 ++++++++++++++++++++++++++---------------------
bin/mozilla/is.pl | 20 +++++++++++--------
bin/mozilla/oe.pl | 2 +-
3 files changed, 40 insertions(+), 31 deletions(-)
diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl
index 9ae97391e..8cbe24456 100644
--- a/bin/mozilla/io.pl
+++ b/bin/mozilla/io.pl
@@ -416,9 +416,9 @@ print (STDERR "sellprice_$i ", Dumper($form->{"sellprice_$i"}), " pricegroup_i
# build html-code for pricegroups in variable $form->{prices_$j}
sub set_pricegroup {
+ my $rowcount = shift;
$lxdebug->enter_sub();
-print STDERR "io.pl-set_pricegroup-i-$i\n";
- for $j (1 .. $i) {
+ for $j (1 .. $rowcount) {
my $pricegroup_old = $form->{"pricegroup_old_$i"};
if ($form->{PRICES}{ $j }) {
@@ -426,7 +426,6 @@ print STDERR "io.pl-set_pricegroup-i-$i\n";
$prices = '';
$price = 0;
foreach $item (@{ $form->{PRICES}{ $j } }) {
-print STDERR "TEST--i--$i--jjj-$j\n";
# print STDERR "-VOR PREIS--$item->{price}--PREISGRUOP-$item->{pricegroup_id}\n";
$price = $form->round_amount($myconfig, $item->{price},5);
$price = $form->format_amount($myconfig, $item->{price},2);
@@ -452,7 +451,6 @@ print STDERR "TEST--i--$i--jjj-$j\n";
}
}
}
- print (STDERR "", Dumper($form->{PRICES}));
$lxdebug->leave_sub();
}
@@ -748,11 +746,10 @@ sub new_item {
sub display_form {
$lxdebug->enter_sub();
-print STDERR "io.pl-display_form\n";
+
# if we have a display_form
if ($form->{display_form}) {
&{"$form->{display_form}"};
-print STDERR " --------------------- exit\n";
exit;
}
if ( $form->{print_and_post}
@@ -777,6 +774,12 @@ print STDERR " --------------------- exit\n";
$form->{second_run} = 1;
$form->{action} = "display_form";
$form->{rowcount}--;
+ my $rowcount = $form->{rowcount};
+ # get pricegroups for parts
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form, "new");
+ # build up html code for prices_$i
+ set_pricegroup($rowcount);
+
$form->{resubmit} = 1;
@@ -787,7 +790,6 @@ print STDERR " --------------------- exit\n";
$subroutine = "display_row";
if ($form->{item} eq 'part') {
-print STDERR " part\n";
#set preisgruppenanzahl
$numrows = $form->{price_rows};
$subroutine = "price_row";
@@ -798,7 +800,6 @@ print STDERR " part\n";
$subroutine = "makemodel_row";
}
if ($form->{item} eq 'assembly') {
-print STDERR " assembly\n";
$numrows = ++$form->{price_rows};
$subroutine = "price_row";
@@ -814,7 +815,6 @@ print STDERR " assembly\n";
$subroutine = "assembly_row";
}
if ($form->{item} eq 'service') {
-print STDERR " service\n";
$numrows = ++$form->{price_rows};
$subroutine = "price_row";
@@ -828,10 +828,6 @@ print STDERR " service\n";
&form_footer;
- # if ($form->{print_and_post}) {
- # &display_form;
- # }
-
$lxdebug->leave_sub();
}
@@ -942,8 +938,6 @@ print STDERR "io.pl-check_form\n";
}
#sk
-print STDERR "LEVEL--$form->{level}\n";
-print STDERR "Type--$form->{type}\n";
# if pricegroups
if ($form->{type} =~ (/sales_quotation/) or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/)) or (($form->{level} eq undef) and ($form->{type} =~ /invoice/)) or ($form->{type} =~ /sales_order/)) {
@@ -1017,7 +1011,9 @@ print STDERR "io.pl-validate_items\n";
sub order {
$lxdebug->enter_sub();
-
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
$form->{ordnumber} = $form->{invnumber};
map { delete $form->{$_} } qw(id printed emailed queued);
@@ -1070,7 +1066,9 @@ sub order {
sub quotation {
$lxdebug->enter_sub();
-
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
map { delete $form->{$_} } qw(id printed emailed queued);
if ($form->{script} eq 'ir.pl' || $form->{type} eq 'purchase_order') {
@@ -1122,7 +1120,10 @@ sub quotation {
sub e_mail {
$lxdebug->enter_sub();
-
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ $form->{resubmit} = 0;
+ }
if ($myconfig{role} eq 'admin') {
$bcc = qq|
| . $locale->text('Bcc') . qq| |
@@ -1391,7 +1392,9 @@ print STDERR "io.pl-print_options\n";
sub print {
$lxdebug->enter_sub();
-print STDERR "io.pl-print\n";
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
# if this goes to the printer pass through
if ($form->{media} eq 'printer' || $form->{media} eq 'queue') {
$form->error($locale->text('Select postscript or PDF!'))
@@ -1409,10 +1412,9 @@ print STDERR "io.pl-print\n";
sub print_form {
$lxdebug->enter_sub();
my ($old_form) = @_;
-print STDERR "io.pl-print_form\n";
+
$inv = "inv";
$due = "due";
-#print (STDERR "", Dumper($form));
$numberfld = "invnumber";
$display_form =
@@ -1735,7 +1737,10 @@ sub post_as_new {
sub ship_to {
$lxdebug->enter_sub();
-print STDERR "io.pl-ship_to\n";
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
+
$title = $form->{title};
$form->{title} = $locale->text('Ship to');
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl
index 31d017eef..53230d2b4 100644
--- a/bin/mozilla/is.pl
+++ b/bin/mozilla/is.pl
@@ -216,9 +216,6 @@ print STDERR "is.pl-prepare_invoice\n";
qw(partnumber description unit partnotes);
$form->{rowcount} = $i;
-# # build up html code for prices_$i
-# print STDERR "set_pricegroup aus is.pl-prepare_invoice\n";
-# set_pricegroup();
}
}
$lxdebug->leave_sub();
@@ -860,10 +857,12 @@ print STDERR "is.pl-form_footer\n";
sub update {
$lxdebug->enter_sub();
-print STDERR "is.pl-update\n";
+
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
-
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
&check_name(customer);
&check_project;
@@ -985,7 +984,7 @@ print STDERR "is.pl-update\n";
IS->get_pricegroups_for_parts(\%myconfig, \%$form, "new");
# build up html code for prices_$i
- set_pricegroup();
+ &set_pricegroup($i);
}
&display_form;
@@ -1016,7 +1015,6 @@ print STDERR "is.pl-update\n";
sub post {
$lxdebug->enter_sub();
-print STDERR "is.pl-post\n";
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
@@ -1025,6 +1023,9 @@ print STDERR "is.pl-post\n";
&update;
exit;
}
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
&validate_items;
@@ -1085,6 +1086,7 @@ sub print_and_post {
$print_post = 1;
$form->{print_and_post} = 1;
&post();
+
&display_form();
$lxdebug->leave_sub();
@@ -1105,7 +1107,9 @@ sub preview {
sub delete {
$lxdebug->enter_sub();
-
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
$form->header;
print qq|
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index 482b4c7e4..dbcc5fdf7 100644
--- a/bin/mozilla/oe.pl
+++ b/bin/mozilla/oe.pl
@@ -961,7 +961,7 @@ sub update {
IS->get_pricegroups_for_parts(\%myconfig, \%$form);
# build up html code for prices_$i
- set_pricegroup();
+ &set_pricegroup($i);
}
&display_form;
--
2.20.1