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

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



Revision: 4919
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4919&view=rev
Author:   einhverfr
Date:     2012-06-19 02:42:31 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------
Fixes to invoice vouchers

Modified Paths:
--------------
    trunk/LedgerSMB/Batch.pm
    trunk/LedgerSMB/IR.pm
    trunk/LedgerSMB/IS.pm
    trunk/bin/ir.pl
    trunk/bin/is.pl

Modified: trunk/LedgerSMB/Batch.pm
===================================================================
--- trunk/LedgerSMB/Batch.pm	2012-06-19 02:13:51 UTC (rev 4918)
+++ trunk/LedgerSMB/Batch.pm	2012-06-19 02:42:31 UTC (rev 4919)
@@ -110,7 +110,7 @@
     } elsif ($args->{mini}){
         $search_proc = "batch_search_mini";
     } else {
-        $search_proc = "batch_search";
+        $search_proc = "batch__search";
     }
 
     if ( !defined $self->{created_by_eid} || $self->{created_by_eid} == 0){

Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm	2012-06-19 02:13:51 UTC (rev 4918)
+++ trunk/LedgerSMB/IR.pm	2012-06-19 02:42:31 UTC (rev 4919)
@@ -781,6 +781,13 @@
         $approved,              $form->{id}
     ) || $form->dberror($query);
 
+    if ($form->{batch_id}){
+        $sth = $dbh->prepare(
+           'INSERT INTO voucher (batch_id, trans_id, batch_class)
+            VALUES (?, ?, ?)');
+        $sth->execute($form->{batch_id}, $form->{id}, 9);
+    }
+
     # add shipto
     $form->{name} = $form->{vendor};
     $form->{name} =~ s/--$form->{vendor_id}//;

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2012-06-19 02:13:51 UTC (rev 4918)
+++ trunk/LedgerSMB/IS.pm	2012-06-19 02:42:31 UTC (rev 4919)
@@ -1260,6 +1260,13 @@
                 $invoice_id
             ) || $form->dberror($query);
 
+            if ($form->{batch_id}){
+                $sth = $dbh->prepare(
+                   'INSERT INTO voucher (batch_id, trans_id, batch_class)
+                    VALUES (?, ?, ?)');
+                $sth->execute($form->{batch_id}, $form->{id}, 8);
+            }
+
             for my $cls(@{$form->{bu_class}}){
                 if ($form->{"b_unit_$cls->{id}_$i"}){
                  $b_unit_sth->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});

Modified: trunk/bin/ir.pl
===================================================================
--- trunk/bin/ir.pl	2012-06-19 02:13:51 UTC (rev 4918)
+++ trunk/bin/ir.pl	2012-06-19 02:42:31 UTC (rev 4919)
@@ -913,8 +913,8 @@
              { ndx => 11, key=> 'N', value => $locale->text('New') }
         );
 
-        if ($from->{separate_duties}){
-           $button{'post'}->{value} = $locale->text('Save') unless $form->{id};
+        if ($from->{separate_duties} or $form->{batch_id}){
+           $button{'post'}->{value} = $locale->text('Save');
         }
 
         if ( $form->{id} ) {
@@ -1388,6 +1388,9 @@
     ( $form->{AP_paid} ) = split /--/, $form->{AP_paid};
 
     if ( IR->post_invoice( \%myconfig, \%$form ) ) {
+        if ($form->{batch_id}){
+            $form->{callback} .= "&batch_id=$form->{batch_id}";
+        }
         $form->redirect(
             $locale->text( 'Invoice [_1] posted!', $form->{invnumber} ) );
     }

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2012-06-19 02:13:51 UTC (rev 4918)
+++ trunk/bin/is.pl	2012-06-19 02:42:31 UTC (rev 4919)
@@ -978,7 +978,7 @@
         );
 
 
-        if ($from->{separate_duties}){
+        if ($from->{separate_duties} or $form->{batch_id}){
            $button{'post'}->{value} = $locale->text('Save') unless $form->{id};
         }
        delete $button{void} if $form->{invnumber} =~ /-VOID/;
@@ -1405,8 +1405,12 @@
     ( $form->{AR_paid} ) = split /--/, $form->{AR_paid};
 
     if ( IS->post_invoice( \%myconfig, \%$form ) ) {
-	$form->{callback} =
+        if ($form->{batch_id}){
+            $form->{callback} .= "&batch_id=$form->{batch_id}";
+        } else {
+   	    $form->{callback} =
 	    "$form->{script}?action=edit&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}&id=$form->{id}";
+        }
         $form->redirect(
             $locale->text( 'Invoice [_1] posted!', $form->{invnumber} ) );
     }

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