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/08/28 07:09:36 UTC

svn commit: r1698259 - /ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy

Author: jleroux
Date: Fri Aug 28 05:09:35 2015
New Revision: 1698259

URL: http://svn.apache.org/r1698259
Log:
A patch from Wai for "simple coding cleanup" https://issues.apache.org/jira/browse/OFBIZ-6583

This fixes and improves CompanyHeader.groovy

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy?rev=1698259&r1=1698258&r2=1698259&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy Fri Aug 28 05:09:35 2015
@@ -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