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

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



Revision: 5214
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5214&view=rev
Author:   einhverfr
Date:     2012-11-20 05:23:02 +0000 (Tue, 20 Nov 2012)
Log Message:
-----------
Standard draft approval/deletion workflows now all work

Modified Paths:
--------------
    trunk/LedgerSMB/App_State.pm
    trunk/LedgerSMB/Report/Unapproved/Drafts.pm
    trunk/LedgerSMB/Scripts/drafts.pm
    trunk/UI/Reports/display_report.html
    trunk/UI/Reports/filters/unapproved.html
    trunk/lsmb-request.pl

Modified: trunk/LedgerSMB/App_State.pm
===================================================================
--- trunk/LedgerSMB/App_State.pm	2012-11-20 04:11:53 UTC (rev 5213)
+++ trunk/LedgerSMB/App_State.pm	2012-11-20 05:23:02 UTC (rev 5214)
@@ -130,7 +130,6 @@
 =cut
 
 sub cleanup {
-
     if ($DBH){
         $DBH->commit;
         $DBH->disconnect;

Modified: trunk/LedgerSMB/Report/Unapproved/Drafts.pm
===================================================================
--- trunk/LedgerSMB/Report/Unapproved/Drafts.pm	2012-11-20 04:11:53 UTC (rev 5213)
+++ trunk/LedgerSMB/Report/Unapproved/Drafts.pm	2012-11-20 05:23:02 UTC (rev 5214)
@@ -199,6 +199,7 @@
     my @rows = $self->exec_method({funcname => 'draft__search'});
     for my $ref (@rows){
         my $script = $self->type;
+        $ref->{row_id} = $ref->{id};
         if ($ref->{invoice}){
             $script = 'is' if $self->type eq 'ar';
             $script = 'ir' if $self->type eq 'ap';

Modified: trunk/LedgerSMB/Scripts/drafts.pm
===================================================================
--- trunk/LedgerSMB/Scripts/drafts.pm	2012-11-20 04:11:53 UTC (rev 5213)
+++ trunk/LedgerSMB/Scripts/drafts.pm	2012-11-20 05:23:02 UTC (rev 5214)
@@ -41,23 +41,15 @@
 =cut
 
 sub search {
-    my ($request) = @_;
-    $request->{class_types} = [
-	{text => $request->{_locale}->text('AR'),  value => 'ar'},
-	{text => $request->{_locale}->text('AP'),  value => 'ap'},
-	{text => $request->{_locale}->text('GL'),  value => 'gl'},
-    ];
-    my $template = LedgerSMB::Template->new(
-        user =>$request->{_user}, 
-        locale => $request->{_locale},
-        path => 'UI',
-        template => 'batch/search_transactions',
-        format => 'HTML'
-    );
-    $template->render($request);
+    use LedgerSMB::Scripts::reports;
+   
+    my $request = shift @_;
+    $request->{search_type} = 'drafts';
+    $request->{report_name} = 'unapproved';
+    LedgerSMB::Scripts::reports::start_report($request);
 }
 
-=item list_drafts_draft_approve
+=item approve
 
 Required hash entries (global):
 
@@ -74,16 +66,16 @@
 =cut
 
 
-sub list_drafts_draft_approve {
+sub approve {
     my ($request) = @_;
     if (!$request->close_form){
         list_drafts($request);
-        $request->finalize_request();
+        return;
     }
     my $draft= LedgerSMB::DBObject::Draft->new(base => $request);
-    for my $row (1 .. $draft->{rowcount}){
-        if ($draft->{"draft_" .$draft->{"row_$row"}}){
-             $draft->{id} = $draft->{"row_$row"};
+    for my $row (1 .. $request->{rowcount_}){
+        if ($draft->{"select_$row"}){
+             $draft->{id} = $draft->{"select_$row"};
              $draft->approve;
         }
     }
@@ -91,7 +83,7 @@
 }
 
 
-=item list_drafts_draft_delete
+=item delete
 
 Required hash entries (global):
 
@@ -107,16 +99,17 @@
 
 =cut
 
-sub list_drafts_draft_delete {
+sub delete {
     my ($request) = @_;
     if (!$request->close_form){
         list_drafts($request);
         $request->finalize_request();
+        return;
     }
     my $draft= LedgerSMB::DBObject::Draft->new(base => $request);
-    for my $row (1 .. $draft->{rowcount}){
-        if ($draft->{"draft_" .$draft->{"row_$row"}}){
-             $draft->{id} = $draft->{"row_$row"};
+    for my $row (1 .. $draft->{rowcount_}){
+        if ($draft->{"select_$row"}){
+             $draft->{id} = $draft->{"select_$row"};
              $draft->delete;
         }
     }
@@ -146,10 +139,13 @@
     my ($request) = @_;
     use LedgerSMB::Report::Unapproved::Drafts;
     my $report = LedgerSMB::Report::Unapproved::Drafts->new(%$request);
+    $request->open_form;
     $report->run_report;
     $report->render($request);
 }
 
+
+
 =back
 
 =head1 COPYRIGHT

Modified: trunk/UI/Reports/display_report.html
===================================================================
--- trunk/UI/Reports/display_report.html	2012-11-20 04:11:53 UTC (rev 5213)
+++ trunk/UI/Reports/display_report.html	2012-11-20 05:23:02 UTC (rev 5214)
@@ -34,6 +34,11 @@
 </div>
 <?lsmb END ?>
 <form method="post" action="<?lsmb ENVARS.SCRIPT_NAME ?>">
+<?lsmb PROCESS input element_data = {
+     name = 'form_id'
+    value = request.form_id
+     type = 'hidden'
+} ?>
 <?lsmb PROCESS dynatable tbody = {rows = rows } 
                attributes = {class = 'report', order_url = order_url } ?>
 

Modified: trunk/UI/Reports/filters/unapproved.html
===================================================================
--- trunk/UI/Reports/filters/unapproved.html	2012-11-20 04:11:53 UTC (rev 5213)
+++ trunk/UI/Reports/filters/unapproved.html	2012-11-20 05:23:02 UTC (rev 5214)
@@ -23,7 +23,7 @@
 
  ?>
 <body>
-<form action="<?lsmb script ?>" method="post">
+<form action="<?lsmb script ?>" method="get">
 <div class="listtop" id="title_div"><?lsmb text('Search Unapproved Transactions') ?></div>
 <div class="input" id="batch_class_div">
 	<?lsmb INCLUDE select element_data = {

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2012-11-20 04:11:53 UTC (rev 5213)
+++ trunk/lsmb-request.pl	2012-11-20 05:23:02 UTC (rev 5214)
@@ -114,7 +114,7 @@
       # when output terminates.  A mere 'die' will no longer trigger an 
       # automatic error, but die 'foo' will map to $request->error('foo')
       # -- CT
-     $LedgerSMB::App_State::DBH->rollback if $LedgerSMB::App_State::DBH;
+     $LedgerSMB::App_State::DBH->rollback if ($LedgerSMB::App_State::DBH and $_ eq 'Died');
      LedgerSMB::App_State->cleanup();
      $request->error($_) unless $_ eq 'Died';
   };

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