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

SF.net SVN: ledger-smb:[5427] trunk/LedgerSMB



Revision: 5427
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5427&view=rev
Author:   einhverfr
Date:     2012-12-27 09:04:38 +0000 (Thu, 27 Dec 2012)
Log Message:
-----------
batch approval now working

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject.pm
    trunk/LedgerSMB/Scripts/vouchers.pm

Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm	2012-12-27 08:39:37 UTC (rev 5426)
+++ trunk/LedgerSMB/DBObject.pm	2012-12-27 09:04:38 UTC (rev 5427)
@@ -50,6 +50,7 @@
 use base qw(LedgerSMB);
 use Log::Log4perl;
 use LedgerSMB::App_State;
+use Carp::Always;
 use strict;
 use warnings;
 
@@ -111,6 +112,7 @@
     my %args  = (ref($_[0]) eq 'HASH')? %{$_[0]}: @_;
     my $funcname = $args{funcname};
     my $dbh = $LedgerSMB::App_State::DBH;
+    die 'No Database Handle' unless $dbh;
     
     my $schema   = $args{schema} || $LedgerSMB::Sysconfig::db_namespace;
     

Modified: trunk/LedgerSMB/Scripts/vouchers.pm
===================================================================
--- trunk/LedgerSMB/Scripts/vouchers.pm	2012-12-27 08:39:37 UTC (rev 5426)
+++ trunk/LedgerSMB/Scripts/vouchers.pm	2012-12-27 09:04:38 UTC (rev 5427)
@@ -18,6 +18,7 @@
 use LedgerSMB::Template;
 use LedgerSMB::Report::Unapproved::Batch_Overview;
 use LedgerSMB::Scripts::payment;
+use LedgerSMB::Scripts::reports;
 use strict;
 
 
@@ -180,26 +181,6 @@
     $vouchers_dispatch->{$request->{batch_type}}{function}($request);
 }
 
-=item search_batch
-
-Displays the search criteria screen.  No inputs required.
-
-=cut
-
-sub search_batch {
-    my ($request) = @_;
-    my $batch_request = LedgerSMB::Batch->new(base => $request);
-    $batch_request->get_search_criteria($custom_batch_types);
-    my $template = LedgerSMB::Template->new(
-        user     => $request->{_user},
-        locale   => $request->{_locale},
-        path     => 'UI/batch',
-        template => 'filter',
-        format   => 'HTML', 
-    );
-    $template->render($batch_request);
-}
-
 =item list_batches
 
 This function displays the search results.
@@ -217,6 +198,7 @@
 
 sub list_batches {
     my ($request) = @_;
+    $request->open_form;
     my $report = LedgerSMB::Report::Unapproved::Batch_Overview->new(
                  %$request);
     $report->run_report;
@@ -305,14 +287,15 @@
     my $batch = LedgerSMB::Batch->new(base => $request);
     if (!$batch->close_form){
         list_batches($request);
-        $request->finalize_request();
     }
-    for my $count (1 .. $batch->{rowcount}){
-        next unless $batch->{"batch_" . $batch->{"row_$count"}};
+    for my $count (1 .. $batch->{rowcount_}){
+        next unless $batch->{"select_" . $count};
         $batch->{batch_id} = $batch->{"row_$count"};
         $batch->post;
     }
-    search_batch($request);
+    $request->{report_name} = 'unapproved'; 
+    $request->{search_type} = 'batches';
+    LedgerSMB::Scripts::reports::start_report($request);
 }
 
 =item batch_delete

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