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

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



Revision: 3768
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3768&view=rev
Author:   einhverfr
Date:     2011-09-28 03:56:10 +0000 (Wed, 28 Sep 2011)
Log Message:
-----------
Merging from branches/1.3

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

Added Paths:
-----------
    trunk/sql/upgrade/3764-control_code_index.sql

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


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-3760
   + /branches/1.3:3711-3767

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2011-09-28 03:54:24 UTC (rev 3767)
+++ trunk/LedgerSMB/AA.pm	2011-09-28 03:56:10 UTC (rev 3768)
@@ -896,7 +896,7 @@
                                 * CASE WHEN '$table' = 'ar' THEN -1 ELSE 1 END)
                           AS paid,
 		          vce.name, vc.meta_number,
-		          a.entity_id, 
+		          a.entity_credit_account, 
 		          d.description AS department
 		     FROM $table a
 		     JOIN entity_credit_account vc ON (a.entity_credit_account = vc.id)
@@ -914,7 +914,7 @@
 			AND a.approved IS TRUE AND acs.approved IS TRUE
 			AND a.force_closed IS NOT TRUE
 		 GROUP BY 
-		          vc.meta_number, a.entity_id, vce.name, 
+		          vc.meta_number, a.entity_credit_account, vce.name, 
                           d.description --,
 		          --a.ponumber, a.invoice 
 		   HAVING abs(sum(acs.amount::numeric(20,2))) > 0.000 |;
@@ -929,7 +929,7 @@
 		          a.invoice, a.datepaid, a.terms, a.notes,
 		          a.shipvia, a.shippingpoint, 
 		          vce.name, vc.meta_number,
-		          a.entity_id, a.till, 
+		          a.entity_credit_account, a.till, 
 		          ex.$buysell AS exchangerate, 
 		          d.description AS department, 
 		          as_array(p.projectnumber) as ac_projects,
@@ -952,7 +952,7 @@
 			AND a.force_closed IS NOT TRUE
 		 GROUP BY a.id, a.invnumber, a.ordnumber, a.transdate, a.duedate, a.netamount,
 		          a.amount, a.terms, a.notes, a.shipvia, a.shippingpoint, vce.name,
-		          vc.meta_number, a.entity_id, a.till, ex.$buysell, d.description, vce.name,
+		          vc.meta_number, a.entity_credit_account, a.till, ex.$buysell, d.description, vce.name,
 		          a.ponumber, a.invoice, a.datepaid $acc_trans_fields
 		   HAVING abs(sum(acs.amount::numeric(20,$p))) > 0 |;
        } 
@@ -1457,10 +1457,10 @@
 			     FROM chart c
 			     JOIN acc_trans ac ON (ac.chart_id = c.id)
 			     JOIN $arap a ON (a.id = ac.trans_id)
-			    WHERE c.charttype = 'A' AND a.entity_id = ?
+			    WHERE c.charttype = 'A' AND a.entity_credit_account = ?
 			          AND a.id = (SELECT max(id) 
 			                         FROM $arap
-			                        WHERE entity_id = 
+			                        WHERE entity_credit_account = 
 			                              ?)
 			|;
 

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2011-09-28 03:54:24 UTC (rev 3767)
+++ trunk/bin/aa.pl	2011-09-28 03:56:10 UTC (rev 3768)
@@ -97,7 +97,7 @@
 
 sub new_screen {
     use LedgerSMB::Form;
-    my @reqprops = qw(ARAP vc dbh stylesheet);
+    my @reqprops = qw(ARAP vc dbh stylesheet batch_id);
     $oldform = $form;
     $form = {};
     bless $form, Form;

Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl	2011-09-28 03:54:24 UTC (rev 3767)
+++ trunk/bin/gl.pl	2011-09-28 03:56:10 UTC (rev 3768)
@@ -138,6 +138,19 @@
     &add;
 }
 
+sub new {
+     for my $row (1 .. $form->{rowcount}){
+         for my $fld(qw(accno projectnumber acc debit credit source memo)){
+            delete $form->{"${fld}_${row}"};
+         }
+     }
+     delete $form->{description};
+     delete $form->{reference};
+     delete $form->{rowcount};
+     delete $form->{id};
+     add();
+}
+
 sub add {
 
     $form->{title} = "Add";
@@ -257,6 +270,8 @@
 		    { ndx => 7, key => 'H', value => $locale->text('Schedule') },
 		  'delete' =>
 		    { ndx => 8, key => 'D', value => $locale->text('Delete') },
+                  'new' => 
+                    { ndx => 9, key => 'N', value => $locale->text('New') },
 	      );
 
 	      if ($form->{separate_duties}){            
@@ -264,9 +279,15 @@
 		  $button{post}->{value} = $locale->text('Save'); 
 	      }
 	      %a = ();
+              if ($form->{id}){
+                 $a{'new'} = 1;
+                 
+              } else {
+                 $a{'update'} = 1;
+              }
 	      if ( $form->{id} && ($form->{approved} || !$form->{batch_id})) {
 
-		  for ( 'update', 'post_as_new', 'schedule' ) { $a{$_} = 1 }
+		  for ( 'post_as_new', 'schedule' ) { $a{$_} = 1 }
 
 		  if ( !$form->{locked} ) {
 		      if ( $transdate > $closedto ) {
@@ -280,7 +301,6 @@
 		      for ( "post", "schedule" ) { $a{$_} = 1 }
 		  }
 	      }
-              $a{update} = 1;
 
 	      if (!$form->{approved} && !$form->{batch_id}){
 		$button{approve} = { 
@@ -1124,7 +1144,7 @@
     }
 
     if ( GL->post_transaction( \%myconfig, \%$form, $locale) ) {
-        $form->redirect( $locale->text('Transaction posted!') );
+        edit();
     }
     else {
         $form->error( $locale->text('Cannot post transaction!') );

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2011-09-28 03:54:24 UTC (rev 3767)
+++ trunk/sql/Pg-database.sql	2011-09-28 03:56:10 UTC (rev 3768)
@@ -431,7 +431,7 @@
   name text check (name ~ '[[:alnum:]_]'),
   entity_class integer references entity_class(id) not null ,
   created date not null default current_date,
-  control_code text,
+  control_code text unique,
   country_id int references country(id) not null,
   PRIMARY KEY(control_code, entity_class));
   

Copied: trunk/sql/upgrade/3764-control_code_index.sql (from rev 3767, branches/1.3/sql/upgrade/3764-control_code_index.sql)
===================================================================
--- trunk/sql/upgrade/3764-control_code_index.sql	                        (rev 0)
+++ trunk/sql/upgrade/3764-control_code_index.sql	2011-09-28 03:56:10 UTC (rev 3768)
@@ -0,0 +1 @@
+ALTER TABLE entity ADD UNIQUE (control_code);

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