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

SF.net SVN: ledger-smb:[3088] addons/1.3/enhanced_tb/trunk



Revision: 3088
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3088&view=rev
Author:   einhverfr
Date:     2010-10-05 20:01:46 +0000 (Tue, 05 Oct 2010)

Log Message:
-----------
UI and TB saving routines corrected

Modified Paths:
--------------
    addons/1.3/enhanced_tb/trunk/LedgerSMB/DBObject/TrialBalance.pm
    addons/1.3/enhanced_tb/trunk/UI/trial_balance/search.html
    addons/1.3/enhanced_tb/trunk/scripts/trial_balance.pl
    addons/1.3/enhanced_tb/trunk/sql/modules/trial_balance.sql

Modified: addons/1.3/enhanced_tb/trunk/LedgerSMB/DBObject/TrialBalance.pm
===================================================================
--- addons/1.3/enhanced_tb/trunk/LedgerSMB/DBObject/TrialBalance.pm	2010-10-05 04:08:46 UTC (rev 3087)
+++ addons/1.3/enhanced_tb/trunk/LedgerSMB/DBObject/TrialBalance.pm	2010-10-05 20:01:46 UTC (rev 3088)
@@ -50,6 +50,11 @@
     return $self->__attr('description');
 }
 
+sub commit {
+    my ($self) = @_;
+    return $self->{dbh}->commit();
+}
+
 sub save {
     my ($self) = @_;
     
@@ -83,7 +88,7 @@
         $ignore_yearend = $self->{ignore_yearend};
     }
     
-    my @lines = $self->exec_method(funcname=>"trial_balance__account_data", args=>[
+    my @lines = $self->exec_method(funcname=>"trial_balance__generate", args=>[
         $self->{date_from},
         $self->{date_to},
         $self->{heading},
@@ -188,4 +193,4 @@
     return ..hidden..;
 }
 
-1;
\ No newline at end of file
+1;

Modified: addons/1.3/enhanced_tb/trunk/UI/trial_balance/search.html
===================================================================
--- addons/1.3/enhanced_tb/trunk/UI/trial_balance/search.html	2010-10-05 04:08:46 UTC (rev 3087)
+++ addons/1.3/enhanced_tb/trunk/UI/trial_balance/search.html	2010-10-05 20:01:46 UTC (rev 3088)
@@ -20,14 +20,16 @@
                 <tr>
                     <th align="right"><?lsmb text('Department') ?></th>
                     <td colspan="3">
+                      
                       <?lsmb d = []; FOR i IN departments;
                                 d.push({
-                                    text=>i,
-                                    value=>loop
+                                    text=>i.description,
+                                    value=>i.id
                                 });
                              END;
+                        d.unshift({});
                       PROCESS select element_data={
-                          name=department,
+                          name="department",
                           default_options=[department],
                           options=d
                       } -?>

Modified: addons/1.3/enhanced_tb/trunk/scripts/trial_balance.pl
===================================================================
--- addons/1.3/enhanced_tb/trunk/scripts/trial_balance.pl	2010-10-05 04:08:46 UTC (rev 3087)
+++ addons/1.3/enhanced_tb/trunk/scripts/trial_balance.pl	2010-10-05 20:01:46 UTC (rev 3088)
@@ -104,16 +104,15 @@
 
 sub save {
     my ($request) = @_;
-    
     # We need a date_start, a date_end, a description, and
     # a whole lot of account IDs.
     # I believe we can assume that a series of checkboxes
     # on the HTML end are translated into an array on the 
     # Perl end of things, in the request object.
     
-    if ($request->{date_from} &&
-        $request->{date_to}   &&
-        $request->{description} &&
+    if ($request->{date_from} ||
+        $request->{date_to}   ||
+        $request->{description} ||
         ($request->{accounts} || $request->{heading})
     ) {
         print STDERR "First if block";
@@ -303,4 +302,4 @@
     return ..hidden.., $total_debits, $total_credits, $report;
 }
 
-1;
\ No newline at end of file
+1;

Modified: addons/1.3/enhanced_tb/trunk/sql/modules/trial_balance.sql
===================================================================
--- addons/1.3/enhanced_tb/trunk/sql/modules/trial_balance.sql	2010-10-05 04:08:46 UTC (rev 3087)
+++ addons/1.3/enhanced_tb/trunk/sql/modules/trial_balance.sql	2010-10-05 20:01:46 UTC (rev 3088)
@@ -246,9 +246,9 @@
 
 CREATE TABLE trial_balance (
     id serial primary key,
-    date_from date not null,
-    date_to date not null,
-    description text,
+    date_from date, 
+    date_to date,
+    description text NOT NULL,
     yearend text not null references trial_balance__yearend_types(type)
 );
 
@@ -339,7 +339,7 @@
             -- Else, do nothing.
             END IF;
             
-            IF in_accounts IS NOT NULL THEN
+            IF in_accounts IS NOT NULL AND in_accounts <> '{}' THEN
                 -- First, we add the new ones.
                 
                 DELETE FROM trial_balance__account_to_report WHERE report_id = in_id;
@@ -370,7 +370,7 @@
                      VALUES (new_report_id, in_heading);
             END IF;
             
-            IF in_accounts IS NOT NULL THEN
+            IF in_accounts IS NOT NULL and in_accounts <> '{}' THEN
                 -- Iterate over the length of the array, and insert each one into the
                 -- account-to-report table.
                 -- Because this targets 8.2, we can't use the 8.4 function unnest();


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