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
This commit is contained in:
Jacques Le Roux
2015-08-28 05:09:35 +00:00
parent 51070abdc0
commit 9dfeb048dc
@@ -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;
}
}
}