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

SF.net SVN: ledger-smb:[5074] addons/1.3/templatetrans/trunk



Revision: 5074
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5074&view=rev
Author:   einhverfr
Date:     2012-08-01 09:25:30 +0000 (Wed, 01 Aug 2012)
Log Message:
-----------
All templatetrans issues resolved

Modified Paths:
--------------
    addons/1.3/templatetrans/trunk/LedgerSMB/DBObject/TransTemplate.pm
    addons/1.3/templatetrans/trunk/patches/aa_gl.patch
    addons/1.3/templatetrans/trunk/sql/modules/trans-functions.sql
    addons/1.3/templatetrans/trunk/sql/modules/trans-tables.sql

Modified: addons/1.3/templatetrans/trunk/LedgerSMB/DBObject/TransTemplate.pm
===================================================================
--- addons/1.3/templatetrans/trunk/LedgerSMB/DBObject/TransTemplate.pm	2012-08-01 08:21:08 UTC (rev 5073)
+++ addons/1.3/templatetrans/trunk/LedgerSMB/DBObject/TransTemplate.pm	2012-08-01 09:25:30 UTC (rev 5074)
@@ -6,6 +6,7 @@
    my $self = shift @_;
    $self->{is_template} = '1';
    $self->{approved} = 0;
+   $self->{source} = $self->{invnumber} if $self->{invnumber};
    my ($ref) = $self->exec_method(funcname => 'journal__add');
    $self->merge($ref);
    $self->{journal_id} = $self->{id};

Modified: addons/1.3/templatetrans/trunk/patches/aa_gl.patch
===================================================================
--- addons/1.3/templatetrans/trunk/patches/aa_gl.patch	2012-08-01 08:21:08 UTC (rev 5073)
+++ addons/1.3/templatetrans/trunk/patches/aa_gl.patch	2012-08-01 09:25:30 UTC (rev 5074)
@@ -1,6 +1,76 @@
+Index: bin/gl.pl
+===================================================================
+--- bin/gl.pl	(revision 5032)
++++ bin/gl.pl	(working copy)
+@@ -266,6 +266,10 @@
+ 		  'update' =>
+ 		    { ndx => 1, key => 'U', value => $locale->text('Update') },
+ 		  'post' => { ndx => 3, key => 'O', value => $locale->text('Post') },
++                  'save_temp' =>
++                    { ndx   => 9, 
++                      key   => 'T', 
++                      value => $locale->text('Save Template') },
+ 		  'post_as_new' =>
+ 		    { ndx => 6, key => 'N', value => $locale->text('Post as new') },
+ 		  'schedule' =>
+@@ -287,6 +291,7 @@
+               } else {
+                  $a{'update'} = 1;
+               }
++              $a{save_temp} = 1;
+ 	      if ( $form->{id} && ($form->{approved} || !$form->{batch_id})) {
+ 
+ 		  for ( 'post_as_new', 'schedule' ) { $a{$_} = 1 }
+@@ -299,7 +304,7 @@
+ 
+ 	      }
+ 	      elsif (!$form->{id}){
+-		  if ( $transdate > $closedto ) {
++		  if ( !$transdate  or ($transdate > $closedto) ) {
+ 		      for ( "post", "schedule" ) { $a{$_} = 1 }
+ 		  }
+ 	      }
+@@ -367,7 +372,37 @@
+ }
+  
+ 
++sub save_temp {
++    use LedgerSMB;
++    use LedgerSMB::DBObject::TransTemplate;
++    my $lsmb = LedgerSMB->new();
++    my ($department_name, $department_id) = split/--/, $form->{department};
++    $lsmb->{department_id} = $department_id;
++    $lsmb->{source} = $form->{reference};
++    $lsmb->{description} = $form->{description};
++    $lsmb->{department_id} = $department_id;
++    $lsmb->{transaction_date} = $form->{transdate};
++    $lsmb->{type} = 'gl';
++    $lsmb->{journal_lines} = [];
++    for my $iter (0 .. $form->{rowcount}){
++        if ($form->{"accno_$iter"} and 
++                  (($form->{"credit_$iter"} != 0) or ($form->{"debit_$iter"} != 0))){
++             my ($acc_id, $acc_name) = split /--/, $form->{"accno_$iter"};
++             my $amount = $form->{"credit_$iter"} || ( $form->{"debit_$iter"} 
++                                                     * -1 );
++             push @{$lsmb->{journal_lines}}, 
++                  {accno => $acc_id,
++                   amount => $amount, 
++                   cleared => false,
++                  };
++        }
++    }
++    $template = LedgerSMB::DBObject::TransTemplate->new(base => $lsmb);
++    $template->save;
++    $form->redirect( $locale->text('Template Saved!') );
++}
+ 
++
+ sub display_row
+ {
+  
 Index: bin/aa.pl
 ===================================================================
---- bin/aa.pl	(revision 3924)
+--- bin/aa.pl	(revision 5025)
 +++ bin/aa.pl	(working copy)
 @@ -108,7 +108,6 @@
  }
@@ -10,7 +80,7 @@
      $form->{title} = "Add";
  	
      $form->{callback} =
-@@ -975,6 +974,8 @@
+@@ -990,6 +989,8 @@
  
              'save_info' => 
                { ndx => 9, key => 'I', value => $locale->text('Save Info') },
@@ -19,7 +89,7 @@
              'new_screen' => # Create a blank ar/ap invoice.
               { ndx => 10, key=> 'N', value => $locale->text('New') }
          );
-@@ -1105,6 +1106,41 @@
+@@ -1120,6 +1121,41 @@
  |;
  }
  
@@ -61,64 +131,3 @@
  sub edit_and_approve {
      use LedgerSMB::DBObject::Draft;
      use LedgerSMB;
-Index: bin/gl.pl
-===================================================================
---- bin/gl.pl	(revision 3923)
-+++ bin/gl.pl	(working copy)
-@@ -264,6 +264,10 @@
- 		  'update' =>
- 		    { ndx => 1, key => 'U', value => $locale->text('Update') },
- 		  'post' => { ndx => 3, key => 'O', value => $locale->text('Post') },
-+                  'save_temp' =>
-+                    { ndx   => 9, 
-+                      key   => 'T', 
-+                      value => $locale->text('Save Template') },
- 		  'post_as_new' =>
- 		    { ndx => 6, key => 'N', value => $locale->text('Post as new') },
- 		  'schedule' =>
-@@ -285,6 +289,7 @@
-               } else {
-                  $a{'update'} = 1;
-               }
-+              $a{save_temp} = 1;
- 	      if ( $form->{id} && ($form->{approved} || !$form->{batch_id})) {
- 
- 		  for ( 'post_as_new', 'schedule' ) { $a{$_} = 1 }
-@@ -365,7 +370,37 @@
- }
-  
- 
-+sub save_temp {
-+    use LedgerSMB;
-+    use LedgerSMB::DBObject::TransTemplate;
-+    my $lsmb = LedgerSMB->new();
-+    my ($department_name, $department_id) = split/--/, $form->{department};
-+    $lsmb->{department_id} = $department_id;
-+    $lsmb->{source} = $form->{reference};
-+    $lsmb->{description} = $form->{description};
-+    $lsmb->{department_id} = $department_id;
-+    $lsmb->{transaction_date} = $form->{transdate};
-+    $lsmb->{type} = 'gl';
-+    $lsmb->{journal_lines} = [];
-+    for my $iter (0 .. $form->{rowcount}){
-+        if ($form->{"accno_$iter"} and 
-+                  (($form->{"credit_$iter"} != 0) or ($form->{"debit_$iter"} != 0))){
-+             my ($acc_id, $acc_name) = split /--/, $form->{"accno_$iter"};
-+             my $amount = $form->{"credit_$iter"} || ( $form->{"debit_$iter"} 
-+                                                     * -1 );
-+             push @{$lsmb->{journal_lines}}, 
-+                  {accno => $acc_id,
-+                   amount => $amount, 
-+                   cleared => false,
-+                  };
-+        }
-+    }
-+    $template = LedgerSMB::DBObject::TransTemplate->new(base => $lsmb);
-+    $template->save;
-+    $form->redirect( $locale->text('Template Saved!') );
-+}
- 
-+
- sub display_row
- {
-  

Modified: addons/1.3/templatetrans/trunk/sql/modules/trans-functions.sql
===================================================================
--- addons/1.3/templatetrans/trunk/sql/modules/trans-functions.sql	2012-08-01 08:21:08 UTC (rev 5073)
+++ addons/1.3/templatetrans/trunk/sql/modules/trans-functions.sql	2012-08-01 09:25:30 UTC (rev 5074)
@@ -44,7 +44,7 @@
 
 CREATE OR REPLACE FUNCTION journal__make_invoice(
 in_order_id int,  in_journal_id int, in_on_hold bool, in_reverse bool,
-in_credit_id int, in_language_code int
+in_credit_id int, in_language_code varchar
 ) returns t_invoice AS $$
 DECLARE retval t_invoice;
 BEGIN	

Modified: addons/1.3/templatetrans/trunk/sql/modules/trans-tables.sql
===================================================================
--- addons/1.3/templatetrans/trunk/sql/modules/trans-tables.sql	2012-08-01 08:21:08 UTC (rev 5073)
+++ addons/1.3/templatetrans/trunk/sql/modules/trans-tables.sql	2012-08-01 09:25:30 UTC (rev 5074)
@@ -15,7 +15,7 @@
 entry_type int references journal_entry_type(id),
 transaction_date date not null default now(),
 approved bool default false, -- this way we do vouchers by default,
-department_id int references department(id) not null, 
+department_id int references department(id), 
 is_template bool default false,
 primary key (id), -- no other set of fields guaranteed to be unique
 check (is_template is false or approved is false)

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