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

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



Revision: 3052
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3052&view=rev
Author:   einhverfr
Date:     2010-08-18 14:47:25 +0000 (Wed, 18 Aug 2010)

Log Message:
-----------
Merging zero-tax-fix and adding GL rowcount override.

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Account.pm
    trunk/bin/gl.pl
    trunk/bin/is.pl

Modified: trunk/LedgerSMB/DBObject/Account.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Account.pm	2010-08-17 19:36:17 UTC (rev 3051)
+++ trunk/LedgerSMB/DBObject/Account.pm	2010-08-18 14:47:25 UTC (rev 3052)
@@ -111,31 +111,23 @@
 
 sub generate_links {
     my $self= shift @_;
-    my @sum =  qw(AR AP IC);
     my $is_summary = 0;
+    my $is_custom = 0;
     my @links;
-    my @others = qw(AR_amount AR_tax AR_paid AR_overpayment AR_discount
-                    AP_amount AP_tax AP_paid AP_overpayment AP_discount
-                    IC_sale IC_cogs IC_taxpart IC_taxservice IC_income
-                    IC_expense);
-
-   for my $l (@sum){
-       if ($self->{$l}){
-           if ($is_summary){
-               $self->error($self->{_locale}->text('Too many links on summary account!'));
+    my @descriptions = $self->exec_method(funcname =>
+                                          'get_link_descriptions');
+   foreach my $d (@descriptions) {
+       my $l = $d->{description};
+       if ($self->{$l}) {
+           $is_summary++ if ($d->{summary} == 1);
+           $is_custom++ if ($d->{custom} == 1);       
+           if ($is_summary > 1 || ($is_summary == 1 && $is_custom >=1 )) {
+                $self->error($self->{_locale}->text("Too many links on summary account!"));
            }
            push (@links, $l);
-           $is_summary = 1;
        }
    }
-   for my $l (@others){
-       if ($self->{$l}){
-           if ($is_summary){
-               $self->error($self->{_locale}->text('Too many links on summary account!'));
-           }
-           push (@links, $l);
-       }
-    }
+ 
     $self->{link} = $self->_db_array_scalars(@links);
 }
 

Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl	2010-08-17 19:36:17 UTC (rev 3051)
+++ trunk/bin/gl.pl	2010-08-18 14:47:25 UTC (rev 3052)
@@ -148,7 +148,9 @@
 
     &create_links;
     $form->{reference} = $form->update_defaults(\%myconfig, 'glnumber');
-    $form->{rowcount} = ( $form->{transfer} ) ? 3 : 9;
+    if (!$form->{rowcount}){
+        $form->{rowcount} = ( $form->{transfer} ) ? 3 : 9;
+    }
     if ( $form->{pos_adjust} ) {
         &pos_adjust;
     }

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2010-08-17 19:36:17 UTC (rev 3051)
+++ trunk/bin/is.pl	2010-08-18 14:47:25 UTC (rev 3052)
@@ -567,6 +567,7 @@
             $form->{"${taccno}_total"} =
                   $form->format_amount( \%myconfig,
                     $form->round_amount( $form->{taxes}{$item}, 2 ), 2 );
+            next if !$form->{"${taccno}_total"};
             $tax .= qq|
         <tr>
       	<th align=right>$form->{"${taccno}_description"}</th>


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