You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2015/01/05 09:50:36 UTC
svn commit: r1649482 [3/26] - in
/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./
applications/accounting/src/org/ofbiz/accounting/invoice/
applications/accounting/src/org/ofbiz/accounting/payment/
applications/accounting/src/org/ofbiz/acc...
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy Mon Jan 5 08:50:30 2015
@@ -43,7 +43,7 @@ if (!glFiscalTypeId) {
}
// Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period
-Map lastClosedTimePeriodResult = dispatcher.runSync("findLastClosedDate", UtilMisc.toMap("organizationPartyId", organizationPartyId, "findDate", new Date(fromDate.getTime()),"userLogin", userLogin));
+Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": organizationPartyId, "findDate": new Date(fromDate.getTime()),"userLogin": userLogin]);
Timestamp lastClosedDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
GenericValue lastClosedTimePeriod = null;
if (lastClosedDate) {
@@ -61,24 +61,19 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List postedTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List postedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
if (postedTransactionTotals) {
Map postedTransactionTotalsMap = [:]
postedTransactionTotals.each { postedTransactionTotal ->
Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId);
if (!accountMap) {
- GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", postedTransactionTotal.glAccountId), true);
+ GenericValue glAccount = from("GlAccount").where("glAccountId", postedTransactionTotal.glAccountId).cache(true).queryOne();
if (glAccount) {
boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
// Get the opening balances at the end of the last closed time period
if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
if (lastClosedTimePeriod) {
- List timePeriodAndExprs = FastList.newInstance();
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, postedTransactionTotal.glAccountId));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+ lastTimePeriodHistory = from("GlAccountAndHistory").where("organizationPartyId", organizationPartyId, "glAccountId", postedTransactionTotal.glAccountId, "customTimePeriodId", lastClosedTimePeriod.customTimePeriodId).queryFirst();
if (lastTimePeriodHistory) {
accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
}
@@ -102,7 +97,7 @@ if (postedTransactionTotals) {
mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
- transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+ transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
transactionTotals.each { transactionTotal ->
UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
}
@@ -120,8 +115,7 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List postedDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List postedDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
if (postedDebitTransactionTotals) {
postedDebitTransactionTotal = postedDebitTransactionTotals.first();
if (postedDebitTransactionTotal && postedDebitTransactionTotal.amount) {
@@ -136,8 +130,7 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List postedCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List postedCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
if (postedCreditTransactionTotals) {
postedCreditTransactionTotal = postedCreditTransactionTotals.first();
if (postedCreditTransactionTotal && postedCreditTransactionTotal.amount) {
@@ -159,23 +152,19 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List unpostedTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List unpostedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
if (unpostedTransactionTotals) {
Map unpostedTransactionTotalsMap = [:]
unpostedTransactionTotals.each { unpostedTransactionTotal ->
Map accountMap = (Map)unpostedTransactionTotalsMap.get(unpostedTransactionTotal.glAccountId);
if (!accountMap) {
- GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", unpostedTransactionTotal.glAccountId), true);
+ GenericValue glAccount = from("GlAccount").where("glAccountId", unpostedTransactionTotal.glAccountId).cache(true).queryOne();
if (glAccount) {
boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
// Get the opening balances at the end of the last closed time period
if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
if (lastClosedTimePeriod) {
- List timePeriodAndExprs = FastList.newInstance();
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, unpostedTransactionTotal.glAccountId));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+ lastTimePeriodHistory = from("GlAccountAndHistory").where("organizationPartyId", organizationPartyId, "glAccountId", unpostedTransactionTotal.glAccountId, "customTimePeriodId", lastClosedTimePeriod.customTimePeriodId).queryFirst();
if (lastTimePeriodHistory) {
accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
}
@@ -199,7 +188,7 @@ if (unpostedTransactionTotals) {
mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
- transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+ transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
transactionTotals.each { transactionTotal ->
UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
}
@@ -217,8 +206,7 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List unpostedDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List unpostedDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
if (unpostedDebitTransactionTotals) {
unpostedDebitTransactionTotal = unpostedDebitTransactionTotals.first();
if (unpostedDebitTransactionTotal && unpostedDebitTransactionTotal.amount) {
@@ -234,7 +222,7 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List unpostedCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List unpostedCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
if (unpostedCreditTransactionTotals) {
unpostedCreditTransactionTotal = unpostedCreditTransactionTotals.first();
if (unpostedCreditTransactionTotal && unpostedCreditTransactionTotal.amount) {
@@ -255,13 +243,13 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List allTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List allTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
if (allTransactionTotals) {
Map allTransactionTotalsMap = [:]
allTransactionTotals.each { allTransactionTotal ->
Map accountMap = (Map)allTransactionTotalsMap.get(allTransactionTotal.glAccountId);
if (!accountMap) {
- GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", allTransactionTotal.glAccountId), true);
+ GenericValue glAccount = from("GlAccount").where("glAccountId", allTransactionTotal.glAccountId).cache(true).queryOne();
if (glAccount) {
boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
// Get the opening balances at the end of the last closed time period
@@ -271,7 +259,7 @@ if (allTransactionTotals) {
timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId));
timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+ lastTimePeriodHistory = from("GlAccountAndHistory").where(timePeriodAndExprs).queryFirst();
if (lastTimePeriodHistory) {
accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
}
@@ -295,7 +283,7 @@ if (allTransactionTotals) {
mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
- transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+ transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
transactionTotals.each { transactionTotal ->
UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
}
@@ -312,8 +300,7 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List allDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List allDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
if (allDebitTransactionTotals) {
allDebitTransactionTotal = allDebitTransactionTotals.first();
if (allDebitTransactionTotal && allDebitTransactionTotal.amount) {
@@ -328,7 +315,7 @@ andExprs.add(EntityCondition.makeConditi
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List allCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List allCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
if (allCreditTransactionTotals) {
allCreditTransactionTotal = allCreditTransactionTotals.first();
if (allCreditTransactionTotal && allCreditTransactionTotal.amount) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy Mon Jan 5 08:50:30 2015
@@ -29,19 +29,19 @@ parties.each { party ->
context.partyNameList = partyNameList;
if (parameters.customTimePeriodId) {
- customTimePeriod = delegator.findOne('CustomTimePeriod', [customTimePeriodId:parameters.customTimePeriodId], true)
+ customTimePeriod = from("CustomTimePeriod").where("customTimePeriodId", parameters.customTimePeriodId).cache(true).queryOne();
exprList = [];
exprList.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
exprList.add(EntityCondition.makeCondition('fromDate', EntityOperator.LESS_THAN, customTimePeriod.getDate('thruDate').toTimestamp()))
exprList.add(EntityCondition.makeCondition(EntityCondition.makeCondition('thruDate', EntityOperator.GREATER_THAN_EQUAL_TO, customTimePeriod.getDate('fromDate').toTimestamp()), EntityOperator.OR, EntityCondition.makeCondition('thruDate', EntityOperator.EQUALS, null)))
- List organizationGlAccounts = delegator.findList('GlAccountOrganizationAndClass', EntityCondition.makeCondition(exprList, EntityOperator.AND), null, ['accountCode'], null, false)
+ List organizationGlAccounts = from("GlAccountOrganizationAndClass").where(exprList).orderBy("accountCode").queryList();
accountBalances = []
postedDebitsTotal = 0
postedCreditsTotal = 0
organizationGlAccounts.each { organizationGlAccount ->
accountBalance = [:]
- accountBalance = dispatcher.runSync('computeGlAccountBalanceForTimePeriod', [organizationPartyId: organizationGlAccount.organizationPartyId, customTimePeriodId: customTimePeriod.customTimePeriodId, glAccountId: organizationGlAccount.glAccountId, userLogin: userLogin]);
+ accountBalance = runService('computeGlAccountBalanceForTimePeriod', [organizationPartyId: organizationGlAccount.organizationPartyId, customTimePeriodId: customTimePeriod.customTimePeriodId, glAccountId: organizationGlAccount.glAccountId]);
if (accountBalance.postedDebits != 0 || accountBalance.postedCredits != 0) {
accountBalance.glAccountId = organizationGlAccount.glAccountId
accountBalance.accountCode = organizationGlAccount.accountCode
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy Mon Jan 5 08:50:30 2015
@@ -26,7 +26,7 @@ orderPaymentPreferenceId = context.order
if ((!orderId) || (!orderPaymentPreferenceId)) return;
if (orderId) {
- orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
context.orderHeader = orderHeader;
}
@@ -37,7 +37,7 @@ if (orderHeader) {
}
if (orderPaymentPreferenceId) {
- orderPaymentPreference = delegator.findOne("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId], false);
+ orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
context.orderPaymentPreference = orderPaymentPreference;
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy Mon Jan 5 08:50:30 2015
@@ -29,12 +29,12 @@ orderPaymentPreferenceId = context.order
if ((!orderId) || (!orderPaymentPreferenceId)) return;
if (orderId) {
- orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
context.orderHeader = orderHeader;
}
if (orderPaymentPreferenceId) {
- orderPaymentPreference = delegator.findOne("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId], false);
+ orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
context.orderPaymentPreference = orderPaymentPreference;
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy Mon Jan 5 08:50:30 2015
@@ -42,7 +42,7 @@ if (!orderPaymentPreferenceId) {
context.orderPaymentPreferenceId = orderPaymentPreference.orderPaymentPreferenceId;
} else {
// second purpose: grab the latest gateway response of the orderpaymentpreferenceId
- orderPaymentPreference = delegator.findOne("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId], false);
+ orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, ["transactionDate DESC"], false);
EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE"));
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy Mon Jan 5 08:50:30 2015
@@ -41,7 +41,7 @@ if ("Y".equals(parameters.isSearch)) {
invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)));
}
invoiceItemAndAssocProductList = [];
- invoiceItemAndAssocProductList = delegator.findList("InvoiceItemAndAssocProduct", EntityCondition.makeCondition(invoiceItemAndAssocProductCond, EntityOperator.AND), null, null, null, false);
+ invoiceItemAndAssocProductList = from("InvoiceItemAndAssocProduct").where(invoiceItemAndAssocProductCond).queryList();
//filtering invoiceItemAndAssocProductList for each productId with updating quantity, commission amount and number of order which generated sales invoices.
totalQuantity = BigDecimal.ZERO;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy Mon Jan 5 08:50:30 2015
@@ -35,11 +35,11 @@ if (fromDate) {
if (context.salesRepPartyList) {
invoiceCond.add(EntityCondition.makeCondition("invoiceRolePartyId", EntityOperator.IN, context.salesRepPartyList));
}
- invoiceList = delegator.findList("InvoiceAndRole", EntityCondition.makeCondition(invoiceCond, EntityOperator.AND), null, null, null, false);
+ invoiceList = from("InvoiceAndRole").where(invoiceCond).queryList();
List invoices = [];
if (invoiceList) {
- resultMap = dispatcher.runSync("getInvoicesFilterByAssocType", [invoiceItemAssocTypeId : "COMMISSION_INVOICE", invoiceList : invoiceList, userLogin : userLogin]);
+ resultMap = runService('getInvoicesFilterByAssocType', [invoiceItemAssocTypeId : "COMMISSION_INVOICE", invoiceList : invoiceList, userLogin : userLogin]);
invoices = resultMap.filteredInvoiceList;
context.invoices = invoices;
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy Mon Jan 5 08:50:30 2015
@@ -43,15 +43,15 @@ if ("Y".equals(parameters.noConditionFin
paymentCond.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom));
}
if (finAccountId) {
- finAccountTransList = delegator.findList("FinAccountTrans", EntityCondition.makeCondition([finAccountId : finAccountId]), null, null, null, false);
+ finAccountTransList = from("FinAccountTrans").where("finAccountId", finAccountId).queryList();
if (finAccountTransList) {
finAccountTransIds = EntityUtil.getFieldListFromEntityList(finAccountTransList, "finAccountTransId", true);
paymentCond.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.IN, finAccountTransIds));
- payments = delegator.findList("PaymentAndTypePartyNameView", EntityCondition.makeCondition(paymentCond, EntityOperator.AND), null, null, null, false);
+ payments = from("PaymentAndTypePartyNameView").where(paymentCond).queryList();
}
} else {
paymentCond.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null));
- payments = delegator.findList("PaymentAndTypePartyNameView", EntityCondition.makeCondition(paymentCond, EntityOperator.AND), null, null, null, false);
+ payments = from("PaymentAndTypePartyNameView").where(paymentCond).queryList();
}
paymentListWithCreditCard = [];
paymentListWithoutCreditCard = [];
@@ -59,10 +59,10 @@ if ("Y".equals(parameters.noConditionFin
payments.each { payment ->
isReceipt = UtilAccounting.isReceipt(payment);
if (isReceipt) {
- paymentGroupMembers = EntityUtil.filterByDate(delegator.findList("PaymentGroupMember", EntityCondition.makeCondition([paymentId : payment.paymentId]), null, null, null, false));
+ paymentGroupMembers = from("PaymentGroupMember").where("paymentId", payment.paymentId).filterByDate().queryList();
if (!paymentGroupMembers) {
if (cardType && payment.paymentMethodId) {
- creditCard = delegator.findOne("CreditCard", [paymentMethodId : payment.paymentMethodId], false);
+ creditCard = from("CreditCard").where("paymentMethodId", payment.paymentMethodId).queryOne();
if (creditCard.cardType == cardType) {
paymentListWithCreditCard.add(payment);
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/config/ContentErrorUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/config/ContentErrorUiLabels.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/config/ContentErrorUiLabels.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/config/ContentErrorUiLabels.xml Mon Jan 5 08:50:30 2015
@@ -306,4 +306,9 @@
<value xml:lang="zh">没æä¸ä¼ æ件</value>
<value xml:lang="zh_TW">æ²æä¸å³æªæ¡</value>
</property>
+ <property key="uploadContentAndImage.noRootDirProvided">
+ <value xml:lang="en">No root dir provided, please fill path in the data resource objectInfo field</value>
+ <value xml:lang="fr">Aucun répertoire racine fourni. Veuillez indiquer le chemin dans le champ objectInfo de la ressource de donnée</value>
+ </property>
+
</resource>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/config/ContentUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/config/ContentUiLabels.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/config/ContentUiLabels.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/config/ContentUiLabels.xml Mon Jan 5 08:50:30 2015
@@ -1031,6 +1031,10 @@
<value xml:lang="zh">å
容设置</value>
<value xml:lang="zh_TW">å
§å®¹è¨å®</value>
</property>
+ <property key="ContentContentShow">
+ <value xml:lang="en">Show Content (if visible else simply Id)</value>
+ <value xml:lang="fr">Montre le contenu (si visible sinon uniquement la référence</value>
+ </property>
<property key="ContentContentToOrFromErrorRetriving">
<value xml:lang="en">Error in retrieving content To or From.</value>
<value xml:lang="fr">Erreur dans la récupération du document de destination ou d'origine.</value>
@@ -1237,6 +1241,10 @@
<value xml:lang="vi">HTML</value>
<value xml:lang="zh_TW">HTML</value>
</property>
+ <property key="ContentDataResourceId">
+ <value xml:lang="en">Data Resource Id</value>
+ <value xml:lang="fr">Ressource de données</value>
+ </property>
<property key="ContentDataResourceImage">
<value xml:lang="ar">صÙرة</value>
<value xml:lang="da">Billede</value>
@@ -7514,8 +7522,8 @@
<value xml:lang="ar">إشØ٠عÙÙÙا اÙصÙرة</value>
<value xml:lang="da">Upload billede</value>
<value xml:lang="de">Bild hochladen</value>
- <value xml:lang="en">Upload Image</value>
- <value xml:lang="fr">Télécharger une image vers le serveur</value>
+ <value xml:lang="en">Upload File</value>
+ <value xml:lang="fr">Télécharger un fichier vers le serveur</value>
<value xml:lang="it">Carica Immagine</value>
<value xml:lang="ja">ç»åãã¢ãããã¼ã</value>
<value xml:lang="pt">Enviar imagem</value>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/entitydef/entitymodel.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/entitydef/entitymodel.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/entitydef/entitymodel.xml Mon Jan 5 08:50:30 2015
@@ -1689,9 +1689,6 @@ under the License.
<field name="secondsTotal" type="floating-point"></field>
<field name="searchDate" type="date-time"></field>
<prim-key field="contentSearchResultId"/>
- <relation type="one" fk-name="CNT_SCHRES_VST" rel-entity-name="Visit">
- <key-map field-name="visitId"/>
- </relation>
</entity>
<entity entity-name="WebAnalyticsConfig"
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/script/org/ofbiz/content/data/DataServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/script/org/ofbiz/content/data/DataServices.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/script/org/ofbiz/content/data/DataServices.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/script/org/ofbiz/content/data/DataServices.xml Mon Jan 5 08:50:30 2015
@@ -564,13 +564,16 @@ under the License.
<property-to-field resource="content.properties" property="content.upload.always.local.file" field="forceLocal"/>
<if>
<condition>
- <!-- if (forceLocal && !("LOCAL_FILE".equals(parameters.dataResourceTypeId) || "OFBIZ_FILE".equals(parameters.dataResourceTypeId)) -->
<and>
<if-compare field="forceLocal" value="true" operator="equals"/>
<not>
<or>
<if-compare field="parameters.dataResourceTypeId" operator="equals" value="LOCAL_FILE"/>
<if-compare field="parameters.dataResourceTypeId" operator="equals" value="OFBIZ_FILE"/>
+ <if-compare field="parameters.dataResourceTypeId" operator="equals" value="CONTEXT_FILE"/>
+ <if-compare field="parameters.dataResourceTypeId" operator="equals" value="LOCAL_FILE_BIN"/>
+ <if-compare field="parameters.dataResourceTypeId" operator="equals" value="OFBIZ_FILE_BIN"/>
+ <if-compare field="parameters.dataResourceTypeId" operator="equals" value="CONTEXT_FILE_BIN"/>
</or>
</not>
</and>
@@ -623,15 +626,44 @@ under the License.
</if>
</if-empty>
- <if-compare field="parameters.dataResourceTypeId" value="LOCAL_FILE" operator="equals">
- <call-simple-method method-name="saveLocalFileDataResource"/>
- <return/>
- </if-compare>
+ <if>
+ <condition>
+ <or>
+ <if-compare field="parameters.dataResourceTypeId" value="LOCAL_FILE" operator="equals"/>
+ <if-compare field="parameters.dataResourceTypeId" value="LOCAL_FILE_BIN" operator="equals"/>
+ </or>
+ </condition>
+ <then>
+ <call-simple-method method-name="saveLocalFileDataResource"/>
+ <return/>
+ </then>
+ </if>
- <if-compare field="parameters.dataResourceTypeId" value="OFBIZ_FILE" operator="equals">
- <call-simple-method method-name="saveOfbizFileDataResource"/>
- <return/>
- </if-compare>
+ <if>
+ <condition>
+ <or>
+ <if-compare field="parameters.dataResourceTypeId" value="OFBIZ_FILE" operator="equals"/>
+ <if-compare field="parameters.dataResourceTypeId" value="OFBIZ_FILE_BIN" operator="equals"/>
+ </or>
+ </condition>
+ <then>
+ <call-simple-method method-name="saveOfbizFileDataResource"/>
+ <return/>
+ </then>
+ </if>
+
+ <if>
+ <condition>
+ <or>
+ <if-compare field="parameters.dataResourceTypeId" value="CONTEXT_FILE" operator="equals"/>
+ <if-compare field="parameters.dataResourceTypeId" value="CONTEXT_FILE_BIN" operator="equals"/>
+ </or>
+ </condition>
+ <then>
+ <call-simple-method method-name="saveContextFileDataResource"/>
+ <return/>
+ </then>
+ </if>
<if-compare field="parameters.dataResourceTypeId" value="IMAGE_OBJECT" operator="equals">
<entity-one entity-name="ImageDataResource" value-field="dataResObj">
@@ -740,7 +772,7 @@ under the License.
<if-not-empty field="extension">
<set value="${uploadPath}/${dataResource.dataResourceId}.${extension.fileExtensionId}" field="dataResource.objectInfo"/>
</if-not-empty>
- <set value="LOCAL_FILE" field="dataResource.dataResourceTypeId"/>
+ <set from-field="parameters.dataResourceTypeId" field="dataResource.dataResourceTypeId"/>
<store-value value-field="dataResource"/>
<set-service-fields service-name="createAnonFile" map="dataResource" to-map="fileCtx"/>
@@ -811,7 +843,7 @@ under the License.
<if-not-empty field="extension">
<set value="${uploadPath}/${dataResource.dataResourceId}.${extension.fileExtensionId}" field="dataResource.objectInfo"/>
</if-not-empty>
- <set value="OFBIZ_FILE" field="dataResource.dataResourceTypeId"/>
+ <set from-field="parameters.dataResourceTypeId" field="dataResource.dataResourceTypeId"/>
<store-value value-field="dataResource"/>
<set-service-fields service-name="createAnonFile" map="dataResource" to-map="fileCtx"/>
@@ -1061,5 +1093,79 @@ under the License.
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
+ </simple-method>
+
+ <!-- save CONTEXT_FILE data -->
+ <simple-method method-name="saveContextFileDataResource" short-description="Attach an uploaded file to a data resource as CONTEXT_FILE">
+ <entity-one entity-name="DataResource" value-field="dataResource"/>
+ <if-empty field="dataResource">
+ <add-error>
+ <fail-property resource="ContentUiLabels" property="ContentDataResourceNotFound"/>
+ </add-error>
+ <else>
+ <if-not-empty field="dataResource.objectInfo">
+ <set field="isUpdate" value="Y"/>
+ </if-not-empty>
+ </else>
+ </if-empty>
+ <if>
+ <condition>
+ <if-empty field="parameters._uploadedFile_fileName"/>
+ </condition>
+ <then>
+ <if>
+ <condition>
+ <or>
+ <if-empty field="isUpdate"/>
+ <if-compare field="isUpdate" value="Y" operator="not-equals"/>
+ </or>
+ </condition>
+ <then>
+ <add-error>
+ <fail-property resource="ContentUiLabels" property="ContentNoUploadedContentFound"/>
+ </add-error>
+ </then>
+ <else>
+ <!-- if not upload is found on an update; its okay, don't do anything just return -->
+ <field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
+ <field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
+ <return/>
+ </else>
+ </if>
+
+ </then>
+ </if>
+ <check-errors/>
+
+ <set field="uploadPath" from-field="parameters.rootDir"/>
+ <log level="info" message="[attachLocalFileToDataResource] - Found Subdir : ${uploadPath}"/>
+ <if-empty field="uploadPath">
+ <add-error>
+ <fail-property resource="ContentErrorUiLabels" property="uploadContentAndImage.noRootDirProvided"/>
+ </add-error>
+ <check-errors/>
+ </if-empty>
+ <log level="info" message="[attachLocalFileToDataResource] - Found Subdir : ${uploadPath}"/>
+
+ <set from-field="parameters._uploadedFile_contentType" field="extenLookup.mimeTypeId"/>
+ <find-by-and entity-name="FileExtension" map="extenLookup" list="extensions"/>
+ <first-from-list entry="extension" list="extensions"/>
+
+ <set from-field="parameters._uploadedFile_fileName" field="dataResource.dataResourceName"/>
+ <set from-field="parameters._uploadedFile_contentType" field="dataResource.mimeTypeId"/>
+ <set value="${uploadPath}/${dataResource.dataResourceId}" field="dataResource.objectInfo"/>
+ <if-not-empty field="extension">
+ <set value="${uploadPath}/${dataResource.dataResourceId}.${extension.fileExtensionId}" field="dataResource.objectInfo"/>
+ </if-not-empty>
+ <set from-field="parameters.dataResourceTypeId" field="dataResource.dataResourceTypeId"/>
+ <store-value value-field="dataResource"/>
+
+ <set-service-fields service-name="createAnonFile" map="dataResource" to-map="fileCtx"/>
+ <set from-field="parameters.uploadedFile" field="fileCtx.binData"/>
+ <set from-field="dataResource" field="fileCtx.dataResource"/>
+ <call-service service-name="createAnonFile" in-map-name="fileCtx" include-user-login="true"/>
+
+ <field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
+ <field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
</simple-method>
</simple-methods>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/servicedef/services_content.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/servicedef/services_content.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/servicedef/services_content.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/servicedef/services_content.xml Mon Jan 5 08:50:30 2015
@@ -88,6 +88,7 @@
<attribute name="dataResourceTypeId" type="String" mode="IN" optional="true"/>
<!-- mimetype is set from the uploaded file (contentType) when empty -->
<attribute name="mimeTypeId" type="String" mode="INOUT" optional="true"/>
+ <attribute mode="IN" name="rootDir" optional="true" type="String"/>
</service>
<service name="createContentFromUploadedFile" engine="group" transaction-timeout="300">
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/ContentManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/ContentManagementServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/ContentManagementServices.java Mon Jan 5 08:50:30 2015
@@ -146,7 +146,6 @@ public class ContentManagementServices {
Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
Locale locale = (Locale) context.get("locale");
- Debug.logInfo("=========== type:" + (String)context.get("dataresourceTypeId") , module);
// Knowing why a request fails permission check is one of the more difficult
// aspects of content management. Setting "displayFailCond" to true will
// put an html table in result.errorMessage that will show what tests were performed
@@ -638,7 +637,7 @@ public class ContentManagementServices {
newDrContext.put("mimeTypeId", mimeTypeId);
}
- if (!dataResourceExists) {
+ if (!dataResourceExists) { // Create
Map<String, Object> thisResult = dispatcher.runSync("createDataResource", newDrContext);
String errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
@@ -651,29 +650,7 @@ public class ContentManagementServices {
dataResource = (GenericValue)thisResult.get("dataResource");
Map<String, Object> fileContext = FastMap.newInstance();
fileContext.put("userLogin", userLogin);
- if (dataResourceTypeId.indexOf("_FILE") >=0) {
- boolean hasData = false;
- if (textData != null) {
- fileContext.put("textData", textData);
- hasData = true;
- }
- if (imageDataBytes != null) {
- fileContext.put("binData", imageDataBytes);
- hasData = true;
- }
- if (hasData) {
- fileContext.put("rootDir", context.get("rootDir"));
- fileContext.put("dataResourceTypeId", dataResourceTypeId);
- if (UtilValidate.isNotEmpty(dataResource) && UtilValidate.isNotEmpty(dataResource.get("objectInfo"))) {
- fileContext.put("objectInfo", dataResource.get("objectInfo"));
- }
- thisResult = dispatcher.runSync("createFile", fileContext);
- errorMsg = ServiceUtil.getErrorMessage(thisResult);
- if (UtilValidate.isNotEmpty(errorMsg)) {
- return ServiceUtil.returnError(errorMsg);
- }
- }
- } else if (dataResourceTypeId.equals("IMAGE_OBJECT")) {
+ if (dataResourceTypeId.equals("IMAGE_OBJECT")) {
if (imageDataBytes != null) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("imageData", imageDataBytes);
@@ -697,46 +674,19 @@ public class ContentManagementServices {
}
}
}
- } else {
+ } else { // Update
Map<String, Object> thisResult = dispatcher.runSync("updateDataResource", newDrContext);
String errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
return ServiceUtil.returnError(errorMsg);
}
- //Map thisResult = DataServices.updateDataResourceMethod(dctx, context);
- if (Debug.infoOn()) {
- Debug.logInfo("====in persist... thisResult.permissionStatus(0):" + thisResult.get("permissionStatus"), null);
- }
- //thisResult = DataServices.updateElectronicTextMethod(dctx, context);
Map<String, Object> fileContext = FastMap.newInstance();
fileContext.put("userLogin", userLogin);
String forceElectronicText = (String)context.get("forceElectronicText");
- Debug.logInfo("====dataResourceType" + dataResourceTypeId , module);
- if (dataResourceTypeId.indexOf("_FILE") >=0) {
- boolean hasData = false;
- if (textData != null) {
- fileContext.put("textData", textData);
- hasData = true;
- }
- if (imageDataBytes != null) {
- fileContext.put("binData", imageDataBytes);
- hasData = true;
- }
- if (hasData || "true".equalsIgnoreCase(forceElectronicText)) {
- fileContext.put("rootDir", context.get("rootDir"));
- fileContext.put("dataResourceTypeId", dataResourceTypeId);
- fileContext.put("objectInfo", dataResource.get("objectInfo"));
- thisResult = dispatcher.runSync("updateFile", fileContext);
- errorMsg = ServiceUtil.getErrorMessage(thisResult);
- if (UtilValidate.isNotEmpty(errorMsg)) {
- return ServiceUtil.returnError(errorMsg);
- }
- }
- } else if (dataResourceTypeId.equals("IMAGE_OBJECT")) {
+ if (dataResourceTypeId.equals("IMAGE_OBJECT")) {
if (imageDataBytes != null || "true".equalsIgnoreCase(forceElectronicText)) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("imageData", imageDataBytes);
- Debug.logInfo("====trying to update image", module);
thisResult = dispatcher.runSync("updateImage", fileContext);
errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
@@ -757,6 +707,17 @@ public class ContentManagementServices {
}
}
}
+ if (dataResourceTypeId.indexOf("_FILE") >=0) {
+ Map<String, Object> uploadImage = FastMap.newInstance();
+ uploadImage.put("userLogin", userLogin);
+ uploadImage.put("dataResourceId", dataResourceId);
+ uploadImage.put("dataResourceTypeId", dataResourceTypeId);
+ uploadImage.put("rootDir", context.get("objectInfo"));
+ uploadImage.put("uploadedFile", imageDataBytes);
+ uploadImage.put("_uploadedFile_fileName", (String) context.get("_imageData_fileName"));
+ uploadImage.put("_uploadedFile_contentType", (String) context.get("_imageData_contentType"));
+ dispatcher.runSync("attachUploadToDataResource", uploadImage);
+ }
result.put("dataResourceId", dataResourceId);
result.put("drDataResourceId", dataResourceId);
context.put("dataResourceId", dataResourceId);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java Mon Jan 5 08:50:30 2015
@@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilCodec;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.common.UrlServletHelper;
@@ -39,7 +39,6 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.webapp.control.ContextFilter;
-import org.owasp.esapi.errors.EncodingException;
public class ContentUrlFilter extends ContextFilter {
public final static String module = ContentUrlFilter.class.getName();
@@ -118,14 +117,10 @@ public class ContentUrlFilter extends Co
.queryFirst();
if (contentAssocDataResource != null) {
url = contentAssocDataResource.getString("drObjectInfo");
- try {
- url = StringUtil.defaultWebEncoder.decodeFromURL(url);
- String mountPoint = request.getContextPath();
- if (!(mountPoint.equals("/")) && !(mountPoint.equals(""))) {
- url = mountPoint + url;
- }
- } catch (EncodingException e) {
- Debug.logError(e, module);
+ url = UtilCodec.getDecoder("url").decode(url);
+ String mountPoint = request.getContextPath();
+ if (!(mountPoint.equals("/")) && !(mountPoint.equals(""))) {
+ url = mountPoint + url;
}
}
} catch (Exception e) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Mon Jan 5 08:50:30 2015
@@ -56,6 +56,7 @@ import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.FileUtil;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.StringUtil.StringWrapper;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilIO;
@@ -63,7 +64,6 @@ import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
-import org.ofbiz.base.util.StringUtil.StringWrapper;
import org.ofbiz.base.util.collections.MapStack;
import org.ofbiz.base.util.template.FreeMarkerWorker;
import org.ofbiz.base.util.template.XslTransform;
@@ -942,14 +942,14 @@ public class DataResourceWorker impleme
public static void renderFile(String dataResourceTypeId, String objectInfo, String rootDir, Appendable out) throws GeneralException, IOException {
// TODO: this method assumes the file is a text file, if it is an image we should respond differently, see the comment above for IMAGE_OBJECT type data resource
- if (dataResourceTypeId.equals("LOCAL_FILE")) {
+ if (dataResourceTypeId.equals("LOCAL_FILE") && UtilValidate.isNotEmpty(objectInfo)) {
File file = FileUtil.getFile(objectInfo);
if (!file.isAbsolute()) {
throw new GeneralException("File (" + objectInfo + ") is not absolute");
}
FileReader in = new FileReader(file);
UtilIO.copy(in, true, out);
- } else if (dataResourceTypeId.equals("OFBIZ_FILE")) {
+ } else if (dataResourceTypeId.equals("OFBIZ_FILE") && UtilValidate.isNotEmpty(objectInfo)) {
String prefix = System.getProperty("ofbiz.home");
String sep = "";
if (objectInfo.indexOf("/") != 0 && prefix.lastIndexOf("/") != (prefix.length() - 1)) {
@@ -958,7 +958,7 @@ public class DataResourceWorker impleme
File file = FileUtil.getFile(prefix + sep + objectInfo);
FileReader in = new FileReader(file);
UtilIO.copy(in, true, out);
- } else if (dataResourceTypeId.equals("CONTEXT_FILE")) {
+ } else if (dataResourceTypeId.equals("CONTEXT_FILE") && UtilValidate.isNotEmpty(objectInfo)) {
String prefix = rootDir;
String sep = "";
if (objectInfo.indexOf("/") != 0 && prefix.lastIndexOf("/") != (prefix.length() - 1)) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java Mon Jan 5 08:50:30 2015
@@ -25,10 +25,12 @@ import java.sql.Timestamp;
import java.text.ParseException;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
@@ -42,6 +44,10 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtilProperties;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
import org.ofbiz.webapp.view.AbstractViewHandler;
import org.ofbiz.webapp.view.ViewHandlerException;
import org.ofbiz.webapp.website.WebSiteWorker;
@@ -66,6 +72,9 @@ public class SimpleContentViewHandler ex
*/
public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
+ LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+ HttpSession session = request.getSession();
+ GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
String contentId = request.getParameter("contentId");
String rootContentId = request.getParameter("rootContentId");
String mapKey = request.getParameter("mapKey");
@@ -136,6 +145,43 @@ public class SimpleContentViewHandler ex
if (!UtilValidate.isEmpty(dataResource.getString("dataResourceName"))) {
fileName = dataResource.getString("dataResourceName").replace(" ", "_"); // spaces in filenames can be a problem
}
+
+ // see if data resource is public or not
+ String isPublic = dataResource.getString("isPublic");
+ if (UtilValidate.isEmpty(isPublic)) {
+ isPublic = "N";
+ }
+ // get the permission service required for streaming data; default is always the genericContentPermission
+ String permissionService = EntityUtilProperties.getPropertyValue("content.properties", "stream.permission.service", "genericContentPermission", delegator);
+
+ // not public check security
+ if (!"Y".equalsIgnoreCase(isPublic)) {
+ // do security check
+ Map<String, ? extends Object> permSvcCtx = UtilMisc.toMap("userLogin", userLogin, "locale", locale, "mainAction", "VIEW", "contentId", contentId);
+ Map<String, Object> permSvcResp;
+ try {
+ permSvcResp = dispatcher.runSync(permissionService, permSvcCtx);
+ } catch (GenericServiceException e) {
+ Debug.logError(e, module);
+ request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
+ throw new ViewHandlerException(e.getMessage());
+ }
+ if (ServiceUtil.isError(permSvcResp)) {
+ String errorMsg = ServiceUtil.getErrorMessage(permSvcResp);
+ Debug.logError(errorMsg, module);
+ request.setAttribute("_ERROR_MESSAGE_", errorMsg);
+ throw new ViewHandlerException(errorMsg);
+ }
+
+ // no service errors; now check the actual response
+ Boolean hasPermission = (Boolean) permSvcResp.get("hasPermission");
+ if (!hasPermission.booleanValue()) {
+ String errorMsg = (String) permSvcResp.get("failMessage");
+ Debug.logError(errorMsg, module);
+ request.setAttribute("_ERROR_MESSAGE_", errorMsg);
+ throw new ViewHandlerException(errorMsg);
+ }
+ }
UtilHttp.streamContentToBrowser(response, bais, byteBuffer.limit(), contentType2, fileName);
}
} catch (GenericEntityException e) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy Mon Jan 5 08:50:30 2015
@@ -35,7 +35,7 @@ Debug.logInfo("in cmseditaddprep, conten
contentAssoc = null;
if (contentAssocPK.isPrimaryKey()) {
- contentAssoc = delegator.findOne("ContentAssoc", contentAssocPK, false);
+ contentAssoc = from("ContentAssoc").where(contentAssocPK).queryOne();
}
if (contentAssoc) {
@@ -50,7 +50,7 @@ dataResourceId = "";
textData = "";
content = null;
if (contentId) {
- content = delegator.findOne("Content", [contentId : contentId], true);
+ content = from("Content").where("contentId", contentId).cache(true).queryOne();
if (content) {
contentAssocDataResourceViewFrom.setAllFields(content, false, null, null);
}
@@ -68,7 +68,7 @@ if (!dataResourceId) {
}
}
if (dataResourceId) {
- dataResource = delegator.findOne("DataResource", [dataResourceId : dataResourceId], true);
+ dataResource = from("DataResource").where("dataResourceId", dataResourceId).cache(true).queryOne();
SimpleMapProcessor.runSimpleMapProcessor("component://content/script/org/ofbiz/content/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault());
templateRoot = [:];
FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy Mon Jan 5 08:50:30 2015
@@ -24,13 +24,13 @@ paramMap = UtilHttp.getParameterMap(requ
contentId = context.contentId;
dataResourceId = context.dataResourceId;
-productFeatureList = delegator.findList("ProductFeature", null, null, null, null, true);
+productFeatureList = from("ProductFeature").cache(true).queryList();
featureList = [] as ArrayList;
if (dataResourceId) {
productFeatureList.each { productFeature ->
productFeatureId = productFeature.productFeatureId;
description = productFeature.description;
- productFeatureDataResource = delegator.findOne("ProductFeatureDataResource", [productFeatureId : productFeatureId, dataResourceId : dataResourceId], true);
+ productFeatureDataResource = from("ProductFeatureDataResource").where("productFeatureId", productFeatureId, "dataResourceId", dataResourceId).cache(true).queryOne();
if (productFeatureDataResource) {
feature = [];
feature.productFeatureId = productFeatureId;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy Mon Jan 5 08:50:30 2015
@@ -38,7 +38,7 @@ if (forumId) {
contentIdToExpr = EntityCondition.makeCondition("caContentId", EntityOperator.EQUALS, forumId);
exprList.add(contentIdToExpr);
expr = EntityCondition.makeCondition(exprList, EntityOperator.AND);
- entityList = delegator.findList("ContentAssocViewFrom", expr, null, ['-caFromDate'], null, false);
+ entityList = from("ContentAssocViewFrom").where(exprList).orderBy("-caFromDate").queryList();
Debug.logInfo("in mostrecentprep(1), entityList.size():" + entityList.size(),"");
Debug.logInfo("in mostrecentprep(1), entityList:" + entityList,"");
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy Mon Jan 5 08:50:30 2015
@@ -23,15 +23,14 @@ import org.ofbiz.content.ContentManageme
paramMap = UtilHttp.getParameterMap(request);
forumId = ContentManagementWorker.getFromSomewhere("permRoleSiteId", paramMap, request, context);
-blogRoles = delegator.findList("RoleType", EntityCondition.makeCondition([parentTypeId : 'BLOG']), null, null, null, true);
+blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList();
if (forumId) {
siteRoleMap = [:];
for (int i=0; i < blogRoles.size(); i++) {
roleType = blogRoles.get(i);
roleTypeId = roleType.roleTypeId;
- contentRoleList = delegator.findList("ContentRole", EntityCondition.makeCondition([contentId : forumId, roleTypeId : roleTypeId]), null, null, null, false);
- filteredRoleList = EntityUtil.filterByDate(contentRoleList);
+ filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList();
cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId);
filteredRoleList.each { contentRole ->
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy Mon Jan 5 08:50:30 2015
@@ -53,8 +53,8 @@ context.put("thruDateStr", toStr);
searchConstraintStrings = ContentSearchSession.searchGetConstraintStrings(false, session, delegator);
searchSortOrderString = ContentSearchSession.searchGetSortOrderString(false, request);
-contentAssocTypes=delegator.findList("ContentAssocType", null, null, null, null, false);
-roleTypes=delegator.findList("RoleType", null, null, null, null, false);
+contentAssocTypes = from("ContentAssocType").queryList();
+roleTypes = from("RoleType").queryList();
context.put("searchOperator", searchOperator);
context.put("searchConstraintStrings", searchConstraintStrings);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy Mon Jan 5 08:50:30 2015
@@ -80,7 +80,6 @@ int highIndex = (viewIndex+1)*viewSize;
context.lowIndex = lowIndex;
int arraySize = 0;
List resultPartialList = null;
- conditions = [EntityCondition.makeCondition("contentIdStart", EntityOperator.EQUALS,(String)parameters.get("contentId"))];
if ((highIndex - lowIndex + 1) > 0) {
// get the results as an entity list iterator
@@ -88,9 +87,7 @@ if ((highIndex - lowIndex + 1) > 0) {
if(resultPartialList==null){
try {
beganTransaction = TransactionUtil.begin();
- allConditions = EntityCondition.makeCondition( conditions, EntityOperator.AND );
- findOptions = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
- EntityListIterator listIt = delegator.find("ContentAssocViewTo", allConditions, null, null, ["contentId ASC"], findOptions);
+ EntityListIterator listIt = from("ContentAssocViewTo").where("contentIdStart", (String)parameters.get("contentId")).orderBy("contentId ASC").cursorScrollInsensitive().cache(true).queryIterator();
resultPartialList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1);
arraySize = listIt.getResultsSizeAfterPartialList();
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy Mon Jan 5 08:50:30 2015
@@ -27,15 +27,14 @@ import org.ofbiz.content.ContentManageme
paramMap = UtilHttp.getParameterMap(request);
forumId = ContentManagementWorker.getFromSomewhere("webSitePublishPoint", paramMap, request, context);
-blogRoles = delegator.findList("RoleType", EntityCondition.makeCondition([parentTypeId : 'BLOG']), null, null, null, true);
+blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList();
if (forumId) {
siteRoleMap = [:];
for (int i=0; i < blogRoles.size(); i++) {
roleType = blogRoles.get(i);
roleTypeId = roleType.roleTypeId;
- contentRoleList = delegator.findList("ContentRole", EntityCondition.makeCondition([contentId : forumId, roleTypeId : roleTypeId]), null, null, null, false);
- filteredRoleList = EntityUtil.filterByDate(contentRoleList);
+ filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList();
cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId);
filteredRoleList.each { contentRole ->
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy Mon Jan 5 08:50:30 2015
@@ -25,11 +25,11 @@ import org.ofbiz.widget.html.*
surveyQuestionId = parameters.surveyQuestionId;
context.surveyQuestionId = surveyQuestionId;
-surveyQuestion = delegator.findOne("SurveyQuestion", [surveyQuestionId : surveyQuestionId], false);
+surveyQuestion = from("SurveyQuestion").where("surveyQuestionId", surveyQuestionId).queryOne();
-surveyQuestionAndApplList = delegator.findList("SurveyQuestionAndAppl", EntityCondition.makeCondition([surveyId : surveyId]), null, ['sequenceNum'], null, false);
-surveyPageList = delegator.findList("SurveyPage", EntityCondition.makeCondition([surveyId : surveyId]), null, ['sequenceNum'], null, false);
-surveyMultiRespList = delegator.findList("SurveyMultiResp", EntityCondition.makeCondition([surveyId : surveyId]), null, ['multiRespTitle'], null, false);
+surveyQuestionAndApplList = from("SurveyQuestionAndAppl").where("surveyId", surveyId).orderBy("sequenceNum").queryList();
+surveyPageList = from("SurveyPage").where("surveyId", surveyId).orderBy("sequenceNum").queryList();
+surveyMultiRespList = from("SurveyMultiResp").where("surveyId", surveyId).orderBy("multiRespTitle").queryList();
HtmlFormWrapper createSurveyQuestionWrapper = new HtmlFormWrapper("component://content/widget/survey/SurveyForms.xml", "CreateSurveyQuestion", request, response);
createSurveyQuestionWrapper.putInContext("surveyId", surveyId);
@@ -40,7 +40,7 @@ createSurveyQuestionCategoryWrapper.putI
if (surveyQuestion && surveyQuestion.surveyQuestionTypeId && "OPTION".equals(surveyQuestion.surveyQuestionTypeId)) {
// get the options
- questionOptions = delegator.findList("SurveyQuestionOption", EntityCondition.makeCondition([surveyQuestionId : surveyQuestionId]), null, ['sequenceNum'], null, false);
+ questionOptions = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId).orderBy("sequenceNum").queryList();
context.questionOptions = questionOptions;
HtmlFormWrapper createSurveyOptionWrapper = new HtmlFormWrapper("component://content/widget/survey/SurveyForms.xml", "CreateSurveyQuestionOption", request, response);
@@ -49,7 +49,7 @@ if (surveyQuestion && surveyQuestion.sur
optionSeqId = parameters.surveyOptionSeqId;
surveyQuestionOption = null;
if (optionSeqId) {
- surveyQuestionOption = delegator.findOne("SurveyQuestionOption", [surveyQuestionId : surveyQuestionId, surveyOptionSeqId : optionSeqId], false);
+ surveyQuestionOption = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId, "surveyOptionSeqId", optionSeqId).queryOne();
}
context.surveyQuestionOption = surveyQuestionOption;
@@ -63,12 +63,12 @@ surveyQuestionCategoryId = parameters.su
surveyQuestionCategory = null;
categoryQuestions = null;
if (surveyQuestionCategoryId) {
- surveyQuestionCategory = delegator.findOne("SurveyQuestionCategory", [surveyQuestionCategoryId : surveyQuestionCategoryId], false);
+ surveyQuestionCategory = from("SurveyQuestionCategory").where("surveyQuestionCategoryId", surveyQuestionCategoryId).queryOne();
if (surveyQuestionCategory) {
categoryQuestions = surveyQuestionCategory.getRelated("SurveyQuestion", null, null, false);
}
}
-questionCategories = delegator.findList("SurveyQuestionCategory", null, null, ['description'], null, false);
+questionCategories = from("SurveyQuestionCategory").orderBy("description").queryList();
context.surveyQuestion = surveyQuestion;
context.surveyQuestionAndApplList = surveyQuestionAndApplList;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy Mon Jan 5 08:50:30 2015
@@ -24,7 +24,8 @@ surveyResponseId = parameters.surveyResp
partyId = null;
if (!surveyId && surveyResponseId) {
- surveyResponse = delegator.findOne("SurveyResponse", [surveyResponseId : surveyResponseId], false);
+ surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne();
+
surveyId = surveyResponse.surveyId;
context.surveyId = surveyId;
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy Mon Jan 5 08:50:30 2015
@@ -22,11 +22,11 @@ import org.ofbiz.content.survey.SurveyWr
if (!survey) {
surveyResponseId = parameters.surveyResponseId;
if (surveyResponseId) {
- surveyResponse = delegator.findOne("SurveyResponse", [surveyResponseId : surveyResponseId], false);
+ surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne();
if (surveyResponse) {
surveyId = surveyResponse.surveyId;
if (surveyId) {
- survey = delegator.findOne("Survey", [surveyId : surveyId], false);
+ survey = from("Survey").where("surveyId", surveyId).queryOne();
context.survey = survey;
context.surveyId = surveyId;
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy Mon Jan 5 08:50:30 2015
@@ -23,36 +23,28 @@ import org.ofbiz.entity.util.*
if (content) {
// lookup assoc content
- titles = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'title']), null, ['-fromDate'], null, false);
- titles = EntityUtil.filterByDate(titles);
- title = EntityUtil.getFirst(titles);
+ title = from("ContentAssoc").where("contentId", contentId, "mapKey", "title").orderBy("-fromDate").filterByDate().queryFirst();
if (title) {
tc = title.getRelatedOne("ToContent", false);
tcdr = tc.getRelatedOne("DataResource", false);
context.title = tcdr;
}
- titleProps = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'titleProperty']), null, ['-fromDate'], null, false);
- titleProps = EntityUtil.filterByDate(titleProps);
- titleProp = EntityUtil.getFirst(titleProps);
+ titleProp = from("ContentAssoc").where("contentId", contentId, "mapKey", "titleProperty").orderBy("-fromDate").filterByDate().queryFirst();
if (titleProp) {
tpc = titleProp.getRelatedOne("ToContent", false);
tpcdr = tpc.getRelatedOne("DataResource", false);
context.titleProperty = tpcdr;
}
- metaDescs = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'metaDescription']), null, ['-fromDate'], null, false);
- metaDescs = EntityUtil.filterByDate(metaDescs);
- metaDesc = EntityUtil.getFirst(metaDescs);
+ metaDesc = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaDescription").orderBy("-fromDate").filterByDate().queryFirst();
if (metaDesc) {
mdc = metaDesc.getRelatedOne("ToContent", false);
mdcdr = mdc.getRelatedOne("DataResource", false);
context.metaDescription = mdcdr;
}
- metaKeys = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'metaKeywords']), null, ['-fromDate'], null, false);
- metaKeys = EntityUtil.filterByDate(metaKeys);
- metaKey = EntityUtil.getFirst(metaKeys);
+ metaKey = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaKeywords").orderBy("-fromDate").filterByDate().queryFirst();
if (metaKey) {
mkc = metaKey.getRelatedOne("ToContent", false);
mkcdr = mkc.getRelatedOne("DataResource", false);