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

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



Revision: 2228
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2228&view=rev
Author:   einhverfr
Date:     2008-07-31 22:08:16 +0000 (Thu, 31 Jul 2008)

Log Message:
-----------
Fixing issues with adding ap/ar vouchers to existing batch

Modified Paths:
--------------
    trunk/bin/aa.pl
    trunk/scripts/vouchers.pl

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2008-07-31 19:04:59 UTC (rev 2227)
+++ trunk/bin/aa.pl	2008-07-31 22:08:16 UTC (rev 2228)
@@ -887,7 +887,7 @@
             'delete' =>
               { ndx => 8, key => 'D', value => $locale->text('Delete') },
         );
-        if (!$form->{approved}){
+        if (!$form->{approved} && !$form->{batch_id}){
            $button{approve} = { ndx => 3, key => 'O', value => $locale->text('Post') };
            delete $button{post_as_new};
            delete $button{print_and_post_as_new};
@@ -895,13 +895,11 @@
            delete $button{print_and_post};
         }
 
-        if ($form->{separate_duties}){
+        if ($form->{separate_duties} || $form->{batch_id}){
             $button{post}->{value} = $locale->text('Save');
             $form->hide_form('separate_duties');
         }
-
         if ( $form->{id} ) {
-
             if ( $form->{locked} || ( $transdate && $transdate <= $closedto ) )
             {
                 for ( "post", "print_and_post", "delete" ) {
@@ -923,7 +921,7 @@
             }
             delete $button{"print_and_post"} if !${LedgerSMB::Sysconfig::latex};
 
-            if ( $transdate && $transdate <= $closedto ) {
+            if ( $transdate && ($transdate <= $closedto) ) {
                 for ( "post", "print_and_post" ) { delete $button{$_} }
             }
         }

Modified: trunk/scripts/vouchers.pl
===================================================================
--- trunk/scripts/vouchers.pl	2008-07-31 19:04:59 UTC (rev 2227)
+++ trunk/scripts/vouchers.pl	2008-07-31 22:08:16 UTC (rev 2228)
@@ -72,10 +72,10 @@
     my $batch = LedgerSMB::Batch->new({base => $request});
     our $vouchers_dispatch = 
     {
-        payable    => {script => 'bin/ap.pl', function => sub {add()}},
-        receivable => {script => 'bin/ar.pl', function => sub {add()}},
+        ap         => {script => 'bin/ap.pl', function => sub {add()}},
+        ar         => {script => 'bin/ar.pl', function => sub {add()}},
         gl         => {script => 'bin/gl.pl', function => sub {add()}},
-        receipt   => {script => 'scripts/payment.pl', 
+        receipt    => {script => 'scripts/payment.pl', 
 	             function => sub {
 				my ($request) = @_;
 				$request->{account_class} = 2;
@@ -124,6 +124,8 @@
     my $script = $vouchers_dispatch->{$request->{batch_type}}{script};
     $form->{script} = $script;
     $form->{script} =~ s|.*/||;
+    delete $form->{id};
+    delete $request->{id};
     if ($script =~ /^bin/){
 
         # Note that the line below is generally considered incredibly bad form. 


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