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

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



Revision: 1942
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1942&view=rev
Author:   einhverfr
Date:     2007-12-04 14:13:25 -0800 (Tue, 04 Dec 2007)

Log Message:
-----------
More Roles fixes

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject.pm
    trunk/UI/payments/payments_filter.html
    trunk/sql/modules/Payment.sql
    trunk/sql/modules/Roles.sql
    trunk/sql/modules/chart.sql

Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm	2007-12-04 21:42:16 UTC (rev 1941)
+++ trunk/LedgerSMB/DBObject.pm	2007-12-04 22:13:25 UTC (rev 1942)
@@ -242,7 +242,7 @@
     my @return_array;
 
     while ($value ne '{}') {
-        my $next = "";
+        my $next;
         my $separator = "";
         if ($value =~ /^\{"/){
             while ($next eq "" or ($next =~ /\\".$/)){
@@ -250,17 +250,19 @@
                 $next .= $1;
                 $next =~ /(.)$/;
                 $separator = $1;
+               $next .= "quoted";
             }
             $next =~ s/"(.*)"$separator$/$1/;
 
-        } elsif ($value =~ /^{({+})/){
+        } elsif ($value =~ /^{({+)/){
             my $open_braces = $1;
             my $close_braces = $open_braces;
             $close_braces =~ s/{/}/g;
-            $value =~ /^{($open_braces.*$close_braces)/;
-            $next = $1;
-            $value =~ s/^{$next/{/;
-            $next = $self->parse_array($next);
+            $value =~ /^{($open_braces[^}]*$close_braces)/;
+            my $parse_next = $1;
+            $value =~ s/^{$parse_next/{/;
+           $value =~ s/^{,/{/;
+            @$next = $self->_parse_array($parse_next);
             
         } else {
             $value =~ s/^\{([^,]*)(,|\})/\{/;

Modified: trunk/UI/payments/payments_filter.html
===================================================================
--- trunk/UI/payments/payments_filter.html	2007-12-04 21:42:16 UTC (rev 1941)
+++ trunk/UI/payments/payments_filter.html	2007-12-04 22:13:25 UTC (rev 1942)
@@ -24,6 +24,11 @@
 	type = "hidden"
 	name = "account_class"
 } ?>
+<?lsmb INCLUDE input element_data={
+	value = batch_id
+	type = "hidden"
+	name = "batch_id"
+} ?>
 <div id = "payments-filter-categories" class="inputgroup">
 <?lsmb IF projects ?>
 <div id = "payments-filter-projects" class="input">

Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql	2007-12-04 21:42:16 UTC (rev 1941)
+++ trunk/sql/modules/Payment.sql	2007-12-04 22:13:25 UTC (rev 1942)
@@ -130,7 +130,7 @@
 		         sum(a.amount - a.paid) AS total_due, 
 		         compound_array(ARRAY[[
 		              a.id::text, a.invnumber, a.transdate::text, 
-		              a.amount::text, 
+		              a.amount::text, a.paid::text,
 		              (CASE WHEN c.discount_terms 
 		                        > extract('days' FROM age(a.transdate))
 		                   THEN 0
@@ -148,12 +148,15 @@
 		    FROM entity e
 		    JOIN entity_credit_account c ON (e.id = c.entity_id)
 		    JOIN (SELECT id, invnumber, transdate, amount, entity_id, 
-		                 paid, curr, 1 as invoice_class 
+		                 paid, curr, 1 as invoice_class, 
+		                 entity_credit_account 
 		            FROM ap
 		           UNION
 		          SELECT id, invnumber, transdate, amount, entity_id,
-		                 paid, curr, 2 as invoice_class
+		                 paid, curr, 2 as invoice_class, 
+		                 entity_credit_account
 		            FROM ar
+			ORDER BY transdate
 		         ) a USING (entity_id)
 		    JOIN transactions t ON (a.id = t.id)
 		   WHERE a.invoice_class = in_account_class
@@ -163,6 +166,7 @@
 		                          WHERE batch_id = in_batch_id))
 		         AND c.entity_class = in_account_class
 		         AND a.curr = in_currency
+		         AND a.entity_credit_account = c.id
 		         AND a.amount - a.paid <> 0
 			 AND t.locked_by NOT IN 
 				(select "session_id" FROM "session"

Modified: trunk/sql/modules/Roles.sql
===================================================================
--- trunk/sql/modules/Roles.sql	2007-12-04 21:42:16 UTC (rev 1941)
+++ trunk/sql/modules/Roles.sql	2007-12-04 22:13:25 UTC (rev 1942)
@@ -1385,4 +1385,6 @@
  GRANT SELECT ON parts, partsgroup TO public;
  GRANT SELECT ON language, project TO public;
 GRANT SELECT ON business, exchangerate, department, shipto, tax TO public;
+GRANT ALL ON recurring, recurringemail, recurringprint TO public; 
+--TODO, lock recurring down more
 

Modified: trunk/sql/modules/chart.sql
===================================================================
--- trunk/sql/modules/chart.sql	2007-12-04 21:42:16 UTC (rev 1941)
+++ trunk/sql/modules/chart.sql	2007-12-04 22:13:25 UTC (rev 1942)
@@ -21,3 +21,25 @@
 $$ language plpgsql;
 COMMENT ON FUNCTION chart_list_cash(in_account_class int) IS
 $$ This function returns the cash account acording with in_account_class which must be 1 or 2 $$;
+
+CREATE OR REPLACE FUNCTION chart_get_ar_ap(in_account_class int)
+RETURNS SETOF chart AS
+$$
+DECLARE out_row chart%ROWTYPE;
+BEGIN
+	IF in_account_class NOT IN (1, 2) THEN
+		RAISE EXCEPTION 'Bad Account Type';
+	END IF;
+       FOR out_row IN
+               SELECT * FROM chart 
+               WHERE link = CASE WHEN in_account_class = 1 THEN 'AP'
+                               WHEN in_account_class = 2 THEN 'AR'
+                               END
+       LOOP
+               RETURN NEXT out_row;
+       END LOOP;
+END;
+$$ LANGUAGE PLPGSQL;
+COMMENT ON FUNCTION chart_get_ar_ap(in_account_class int) IS
+$$ This function returns the cash account acording with in_account_class which must be 1 or 2 $$;
+


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