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

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



Revision: 2156
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2156&view=rev
Author:   einhverfr
Date:     2008-05-26 11:35:50 -0700 (Mon, 26 May 2008)

Log Message:
-----------
Closing bug 1871072

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/LedgerSMB/GL.pm
    trunk/LedgerSMB/IR.pm

Added Paths:
-----------
    trunk/LedgerSMB/DBObject/Draft.pm

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2008-05-25 18:27:28 UTC (rev 2155)
+++ trunk/LedgerSMB/AA.pm	2008-05-26 18:35:50 UTC (rev 2156)
@@ -371,10 +371,7 @@
         $query = qq| UPDATE $table SET approved = ? WHERE id = ?|;
         $dbh->prepare($query)->execute($form->{approved}, $form->{id}) ||
             $form->dberror($query);
-        if (!$form->{approved}){
-           if (not defined $form->{batch_id}){
-               $form->error($locale->text('Batch ID Missing'));
-           }
+        if (!$form->{approved} && $form->{batch_id}){
            if ($form->{arap} eq 'ar'){
                $batch_class = 'receivable';
            } else {

Added: trunk/LedgerSMB/DBObject/Draft.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Draft.pm	                        (rev 0)
+++ trunk/LedgerSMB/DBObject/Draft.pm	2008-05-26 18:35:50 UTC (rev 2156)
@@ -0,0 +1,27 @@
+package LedgerSMB::DBObject::Draft;
+
+use base qw/LedgerSMB::DBObject/;
+
+sub search {
+    my ($self) = @_;
+    @{$self->{draft_results} = $self->exec_method(funcname => 'draft__search');
+    return @{$self->{draft_results};
+}
+
+sub approve {
+   my ($self) = @_;
+   if (!$self->{id}){
+       $self->error($self->{_locale}->text('No ID Set');
+   }
+   ($self->{approved}) = $self->exec_method(funcname => 'draft_approve');
+   return $self->{approved};
+}
+
+sub delete {
+   my ($self) = @_;
+   if (!$self->{id}){
+       $self->error($self->{_locale}->text('No ID Set');
+   }
+   ($self->{deleted}) = $self->exec_method(funcname => 'draft_delete');
+   return $self->{deleted};
+}

Modified: trunk/LedgerSMB/GL.pm
===================================================================
--- trunk/LedgerSMB/GL.pm	2008-05-25 18:27:28 UTC (rev 2155)
+++ trunk/LedgerSMB/GL.pm	2008-05-26 18:35:50 UTC (rev 2156)
@@ -80,7 +80,7 @@
 
     my $id = $dbh->quote( $form->{id} );
     if ($form->{separate_duties}){
-        $form->approved = '0';
+        $form->{approved} = '0';
     }
     if ( $form->{id} ) {
 
@@ -135,7 +135,7 @@
         my $query = qq| UPDATE gl SET approved = ? WHERE id = ?|;
         $dbh->prepare($query)->execute($form->{approved}, $form->{id}) 
              || $form->dberror($query);
-        if (!$form->{approved}){
+        if (!$form->{approved} and $form->{batch_id}){
            if (not defined $form->{batch_id}){
                $form->error($locale->text('Batch ID Missing'));
            }

Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm	2008-05-25 18:27:28 UTC (rev 2155)
+++ trunk/LedgerSMB/IR.pm	2008-05-26 18:35:50 UTC (rev 2156)
@@ -921,16 +921,16 @@
 
     # delete acc_trans
     $query = qq|DELETE FROM acc_trans WHERE trans_id = ?|;
-    $dbh->prepare($query);
+    $sth = $dbh->prepare($query);
     $sth->execute( $form->{id} ) || $form->dberror($query);
 
     # delete invoice entries
     $query = qq|DELETE FROM invoice WHERE trans_id = ?|;
-    $dbh->prepare($query);
+    $sth = $dbh->prepare($query);
     $sth->execute( $form->{id} ) || $form->dberror($query);
 
     $query = qq|DELETE FROM shipto WHERE trans_id = ?|;
-    $dbh->prepare($query);
+    $sth = $dbh->prepare($query);
     $sth->execute( $form->{id} ) || $form->dberror($query);
 
     $dbh->commit;


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