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

SF.net SVN: ledger-smb:[6736] branches/1.3



Revision: 6736
          http://sourceforge.net/p/ledger-smb/code/6736
Author:   einhverfr
Date:     2014-02-04 05:08:38 +0000 (Tue, 04 Feb 2014)
Log Message:
-----------
Locking and unlocking of batches confirmed for 1.3

Modified Paths:
--------------
    branches/1.3/LedgerSMB/Batch.pm
    branches/1.3/scripts/vouchers.pl
    branches/1.3/sql/modules/Voucher.sql

Modified: branches/1.3/LedgerSMB/Batch.pm
===================================================================
--- branches/1.3/LedgerSMB/Batch.pm	2014-02-04 04:49:48 UTC (rev 6735)
+++ branches/1.3/LedgerSMB/Batch.pm	2014-02-04 05:08:38 UTC (rev 6736)
@@ -65,7 +65,7 @@
 
 sub unlock{
     my ($self, $id) = @_;
-    $self->call_procedure(procname => 'batch__unlick', args => [$id]);
+    $self->call_procedure(procname => 'batch__unlock', args => [$id]);
 }
 
 =item get_search_criteria

Modified: branches/1.3/scripts/vouchers.pl
===================================================================
--- branches/1.3/scripts/vouchers.pl	2014-02-04 04:49:48 UTC (rev 6735)
+++ branches/1.3/scripts/vouchers.pl	2014-02-04 05:08:38 UTC (rev 6736)
@@ -204,6 +204,29 @@
     $template->render($batch_request);
 }
 
+=item batch_unlock
+
+Unlocks selected batches 
+
+=cut
+
+sub batch_unlock {
+    my ($request) = @_;
+    my $batch = LedgerSMB::Batch->new(base => $request);
+    if ($request->{batch_id}){
+       $batch->unlock($request->{batch_id});
+    } else {
+        for my $count (1 .. $batch->{rowcount}){
+            next unless $batch->{"batch_" . $batch->{"row_$count"}};
+            $batch->unlock($request->{"row_$count"});
+        }
+    }
+    $request->{report_name} = 'unapproved'; 
+    $request->{search_type} = 'batches';
+    $request->{dbh}->commit;
+    search_batch($request);
+}
+
 =item list_batches
 
 This function displays the search results.
@@ -332,6 +355,12 @@
                     text  => $request->{_locale}->text('Delete'),
                     value => 'batch_delete',
                     class => 'submit',
+                 },{
+                    name  => 'action',
+                    type  => 'submit',
+                    text  => $request->{_locale}->text('Unlock'),
+                    value => 'batch_unlock',
+                    class => 'submit',
                 }];
     }
        # save form_id into the DB before sending the form.
@@ -489,6 +518,10 @@
     batch_approve(@_);
 }
 
+sub list_batches_batch_unlock {
+    batch_unlock(@_);
+}
+
 =item get_batch_batch_approve
 
 Approves the single batch on the details screen.  Batch_id must be set.,

Modified: branches/1.3/sql/modules/Voucher.sql
===================================================================
--- branches/1.3/sql/modules/Voucher.sql	2014-02-04 04:49:48 UTC (rev 6735)
+++ branches/1.3/sql/modules/Voucher.sql	2014-02-04 05:08:38 UTC (rev 6736)
@@ -159,7 +159,7 @@
 UPDATE batch SET locked_by = NULL
  WHERE id = $1 AND locked_by IN (select session_id 
                                    from "session" s
-                                   join users u on (u.id = s.user_id)
+                                   join users u on (u.id = s.users_id)
                                   where username = SESSION_USER);
  
 RETURN FOUND;

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


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits