From 9dfeb048dc1ff80dcd16579fb043666835fd21d6 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Fri, 28 Aug 2015 05:09:35 +0000 Subject: [PATCH] A patch from Wai for "simple coding cleanup" https://issues.apache.org/jira/browse/OFBIZ-6583 This fixes and improves CompanyHeader.groovy git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1698259 13f79535-47bb-0310-9956-ffa450edef68 --- .../actions/order/CompanyHeader.groovy | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy b/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy index a818693a7b..28db48808a 100644 --- a/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy +++ b/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy @@ -45,7 +45,7 @@ if (!orderHeader && orderId) { if (parameters.facilityId) { response.setHeader("Content-Disposition","attachment; filename=\"PickSheet" + orderId + ".pdf" + "\";"); } else { - response.setHeader("Content-Disposition","attachment; filename=\"" + orderId + ".pdf" + "\";"); + response.setHeader("Content-Disposition","attachment; filename=\"" + orderId + ".pdf" + "\";"); } } else if (shipmentId) { shipment = from("Shipment").where("shipmentId", shipmentId).queryOne(); @@ -138,7 +138,7 @@ if (partyGroup) { } //If logoImageUrl not null then only set it to context else it will override the default value "/images/ofbiz_powered.gif" if (logoImageUrl) { - context.logoImageUrl = logoImageUrl; + //context.logoImageUrl = logoImageUrl; } // the company name @@ -213,28 +213,28 @@ if (emails) { // website websiteUrls = from("PartyContactWithPurpose") - .where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_WEB_URLs") + .where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_WEB_URL") .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") .queryList(); if (websiteUrls) { websiteUrl = EntityUtil.getFirst(websiteUrls); context.website = from("ContactMech").where("contactMechId", websiteUrl.contactMechId).queryOne(); } else { //get web address from party contact mech -selContacts = from("PartyContactMech") - .where("partyId", partyId) - .filterByDate(nowTimestamp, "fromDate", "thruDate") - .queryList(); -if (selContacts) { - Iterator i = selContacts.iterator(); - while (i.hasNext()) { - website = i.next().getRelatedOne("ContactMech", false); - if ("WEB_ADDRESS".equals(website.contactMechTypeId)) { - context.website = website; - break; + selContacts = from("PartyContactMech") + .where("partyId", partyId) + .filterByDate(nowTimestamp, "fromDate", "thruDate") + .queryList(); + if (selContacts) { + Iterator i = selContacts.iterator(); + while (i.hasNext()) { + website = i.next().getRelatedOne("ContactMech", false); + if ("WEB_ADDRESS".equals(website.contactMechTypeId)) { + context.website = website; + break; + } } } } -} //Bank account selPayments = from("PaymentMethod") @@ -246,7 +246,9 @@ if (selPayments) { } // Tax ID Info -partyTaxAuthInfoList = from("PartyTaxAuthInfo").where("partyId", partyId).queryList(); +partyTaxAuthInfoList = from("PartyTaxAuthInfo").where("partyId", partyId) + .filterByDate(nowTimestamp, "fromDate", "thruDate") + .queryList(); if (partyTaxAuthInfoList) { if (address.countryGeoId) { // if we have an address with country filter by that @@ -259,4 +261,4 @@ if (partyTaxAuthInfoList) { // otherwise just grab the first one context.sendingPartyTaxId = partyTaxAuthInfoList[0].partyTaxId; } -} +} \ No newline at end of file