[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1921] branches/1.2



Revision: 1921
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1921&view=rev
Author:   tetragon
Date:     2007-11-29 12:25:15 -0800 (Thu, 29 Nov 2007)

Log Message:
-----------
Fix for bug 1831402

Modified Paths:
--------------
    branches/1.2/LedgerSMB/IS.pm
    branches/1.2/LedgerSMB/OE.pm
    branches/1.2/bin/am.pl
    branches/1.2/bin/arap.pl
    branches/1.2/bin/io.pl
    branches/1.2/bin/oe.pl

Modified: branches/1.2/LedgerSMB/IS.pm
===================================================================
--- branches/1.2/LedgerSMB/IS.pm	2007-11-29 20:24:56 UTC (rev 1920)
+++ branches/1.2/LedgerSMB/IS.pm	2007-11-29 20:25:15 UTC (rev 1921)
@@ -244,6 +244,7 @@
 
         if ( $form->{"qty_$i"} ) {
 
+            $form->{discount} = [] if ref $form->{discount} ne 'ARRAY';
             $form->{totalqty}  += $form->{"qty_$i"};
             $form->{totalship} += $form->{"qty_$i"};
             $form->{totalweight} +=

Modified: branches/1.2/LedgerSMB/OE.pm
===================================================================
--- branches/1.2/LedgerSMB/OE.pm	2007-11-29 20:24:56 UTC (rev 1920)
+++ branches/1.2/LedgerSMB/OE.pm	2007-11-29 20:25:15 UTC (rev 1921)
@@ -1204,6 +1204,7 @@
 
         if ( $form->{"qty_$i"} ) {
 
+            $form->{discount} = [] if ref $form->{discount} ne 'ARRAY';
             $form->{totalqty}  += $form->{"qty_$i"};
             $form->{totalship} += $form->{"ship_$i"};
             $form->{totalweight} +=

Modified: branches/1.2/bin/am.pl
===================================================================
--- branches/1.2/bin/am.pl	2007-11-29 20:24:56 UTC (rev 1920)
+++ branches/1.2/bin/am.pl	2007-11-29 20:25:15 UTC (rev 1921)
@@ -3575,6 +3575,7 @@
     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 @@
                   . $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 @@
                 last;
             }
         }
+        $form->{callback} = $orig_callback;
     }
 
     $ok;
@@ -3621,6 +3619,7 @@
     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 @@
 
             $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 @@
                 last;
             }
         }
+        $form->{callback} = $orig_callback;
     }
 
     $ok;

Modified: branches/1.2/bin/arap.pl
===================================================================
--- branches/1.2/bin/arap.pl	2007-11-29 20:24:56 UTC (rev 1920)
+++ branches/1.2/bin/arap.pl	2007-11-29 20:25:15 UTC (rev 1921)
@@ -1024,6 +1024,8 @@
           ( $form->{message} ) ? $form->{message} : $locale->text('sent');
 
         $form->save_intnotes( \%myconfig, $form->{module} );
+
+        0; #SC: Reversing the expected value to work with its caller
     }
 
 }

Modified: branches/1.2/bin/io.pl
===================================================================
--- branches/1.2/bin/io.pl	2007-11-29 20:24:56 UTC (rev 1920)
+++ branches/1.2/bin/io.pl	2007-11-29 20:25:15 UTC (rev 1921)
@@ -1553,9 +1553,9 @@
 
     &{"$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 @@
     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 @@
                 $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 @@
 
     # 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 @@
         }
     }
 
-    @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 @@
         }
         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 @@
 
     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 @@
         $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 @@
 
     $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 @@
           $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 @@
         $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} } ) {

Modified: branches/1.2/bin/oe.pl
===================================================================
--- branches/1.2/bin/oe.pl	2007-11-29 20:24:56 UTC (rev 1920)
+++ branches/1.2/bin/oe.pl	2007-11-29 20:25:15 UTC (rev 1921)
@@ -243,6 +243,7 @@
             $form->{$_} = $form->quote( $form->{$_} );
         }
 
+        my $i = 0;
         foreach $ref ( @{ $form->{form_details} } ) {
             $i++;
             for ( keys %$ref ) { $form->{"${_}_$i"} = $ref->{$_} }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.