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

SF.net SVN: ledger-smb:[3762] branches/1.3/bin/gl.pl



Revision: 3762
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3762&view=rev
Author:   einhverfr
Date:     2011-09-27 17:30:11 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
Correcting gl workflow for file attachments

Modified Paths:
--------------
    branches/1.3/bin/gl.pl

Modified: branches/1.3/bin/gl.pl
===================================================================
--- branches/1.3/bin/gl.pl	2011-09-27 15:45:59 UTC (rev 3761)
+++ branches/1.3/bin/gl.pl	2011-09-27 17:30:11 UTC (rev 3762)
@@ -138,6 +138,17 @@
     &add;
 }
 
+sub new {
+     for my $row (1 .. $form->{rowcount}){
+         for my $fld(qw(accno projectnumber acc debit credit source memo)){
+            delete $form->{"${fld}_${row}"};
+         }
+     }
+     delete $form->{rowcount};
+     delete $form->{id};
+     add();
+}
+
 sub add {
 
     $form->{title} = "Add";
@@ -257,6 +268,8 @@
 		    { ndx => 7, key => 'H', value => $locale->text('Schedule') },
 		  'delete' =>
 		    { ndx => 8, key => 'D', value => $locale->text('Delete') },
+                  'new' => 
+                    { ndx => 9, key => 'N', value => $locale->text('New') },
 	      );
 
 	      if ($form->{separate_duties}){            
@@ -264,9 +277,15 @@
 		  $button{post}->{value} = $locale->text('Save'); 
 	      }
 	      %a = ();
+              if ($form->{id}){
+                 $a{'new'} = 1;
+                 
+              } else {
+                 $a{'update'} = 1;
+              }
 	      if ( $form->{id} && ($form->{approved} || !$form->{batch_id})) {
 
-		  for ( 'update', 'post_as_new', 'schedule' ) { $a{$_} = 1 }
+		  for ( 'post_as_new', 'schedule' ) { $a{$_} = 1 }
 
 		  if ( !$form->{locked} ) {
 		      if ( $transdate > $closedto ) {
@@ -280,7 +299,6 @@
 		      for ( "post", "schedule" ) { $a{$_} = 1 }
 		  }
 	      }
-              $a{update} = 1;
 
 	      if (!$form->{approved} && !$form->{batch_id}){
 		$button{approve} = { 
@@ -1124,7 +1142,7 @@
     }
 
     if ( GL->post_transaction( \%myconfig, \%$form, $locale) ) {
-        $form->redirect( $locale->text('Transaction posted!') );
+        edit();
     }
     else {
         $form->error( $locale->text('Cannot post transaction!') );

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