summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-29 20:25:15 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-29 20:25:15 +0000
commite9ca709ec10b5d44eb0f1352e3438e02d5ebc93c (patch)
tree5c9e2bf8954853deeb617abebda7cda6e7fb4cbd
parent81afc95f60b3f9195aefb0452056463599a1be24 (diff)
Fix for bug 1831402
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1921 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/IS.pm1
-rwxr-xr-xLedgerSMB/OE.pm1
-rwxr-xr-xbin/am.pl24
-rwxr-xr-xbin/arap.pl2
-rwxr-xr-xbin/io.pl38
-rwxr-xr-xbin/oe.pl1
6 files changed, 32 insertions, 35 deletions
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm
index ad1f1c27..2f3eebef 100755
--- a/LedgerSMB/IS.pm
+++ b/LedgerSMB/IS.pm
@@ -244,6 +244,7 @@ sub invoice_details {
if ( $form->{"qty_$i"} ) {
+ $form->{discount} = [] if ref $form->{discount} ne 'ARRAY';
$form->{totalqty} += $form->{"qty_$i"};
$form->{totalship} += $form->{"qty_$i"};
$form->{totalweight} +=
diff --git a/LedgerSMB/OE.pm b/LedgerSMB/OE.pm
index 5b83c786..295e736c 100755
--- a/LedgerSMB/OE.pm
+++ b/LedgerSMB/OE.pm
@@ -1204,6 +1204,7 @@ sub order_details {
if ( $form->{"qty_$i"} ) {
+ $form->{discount} = [] if ref $form->{discount} ne 'ARRAY';
$form->{totalqty} += $form->{"qty_$i"};
$form->{totalship} += $form->{"ship_$i"};
$form->{totalweight} +=
diff --git a/bin/am.pl b/bin/am.pl
index 479fcb83..2279a66a 100755
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -3575,6 +3575,7 @@ sub print_recurring {
my $ok = 1;
if ( $pt->{recurringprint} ) {
+ my $orig_callback = $form->{callback};
@f = split /:/, $pt->{recurringprint};
for ( $j = 0 ; $j <= $#f ; $j += 3 ) {
$media = $f[ $j + 2 ];
@@ -3587,15 +3588,11 @@ sub print_recurring {
. $locale->text( $f{ $f[$j] } )
. " $form->{reference}" );
- @a = (
- "perl", "$form->{script}",
-"action=reprint&module=$form->{module}&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}&id=$form->{id}&formname=$f[$j]&format=$f[$j+1]&media=$media&vc=$form->{vc}&ARAP=$form->{ARAP}"
- );
-
$form->error( $locale->text('Invalid redirect') )
unless first { $_ eq $form->{script} }
- @{LedgerSMB::Sysconfig::scripts};
- $ok = !( system(@a) );
+ @{LedgerSMB::Sysconfig::scripts};
+ $form->{callback} = "$form->{script}?action=reprint&module=$form->{module}&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}&id=$form->{id}&formname=$f[$j]&format=$f[$j+1]&media=$media&vc=$form->{vc}&ARAP=$form->{ARAP}";
+ $ok = !(main::redirect());
if ($ok) {
$form->info( " ..... " . $locale->text('done') );
@@ -3605,6 +3602,7 @@ sub print_recurring {
last;
}
}
+ $form->{callback} = $orig_callback;
}
$ok;
@@ -3621,6 +3619,7 @@ sub email_recurring {
if ( $pt->{recurringemail} ) {
@f = split /:/, $pt->{recurringemail};
+ my $orig_callback = $form->{callback};
for ( $j = 0 ; $j <= $#f ; $j += 2 ) {
$form->info( "\n"
@@ -3637,15 +3636,11 @@ sub email_recurring {
$message = $form->escape( $pt->{message}, 1 );
- @a = (
- "perl", "$form->{script}",
-"action=reprint&module=$form->{module}&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}&id=$form->{id}&formname=$f[$j]&format=$f[$j+1]&media=email&vc=$form->{vc}&ARAP=$form->{ARAP}&message=$message"
- );
-
$form->error( $locale->text('Invalid redirect') )
unless first { $_ eq $form->{script} }
- @{LedgerSMB::Sysconfig::scripts};
- $ok = !( system(@a) );
+ @{LedgerSMB::Sysconfig::scripts};
+ $form->{callback} = "$form->{script}?action=reprint&module=$form->{module}&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}&id=$form->{id}&formname=$f[$j]&format=$f[$j+1]&media=email&vc=$form->{vc}&ARAP=$form->{ARAP}&message=$message";
+ $ok = !( main::redirect() );
if ($ok) {
$form->info( " ..... " . $locale->text('done') );
@@ -3655,6 +3650,7 @@ sub email_recurring {
last;
}
}
+ $form->{callback} = $orig_callback;
}
$ok;
diff --git a/bin/arap.pl b/bin/arap.pl
index 7ad58466..94223af4 100755
--- a/bin/arap.pl
+++ b/bin/arap.pl
@@ -1024,6 +1024,8 @@ sub reprint {
( $form->{message} ) ? $form->{message} : $locale->text('sent');
$form->save_intnotes( \%myconfig, $form->{module} );
+
+ 0; #SC: Reversing the expected value to work with its caller
}
}
diff --git a/bin/io.pl b/bin/io.pl
index d8dd0897..c49ab222 100755
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -1553,9 +1553,9 @@ sub print_form {
&{"$form->{vc}_details"};
- @a = ();
+ my @vars = ();
foreach $i ( 1 .. $form->{rowcount} ) {
- push @a,
+ push @vars,
(
"partnumber_$i", "description_$i",
"projectnumber_$i", "partsgroup_$i",
@@ -1566,7 +1566,7 @@ sub print_form {
for ( split / /, $form->{taxaccounts} ) { push @a, "${_}_description" }
$ARAP = ( $form->{vc} eq 'customer' ) ? "AR" : "AP";
- push @a, $ARAP;
+ push @vars, $ARAP;
# format payment dates
for $i ( 1 .. $form->{paidaccounts} - 1 ) {
@@ -1576,10 +1576,10 @@ sub print_form {
$form->{longformat} );
}
- push @a, "${ARAP}_paid_$i", "source_$i", "memo_$i";
+ push @vars, "${ARAP}_paid_$i", "source_$i", "memo_$i";
}
- $form->format_string(@a);
+ $form->format_string(@vars);
( $form->{employee} ) = split /--/, $form->{employee};
( $form->{warehouse}, $form->{warehouse_id} ) = split /--/,
@@ -1594,10 +1594,10 @@ sub print_form {
# create the form variables
if ($order) {
- OE->order_details( \%myconfig, \%$form );
+ OE->order_details( \%myconfig, $form );
}
else {
- IS->invoice_details( \%myconfig, \%$form );
+ IS->invoice_details( \%myconfig, $form );
}
if ( exists $form->{longformat} ) {
$form->{"${due}date"} = $duedate;
@@ -1607,13 +1607,13 @@ sub print_form {
}
}
- @a =
+ @vars =
qw(name address1 address2 city state zipcode country contact phone fax email);
$shipto = 1;
# if there is no shipto fill it in from billto
- foreach $item (@a) {
+ foreach $item (@vars) {
if ( $form->{"shipto$item"} ) {
$shipto = 0;
last;
@@ -1630,16 +1630,16 @@ sub print_form {
}
else {
if ( $form->{formname} !~ /bin_list/ ) {
- for (@a) { $form->{"shipto$_"} = $form->{$_} }
+ for (@vars) { $form->{"shipto$_"} = $form->{$_} }
}
}
}
# some of the stuff could have umlauts so we translate them
- push @a,
+ push @vars,
qw(contact shiptoname shiptoaddress1 shiptoaddress2 shiptocity shiptostate shiptozipcode shiptocountry shiptocontact shiptoemail shippingpoint shipvia notes intnotes employee warehouse);
- push @a, ( "${inv}number", "${inv}date", "${due}date" );
+ push @vars, ( "${inv}number", "${inv}date", "${due}date" );
for (qw(company address tel fax businessnumber)) {
$form->{$_} = $myconfig{$_};
@@ -1648,7 +1648,7 @@ sub print_form {
for (qw(name email)) { $form->{"user$_"} = $myconfig{$_} }
- push @a, qw(company address tel fax businessnumber username useremail);
+ push @vars, qw(company address tel fax businessnumber username useremail);
for (qw(notes intnotes)) { $form->{$_} =~ s/^\s+//g }
@@ -1657,7 +1657,7 @@ sub print_form {
$form->{$_} =~ s/<%(.*?)%>/$form->{$1}/g;
}
- $form->format_string(@a);
+ $form->format_string(@vars);
$form->{templates} = "$myconfig{templates}";
$form->{IN} = "$form->{formname}.$form->{format}";
@@ -1668,7 +1668,7 @@ sub print_form {
$form->{pre} = '<body bgcolor="#ffffff">\n<pre>' if $form->{format} eq 'txt';
- if ( $form->{media} !~ /(screen|queue|email)/ ) {
+ if ( $form->{media} !~ /(screen|queue|email)/ ) { # printer
$form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
$form->{printmode} = '|-';
$form->{OUT} =~ s/<%(fax)%>/<%$form->{vc}$1%>/;
@@ -1696,9 +1696,7 @@ sub print_form {
$form->audittrail( "", \%myconfig, \%audittrail )
if defined %$old_form;
- }
-
- if ( $form->{media} eq 'email' ) {
+ } elsif ( $form->{media} eq 'email' ) {
$form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
unless $form->{subject};
@@ -1753,9 +1751,7 @@ sub print_form {
$old_form->{audittrail} .=
$form->audittrail( "", \%myconfig, \%audittrail )
if defined %$old_form;
- }
-
- if ( $form->{media} eq 'queue' ) {
+ } elsif ( $form->{media} eq 'queue' ) {
%queued = split / /, $form->{queued};
if ( $filename = $queued{ $form->{formname} } ) {
diff --git a/bin/oe.pl b/bin/oe.pl
index 64732dab..0d98b5e4 100755
--- a/bin/oe.pl
+++ b/bin/oe.pl
@@ -243,6 +243,7 @@ sub prepare_order {
$form->{$_} = $form->quote( $form->{$_} );
}
+ my $i = 0;
foreach $ref ( @{ $form->{form_details} } ) {
$i++;
for ( keys %$ref ) { $form->{"${_}_$i"} = $ref->{$_} }