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

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



Revision: 3715
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3715&view=rev
Author:   einhverfr
Date:     2011-09-19 21:26:22 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
Merging voucher saving fixes to trunk

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/LedgerSMB/Sysconfig.pm
    trunk/bin/aa.pl
    trunk/common.pl
    trunk/sql/Pg-database.sql

Removed Paths:
-------------
    trunk/SNAPSHOT_SVNREV

Property Changed:
----------------
    trunk/


Property changes on: trunk
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/1.3:3711-3714

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2011-09-19 21:23:53 UTC (rev 3714)
+++ trunk/LedgerSMB/AA.pm	2011-09-19 21:26:22 UTC (rev 3715)
@@ -294,9 +294,14 @@
 			SELECT id
 			  FROM $table
 			 WHERE id = $id|;
+        my ($exists) = $dbh->selectrow_array($query);
+        if ($exists and $form->{batch_id}) {
+           $query = "SELECT voucher__delete(id) 
+                       FROM voucher 
+                      where trans_id = ? and batch_class in (1, 2)";
+           $dbh->prepare($query)->execute($form->{id}) || $form->dberror($query);           
+        } elsif ($exists) {
 
-        if ( $dbh->selectrow_array($query) ) {
-
            # delete detail records
 
 	    $dbh->do($query) || $form->dberror($query);
@@ -307,21 +312,16 @@
 				              WHERE trans_id = $id)|;
 
             $dbh->do($query) || $form->dberror($query);
-            $query = qq|
-				DELETE FROM voucher
-                                       WHERE trans_id = $id 
-                                             and batch_class in (1,2)|;
 
-            $dbh->do($query) || $form->dberror($query);
-
             $query = qq|
 				DELETE FROM acc_trans
 				 WHERE trans_id = $id|;
 
             $dbh->do($query) || $form->dberror($query);
+            $dbh->do("DELETE FROM $table where id = $id");
         }
+
     }
-    else {
 
         my $uid = localtime;
         $uid .= "$$";
@@ -332,7 +332,7 @@
         # are using the current username as the "person" inserting the new 
         # AR/AP Transaction.
         # ~A
-        $query = qq|
+    $query = qq|
 			INSERT INTO $table (invnumber, person_id, 
 				entity_credit_account)
 			     VALUES (?,    (select  u.entity_id from users u
@@ -343,14 +343,13 @@
         # attributes to pass to $dbh->prepare. This is not used here.
         # ~A
         
-        $dbh->do($query,undef,$uid,$form->{login}, $form->{"$form->{vc}_id"}) || $form->dberror($query);
+    $dbh->do($query,undef,$uid,$form->{login}, $form->{"$form->{vc}_id"}) || $form->dberror($query);
 
-        $query = qq|
+    $query = qq|
 			SELECT id FROM $table
 			 WHERE invnumber = ?|;
 
-        ( $form->{id} ) = $dbh->selectrow_array($query,undef,$uid);
-    }
+    ( $form->{id} ) = $dbh->selectrow_array($query,undef,$uid);
 
     # record last payment date in ar/ap table
     $form->{datepaid} = $form->{transdate} unless $form->{datepaid};

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2011-09-19 21:23:53 UTC (rev 3714)
+++ trunk/LedgerSMB/Sysconfig.pm	2011-09-19 21:26:22 UTC (rev 3715)
@@ -26,11 +26,18 @@
 our @io_lineitem_columns = qw(unit onhand sellprice discount linetotal);
 
 # Whitelist for redirect destination
+#
+our @newscripts = qw(
+     account.pl  customer.pl  inventory.pl  payment.pl  user.pl
+admin.pl    drafts.pl    journal.pl    recon.pl    vendor.pl
+asset.pl    employee.pl  login.pl      setup.pl    vouchers.pl
+file.pl      menu.pl       taxform.pl);
+
 our @scripts = (
-    'aa.pl', 'admin.pl', 'am.pl',      'ap.pl',
+    'aa.pl', 'am.pl',      'ap.pl',
     'ar.pl', 'arap.pl',  'arapprn.pl', 'bp.pl',
     'ca.pl', 'gl.pl',
-    'ic.pl',    'io.pl',      'ir.pl',
+    'ic.pl',  'ir.pl',
     'is.pl', 'jc.pl',    'login.pl',   'menu.pl',
     'oe.pl', 'pe.pl',    'pos.pl',     'ps.pl',
     'pw.pl', 'rc.pl',    'rp.pl', 	'initiate.pl'

Deleted: trunk/SNAPSHOT_SVNREV
===================================================================
--- trunk/SNAPSHOT_SVNREV	2011-09-19 21:23:53 UTC (rev 3714)
+++ trunk/SNAPSHOT_SVNREV	2011-09-19 21:26:22 UTC (rev 3715)
@@ -1,3 +0,0 @@
-Snapshot 20110716 has revision 3544
-Snapshot 20110731 has revision 3609
-Snapshot 20110803 has revision 3625

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2011-09-19 21:23:53 UTC (rev 3714)
+++ trunk/bin/aa.pl	2011-09-19 21:26:22 UTC (rev 3715)
@@ -1355,17 +1355,12 @@
            &{"print_$form->{formname}"}( $old_form, 1 );
         }
 
-        if(defined($form->{batch_id}) and $form->{batch_id})
+        if(defined($form->{batch_id}) and $form->{batch_id} 
+           and ($form->{callback} !~ /vouchers/))
 	{
         	$form->{callback}.= qq|&batch_id=$form->{batch_id}|;
 	}
 
-
-        if(defined($form->{batch_id}) and $form->{batch_id})
-	{
-        	$form->{callback}.= qq|&batch_id=$form->{batch_id}|;
-	}
-
         $form->redirect( $locale->text('Transaction posted!') );
     }
     else {

Modified: trunk/common.pl
===================================================================
--- trunk/common.pl	2011-09-19 21:23:53 UTC (rev 3714)
+++ trunk/common.pl	2011-09-19 21:26:22 UTC (rev 3715)
@@ -36,7 +36,11 @@
         print "Content-type: text/html\n\n";
         exit;
     }
-
+    if (first { $_ eq $script } @{LedgerSMB::Sysconfig::newscripts}){
+        print "Location: $form->{callback}\n";
+        print "Content-type: text/html\n\n";
+        exit;
+    }
     $form->error(
         $locale->text(
             __FILE__ . ':' . __LINE__ . ':' . $script . ':' . "Invalid Redirect"

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2011-09-19 21:23:53 UTC (rev 3714)
+++ trunk/sql/Pg-database.sql	2011-09-19 21:26:22 UTC (rev 3715)
@@ -967,7 +967,7 @@
 sonumber|1
 yearend|1
 businessnumber|1
-version|1.2.99
+version|1.3.0
 closedto|\N
 revtrans|1
 ponumber|1

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