[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4411] trunk
- Subject: SF.net SVN: ledger-smb:[4411] trunk
- From: ..hidden..
- Date: Thu, 08 Mar 2012 09:25:21 +0000
Revision: 4411
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4411&view=rev
Author: einhverfr
Date: 2012-03-08 09:25:20 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
More Business Unit fixes
Also fixes for changing customer/vendortax to eca_tax
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/sql/modules/Business_Unit.sql
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2012-03-08 08:27:56 UTC (rev 4410)
+++ trunk/LedgerSMB/AA.pm 2012-03-08 09:25:20 UTC (rev 4411)
@@ -1415,9 +1415,9 @@
# get taxes
$query = qq|
SELECT c.accno
- FROM chart c
- JOIN $form->{vc}tax ct ON (ct.chart_id = c.id)
- WHERE c.charttype = 'A' AND ct.$form->{vc}_id = ?|;
+ FROM account c
+ JOIN eca_tax ct ON (ct.chart_id = c.id)
+ WHERE ct.eca_id = ?|;
$sth = $dbh->prepare($query);
$sth->execute( $form->{"$form->{vc}_id"} ) || $form->dberror($query);
Modified: trunk/sql/modules/Business_Unit.sql
===================================================================
--- trunk/sql/modules/Business_Unit.sql 2012-03-08 08:27:56 UTC (rev 4410)
+++ trunk/sql/modules/Business_Unit.sql 2012-03-08 09:25:20 UTC (rev 4411)
@@ -1,16 +1,22 @@
BEGIN;
-CREATE OR REPLACE FUNCTION business_unit__list_classes(in_active bool)
+CREATE OR REPLACE FUNCTION business_unit__list_classes(in_active bool, in_module text)
RETURNS SETOF business_unit_class AS
$$
-SELECT * FROM business_unit_class
- WHERE active = $1 OR $1 IS NULL
+SELECT bc.*
+ FROM business_unit_class bc
+ WHERE (active = $1 OR $1 IS NULL)
+ AND (id IN (select bu_class_id
+ FROM bu_class_to_module bcm
+ JOIN lsmb_module mod ON mod.id = bcm.module_id
+ WHERE lower(label) = lower($2))
+ OR $2 is null)
ORDER BY ordering;
$$ LANGUAGE SQL;
-COMMENT ON FUNCTION business_unit__list_classes(in_active bool) IS
+COMMENT ON FUNCTION business_unit__list_classes(in_active bool, in_module text) IS
$$ This function lists all business unit clases. If in_active is true, then
only active classes are listed. If it is false then only inactive classes are
listed. If it is null, then all classes are listed.$$;
@@ -26,8 +32,9 @@
$$
BEGIN
RETURN QUERY SELECT * FROM business_unit
- WHERE (in_active_on BETWEEN start_date AND end_date OR
- in_active_on IS NULL)
+ WHERE (in_active_on BETWEEN coalesce(start_date, in_active_on)
+ AND coalesce(end_date, in_active_on)
+ OR in_active_on IS NULL)
AND (in_credit_id = credit_id
OR (credit_id IS NULL and in_strict_credit IS NOT TRUE)
OR (in_credit_id IS NULL))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.