Author: ashish
Date: Sat Dec 20 04:31:20 2014 New Revision: 1646916 URL: http://svn.apache.org/r1646916 Log: Applied all the patch files from jira issue - OFBIZ-5893 - Use EntityQuery Builder methods in goovy files by replacing Entity Engine methods. Thanks so much Arun for the contribution. Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunContent.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsComponentsByFeature.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsInfoAndOrder.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsAndOrder.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsByFeature.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsStacks.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PackageContentsAndOrder.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentLabel.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentPlanStockReport.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentWorkEffortTasks.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendar.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendarExceptionDay.groovy ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendarExceptionWeek.groovy ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/reports/EmailStatusReport.groovy ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/reports/MarketingCampaignReport.groovy ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/reports/PartyStatusReport.groovy ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/reports/TrackingCodeReport.groovy ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/CloneLead.groovy ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/MergeContacts.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AdditionalPartyListing.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/BillSettings.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckInits.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutOptions.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutPayment.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutReview.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutShippingAddress.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OptionSettings.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderAgreements.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderTerms.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShoppingList.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShowCart.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SplitShip.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/ShowPromotionDetails.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/AdvancedSearchOptions.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CompareProducts.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy Sat Dec 20 04:31:20 2014 @@ -30,7 +30,7 @@ invItemTypePrefix += "_%"; organizationPartyId = parameters.organizationPartyId; exprBldr = new EntityConditionBuilder(); -invoiceItemTypes = delegator.findList("InvoiceItemType", exprBldr.LIKE(invoiceItemTypeId: invItemTypePrefix), null, null, null, false); +invoiceItemTypes = from('InvoiceItemType').where(exprBldr.LIKE(invoiceItemTypeId: invItemTypePrefix)).queryList(); context.invoiceItemTypes = invoiceItemTypes.collect { invoiceItemType -> defaultAccount = true Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy Sat Dec 20 04:31:20 2014 @@ -20,7 +20,7 @@ import org.ofbiz.base.util.UtilMisc; import javolution.util.FastList; -taxAuthorities = delegator.findList("TaxAuthority", null, null, ["taxAuthGeoId", "taxAuthPartyId"], null, false); +taxAuthorities = from('TaxAuthority').orderBy("taxAuthGeoId", "taxAuthPartyId").queryList(); context.taxAuthorityHavingNoGlAccountList = taxAuthorities.findAll { taxAuthority -> !taxAuthority.getRelated('TaxAuthorityGlAccount', [organizationPartyId : organizationPartyId], null, false) Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy Sat Dec 20 04:31:20 2014 @@ -38,7 +38,7 @@ if (fixedAsset) { context.geoChart = geoChart; } if (latestGeoPoint.elevationUomId) { - elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false); + elevationUom = from('Uom').where('uomId', atestGeoPoint.elevationUomId).queryOne() context.elevationUomAbbr = elevationUom.abbreviation; } } Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy Sat Dec 20 04:31:20 2014 @@ -35,7 +35,7 @@ import javolution.util.FastMap; invoiceId = parameters.get("invoiceId"); -invoice = delegator.findOne("Invoice", [invoiceId : invoiceId], false); +invoice = from('Invoice').where('invoiceId', invoiceId).queryOne(); context.invoice = invoice; currency = parameters.currency; // allow the display of the invoice in the original currency, the default is to display the invoice in the default currency @@ -77,13 +77,17 @@ if (invoice) { // also create a map with tax grand total amount by VAT tax: it is also required in invoices by UE taxRate = invoiceItem.getRelatedOne("TaxAuthorityRateProduct", false); if (taxRate && "VAT_TAX".equals(taxRate.taxAuthorityRateTypeId)) { - taxInfos = EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : billToParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId], null, false), invoice.invoiceDate); - taxInfo = EntityUtil.getFirst(taxInfos); + taxInfo = from("PartyTaxAuthInfo") + .where('partyId', billToParty.partyId, 'taxAuthGeoId', taxRate.taxAuthGeoId, 'taxAuthPartyId', taxRate.taxAuthPartyId) + .filterByDate(invoice.invoiceDate) + .queryFirst(); if (taxInfo) { context.billToPartyTaxId = taxInfo.partyTaxId; } - taxInfos = EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : sendingParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId], null, false), invoice.invoiceDate); - taxInfo = EntityUtil.getFirst(taxInfos); + taxInfo = from("PartyTaxAuthInfo") + .where('partyId', sendingParty.partyId, 'taxAuthGeoId', taxRate.taxAuthGeoId, 'taxAuthPartyId', taxRate.taxAuthPartyId) + .filterByDate(invoice.invoiceDate) + .queryFirst(); if (taxInfo) { context.sendingPartyTaxId = taxInfo.partyTaxId; } @@ -135,10 +139,10 @@ if (invoice) { terms = invoice.getRelated("InvoiceTerm", null, null, false); context.terms = terms; - paymentAppls = delegator.findByAnd("PaymentApplication", [invoiceId : invoiceId], null, false); + paymentAppls = from("PaymentApplication").where('invoiceId', invoiceId).queryList(); context.payments = paymentAppls; - orderItemBillings = delegator.findByAnd("OrderItemBilling", [invoiceId : invoiceId], ['orderId'], false); + orderItemBillings = from("OrderItemBilling").where('invoiceId', invoiceId).orderBy('orderId').queryList(); orders = new LinkedHashSet(); orderItemBillings.each { orderIb -> orders.add(orderIb.orderId); @@ -150,7 +154,7 @@ if (invoice) { edit = parameters.editInvoice; if ("true".equalsIgnoreCase(edit)) { - invoiceItemTypes = delegator.findList("InvoiceItemType", null, null, null, null, false); + invoiceItemTypes = from("InvoiceItemType").queryList(); context.invoiceItemTypes = invoiceItemTypes; context.editInvoice = true; } Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy Sat Dec 20 04:31:20 2014 @@ -40,8 +40,8 @@ if ("SALES_INVOICE".equals(invoice.invoi EQUALS(invoiceItemTypeId: "INV_PROD_ITEM") EQUALS(parentTypeId: "INV_PROD_ITEM") } - invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false); - glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyIdFrom], null, false); + invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList(); + glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyIdFrom).queryList(); } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) { itemTypesCond = exprBldr.OR() { EQUALS(invoiceItemTypeId: "PINVOICE_ADJ") @@ -51,8 +51,8 @@ if ("SALES_INVOICE".equals(invoice.invoi EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM") EQUALS(parentTypeId: "PINV_PROD_ITEM") } - invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false); - glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false); + invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList(); + glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList(); } else if ("PAYROL_INVOICE".equals(invoice.invoiceTypeId)) { itemTypesCond = exprBldr.OR() { EQUALS(invoiceItemTypeId: "PAYROL_EARN_HOURS") @@ -62,8 +62,8 @@ if ("SALES_INVOICE".equals(invoice.invoi EQUALS(invoiceItemTypeId: "PAYROL_TAXES") EQUALS(parentTypeId: "PAYROL_TAXES") } - invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false); - glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false); + invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList(); + glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList(); } else if ("COMMISSION_INVOICE".equals(invoice.invoiceTypeId)) { itemTypesCond = exprBldr.OR() { EQUALS(invoiceItemTypeId: "COMM_INV_ITEM") @@ -71,10 +71,10 @@ if ("SALES_INVOICE".equals(invoice.invoi EQUALS(invoiceItemTypeId: "COMM_INV_ADJ") EQUALS(parentTypeId: "COMM_INV_ADJ") } - invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false); - glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false); + invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList(); + glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList(); } else { - map = delegator.findByAnd("InvoiceItemTypeMap", [invoiceTypeId : invoice.invoiceTypeId], null, true); + map = from("InvoiceItemTypeMap").where('invoiceTypeId', invoice.invoiceTypeId).cache(true).queryList(); invoiceItemTypes = EntityUtil.getRelated("InvoiceItemType", map, null, false); } context.invoiceItemTypes = invoiceItemTypes; Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy Sat Dec 20 04:31:20 2014 @@ -42,7 +42,7 @@ if (invoiceTypeId) { } expr = exprBldr.AND([expr, invoiceStatusesCondition]); - PastDueInvoices = delegator.findList("Invoice", expr, null, ["dueDate DESC"], null, false); + PastDueInvoices = from("Invoice").where(expr).orderBy("dueDate DESC").queryList(); if (PastDueInvoices) { invoiceIds = PastDueInvoices.invoiceId; totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId]); @@ -56,9 +56,7 @@ if (invoiceTypeId) { EQUALS(invoiceTypeId: invoiceTypeId) GREATER_THAN_EQUAL_TO(dueDate: UtilDateTime.nowTimestamp()) } - EntityFindOptions findOptions = new EntityFindOptions(); - findOptions.setMaxRows(10); - InvoicesDueSoon = delegator.findList("Invoice", invoicesCond, null, ["dueDate ASC"], findOptions, false); + InvoicesDueSoon = from("Invoice").where(invoicesCond).orderBy("dueDate ASC").maxRows(10).queryList(); if (InvoicesDueSoon) { invoiceIds = InvoicesDueSoon.invoiceId; totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId]); Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy Sat Dec 20 04:31:20 2014 @@ -32,7 +32,7 @@ import org.ofbiz.entity.condition.Entity import java.math.*; invoiceId = parameters.invoiceId; -invoice = delegator.findOne("Invoice", [invoiceId : invoiceId], false); +invoice = from("Invoice").where(invoiceId : invoiceId).queryOne(); decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); @@ -52,9 +52,9 @@ topCondActual = exprBldr.AND(preCurrency EQUALS(actualCurrencyUomId: invoice.currencyUomId) } -payments = delegator.findList("Payment", topCond, null, ["effectiveDate"], null, false); +payments = from("Payment").where(topCond).orderBy("effectiveDate").queryList(); context.payments = getPayments(payments, false); -payments = delegator.findList("Payment", topCondActual, null, ["effectiveDate"], null, false); +payments = from("Payment").where(topCondActual).orderBy("effectiveDate").queryList(); context.paymentsActualCurrency = getPayments(payments, true); List getPayments(List payments, boolean actual) { Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy Sat Dec 20 04:31:20 2014 @@ -25,7 +25,7 @@ import org.ofbiz.entity.condition.Entity invoiceDetailList = []; invoiceIds.each { invoiceId -> invoicesMap = [:]; - invoice = delegator.findOne("Invoice", [invoiceId : invoiceId], false); + invoice = from("Invoice").where('invoiceId', invoiceId).queryOne(); invoicesMap.invoice = invoice; currency = parameters.currency; // allow the display of the invoice in the original currency, the default is to display the invoice in the default currency @@ -98,10 +98,10 @@ invoiceIds.each { invoiceId -> terms = invoice.getRelated("InvoiceTerm", null, null, false); invoicesMap.terms = terms; - paymentAppls = delegator.findList("PaymentApplication", EntityCondition.makeCondition([invoiceId : invoiceId]), null, null, null, false); + paymentAppls = from("PaymentApplication").where('invoiceId', invoiceId).queryList(); invoicesMap.payments = paymentAppls; - orderItemBillings = delegator.findList("OrderItemBilling", EntityCondition.makeCondition([invoiceId : invoiceId]), null, ['orderId'], null, false); + orderItemBillings = from("OrderItemBilling").where('invoiceId', invoiceId).orderBy("orderId").queryList(); orders = new LinkedHashSet(); orderItemBillings.each { orderIb -> orders.add(orderIb.orderId); @@ -113,7 +113,7 @@ invoiceIds.each { invoiceId -> edit = parameters.editInvoice; if ("true".equalsIgnoreCase(edit)) { - invoiceItemTypes = delegator.findList("InvoiceItemType", null, null, null, null, false); + invoiceItemTypes = from("InvoiceItemType").queryList(); invoicesMap.invoiceItemTypes = invoiceItemTypes; invoicesMap.editInvoice = true; } Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy Sat Dec 20 04:31:20 2014 @@ -23,11 +23,11 @@ import javolution.util.FastMap; if (billingAccountId) { orderPaymentPreferencesList = []; - orderList = delegator.findByAnd("OrderHeader", [billingAccountId : billingAccountId], null, false); + orderList = from("OrderHeader").where('billingAccountId', billingAccountId).queryList(); if (orderList) { orderList.each { orderHeader -> orderId = orderHeader.orderId; - orderBillingAcc = EntityUtil.getFirst(delegator.findByAnd("OrderHeaderAndPaymentPref", [orderId : orderId], null, false)); + orderBillingAcc = from("OrderHeaderAndPaymentPref").where("orderId", orderId).queryFirst(); orderBillingAccMap = FastMap.newInstance(); if (orderBillingAcc.paymentMethodTypeId.equals("EXT_BILLACT") && orderBillingAcc.paymentStatusId.equals("PAYMENT_NOT_RECEIVED")) { orderBillingAccMap.putAll(orderBillingAcc); Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy Sat Dec 20 04:31:20 2014 @@ -24,7 +24,7 @@ partyId = parameters.partyId; currencyUomId = null; billingAccounts = []; if (partyId) { - billingAccountAndRoles = delegator.findByAnd("BillingAccountAndRole", [partyId : partyId], null, false); + billingAccountAndRoles = from("BillingAccountAndRole").where('partyId', partyId).queryList() if (billingAccountAndRoles) currencyUomId = billingAccountAndRoles.first().accountCurrencyUomId; if (currencyUomId) billingAccounts = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher); } Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy Sat Dec 20 04:31:20 2014 @@ -25,9 +25,7 @@ import org.ofbiz.entity.condition.Entity if ("Y".equals(parameters.noConditionFind)) { List exprListForParameters = []; - finAcctCond = EntityCondition.makeCondition([EntityCondition.makeCondition("finAccountId", EntityOperator.EQUALS, finAccountId), - EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "DIVISION")], EntityOperator.AND); - finAccountRoles = EntityUtil.filterByDate(delegator.findList("FinAccountRole", finAcctCond, null, null, null, false)); + finAccountRoles = from("FinAccountRole").where("finAccountId", finAccountId, "roleTypeId", "DIVISION").filterByDate().queryList(); finAccountPartyIds = EntityUtil.getFieldListFromEntityList(finAccountRoles, "partyId", true); finAccountPartyIds.add(organizationPartyId); partyCond = EntityCondition.makeCondition([EntityCondition.makeCondition("partyIdTo", EntityOperator.IN, finAccountPartyIds), @@ -50,12 +48,12 @@ if ("Y".equals(parameters.noConditionFin exprListForParameters.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null)); paramCond = EntityCondition.makeCondition(exprListForParameters, EntityOperator.AND); combinedPaymentCond = EntityCondition.makeCondition([partyCond, statusCond, paramCond], EntityOperator.AND); - payments = delegator.findList("PaymentAndTypePartyNameView", combinedPaymentCond, null, null, null, false); + payments = from("PaymentAndTypePartyNameView").where(combinedPaymentCond).queryList(); paymentListWithCreditCard = []; paymentListWithoutCreditCard = []; payments.each { payment -> 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/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy Sat Dec 20 04:31:20 2014 @@ -31,7 +31,7 @@ import org.ofbiz.entity.condition.Entity import java.math.*; paymentId = parameters.paymentId; -payment = delegator.findOne("Payment", [paymentId : paymentId], false); +payment = from("Payment").where("paymentId", paymentId).queryOne(); decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); @@ -51,13 +51,20 @@ actualCurrCond = EntityCondition.makeCon topCond = EntityCondition.makeCondition([partyCond, statusCond, currCond], EntityOperator.AND); topCondActual = EntityCondition.makeCondition([partyCond, statusCond, actualCurrCond], EntityOperator.AND); -fields = new HashSet(["invoiceId", "invoiceTypeId", "currencyUomId", "description", "invoiceDate"]); //retrieve invoices for the related parties which have not been (fully) applied yet and which have the same currency as the payment -invoices = delegator.findList("Invoice", topCond, fields, ["invoiceDate"], null, false); +invoices = select("invoiceId", "invoiceTypeId", "currencyUomId", "description", "invoiceDate") + .from("Invoice") + .where(topCond) + .orderBy("invoiceDate") + .queryList(); context.invoices = getInvoices(invoices, false); //retrieve invoices for the related parties which have not been (fully) applied yet and which have the same originalCurrency as the payment -invoices = delegator.findList("Invoice", topCondActual, fields, ["invoiceDate"], null, false); +invoices = select("invoiceId", "invoiceTypeId", "currencyUomId", "description", "invoiceDate") + .from("Invoice") + .where(topCondActual) + .orderBy("invoiceDate") + .queryList(); context.invoicesOtherCurrency = getInvoices(invoices, true); List getInvoices(List invoices, boolean actual) { Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy Sat Dec 20 04:31:20 2014 @@ -34,7 +34,7 @@ import org.ofbiz.entity.model.*; import java.text.NumberFormat; basePaymentId = parameters.paymentId; -basePayment = delegator.findOne("Payment", [paymentId : basePaymentId], false); +basePayment = from("Payment").where("paymentId", basePaymentId).queryOne(); decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); @@ -62,7 +62,7 @@ exprList.add(orCond); topCond = EntityCondition.makeCondition(exprList, EntityOperator.AND); -payments = delegator.findList("Payment", topCond, null, ["effectiveDate"], null, false); +payments = from("Payment").where(topCond).orderBy("effectiveDate").queryList() if (payments) { basePaymentApplied = PaymentWorker.getPaymentApplied(basePayment); Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy Sat Dec 20 04:31:20 2014 @@ -20,18 +20,18 @@ import org.ofbiz.base.util.*; // stores -productStores = delegator.findList("ProductStore", null, null, ["storeName"], null, true); +productStores = from("ProductStore").orderBy("storeName").cache(true).queryList(); context.productStores = productStores; // current store productStoreId = parameters.productStoreId; if (productStoreId) { - productStore = delegator.findOne("ProductStore", [productStoreId : productStoreId], false); + productStore = from("ProductStore").where("productStoreId", productStoreId).queryOne(); context.currentStore = productStore; } // payment settings -paymentSettings = delegator.findByAnd("Enumeration", [enumTypeId : "PRDS_PAYSVC"], ["sequenceId"], false); +paymentSettings = from("Enumeration").where("enumTypeId", "PRDS_PAYSVC").orderBy("sequenceId").queryList(); context.paymentSettings = paymentSettings; // payment method (for auto-fill) @@ -46,12 +46,12 @@ context.paymentMethodTypeId = paymentMet txType = parameters.transactionType; context.txType = txType; if (txType) { - currentTx = delegator.findOne("Enumeration", [enumId : txType], false); + currentTx = from("Enumeration").where("enumId", txType).queryOne(); context.currentTx = currentTx; } if (paymentMethodId) { - paymentMethod = delegator.findOne("PaymentMethod", [paymentMethodId : paymentMethodId], false); + paymentMethod = from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne(); if (paymentMethod) { // payment method type paymentMethodTypeId = paymentMethod.paymentMethodTypeId; @@ -82,7 +82,7 @@ if (paymentMethodId) { } if (paymentMethodTypeId) { - paymentMethodType = delegator.findOne("PaymentMethodType", [paymentMethodTypeId : paymentMethodTypeId], false); + paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne(); context.paymentMethodType = paymentMethodType; context.paymentMethodTypeId = paymentMethodTypeId; } Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy Sat Dec 20 04:31:20 2014 @@ -45,7 +45,7 @@ if (!security.hasEntityPermission("ACCOU // in the case of a single payment, the paymentId will be supplied paymentId = context.paymentId; if (paymentId) { - payment = delegator.findOne("Payment", [paymentId : paymentId], false); + payment = from("Payment").where("paymentId", paymentId).queryOne(); if (payment) payments.add(payment); context.payments = payments; return; @@ -54,12 +54,12 @@ if (paymentId) { // in the case of a multi form, parse the multi data and get all of the selected payments selected = UtilHttp.parseMultiFormData(parameters); selected.each { row -> - payment = delegator.findOne("Payment", [paymentId : row.paymentId], false); + payment = from("Payment").where("paymentId", row.paymentId).queryOne(); if (payment) { payments.add(payment); } } -paymentGroupMembers = EntityUtil.filterByDate(delegator.findList("PaymentGroupMember", EntityCondition.makeCondition("paymentGroupId", EntityOperator.EQUALS, parameters.paymentGroupId), null, null, null, false)); +paymentGroupMembers = from("PaymentGroupMember").where("paymentGroupId", parameters.paymentGroupId).filterByDate().queryList(); //in the case of a multiple payments, paymentId List is supplied. paymentGroupMembers.each { paymentGropupMember-> payments.add(paymentGropupMember.getRelatedOne("Payment", false)); Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy Sat Dec 20 04:31:20 2014 @@ -33,7 +33,7 @@ if (currentCustomTimePeriodId) { context.currentCustomTimePeriodId = currentCustomTimePeriodId; } -currentCustomTimePeriod = currentCustomTimePeriodId ? delegator.findOne("CustomTimePeriod", [customTimePeriodId : currentCustomTimePeriodId], false) : null; +currentCustomTimePeriod = currentCustomTimePeriodId ? from("CustomTimePeriod").where("customTimePeriodId", currentCustomTimePeriodId).queryOne() : null; if (currentCustomTimePeriod) { context.currentCustomTimePeriod = currentCustomTimePeriod; } @@ -47,13 +47,13 @@ findMap = [ : ]; if (findOrganizationPartyId) findMap.organizationPartyId = findOrganizationPartyId; if (currentCustomTimePeriodId) findMap.parentPeriodId = currentCustomTimePeriodId; -customTimePeriods = delegator.findByAnd("CustomTimePeriod", findMap, ["periodTypeId", "periodNum", "fromDate"], false); +customTimePeriods = from("CustomTimePeriod").where(findMap).orderBy(["periodTypeId", "periodNum", "fromDate"]).queryList(); context.customTimePeriods = customTimePeriods; -allCustomTimePeriods = delegator.findList("CustomTimePeriod", null, null, ["organizationPartyId", "parentPeriodId", "periodTypeId", "periodNum", "fromDate"], null, false); +allCustomTimePeriods = from("CustomTimePeriod").orderBy(["organizationPartyId", "parentPeriodId", "periodTypeId", "periodNum", "fromDate"]).queryList(); context.allCustomTimePeriods = allCustomTimePeriods; -periodTypes = delegator.findList("PeriodType", null, null, ["description"], null, true); +periodTypes = from("PeriodType").orderBy("description").cache(true).queryList(); context.periodTypes = periodTypes; newPeriodTypeId = "FISCAL_YEAR"; Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy Sat Dec 20 04:31:20 2014 @@ -45,23 +45,23 @@ List partyIds = PartyWorker.getAssociate partyIds.add(organizationPartyId); // Get the group of account classes that will be used to position accounts in the proper section of the financial statement -GenericValue assetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "ASSET"), true); +GenericValue assetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ASSET").cache(true).queryOne(); List assetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(assetGlAccountClass); -GenericValue contraAssetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CONTRA_ASSET"), true); +GenericValue contraAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CONTRA_ASSET").cache(true).queryOne(); List contraAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraAssetGlAccountClass); -GenericValue liabilityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "LIABILITY"), true); +GenericValue liabilityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "LIABILITY").cache(true).queryOne(); List liabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(liabilityGlAccountClass); -GenericValue equityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "EQUITY"), true); +GenericValue equityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "EQUITY").cache(true).queryOne(); List equityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(equityGlAccountClass); -GenericValue currentAssetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CURRENT_ASSET"), true); +GenericValue currentAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CURRENT_ASSET").cache(true).queryOne(); List currentAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentAssetGlAccountClass); -GenericValue longtermAssetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "LONGTERM_ASSET"), true); +GenericValue longtermAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "LONGTERM_ASSET").cache(true).queryOne(); List longtermAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(longtermAssetGlAccountClass); -GenericValue currentLiabilityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CURRENT_LIABILITY"), true); +GenericValue currentLiabilityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CURRENT_LIABILITY").cache(true).queryOne(); List currentLiabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentLiabilityGlAccountClass); -GenericValue accumDepreciationGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "ACCUM_DEPRECIATION"), true); +GenericValue accumDepreciationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ACCUM_DEPRECIATION").cache(true).queryOne(); List accumDepreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumDepreciationGlAccountClass); -GenericValue accumAmortizationGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "ACCUM_AMORTIZATION"), true); +GenericValue accumAmortizationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ACCUM_AMORTIZATION").cache(true).queryOne(); List accumAmortizationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumAmortizationGlAccountClass); // 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 @@ -85,7 +85,7 @@ if (lastClosedTimePeriod) { timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, assetAccountClassIds)); timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO)); timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId)); - List lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false); + List lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList(); lastTimePeriodHistories.each { lastTimePeriodHistory -> Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits")); assetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap); @@ -95,7 +95,7 @@ if (lastClosedTimePeriod) { timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraAssetAccountClassIds)); timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO)); timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId)); - lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false); + lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList(); lastTimePeriodHistories.each { lastTimePeriodHistory -> Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits")); contraAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap); @@ -105,7 +105,7 @@ if (lastClosedTimePeriod) { timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, liabilityAccountClassIds)); timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO)); timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId)); - lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false); + lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList(); lastTimePeriodHistories.each { lastTimePeriodHistory -> Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits")); liabilityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap); @@ -115,7 +115,7 @@ if (lastClosedTimePeriod) { timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, equityAccountClassIds)); timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO)); timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId)); - lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false); + lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList(); lastTimePeriodHistories.each { lastTimePeriodHistory -> Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits")); equityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap); @@ -125,7 +125,7 @@ if (lastClosedTimePeriod) { timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds)); timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO)); timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId)); - lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false); + lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList(); lastTimePeriodHistories.each { lastTimePeriodHistory -> Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits")); currentAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap); @@ -135,7 +135,7 @@ if (lastClosedTimePeriod) { timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longtermAssetAccountClassIds)); timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO)); timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId)); - lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false); + lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList(); lastTimePeriodHistories.each { lastTimePeriodHistory -> Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits")); longtermAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap); @@ -145,7 +145,7 @@ if (lastClosedTimePeriod) { timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds)); timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO)); timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId)); - lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false); + lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList(); lastTimePeriodHistories.each { lastTimePeriodHistory -> Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits")); currentLiabilityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap); @@ -169,8 +169,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List assetAndExprs = FastList.newInstance(mainAndExprs); assetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, assetAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(assetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); - +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(assetAndExprs).orderBy("glAccountId").queryList(); transactionTotalsMap = [:]; transactionTotalsMap.putAll(assetOpeningBalances); transactionTotals.each { transactionTotal -> @@ -206,7 +205,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List currentAssetAndExprs = FastList.newInstance(mainAndExprs); currentAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(currentAssetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(currentAssetAndExprs).orderBy("glAccountId").queryList(); transactionTotalsMap = [:]; transactionTotalsMap.putAll(currentAssetOpeningBalances); transactionTotals.each { transactionTotal -> @@ -241,7 +240,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List longtermAssetAndExprs = FastList.newInstance(mainAndExprs); longtermAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longtermAssetAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(longtermAssetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").orderBy("glAccountId").queryList(); transactionTotalsMap = [:]; transactionTotalsMap.putAll(longtermAssetOpeningBalances); transactionTotals.each { transactionTotal -> @@ -276,7 +275,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List contraAssetAndExprs = FastList.newInstance(mainAndExprs); contraAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraAssetAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(contraAssetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(contraAssetAndExprs).orderBy("glAccountId").queryList(); transactionTotalsMap = [:]; transactionTotalsMap.putAll(contraAssetOpeningBalances); @@ -317,7 +316,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List liabilityAndExprs = FastList.newInstance(mainAndExprs); liabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, liabilityAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(liabilityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(liabilityAndExprs).orderBy("glAccountId").queryList(); transactionTotalsMap = [:]; transactionTotalsMap.putAll(liabilityOpeningBalances); transactionTotals.each { transactionTotal -> @@ -353,7 +352,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List currentLiabilityAndExprs = FastList.newInstance(mainAndExprs); currentLiabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(currentLiabilityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(currentLiabilityAndExprs).orderBy("glAccountId").queryList(); transactionTotalsMap = [:]; transactionTotalsMap.putAll(currentLiabilityOpeningBalances); transactionTotals.each { transactionTotal -> @@ -388,7 +387,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List equityAndExprs = FastList.newInstance(mainAndExprs); equityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, equityAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(equityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(equityAndExprs).orderBy("glAccountId").queryList(); transactionTotalsMap = [:]; transactionTotalsMap.putAll(equityOpeningBalances); transactionTotals.each { transactionTotal -> @@ -412,7 +411,7 @@ transactionTotals.each { transactionTota // Add the "retained earnings" account Map netIncomeResult = runService('prepareIncomeStatement', ["organizationPartyId": organizationPartyId, "glFiscalTypeId": glFiscalTypeId, "fromDate": fromDate, "thruDate": thruDate, "userLogin": userLogin]); BigDecimal netIncome = (BigDecimal)netIncomeResult.totalNetIncome; -GenericValue retainedEarningsAccount = delegator.findOne("GlAccountTypeDefault", UtilMisc.toMap("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", organizationPartyId), true); +GenericValue retainedEarningsAccount = from("GlAccountTypeDefault").where("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", organizationPartyId).cache(true).queryOne(); if (retainedEarningsAccount) { GenericValue retainedEarningsGlAccount = retainedEarningsAccount.getRelatedOne("GlAccount", false); transactionTotalsMap.put(retainedEarningsGlAccount.glAccountId, UtilMisc.toMap("glAccountId", retainedEarningsGlAccount.glAccountId,"accountName", retainedEarningsGlAccount.accountName, "accountCode", retainedEarningsGlAccount.accountCode, "balance", netIncome)); Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy Sat Dec 20 04:31:20 2014 @@ -50,7 +50,7 @@ List partyIds = PartyWorker.getAssociate partyIds.add(organizationPartyId); // Get the group of account classes that will be used to position accounts in the proper section of the Cash Flow statement -GenericValue glAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CASH_EQUIVALENT"), true); +GenericValue glAccountClass = from("GlAccountClass").where("glAccountClassId", "CASH_EQUIVALENT").cache(true).queryOne(); List glAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(glAccountClass); List cashFlowBalanceTotalList = []; @@ -70,7 +70,7 @@ if (lastClosedTimePeriod) { timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, glAccountClassIds)); timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO)); timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId)); - List lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false); + List lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList(); lastTimePeriodHistories.each { lastTimePeriodHistory -> Map accountMap = ["glAccountId":lastTimePeriodHistory.glAccountId, "accountCode":lastTimePeriodHistory.accountCode, "accountName":lastTimePeriodHistory.accountName, "balance":lastTimePeriodHistory.getBigDecimal("endingBalance"), "D":lastTimePeriodHistory.getBigDecimal("postedDebits"), "C":lastTimePeriodHistory.getBigDecimal("postedCredits")]; openingCashBalances.(lastTimePeriodHistory.glAccountId) = accountMap; @@ -90,7 +90,7 @@ balanceTotal = BigDecimal.ZERO; List openingCashBalanceAndExprs = FastList.newInstance(mainAndExprs); openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, periodClosingFromDate)); openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, parametersFromDate)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(openingCashBalanceAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(openingCashBalanceAndExprs).orderBy("glAccountId").queryList(); transactionTotalsMap = [:]; transactionTotalsMap.putAll(openingCashBalances); transactionTotals.each { transactionTotal -> @@ -135,7 +135,7 @@ balanceTotal = BigDecimal.ZERO; List periodCashBalanceAndExprs = FastList.newInstance(mainAndExprs); periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, parametersFromDate)); periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(periodCashBalanceAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(periodCashBalanceAndExprs).orderBy("glAccountId").queryList(); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; @@ -214,7 +214,7 @@ context.closingCashBalanceList.add("acco if (closingTransactionKeySet) { closingTransactionKeySet.removeAll(openingTransactionKeySet); closingTransactionKeySet.each { closingTransactionKey -> - glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", closingTransactionKey), true); + glAccount = from("GlAccount").where("glAccountId", closingTransactionKey).cache(true).queryOne(); context.openingCashBalanceList.add(["glAccountId":glAccount.glAccountId, "accountName":glAccount.accountName, accountCode:glAccount.accountCode, balance:BigDecimal.ZERO, D:BigDecimal.ZERO, C:BigDecimal.ZERO]); } } Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy Sat Dec 20 04:31:20 2014 @@ -48,9 +48,9 @@ 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 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(andCond).orderBy("glAccountId").queryList(); if (postedTransactionTotals) { - glAccountCategories = delegator.findByAnd("GlAccountCategory", [glAccountCategoryTypeId : 'COST_CENTER'], ['glAccountCategoryId'], false); + glAccountCategories = from("GlAccountCategory").where("glAccountCategoryTypeId", "COST_CENTER").orderBy("glAccountCategoryId").queryList(); context.glAccountCategories = glAccountCategories; Map postedTransactionTotalsMap = [:] postedTransactionTotals.each { postedTransactionTotal -> @@ -67,7 +67,7 @@ if (postedTransactionTotals) { BigDecimal balance = debitAmount.subtract(creditAmount); accountMap.put("balance", balance); glAccountCategories.each { glAccountCategory -> - glAccountCategoryMember = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("GlAccountCategoryMember", [glAccountCategoryId : glAccountCategory.glAccountCategoryId, glAccountId: postedTransactionTotal.glAccountId], ['glAccountCategoryId'], false))); + glAccountCategoryMember = from("GlAccountCategoryMember").where("glAccountCategoryId", glAccountCategory.glAccountCategoryId, "glAccountId", postedTransactionTotal.glAccountId).orderBy("glAccountCategoryId").filterByDate().queryFirst(); if (glAccountCategoryMember) { BigDecimal glAccountCategorySharePercentage = glAccountCategoryMember.amountPercentage; if (glAccountCategorySharePercentage && glAccountCategorySharePercentage != BigDecimal.ZERO ) { Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy Sat Dec 20 04:31:20 2014 @@ -33,9 +33,9 @@ if (organizationPartyId) { } decimals = UtilNumber.getBigDecimalScale("ledger.decimals"); rounding = UtilNumber.getBigDecimalRoundingMode("ledger.rounding"); - context.currentOrganization = delegator.findOne("PartyNameView", [partyId : organizationPartyId], false); + context.currentOrganization = from("PartyNameView").where("partyId", organizationPartyId).queryOne(); if (parameters.glAccountId) { - glAccount = delegator.findOne("GlAccount", [glAccountId : parameters.glAccountId], false); + glAccount = from("GlAccount").where("glAccountId", parameters.glAccountId).queryOne(); isDebitAccount = UtilAccounting.isDebitAccount(glAccount); context.isDebitAccount = isDebitAccount; context.glAccount = glAccount; @@ -45,12 +45,11 @@ if (organizationPartyId) { BigDecimal balanceOfTheAcctgForYear = BigDecimal.ZERO; if (parameters.timePeriod) { - currentTimePeriod = delegator.findOne("CustomTimePeriod", [customTimePeriodId : parameters.timePeriod], false); + currentTimePeriod = from("CustomTimePeriod").where("customTimePeriodId", parameters.timePeriod).queryOne(); previousTimePeriodResult = runService('getPreviousTimePeriod', [customTimePeriodId : parameters.timePeriod, userLogin : userLogin]); previousTimePeriod = previousTimePeriodResult.previousTimePeriod; if (UtilValidate.isNotEmpty(previousTimePeriod)) { - glAccountHistory = delegator.findOne("GlAccountHistory", - [customTimePeriodId : previousTimePeriod.customTimePeriodId, glAccountId : parameters.glAccountId, organizationPartyId : organizationPartyId], false); + glAccountHistory = from("GlAccountHistory").where("customTimePeriodId", previousTimePeriod.customTimePeriodId, "glAccountId", parameters.glAccountId, "organizationPartyId", organizationPartyId).queryOne(); if (glAccountHistory && glAccountHistory.endingBalance != null) { context.openingBalance = glAccountHistory.endingBalance; balanceOfTheAcctgForYear = glAccountHistory.endingBalance; Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy Sat Dec 20 04:31:20 2014 @@ -42,19 +42,19 @@ List partyIds = PartyWorker.getAssociate partyIds.add(organizationPartyId); // Get the group of account classes that will be used to position accounts in the proper section of the financial statement -GenericValue revenueGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "REVENUE"), true); +GenericValue revenueGlAccountClass = from("GlAccountClass").where("glAccountClassId", "REVENUE").cache(true).queryOne(); List revenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(revenueGlAccountClass); -GenericValue contraRevenueGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CONTRA_REVENUE"), true); +GenericValue contraRevenueGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CONTRA_REVENUE").cache(true).queryOne(); List contraRevenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraRevenueGlAccountClass); -GenericValue incomeGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "INCOME"), true); +GenericValue incomeGlAccountClass = from("GlAccountClass").where("glAccountClassId", "INCOME").cache(true).queryOne(); List incomeAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(incomeGlAccountClass); -GenericValue expenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "EXPENSE"), true); +GenericValue expenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "EXPENSE").cache(true).queryOne(); List expenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(expenseGlAccountClass); -GenericValue cogsExpenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "COGS_EXPENSE"), true); +GenericValue cogsExpenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "COGS_EXPENSE").cache(true).queryOne(); List cogsExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(cogsExpenseGlAccountClass); -GenericValue sgaExpenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "SGA_EXPENSE"), true); +GenericValue sgaExpenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "SGA_EXPENSE").cache(true).queryList(); List sgaExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(sgaExpenseGlAccountClass); -GenericValue depreciationGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "DEPRECIATION"), true); +GenericValue depreciationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "DEPRECIATION").cache(true).queryOne(); List depreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(depreciationGlAccountClass); List mainAndExprs = FastList.newInstance(); @@ -74,7 +74,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List revenueAndExprs = FastList.newInstance(mainAndExprs); revenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, revenueAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(revenueAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(revenueAndExprs).orderBy("glAccountId").queryList(); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; @@ -117,7 +117,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List contraRevenueAndExprs = FastList.newInstance(mainAndExprs); contraRevenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraRevenueAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(contraRevenueAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(contraRevenueAndExprs).orderBy("glAccountId").queryList(); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; @@ -159,7 +159,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List expenseAndExprs = FastList.newInstance(mainAndExprs); expenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, expenseAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(expenseAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(expenseAndExprs).queryList(); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; @@ -202,7 +202,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List cogsExpenseAndExprs = FastList.newInstance(mainAndExprs); cogsExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, cogsExpenseAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(cogsExpenseAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(cogsExpenseAndExprs).orderBy("glAccountId").queryList(); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; @@ -244,7 +244,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List sgaExpenseAndExprs = FastList.newInstance(mainAndExprs); sgaExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, sgaExpenseAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(sgaExpenseAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(sgaExpenseAndExprs).orderBy("glAccountId").queryList(); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; @@ -285,7 +285,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List depreciationAndExprs = FastList.newInstance(mainAndExprs); depreciationAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, depreciationAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(depreciationAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(depreciationAndExprs).orderBy("glAccountId").queryList(); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; @@ -326,7 +326,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List incomeAndExprs = FastList.newInstance(mainAndExprs); incomeAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, incomeAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(incomeAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(incomeAndExprs).orderBy("glAccountId").queryList(); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; |
Free forum by Nabble | Edit this page |