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

SF.net SVN: ledger-smb: [1920] trunk



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

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

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

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2007-11-29 20:07:09 UTC (rev 1919)
+++ trunk/LedgerSMB/IS.pm	2007-11-29 20:24:56 UTC (rev 1920)
@@ -242,6 +242,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: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm	2007-11-29 20:07:09 UTC (rev 1919)
+++ trunk/LedgerSMB/OE.pm	2007-11-29 20:24:56 UTC (rev 1920)
@@ -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: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2007-11-29 20:07:09 UTC (rev 1919)
+++ trunk/bin/am.pl	2007-11-29 20:24:56 UTC (rev 1920)
@@ -2760,6 +2760,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 ];
@@ -2772,15 +2773,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') );
@@ -2790,6 +2787,7 @@
                 last;
             }
         }
+        $form->{callback} = $orig_callback;
     }
 
     $ok;
@@ -2804,7 +2802,7 @@
     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 @@
 
             $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 @@
                 last;
             }
         }
+        $form->{callback} = $orig_callback;
     }
 
     $ok;

Modified: trunk/bin/arap.pl
===================================================================
--- trunk/bin/arap.pl	2007-11-29 20:07:09 UTC (rev 1919)
+++ trunk/bin/arap.pl	2007-11-29 20:24:56 UTC (rev 1920)
@@ -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: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2007-11-29 20:07:09 UTC (rev 1919)
+++ trunk/bin/io.pl	2007-11-29 20:24:56 UTC (rev 1920)
@@ -1556,9 +1556,9 @@
 
     &{"$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 @@
     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 @@
                 $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 @@
 
     # 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 @@
         }
     }
 
-    @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 @@
         }
         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 @@
 
     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 @@
         $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 @@
 
     $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 @@
           $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 @@
         $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: trunk/bin/oe.pl
===================================================================
--- trunk/bin/oe.pl	2007-11-29 20:07:09 UTC (rev 1919)
+++ trunk/bin/oe.pl	2007-11-29 20:24:56 UTC (rev 1920)
@@ -243,6 +243,7 @@
             $form->{$_} = $form->quote( $form->{$_} );
         }
 
+        my $i;
         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.