Merge pull request #1848 from gilmoskowitz/i24559_xtlocks
authorSteve Hackbarth <stephenhackbarth@gmail.com>
Thu, 18 Sep 2014 18:13:46 +0000 (14:13 -0400)
committerSteve Hackbarth <stephenhackbarth@gmail.com>
Thu, 18 Sep 2014 18:13:46 +0000 (14:13 -0400)
issue #24559 - locking with pg 9.3 and web vs qt clients

foundation-database/public/tables/metasql/billingSelections-detail.mql
foundation-database/public/tables/report/BankrecHistory.xml
foundation-database/public/trigger_functions/usrpriv.sql

index 864b03b..66bfe7e 100644 (file)
@@ -1,8 +1,8 @@
 -- Group: billingSelections
 -- Name: detail
 -- Notes: used by dspBillingSelections
--- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
--- See www.xtuple.com/CPAL for the full text of the software license.
+--        Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
+--        See www.xtuple.com/CPAL for the full text of the software license.
 
 SELECT cobmisc_id, cohead_id,
        cohead_number, cust_number, cust_name,
@@ -21,7 +21,7 @@ FROM cobmisc, cohead, custinfo, coitem, cobill
 WHERE ((cobmisc_cohead_id=cohead_id)
    AND (cohead_cust_id=cust_id)
    AND (coitem_cohead_id=cohead_id)
-   AND (cobill_coitem_id=coitem_id)
+   AND (cobill_coitem_id=coitem_id) AND (COALESCE(cobill_invcnum,0) = 0)
    AND (NOT cobmisc_posted))
 GROUP BY cobmisc_id, cohead_id, cohead_number, cust_number,
          cust_name, cobmisc_misc, cobmisc_freight, cobmisc_tax, cobmisc_payment
index 8ffe63e..151a654 100644 (file)
@@ -24,7 +24,7 @@
   <name>head</name>
   <sql>SELECT (bankaccnt_name || '-' || bankaccnt_descrip) AS f_bankaccnt,
        (formatDate(bankrec_opendate) || '-' || formatDate(bankrec_enddate)) AS f_bankrec,
-       bankrec_username AS f_username, formatDate(bankrec_created) AS f_created,
+       bankrec_username AS f_username, formatDate(bankrec_postdate) AS f_postdate,
        formatDate(bankrec_opendate) AS f_opendate,
        formatDate(bankrec_enddate) AS f_enddate,
        formatMoney(bankrec_openbal) AS f_openbal,
    <vcenter/>
    <data>
     <query>head</query>
-    <column>f_created</column>
+    <column>f_postdate</column>
    </data>
   </field>
   <label>
index 7ab0098..b35a826 100644 (file)
@@ -1,4 +1,4 @@
-CREATE OR REPLACE FUNCTION _usrprivTrigger() RETURNS TRIGGER AS $$
+CREATE OR REPLACE FUNCTION _usrprivTrigger() RETURNS TRIGGER AS $$
 -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple. 
 -- See www.xtuple.com/CPAL for the full text of the software license.
 DECLARE
@@ -8,6 +8,13 @@ BEGIN
   -- This looks like a candidate for a foreign key but isn't.
   -- fkeys don't work if the foreign key value resides in a child of the 
   -- table and not the table itself.
+  IF (NOT EXISTS(SELECT usrpriv_id 
+                 FROM usrpriv, priv  
+                 WHERE ((usrpriv_priv_id=priv_id) AND (priv_name ='MaintainUsers')
+                        AND (usrpriv_username=geteffectivextuser())))) THEN
+    RAISE EXCEPTION 'User have no privileges to modify user privileges.';
+  END IF;                
+
   IF ((TG_OP = 'UPDATE' OR TG_OP = 'INSERT') AND
       (NOT EXISTS(SELECT priv_id
                   FROM priv