summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-29 20:24:56 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-29 20:24:56 +0000
commitbc761936059300ae24be93b5ac7dcbf3a0c62a34 (patch)
treeee2060f8af976cfd243d898dfe343769dc2a9ab9 /bin
parentadcdb4574294942cee0efeeb7bc805a265b1c9d9 (diff)
Fix for bug 1831402
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1920 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r--bin/am.pl25
-rw-r--r--bin/arap.pl2
-rw-r--r--bin/io.pl38
-rw-r--r--bin/oe.pl1
4 files changed, 30 insertions, 36 deletions
diff --git a/bin/am.pl b/bin/am.pl
index 0eab19c5..a81d2166 100644
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -2760,6 +2760,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 ];
@@ -2772,15 +2773,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') );
@@ -2790,6 +2787,7 @@ sub print_recurring {
last;
}
}
+ $form->{callback} = $orig_callback;
}
$ok;
@@ -2804,7 +2802,7 @@ sub email_recurring {
my $ok = 1;
if ( $pt->{recurringemail} ) {
-
+ my $orig_callback = $form->{callback};
@f = split /:/, $pt->{recurringemail};
for ( $j = 0 ; $j <= $#f ; $j += 2 ) {
@@ -2822,15 +2820,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') );
@@ -2840,6 +2834,7 @@ sub email_recurring {
last;
}
}
+ $form->{callback} = $orig_callback;
}
$ok;
diff --git a/bin/arap.pl b/bin/arap.pl
index 782cc077..54ab7958 100644
--- 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 f066b6be..bec37ddb 100644
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -1556,9 +1556,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",
@@ -1569,7 +1569,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 ) {
@@ -1579,10 +1579,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 /--/,
@@ -1597,10 +1597,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;
@@ -1610,13 +1610,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;
@@ -1633,16 +1633,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{$_};
@@ -1651,7 +1651,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 }
@@ -1660,7 +1660,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}";
@@ -1671,7 +1671,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)/ ) { # printing
$form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
$form->{printmode} = '|-';
$form->{OUT} =~ s/<%(fax)%>/<%$form->{vc}$1%>/;
@@ -1699,9 +1699,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};
@@ -1756,9 +1754,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 e2f32dcf..a96d931d 100644
--- a/bin/oe.pl
+++ b/bin/oe.pl
@@ -243,6 +243,7 @@ sub prepare_order {
$form->{$_} = $form->quote( $form->{$_} );
}
+ my $i;
foreach $ref ( @{ $form->{form_details} } ) {
$i++;
for ( keys %$ref ) { $form->{"${_}_$i"} = $ref->{$_} }