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

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



Revision: 3588
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3588&view=rev
Author:   einhverfr
Date:     2011-07-29 07:08:55 +0000 (Fri, 29 Jul 2011)

Log Message:
-----------
Workflow fixes to drafts interface
Removing dependencies on customer/vendor views
Correcting issue to journal entry AJAX controls

Modified Paths:
--------------
    trunk/LedgerSMB/BP.pm
    trunk/LedgerSMB/OE.pm
    trunk/LedgerSMB/PE.pm
    trunk/bin/aa.pl
    trunk/sql/modules/chart.sql

Modified: trunk/LedgerSMB/BP.pm
===================================================================
--- trunk/LedgerSMB/BP.pm	2011-07-28 21:43:49 UTC (rev 3587)
+++ trunk/LedgerSMB/BP.pm	2011-07-29 07:08:55 UTC (rev 3588)
@@ -65,10 +65,10 @@
         $query = qq|
 			SELECT count(*)
 			  FROM (SELECT DISTINCT vc.id
-				  FROM $form->{vc} vc, $item a, status s
-				 WHERE a.entity_id = vc.entity_id
-			               AND s.trans_id = a.id
-			               AND s.formname = ?
+				  FROM entity_credit_account vc
+                                  JOIN $item a ON a.entity_credit_account = vc.id
+                                  JOIN status s ON s.trans_id = a.id
+				 WHERE s.formname = ?
 			               AND s.spoolfile IS NOT NULL) AS total|;
 
         $sth = $dbh->prepare($query);
@@ -87,10 +87,11 @@
         foreach $item ( @{ $arap{ $form->{type} } } ) {
             $query .= qq| 
 				$union
-				SELECT DISTINCT vc.id, vc.name
+				SELECT DISTINCT eca.id, e.name
 				  FROM $item a
-				  JOIN $form->{vc} vc 
-				       USING (entity_id)
+				  JOIN entity_credit_account eca
+                                       ON a.entity_credit_account = eca.id 
+                                  JOIN entity e ON eca.entity_id = e.id
 				  JOIN status s ON (s.trans_id = a.id)
 				 WHERE s.formname = ?
 				       AND s.spoolfile IS NOT NULL|;
@@ -202,12 +203,13 @@
 				SELECT a.id, c.legal_name AS name, a.$invnumber AS invnumber, a.transdate,
 				       a.ordnumber, a.quonumber, $invoice AS invoice,
 				       '$item' AS module, s.spoolfile
-				  FROM $item a, $form->{vc} vc, status s, company c
-				 WHERE s.trans_id = a.id
-				       AND s.spoolfile IS NOT NULL
-				       AND s.formname = ?
-				       AND c.entity_id = vc.entity_id
-				       AND a.entity_id = vc.entity_id|;
+				  FROM $item a, 
+                                  JOIN entity_credit_account vc
+                                       ON vc.id = a.entity_credit_account
+                                  JOIN status s ON s.trans_id = a.id
+                                  JOIN company c ON c.entity_id = vc.entity_id
+				 WHERE s.spoolfile IS NOT NULL
+				       AND s.formname = ?|;
 
             push( @queryargs, $form->{type} );
             if ( $form->{"$form->{vc}_id"} ) {

Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm	2011-07-28 21:43:49 UTC (rev 3587)
+++ trunk/LedgerSMB/OE.pm	2011-07-29 07:08:55 UTC (rev 3588)
@@ -132,7 +132,9 @@
 				o.shipvia, ee.name AS employee, o.curr, 
 				o.ponumber
 			FROM oe o
-			JOIN $form->{vc} ct ON (o.$form->{vc}_id = ct.id)
+			JOIN entity_credit_account eca  
+                             ON (o.entity_credit_account = eca.id)
+                        JOIN company ct ON eca.entity_id = ct.entity_id
 			JOIN orderitems oi ON (oi.trans_id = o.id)
 			JOIN parts p ON (p.id = oi.parts_id)|;
 

Modified: trunk/LedgerSMB/PE.pm
===================================================================
--- trunk/LedgerSMB/PE.pm	2011-07-28 21:43:49 UTC (rev 3587)
+++ trunk/LedgerSMB/PE.pm	2011-07-29 07:08:55 UTC (rev 3588)
@@ -1828,18 +1828,20 @@
 
     my $query;
     my $ref;
-
+# XXX Note that this is aimed at current customer functionality only.  In the 
+# future, this will be more generaly constructed.
     $query = qq|
 		   SELECT j.id, j.description, j.qty - j.allocated AS qty,
-		          j.sellprice, j.parts_id, pr.$form->{vc}_id, 
+		          j.sellprice, j.parts_id, pr.customer_id, 
 		          j.project_id, j.checkedin::date AS transdate, 
-		          j.notes, c.name AS $form->{vc}, pr.projectnumber, 
+		          j.notes, c.name AS customer, pr.projectnumber, 
 		          p.partnumber
 		     FROM jcitems j
 		     JOIN project pr ON (pr.id = j.project_id)
 		     JOIN employee e ON (e.id = j.employee_id)
 		     JOIN parts p ON (p.id = j.parts_id)
-		LEFT JOIN $form->{vc} c ON (c.id = pr.$form->{vc}_id)
+		LEFT JOIN entity_credit_account eca ON (c.id = pr.customer_id)
+                LEFT JOIN company c ON eca.entity_id = c.entity_id
 		    WHERE pr.parts_id IS NULL
 		          AND j.allocated != j.qty $where
 		 ORDER BY pr.projectnumber, c.name, j.checkedin::date|;

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2011-07-28 21:43:49 UTC (rev 3587)
+++ trunk/bin/aa.pl	2011-07-29 07:08:55 UTC (rev 3588)
@@ -995,7 +995,9 @@
             'new_screen' => # Create a blank ar/ap invoice.
              { ndx => 10, key=> 'N', value => $locale->text('New') }
         );
+        my $is_draft = 0;
         if (!$form->{approved} && !$form->{batch_id}){
+           $is_draft = 1;
            $button{approve} = { 
                    ndx   => 3, 
                    key   => 'O', 
@@ -1049,9 +1051,10 @@
             }
         }
         if ($form->{id}){
-            for ( "update", "post_as_new", "print_and_post_as_new"){
+            for ( "post_as_new", "print_and_post_as_new"){
                delete $button{$_};
             }
+            delete $button{'update'} unless $is_draft;
         }
 
         for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button )

Modified: trunk/sql/modules/chart.sql
===================================================================
--- trunk/sql/modules/chart.sql	2011-07-28 21:43:49 UTC (rev 3587)
+++ trunk/sql/modules/chart.sql	2011-07-29 07:08:55 UTC (rev 3588)
@@ -127,7 +127,7 @@
 		SELECT * FROM account 
                  WHERE (accno ~* ('^'||in_search) 
                        OR description ~* ('^'||in_search))
-                       AND (link_desc IS NULL 
+                       AND (in_link_desc IS NULL 
                            or id in 
                           (select account_id from account_link 
                             where description = in_link_desc))


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