svn commit: r606625 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r606625 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java

jleroux@apache.org
Author: jleroux
Date: Sun Dec 23 14:03:06 2007
New Revision: 606625

URL: http://svn.apache.org/viewvc?rev=606625&view=rev
Log:
Run GiftCertificateServices.createTransaction as system user to allow creation of a financial account transaction ( "ACCTG_ATX_CREATE" permission as admin ) see https://issues.apache.org/jira/browse/OFBIZ-1532  - OFBIZ-1532

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java?rev=606625&r1=606624&r2=606625&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java Sun Dec 23 14:03:06 2007
@@ -124,8 +124,11 @@
             }
             
             // create the initial (deposit) transaction
-            refNum = GiftCertificateServices.createTransaction(delegator, dispatcher, userLogin, initialAmount,
-                    productStoreId, partyId, currencyUom, deposit, finAccountId);
+            // do something tricky here: run as the "system" user
+            // that can actually create a financial account transaction
+            GenericValue permUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system"));
+            refNum = createTransaction(delegator, dispatcher, permUserLogin, initialAmount,
+                                    productStoreId, partyId, currencyUom, deposit, finAccountId);
 
         } catch (GenericEntityException e) {
             Debug.logError(e, module);