# 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 }) {
$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);
}
}
}
- print (STDERR "", Dumper($form->{PRICES}));
$lxdebug->leave_sub();
}
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}
$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;
$subroutine = "display_row";
if ($form->{item} eq 'part') {
-print STDERR " part\n";
#set preisgruppenanzahl
$numrows = $form->{price_rows};
$subroutine = "price_row";
$subroutine = "makemodel_row";
}
if ($form->{item} eq 'assembly') {
-print STDERR " assembly\n";
$numrows = ++$form->{price_rows};
$subroutine = "price_row";
$subroutine = "assembly_row";
}
if ($form->{item} eq 'service') {
-print STDERR " service\n";
$numrows = ++$form->{price_rows};
$subroutine = "price_row";
&form_footer;
- # if ($form->{print_and_post}) {
- # &display_form;
- # }
-
$lxdebug->leave_sub();
}
}
#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/)) {
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);
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') {
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|
<th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
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!'))
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 =
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');
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();
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;
IS->get_pricegroups_for_parts(\%myconfig, \%$form, "new");
# build up html code for prices_$i
- set_pricegroup();
+ &set_pricegroup($i);
}
&display_form;
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!'));
&update;
exit;
}
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
&validate_items;
$print_post = 1;
$form->{print_and_post} = 1;
&post();
+
&display_form();
$lxdebug->leave_sub();
sub delete {
$lxdebug->enter_sub();
-
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
$form->header;
print qq|