This is an automated email from the ASF dual-hosted git repository.

jamesyong pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e3e12ee  Improved: No need to specify externalKeyParam in ofbizUrl 
calls (OFBIZ-11711)
e3e12ee is described below

commit e3e12ee4870aa53874d6773a27473b7dcbefec30
Author: James Yong <jamesy...@apache.org>
AuthorDate: Sun May 17 20:37:48 2020 +0800

    Improved: No need to specify externalKeyParam in ofbizUrl calls 
(OFBIZ-11711)
    
    Let ofbizUrl macro generates externalLoginKey when needed.
    
    Thanks: Jacques for review
---
 .../manufacturing/template/bom/BomSimulation.ftl   |  4 +--
 applications/order/template/entry/CheckInits.ftl   |  4 +--
 .../order/template/entry/OrderShortcuts.ftl        |  4 +--
 .../order/template/entry/cart/ShowCartItems.ftl    |  2 +-
 .../order/template/entry/catalog/EditProduct.ftl   |  2 +-
 applications/order/template/order/OrderInfo.ftl    |  6 ++--
 applications/order/template/order/OrderItems.ftl   | 20 ++++++-------
 .../order/template/order/OrderPaymentInfo.ftl      | 34 +++++++++++-----------
 .../order/template/order/OrderShippingInfo.ftl     |  6 ++--
 applications/order/template/return/QuickReturn.ftl |  2 +-
 applications/order/template/return/ReturnItems.ftl | 10 +++----
 applications/order/template/task/OrderTaskList.ftl |  2 +-
 .../template/party/profileblocks/FinAccounts.ftl   |  2 +-
 .../party/profileblocks/PaymentMethods.ftl         |  2 +-
 .../product/template/facility/PicklistOptions.ftl  |  6 ++--
 .../template/inventory/ReceiveInventory.ftl        |  6 ++--
 .../template/product/EditProductInventoryItems.ftl |  8 ++---
 .../product/template/returns/ReceiveReturn.ftl     |  8 ++---
 .../product/template/shipment/PackOrder.ftl        | 12 ++++----
 .../product/template/shipment/VerifyPick.ftl       |  6 ++--
 .../product/template/shipment/WeightPackage.ftl    |  4 +--
 .../webapp/control/ExternalLoginKeysManager.java   | 33 ++++++++++++++++-----
 .../ofbiz/webapp/control/RequestHandler.java       | 20 ++++++++++---
 .../apache/ofbiz/webapp/ftl/OfbizUrlTransform.java |  1 +
 .../ofbiz/widget/renderer/ScreenRenderer.java      |  2 +-
 themes/bluelight/template/Header.ftl               |  2 +-
 themes/tomahawk/template/AppBarClose.ftl           |  2 +-
 27 files changed, 121 insertions(+), 89 deletions(-)

diff --git a/applications/manufacturing/template/bom/BomSimulation.ftl 
b/applications/manufacturing/template/bom/BomSimulation.ftl
index 723e4c8..763f887 100644
--- a/applications/manufacturing/template/bom/BomSimulation.ftl
+++ b/applications/manufacturing/template/bom/BomSimulation.ftl
@@ -110,7 +110,7 @@ under the License.
           <#list productsData as productData>
             <#assign node = productData.node>
             <tr valign="middle"<#if alt_row> class="alternate-row"</#if>>
-              <td><a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${node.product.productId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${node.product.productId}</a></td>
+              <td><a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${node.product.productId}</@ofbizUrl>"
 class="buttontext">${node.product.productId}</a></td>
               <td>${node.product.internalName?default("&nbsp;")}</td>
               <td align="right">${node.quantity}</td>
               <td align="right">${productData.qoh!}</td>
@@ -118,7 +118,7 @@ under the License.
               <#if productData.unitCost?? && (productData.unitCost > 0)>
               <td align="right">${productData.unitCost!}</td>
               <#else>
-              <td align="right"><a href="<@ofbizUrl 
controlPath="/catalog/control">EditProductCosts?productId=${node.product.productId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">NA</a></td>
+              <td align="right"><a href="<@ofbizUrl 
controlPath="/catalog/control">EditProductCosts?productId=${node.product.productId}</@ofbizUrl>"
 class="buttontext">NA</a></td>
               </#if>
               <td align="right">${productData.totalCost!}</td>
             </tr>
diff --git a/applications/order/template/entry/CheckInits.ftl 
b/applications/order/template/entry/CheckInits.ftl
index fe4c0db..5317c70 100644
--- a/applications/order/template/entry/CheckInits.ftl
+++ b/applications/order/template/entry/CheckInits.ftl
@@ -40,7 +40,7 @@ under the License.
         <div class="basic-nav">
           <ul>
             <li><a 
href="javascript:document.salesentryform.submit();">${uiLabelMap.CommonContinue}</a></li>
-            <li><a href="<@ofbizUrl 
controlPath="/partymgr/control">findparty?${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>">${uiLabelMap.PartyFindParty}</a></li>
+            <li><a href="<@ofbizUrl 
controlPath="/partymgr/control">findparty</@ofbizUrl>">${uiLabelMap.PartyFindParty}</a></li>
           </ul>
         </div>
       </ul>
@@ -126,7 +126,7 @@ under the License.
         <div class="basic-nav">
           <ul>
             <li><a 
href="javascript:document.poentryform.submit();">${uiLabelMap.CommonContinue}</a></li>
-            <li><a href="<@ofbizUrl 
controlPath="/partymgr/control">findparty?${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>">${uiLabelMap.PartyFindParty}</a></li>
+            <li><a href="<@ofbizUrl 
controlPath="/partymgr/control">findparty</@ofbizUrl>">${uiLabelMap.PartyFindParty}</a></li>
           </ul>
         </div>
       </ul>
diff --git a/applications/order/template/entry/OrderShortcuts.ftl 
b/applications/order/template/entry/OrderShortcuts.ftl
index cafc93a..130fcc4 100644
--- a/applications/order/template/entry/OrderShortcuts.ftl
+++ b/applications/order/template/entry/OrderShortcuts.ftl
@@ -36,13 +36,13 @@ under the License.
             <#if "SALES_ORDER" == shoppingCart.getOrderType()>
               <li><a 
href="<@ofbizUrl>createCustRequestFromCart?destroyCart=Y</@ofbizUrl>" 
class="buttontext">${uiLabelMap.OrderCreateCustRequestFromCart}</a></li>
             </#if>
-            <li><a href="<@ofbizUrl 
controlPath="/partymgr/control">findparty?${externalKeyParam!}</@ofbizUrl>" 
class="buttontext">${uiLabelMap.PartyFindParty}</a></li>
+            <li><a href="<@ofbizUrl 
controlPath="/partymgr/control">findparty?</@ofbizUrl>" 
class="buttontext">${uiLabelMap.PartyFindParty}</a></li>
             <#if "SALES_ORDER" == shoppingCart.getOrderType()>
               <li><a href="<@ofbizUrl>setCustomer</@ofbizUrl>" 
class="buttontext">${uiLabelMap.PartyCreateNewCustomer}</a></li>
             </#if>
             <li><a href="<@ofbizUrl>checkinits</@ofbizUrl>" 
class="buttontext">${uiLabelMap.PartyChangeParty}</a></li>
             <#if security.hasEntityPermission("CATALOG", "_CREATE", session)>
-               <li><a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?${externalKeyParam!}</@ofbizUrl>" 
target="catalog" 
class="buttontext">${uiLabelMap.ProductCreateNewProduct}</a></li>
+               <li><a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?</@ofbizUrl>" target="catalog" 
class="buttontext">${uiLabelMap.ProductCreateNewProduct}</a></li>
             </#if>
             <li><a href="<@ofbizUrl>quickadd</@ofbizUrl>" 
class="buttontext">${uiLabelMap.OrderQuickAdd}</a></li>
             <#if shoppingLists??>
diff --git a/applications/order/template/entry/cart/ShowCartItems.ftl 
b/applications/order/template/entry/cart/ShowCartItems.ftl
index 0c9b1d5..eebeb57 100644
--- a/applications/order/template/entry/cart/ShowCartItems.ftl
+++ b/applications/order/template/entry/cart/ShowCartItems.ftl
@@ -109,7 +109,7 @@ under the License.
                     <#if cartLine.getAttribute("surveyResponses")?has_content>
                         <br />Surveys:
                        <#list cartLine.getAttribute("surveyResponses") as 
surveyResponseId>
-                        <a href="<@ofbizUrl 
controlPath="/content/control">ViewSurveyResponses?surveyResponseId=${surveyResponseId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" style="font-size: xx-small;">${surveyResponseId}</a>
+                        <a href="<@ofbizUrl 
controlPath="/content/control">ViewSurveyResponses?surveyResponseId=${surveyResponseId}</@ofbizUrl>"
 class="buttontext" style="font-size: xx-small;">${surveyResponseId}</a>
                        </#list>
                     </#if>
                 </div>
diff --git a/applications/order/template/entry/catalog/EditProduct.ftl 
b/applications/order/template/entry/catalog/EditProduct.ftl
index 7f10eb5..707568a 100644
--- a/applications/order/template/entry/catalog/EditProduct.ftl
+++ b/applications/order/template/entry/catalog/EditProduct.ftl
@@ -19,6 +19,6 @@ under the License.
 
 <#if security.hasEntityPermission("CATALOG", "_CREATE", session)>
 <div>
-<a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${productId}${externalKeyParam!}</@ofbizUrl>"
 target="catalog" class="buttontext">${uiLabelMap.ProductEditProduct}</a>
+<a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${productId}</@ofbizUrl>" 
target="catalog" class="buttontext">${uiLabelMap.ProductEditProduct}</a>
 </div>
 </#if>
diff --git a/applications/order/template/order/OrderInfo.ftl 
b/applications/order/template/order/OrderInfo.ftl
index 313bc70..1e74f87 100644
--- a/applications/order/template/order/OrderInfo.ftl
+++ b/applications/order/template/order/OrderInfo.ftl
@@ -161,7 +161,7 @@ under the License.
               <tr>
                 <td class="label">&nbsp;${uiLabelMap.OrderProductStore}</td>
                 <td>
-                  ${productStore.storeName!}&nbsp;<a href="<@ofbizUrl 
controlPath="/catalog/control">EditProductStore?productStoreId=${productStore.productStoreId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="catalogmgr" class="buttontext">(${productStore.productStoreId})</a>
+                  ${productStore.storeName!}&nbsp;<a href="<@ofbizUrl 
controlPath="/catalog/control">EditProductStore?productStoreId=${productStore.productStoreId}</@ofbizUrl>"
 target="catalogmgr" class="buttontext">(${productStore.productStoreId})</a>
                 </td>
               </tr>
               <tr><td colspan="3"><hr /></td></tr>
@@ -170,7 +170,7 @@ under the License.
               <td class="label">&nbsp;${uiLabelMap.OrderOriginFacility}</td>
               <td>
                   <#if orderHeader.originFacilityId?has_content>
-                    <a href="<@ofbizUrl 
controlPath="/facility/control">EditFacility?facilityId=${orderHeader.originFacilityId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="facilitymgr" class="buttontext">${orderHeader.originFacilityId}</a>
+                    <a href="<@ofbizUrl 
controlPath="/facility/control">EditFacility?facilityId=${orderHeader.originFacilityId}</@ofbizUrl>"
 target="facilitymgr" class="buttontext">${orderHeader.originFacilityId}</a>
                   <#else>
                     ${uiLabelMap.CommonNA}
                   </#if>
@@ -181,7 +181,7 @@ under the License.
               <td class="label">&nbsp;${uiLabelMap.CommonCreatedBy}</td>
               <td>
                   <#if orderHeader.createdBy?has_content>
-                    <a href="<@ofbizUrl 
controlPath="/partymgr/control">viewprofile?userlogin_id=${orderHeader.createdBy}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="partymgr" class="buttontext">${orderHeader.createdBy}</a>
+                    <a href="<@ofbizUrl 
controlPath="/partymgr/control">viewprofile?userlogin_id=${orderHeader.createdBy}</@ofbizUrl>"
 target="partymgr" class="buttontext">${orderHeader.createdBy}</a>
                   <#else>
                     ${uiLabelMap.CommonNotSet}
                   </#if>
diff --git a/applications/order/template/order/OrderItems.ftl 
b/applications/order/template/order/OrderItems.ftl
index ffbf1eb..0c16674 100644
--- a/applications/order/template/order/OrderItems.ftl
+++ b/applications/order/template/order/OrderItems.ftl
@@ -87,7 +87,7 @@ under the License.
                                                 <a href="<@ofbizUrl 
controlPath="/content/control">ViewSimpleContent?contentId=${downloadContent.contentId}</@ofbizUrl>"
 class="buttontext" target="_blank">${uiLabelMap.ContentDownload}</a>&nbsp;
                                             </#list>
                                         </#if>
-                                        <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${productId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" target="_blank">${uiLabelMap.ProductCatalog}</a>
+                                        <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${productId}</@ofbizUrl>" 
class="buttontext" target="_blank">${uiLabelMap.ProductCatalog}</a>
                                         <a href="<@ofbizUrl 
controlPath="/ecommerce/control">product?product_id=${productId}</@ofbizUrl>" 
class="buttontext" target="_blank">${uiLabelMap.OrderEcommerce}</a>
                                         <#if 
orderItemContentWrapper.get("IMAGE_URL", "url")?has_content>
                                             <a 
href="<@ofbizUrl>viewimage?orderId=${orderId}&amp;orderItemSeqId=${orderItem.orderItemSeqId}&amp;orderContentTypeId=IMAGE_URL</@ofbizUrl>"
@@ -349,7 +349,7 @@ under the License.
                                     <td colspan="6">
                                         <#if orderItem.orderItemTypeId != 
"RENTAL_ORDER_ITEM">
                                             <span 
class="label">${uiLabelMap.ManufacturingProductionRun}</span>
-                                            <a href="<@ofbizUrl 
controlPath="/manufacturing/control">ShowProductionRun?productionRunId=${workEffort.workEffortId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
+                                            <a href="<@ofbizUrl 
controlPath="/manufacturing/control">ShowProductionRun?productionRunId=${workEffort.workEffortId}</@ofbizUrl>"
                                                 
class="buttontext">${workEffort.workEffortId}</a>
                                             ${uiLabelMap.OrderCurrentStatus}
                                             ${(delegator.findOne("StatusItem", 
Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("statusId", 
workEffort.getString("currentStatusId")), true).get("description",locale))!}
@@ -439,7 +439,7 @@ under the License.
                                             
(${orderItemAdjustment.comments?default("")})
                                         </#if>
                                         <#if 
orderItemAdjustment.productPromoId?has_content>
-                                            <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProductPromo?productPromoId=${orderItemAdjustment.productPromoId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
+                                            <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProductPromo?productPromoId=${orderItemAdjustment.productPromoId}</@ofbizUrl>"
                                                 
>${orderItemAdjustment.getRelatedOne("ProductPromo", 
false).getString("promoName")}</a>
                                         </#if>
                                         <#if "SALES_TAX" == 
orderItemAdjustment.orderAdjustmentTypeId>
@@ -504,7 +504,7 @@ under the License.
                                 <tr<#if "1" == itemClass> 
class="alternate-row"</#if>>
                                     <td align="right" colspan="2">
                                         <span 
class="label">${uiLabelMap.CommonSurveys}</span>&nbsp;
-                                        <a href="<@ofbizUrl 
controlPath="/content/control">ViewSurveyResponses?surveyResponseId=${survey.surveyResponseId}&amp;surveyId=${survey.surveyId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
+                                        <a href="<@ofbizUrl 
controlPath="/content/control">ViewSurveyResponses?surveyResponseId=${survey.surveyResponseId}&amp;surveyId=${survey.surveyId}</@ofbizUrl>"
                                            
class="buttontext">${survey.surveyId}</a>
                                     </td>
                                     <td colspan="5">&nbsp;</td>
@@ -568,7 +568,7 @@ under the License.
                                 <tr<#if "1" == itemClass> 
class="alternate-row"</#if>>
                                     <td align="right" colspan="2">
                                         <span 
class="label">${uiLabelMap.CommonInventory}</span>&nbsp;
-                                        <a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?inventoryItemId=${orderItemShipGrpInvRes.inventoryItemId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
+                                        <a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?inventoryItemId=${orderItemShipGrpInvRes.inventoryItemId}</@ofbizUrl>"
                                            
class="buttontext">${orderItemShipGrpInvRes.inventoryItemId}</a>
                                         <span 
class="label">${uiLabelMap.OrderShipGroup}</span>&nbsp;${orderItemShipGrpInvRes.shipGroupSeqId}
                                     </td>
@@ -596,7 +596,7 @@ under the License.
                                     <td align="right" colspan="2">
                                         <span 
class="label">${uiLabelMap.OrderPlannedInShipment}</span>&nbsp;<a
                                             target="facility"
-                                            
href="/facility/control/ViewShipment?shipmentId=${orderShipment.shipmentId}${StringUtil.wrapString(externalKeyParam)}"
+                                            href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${orderShipment.shipmentId}</@ofbizUrl>"
                                             
class="buttontext">${orderShipment.shipmentId}</a>: 
${orderShipment.shipmentItemSeqId}
                                     </td>
                                     <td align="center">
@@ -615,7 +615,7 @@ under the License.
                                     <#if itemIssuance.shipmentId?has_content>
                                         <span 
class="label">${uiLabelMap.OrderIssuedToShipmentItem}</span>&nbsp;
                                         <a target="facility"
-                                           
href="/facility/control/ViewShipment?shipmentId=${itemIssuance.shipmentId}${StringUtil.wrapString(externalKeyParam)}"
+                                           href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${itemIssuance.shipmentId}</@ofbizUrl>"
                                            
class="buttontext">${itemIssuance.shipmentId}</a>: 
${itemIssuance.shipmentItemSeqId!}
                                     <#else>
                                         <span 
class="label">${uiLabelMap.OrderIssuedWithoutShipment}</span>
@@ -636,7 +636,7 @@ under the License.
                                         <#if 
itemIssuance.inventoryItemId?has_content>
                                             <#assign inventoryItem = 
itemIssuance.getRelatedOne("InventoryItem", false)/>
                                             <span 
class="label">${uiLabelMap.CommonInventory}</span>
-                                            <a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?inventoryItemId=${itemIssuance.inventoryItemId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
+                                            <a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?inventoryItemId=${itemIssuance.inventoryItemId}</@ofbizUrl>"
                                                
class="buttontext">${itemIssuance.inventoryItemId}</a>
                                             <span 
class="label">${uiLabelMap.OrderShipGroup}</span>&nbsp;${itemIssuance.shipGroupSeqId!}
                                             <#if 
(inventoryItem.serialNumber?has_content)>
@@ -661,12 +661,12 @@ under the License.
                                         <#if 
shipmentReceipt.shipmentId?has_content>
                                             <span 
class="label">${uiLabelMap.OrderShipmentReceived}</span>&nbsp;
                                             <a target="facility"
-                                               
href="/facility/control/ViewShipment?shipmentId=${shipmentReceipt.shipmentId}${StringUtil.wrapString(externalKeyParam)}"
+                                               href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${shipmentReceipt.shipmentId}</@ofbizUrl>"
                                                
class="buttontext">${shipmentReceipt.shipmentId}</a>:${shipmentReceipt.shipmentItemSeqId!}
                                         </#if>
                                         &nbsp;<#if 
shipmentReceipt.datetimeReceived?has_content>${Static["org.apache.ofbiz.base.util.UtilFormatOut"].formatDateTime(shipmentReceipt.datetimeReceived,
 "", locale, timeZone)!}</#if>&nbsp;
                                         <span 
class="label">${uiLabelMap.CommonInventory}</span>&nbsp;
-                                        <a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?inventoryItemId=${shipmentReceipt.inventoryItemId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
+                                        <a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?inventoryItemId=${shipmentReceipt.inventoryItemId}</@ofbizUrl>"
                                            
class="buttontext">${shipmentReceipt.inventoryItemId}</a>
                                     </td>
                                     <td align="center">
diff --git a/applications/order/template/order/OrderPaymentInfo.ftl 
b/applications/order/template/order/OrderPaymentInfo.ftl
index 388e458..a4c1673 100644
--- a/applications/order/template/order/OrderPaymentInfo.ftl
+++ b/applications/order/template/order/OrderPaymentInfo.ftl
@@ -78,8 +78,8 @@ under the License.
            <td class="label"><label>${uiLabelMap.OrderInvoices}</label></td>
            <td>
              <#list invoices as invoice>
-               <div>${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoice}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${invoice}</a>
-               (<a target="_BLANK" href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoice}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.CommonPdf}</a>)</div>
+               <div>${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoice}</@ofbizUrl>"
 class="buttontext">${invoice}</a>
+               (<a target="_BLANK" href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoice}</@ofbizUrl>" 
class="buttontext">${uiLabelMap.CommonPdf}</a>)</div>
              </#list>
            </td>
          </tr>
@@ -140,7 +140,7 @@ under the License.
                         <table class="basic-table" cellspacing='0'>
                             <tr>
                                 <td>
-                                    ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">EditBillingAccount?billingAccountId=${billingAccount.billingAccountId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${billingAccount.billingAccountId}</a>  - 
${billingAccount.description!}
+                                    ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">EditBillingAccount?billingAccountId=${billingAccount.billingAccountId}</@ofbizUrl>"
 class="buttontext">${billingAccount.billingAccountId}</a>  - 
${billingAccount.description!}
                                 </td>
                                 <td>
                                     <#if orderPaymentPreference.statusId != 
"PAYMENT_SETTLED" && orderPaymentPreference.statusId != "PAYMENT_RECEIVED">
@@ -186,7 +186,7 @@ under the License.
                       <#if (finAccountType?has_content)>
                         
${finAccountType.description?default(finAccountType.finAccountTypeId)}&nbsp;
                       </#if>
-                      
#${finAccount.finAccountCode?default(finAccount.finAccountId)} (<a 
href="<@ofbizUrl 
controlPath="/accounting/control">EditFinAccount?finAccountId=${finAccount.finAccountId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${finAccount.finAccountId}</a>)
+                      
#${finAccount.finAccountCode?default(finAccount.finAccountId)} (<a 
href="<@ofbizUrl 
controlPath="/accounting/control">EditFinAccount?finAccountId=${finAccount.finAccountId}</@ofbizUrl>"
 class="buttontext">${finAccount.finAccountId}</a>)
                       <br />
                       ${finAccount.finAccountName!}
                       <br />
@@ -194,10 +194,10 @@ under the License.
                       <#-- Authorize and Capture transactions -->
                       <div>
                         <#if "PAYMENT_SETTLED" != 
orderPaymentPreference.statusId>
-                          <a href="<@ofbizUrl 
controlPath="/accounting/control">AuthorizeTransaction?orderId=${orderId!}&amp;orderPaymentPreferenceId=${orderPaymentPreference.orderPaymentPreferenceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.AccountingAuthorize}</a>
+                          <a href="<@ofbizUrl 
controlPath="/accounting/control">AuthorizeTransaction?orderId=${orderId!}&amp;orderPaymentPreferenceId=${orderPaymentPreference.orderPaymentPreferenceId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.AccountingAuthorize}</a>
                         </#if>
                         <#if "PAYMENT_AUTHORIZED" == 
orderPaymentPreference.statusId>
-                          <a href="<@ofbizUrl 
controlPath="/accounting/control">CaptureTransaction?orderId=${orderId!}&amp;orderPaymentPreferenceId=${orderPaymentPreference.orderPaymentPreferenceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.AccountingCapture}</a>
+                          <a href="<@ofbizUrl 
controlPath="/accounting/control">CaptureTransaction?orderId=${orderId!}&amp;orderPaymentPreferenceId=${orderPaymentPreference.orderPaymentPreferenceId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.AccountingCapture}</a>
                         </#if>
                       </div>
                     </div>
@@ -212,7 +212,7 @@ under the License.
                           (<span 
class="label">${uiLabelMap.OrderReference}</span>&nbsp;${gatewayResponse.referenceNum!}
                           <span 
class="label">${uiLabelMap.OrderAvs}</span>&nbsp;${gatewayResponse.gatewayAvsResult?default("N/A")}
                           <span 
class="label">${uiLabelMap.OrderScore}</span>&nbsp;${gatewayResponse.gatewayScoreResult?default("N/A")})
-                          <a href="<@ofbizUrl 
controlPath="/accounting/control">ViewGatewayResponse?paymentGatewayResponseId=${gatewayResponse.paymentGatewayResponseId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.CommonDetails}</a>
+                          <a href="<@ofbizUrl 
controlPath="/accounting/control">ViewGatewayResponse?paymentGatewayResponseId=${gatewayResponse.paymentGatewayResponseId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.CommonDetails}</a>
                           <#if gatewayResponse_has_next><hr /></#if>
                         </#list>
                       </div>
@@ -242,7 +242,7 @@ under the License.
                       <td>
                         <div>
                             <#list paymentList as paymentMap>
-                                <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
+                                <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
                             </#list>
                         </div>
                       </td>
@@ -296,7 +296,7 @@ under the License.
                       <td>
                         <div>
                             <#list paymentList as paymentMap>
-                                <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
+                                <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
                             </#list>
                         </div>
                       </td>
@@ -343,10 +343,10 @@ under the License.
                       <#-- Authorize and Capture transactions -->
                       <div>
                         <#if "PAYMENT_SETTLED" != 
orderPaymentPreference.statusId>
-                          <a href="<@ofbizUrl 
controlPath="/accounting/control">AuthorizeTransaction?orderId=${orderId!}&amp;orderPaymentPreferenceId=${orderPaymentPreference.orderPaymentPreferenceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.AccountingAuthorize}</a>
+                          <a href="<@ofbizUrl 
controlPath="/accounting/control">AuthorizeTransaction?orderId=${orderId!}&amp;orderPaymentPreferenceId=${orderPaymentPreference.orderPaymentPreferenceId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.AccountingAuthorize}</a>
                         </#if>
                         <#if "PAYMENT_AUTHORIZED" == 
orderPaymentPreference.statusId>
-                          <a href="<@ofbizUrl 
controlPath="/accounting/control">CaptureTransaction?orderId=${orderId!}&amp;orderPaymentPreferenceId=${orderPaymentPreference.orderPaymentPreferenceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.AccountingCapture}</a>
+                          <a href="<@ofbizUrl 
controlPath="/accounting/control">CaptureTransaction?orderId=${orderId!}&amp;orderPaymentPreferenceId=${orderPaymentPreference.orderPaymentPreferenceId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.AccountingCapture}</a>
                         </#if>
                       </div>
                     <#else>
@@ -364,7 +364,7 @@ under the License.
                         (<span 
class="label">${uiLabelMap.OrderReference}</span>&nbsp;${gatewayResponse.referenceNum!}
                         <span 
class="label">${uiLabelMap.OrderAvs}</span>&nbsp;${gatewayResponse.gatewayAvsResult?default("N/A")}
                         <span 
class="label">${uiLabelMap.OrderScore}</span>&nbsp;${gatewayResponse.gatewayScoreResult?default("N/A")})
-                        <a href="<@ofbizUrl 
controlPath="/accounting/control">ViewGatewayResponse?paymentGatewayResponseId=${gatewayResponse.paymentGatewayResponseId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.CommonDetails}</a>
+                        <a href="<@ofbizUrl 
controlPath="/accounting/control">ViewGatewayResponse?paymentGatewayResponseId=${gatewayResponse.paymentGatewayResponseId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.CommonDetails}</a>
                         <#if gatewayResponse_has_next><hr /></#if>
                       </#list>
                     </div>
@@ -431,7 +431,7 @@ under the License.
                   <td>
                     <div>
                         <#list paymentList as paymentMap>
-                            <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
+                            <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
                         </#list>
                     </div>
                   </td>
@@ -488,7 +488,7 @@ under the License.
                   <td>
                     <div>
                         <#list paymentList as paymentMap>
-                            <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
+                            <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
                         </#list>
                     </div>
                   </td>
@@ -521,7 +521,7 @@ under the License.
               <td>
                 <div>
                     <#list paymentList as paymentMap>
-                        <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
+                        <a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${paymentMap.paymentId}</@ofbizUrl>"
 class="buttontext">${paymentMap.paymentId}</a><#if paymentMap_has_next><br 
/></#if>
                     </#list>
                 </div>
               </td>
@@ -546,8 +546,8 @@ under the License.
             <td>&nbsp;<span 
class="label">${uiLabelMap.OrderInvoices}</span></td>
             <td>
               <#list invoices as invoice>
-                <div>${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoice}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${invoice}</a>
-                (<a target="_BLANK" href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoice}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.CommonPdf}</a>)</div>
+                <div>${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoice}</@ofbizUrl>"
 class="buttontext">${invoice}</a>
+                (<a target="_BLANK" href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoice}</@ofbizUrl>" 
class="buttontext">${uiLabelMap.CommonPdf}</a>)</div>
               </#list>
             </td>
             <td>&nbsp;</td>
diff --git a/applications/order/template/order/OrderShippingInfo.ftl 
b/applications/order/template/order/OrderShippingInfo.ftl
index 5ea9911..796a9ce 100644
--- a/applications/order/template/order/OrderShippingInfo.ftl
+++ b/applications/order/template/order/OrderShippingInfo.ftl
@@ -754,8 +754,8 @@ under the License.
               <td>
                   <#list shipGroupShipments as shipment>
                       <div>
-                        ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${shipment.shipmentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${shipment.shipmentId}</a>&nbsp;&nbsp;
-                        <a target="_BLANK" href="<@ofbizUrl 
controlPath="/facility/control">PackingSlip.pdf?shipmentId=${shipment.shipmentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.ProductPackingSlip}</a>
+                        ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${shipment.shipmentId}</@ofbizUrl>"
 class="buttontext">${shipment.shipmentId}</a>&nbsp;&nbsp;
+                        <a target="_BLANK" href="<@ofbizUrl 
controlPath="/facility/control">PackingSlip.pdf?shipmentId=${shipment.shipmentId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.ProductPackingSlip}</a>
                         <#if "SALES_ORDER" == orderHeader.orderTypeId && 
"ORDER_COMPLETED" == orderHeader.statusId>
                           <#assign shipmentRouteSegments = 
EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", 
shipment.shipmentId!).queryList()!>
                           <#if shipmentRouteSegments?has_content>
@@ -787,7 +787,7 @@ under the License.
                <#if "SALES_ORDER" == orderHeader.orderTypeId>
                  <#if !shipGroup.supplierPartyId?has_content>
                    <#if "ORDER_APPROVED" == orderHeader.statusId>
-                 <a href="<@ofbizUrl 
controlPath="/facility/control">PackOrder?facilityId=${storeFacilityId!}&amp;orderId=${orderId}&amp;shipGroupSeqId=${shipGroup.shipGroupSeqId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.OrderPackShipmentForShipGroup}</a>
+                 <a href="<@ofbizUrl 
controlPath="/facility/control">PackOrder?facilityId=${storeFacilityId!}&amp;orderId=${orderId}&amp;shipGroupSeqId=${shipGroup.shipGroupSeqId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.OrderPackShipmentForShipGroup}</a>
                    <br />
                    </#if>
                    <a 
href="javascript:document.createShipment_${shipGroup.shipGroupSeqId}.submit()" 
class="buttontext">${uiLabelMap.OrderNewShipmentForShipGroup}</a>
diff --git a/applications/order/template/return/QuickReturn.ftl 
b/applications/order/template/return/QuickReturn.ftl
index 580720a..1ff53ed 100644
--- a/applications/order/template/return/QuickReturn.ftl
+++ b/applications/order/template/return/QuickReturn.ftl
@@ -61,7 +61,7 @@ under the License.
                 <input type='text' size='20' name='paymentMethodId' />
               </#if>
               <#if (party.partyId)?has_content>
-                <a href="<@ofbizUrl 
controlPath="/partymgr/control">editcreditcard?partyId=${party.partyId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="partymgr" 
class="smallSubmit">${uiLabelMap.AccountingCreateCreditCard}</a>
+                <a href="<@ofbizUrl 
controlPath="/partymgr/control">editcreditcard?partyId=${party.partyId}</@ofbizUrl>"
 target="partymgr" 
class="smallSubmit">${uiLabelMap.AccountingCreateCreditCard}</a>
               </#if>
             </td></tr>
           </table>
diff --git a/applications/order/template/return/ReturnItems.ftl 
b/applications/order/template/return/ReturnItems.ftl
index f4d1ee8..6bf0836 100644
--- a/applications/order/template/return/ReturnItems.ftl
+++ b/applications/order/template/return/ReturnItems.ftl
@@ -71,13 +71,13 @@ under the License.
     <#if returnHeader?has_content>
       <#if returnHeader.destinationFacilityId?has_content && "RETURN_ACCEPTED" 
== returnHeader.statusId && 
returnHeader.returnHeaderTypeId?starts_with("CUSTOMER_")>
         <#list returnShipmentIds as returnShipmentId>
-          <a href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${returnShipmentId.shipmentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.ProductShipmentId} 
${returnShipmentId.shipmentId}</a>
-          <a href="<@ofbizUrl 
controlPath="/facility/control">ReceiveReturn?facilityId=${returnHeader.destinationFacilityId}&amp;returnId=${returnHeader.returnId!}&amp;shipmentId=${returnShipmentId.shipmentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.OrderReceiveReturn}</a>
+          <a href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${returnShipmentId.shipmentId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.ProductShipmentId} 
${returnShipmentId.shipmentId}</a>
+          <a href="<@ofbizUrl 
controlPath="/facility/control">ReceiveReturn?facilityId=${returnHeader.destinationFacilityId}&amp;returnId=${returnHeader.returnId!}&amp;shipmentId=${returnShipmentId.shipmentId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.OrderReceiveReturn}</a>
         </#list>
       <#elseif "SUP_RETURN_ACCEPTED" == returnHeader.statusId && 
"VENDOR_RETURN" == returnHeader.returnHeaderTypeId>
          <#if returnShipmentIds?has_content>
            <#list returnShipmentIds as returnShipmentId>
-             <a href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${returnShipmentId.shipmentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.ProductShipmentId} 
${returnShipmentId.shipmentId}</a>
+             <a href="<@ofbizUrl 
controlPath="/facility/control">ViewShipment?shipmentId=${returnShipmentId.shipmentId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.ProductShipmentId} 
${returnShipmentId.shipmentId}</a>
            </#list>
          <#else>
            <a href="<@ofbizUrl 
controlPath="/facility/control">EditShipment?primaryReturnId=${returnHeader.returnId}&amp;partyIdTo=${toPartyId}&amp;statusId=SHIPMENT_INPUT&amp;shipmentTypeId=PURCHASE_RETURN</@ofbizUrl>"
 class="buttontext">${uiLabelMap.OrderCreateReturnShipment}</a>
@@ -238,11 +238,11 @@ under the License.
                     <#assign itemResp = 
item.getRelatedOne("ReturnItemResponse", false)!>
                     <#if itemResp?has_content>
                       <#if itemResp.paymentId?has_content>
-                        <div>${uiLabelMap.AccountingPayment} 
${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${itemResp.paymentId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${itemResp.paymentId}</a></div>
+                        <div>${uiLabelMap.AccountingPayment} 
${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">paymentOverview?paymentId=${itemResp.paymentId}</@ofbizUrl>"
 class="buttontext">${itemResp.paymentId}</a></div>
                       <#elseif itemResp.replacementOrderId?has_content>
                         <div>${uiLabelMap.OrderOrder} 
${uiLabelMap.CommonNbr}<a 
href="<@ofbizUrl>orderview?orderId=${itemResp.replacementOrderId}</@ofbizUrl>" 
class="buttontext">${itemResp.replacementOrderId}</a></div>
                       <#elseif itemResp.billingAccountId?has_content>
-                        <div>${uiLabelMap.AccountingAccountId} 
${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">EditBillingAccount?billingAccountId=${itemResp.billingAccountId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${itemResp.billingAccountId}</a></div>
+                        <div>${uiLabelMap.AccountingAccountId} 
${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">EditBillingAccount?billingAccountId=${itemResp.billingAccountId}</@ofbizUrl>"
 class="buttontext">${itemResp.billingAccountId}</a></div>
                       </#if>
                     <#else>
                       <div>${uiLabelMap.CommonNone}</div>
diff --git a/applications/order/template/task/OrderTaskList.ftl 
b/applications/order/template/task/OrderTaskList.ftl
index 56d5ae5..355e323 100644
--- a/applications/order/template/task/OrderTaskList.ftl
+++ b/applications/order/template/task/OrderTaskList.ftl
@@ -163,7 +163,7 @@ under the License.
                               </td>
                               <td>${task.priority?default("0")}</td>
                               <td>
-                                <a href="<@ofbizUrl 
controlPath="/workeffort/control">activity?workEffortId=${task.workEffortId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="workeffort" class="buttontext">
+                                <a href="<@ofbizUrl 
controlPath="/workeffort/control">activity?workEffortId=${task.workEffortId}</@ofbizUrl>"
 target="workeffort" class="buttontext">
                                   
${Static["org.apache.ofbiz.order.task.TaskWorker"].getPrettyStatus(task)}
                                 </a>
                               </td>
diff --git a/applications/party/template/party/profileblocks/FinAccounts.ftl 
b/applications/party/template/party/profileblocks/FinAccounts.ftl
index eacedd8..58b1291 100644
--- a/applications/party/template/party/profileblocks/FinAccounts.ftl
+++ b/applications/party/template/party/profileblocks/FinAccounts.ftl
@@ -19,7 +19,7 @@ under the License.
 
 <div style="border-bottom: 1px solid #ccc; margin-bottom: 20px">
     <p>
-        <b>${uiLabelMap.AccountingAccountNumber}:</b> <a href="<@ofbizUrl 
controlPath="/accounting/control">EditFinAccount?finAccountId=${ownedFinAccount.finAccountId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
+        <b>${uiLabelMap.AccountingAccountNumber}:</b> <a href="<@ofbizUrl 
controlPath="/accounting/control">EditFinAccount?finAccountId=${ownedFinAccount.finAccountId}</@ofbizUrl>"
              class="smallSubmit">${ownedFinAccount.finAccountId}</a>
         <b>${uiLabelMap.AccountingAccountType}:</b> 
${(ownedFinAccountType.description)?default('N/A')}
         <b>${uiLabelMap.FormFieldTitle_finAccountName}:</b> 
${ownedFinAccount.finAccountName!}
diff --git a/applications/party/template/party/profileblocks/PaymentMethods.ftl 
b/applications/party/template/party/profileblocks/PaymentMethods.ftl
index aa0abe5..54bb1f4 100644
--- a/applications/party/template/party/profileblocks/PaymentMethods.ftl
+++ b/applications/party/template/party/profileblocks/PaymentMethods.ftl
@@ -82,7 +82,7 @@ under the License.
                 </td>
                 <td class="button-col">
                   <#if security.hasEntityPermission("MANUAL", "_PAYMENT", 
session)>
-                    <a href="<@ofbizUrl 
controlPath="/accounting/control">manualETx?paymentMethodId=${paymentMethod.paymentMethodId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>">${uiLabelMap.PartyManualTx}</a>
+                    <a href="<@ofbizUrl 
controlPath="/accounting/control">manualETx?paymentMethodId=${paymentMethod.paymentMethodId}</@ofbizUrl>">${uiLabelMap.PartyManualTx}</a>
                   </#if>
                   <#if security.hasEntityPermission("PAY_INFO", "_UPDATE", 
session) || security.hasEntityPermission("ACCOUNTING", "_UPDATE", session)>
                     <a 
href="<@ofbizUrl>editcreditcard?partyId=${partyId}&amp;paymentMethodId=${paymentMethod.paymentMethodId}</@ofbizUrl>">${uiLabelMap.CommonUpdate}</a>
diff --git a/applications/product/template/facility/PicklistOptions.ftl 
b/applications/product/template/facility/PicklistOptions.ftl
index fdeb3c0..60d791a 100644
--- a/applications/product/template/facility/PicklistOptions.ftl
+++ b/applications/product/template/facility/PicklistOptions.ftl
@@ -272,14 +272,14 @@ under the License.
             <#assign orderProduct = oiasga.getRelatedOne("OrderItem", 
false).getRelatedOne("Product", false)!>
             <#assign product = oiasga.getRelatedOne("InventoryItem", 
false).getRelatedOne("Product", false)!>
             <tr valign="middle"<#if alt_row> class="alternate-row"</#if>>
-              <td><a href="<@ofbizUrl 
controlPath="/ordermgr/control">orderview?orderId=${oiasga.orderId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" target="_blank">${oiasga.orderId}</a></td>
+              <td><a href="<@ofbizUrl 
controlPath="/ordermgr/control">orderview?orderId=${oiasga.orderId}</@ofbizUrl>"
 class="buttontext" target="_blank">${oiasga.orderId}</a></td>
               <td>${header.orderDate?string}</td>
               <td>${(channel.description)!}</td>
               <td>${oiasga.orderItemSeqId}</td>
               <td>
-                <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${orderProduct.productId!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" target="_blank">${(orderProduct.internalName)!}</a>
+                <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${orderProduct.productId!}</@ofbizUrl>"
 class="buttontext" target="_blank">${(orderProduct.internalName)!}</a>
                 <#if orderProduct.productId != product.productId>
-                  &nbsp;[<a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" target="_blank">${(product.internalName)!}</a>]
+                  &nbsp;[<a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId!}</@ofbizUrl>"
 class="buttontext" target="_blank">${(product.internalName)!}</a>]
                 </#if>
               </td>
               <td>${oiasga.shipGroupSeqId}</td>
diff --git a/applications/product/template/inventory/ReceiveInventory.ftl 
b/applications/product/template/inventory/ReceiveInventory.ftl
index f575ef7..20c7e79 100644
--- a/applications/product/template/inventory/ReceiveInventory.ftl
+++ b/applications/product/template/inventory/ReceiveInventory.ftl
@@ -110,7 +110,7 @@ under the License.
                 <td width="6%" align="right" nowrap="nowrap" 
class="label">${uiLabelMap.ProductProductName}</td>
                 <td width="6%">&nbsp;</td>
                 <td width="74%">
-                  <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId}${externalKeyParam!}</@ofbizUrl>"
 target="catalog" class="buttontext">${product.internalName!}</a>
+                  <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId}</@ofbizUrl>"
 target="catalog" class="buttontext">${product.internalName!}</a>
                 </td>
               </tr>
               <tr>
@@ -413,13 +413,13 @@ under the License.
                             <#assign product = 
orderItem.getRelatedOne("Product", true)/>
                             <input type="hidden" 
name="productId_o_${rowCount}" value="${product.productId}"/>
                             <td width="45%">
-                                ${orderItem.orderItemSeqId}:&nbsp;<a 
href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId}${externalKeyParam!}</@ofbizUrl>"
 target="catalog" 
class="buttontext">${product.productId}&nbsp;-&nbsp;${orderItem.itemDescription!}</a>
 : ${product.description!}
+                                ${orderItem.orderItemSeqId}:&nbsp;<a 
href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId}</@ofbizUrl>"
 target="catalog" 
class="buttontext">${product.productId}&nbsp;-&nbsp;${orderItem.itemDescription!}</a>
 : ${product.description!}
                             </td>
                           <#else>
                             <td width="45%">
                                 
<b>${orderItemType.get("description",locale)}</b> : 
${orderItem.itemDescription!}&nbsp;&nbsp;
                                 <input type="text" size="12" 
name="productId_o_${rowCount}"/>
-                                <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="catalog" class="buttontext">${uiLabelMap.ProductCreateProduct}</a>
+                                <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct</@ofbizUrl>" target="catalog" 
class="buttontext">${uiLabelMap.ProductCreateProduct}</a>
                             </td>
                           </#if>
                           <td align="right">${uiLabelMap.ProductLocation}:</td>
diff --git 
a/applications/product/template/product/EditProductInventoryItems.ftl 
b/applications/product/template/product/EditProductInventoryItems.ftl
index a357161..ef44275 100644
--- a/applications/product/template/product/EditProductInventoryItems.ftl
+++ b/applications/product/template/product/EditProductInventoryItems.ftl
@@ -24,7 +24,7 @@ under the License.
     </div>
     <div class="screenlet-body">
         <#if productId?has_content>
-            <a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?productId=${productId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.ProductCreateNewInventoryItemProduct}</a>
+            <a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?productId=${productId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.ProductCreateNewInventoryItemProduct}</a>
             <#if showEmpty>
                 <a 
href="<@ofbizUrl>EditProductInventoryItems?productId=${productId}</@ofbizUrl>" 
class="buttontext">${uiLabelMap.ProductHideEmptyItems}</a>
             <#else>
@@ -61,7 +61,7 @@ under the License.
                     <#assign inventoryItemDetailFirst = 
Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(inventoryItem.getRelated("InventoryItemDetail",
 null, Static["org.apache.ofbiz.base.util.UtilMisc"].toList("effectiveDate"), 
false))!>
                     <#if curInventoryItemType??>
                         <tr valign="middle"<#if "1" == rowClass> 
class="alternate-row"</#if>>
-                            <td><a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?inventoryItemId=${(inventoryItem.inventoryItemId)!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext">${(inventoryItem.inventoryItemId)!}</a></td>
+                            <td><a href="<@ofbizUrl 
controlPath="/facility/control">EditInventoryItem?inventoryItemId=${(inventoryItem.inventoryItemId)!}</@ofbizUrl>"
 class="buttontext">${(inventoryItem.inventoryItemId)!}</a></td>
                             
<td>&nbsp;${(curInventoryItemType.get("description",locale))!}</td>
                             <td>
                                 <div>
@@ -80,13 +80,13 @@ under the License.
                                 <td style="color: 
red;">${uiLabelMap.ProductErrorFacility} (${inventoryItem.facilityId})
                                     ${uiLabelMap.ProductAndContainer} 
(${inventoryItem.containerId}) ${uiLabelMap.CommonSpecified}</td>
                             <#elseif inventoryItem.facilityId??>
-                                
<td>${uiLabelMap.ProductFacilityLetter}:&nbsp;<a href="<@ofbizUrl 
controlPath="/facility/control">EditFacility?facilityId=${inventoryItem.facilityId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="linktext">${inventoryItem.facilityId}</a></td>
+                                
<td>${uiLabelMap.ProductFacilityLetter}:&nbsp;<a href="<@ofbizUrl 
controlPath="/facility/control">EditFacility?facilityId=${inventoryItem.facilityId}</@ofbizUrl>"
 class="linktext">${inventoryItem.facilityId}</a></td>
                             <#elseif (inventoryItem.containerId)??>
                                 
<td>${uiLabelMap.ProductContainerLetter}:&nbsp;<a 
href="<@ofbizUrl>EditContainer?containerId=${inventoryItem.containerId 
}</@ofbizUrl>" class="linktext">${inventoryItem.containerId}</a></td>
                             <#else>
                                 <td>&nbsp;</td>
                             </#if>
-                            <td><a href="<@ofbizUrl 
controlPath="/facility/control">EditFacilityLocation?facilityId=${(inventoryItem.facilityId)!}&amp;locationSeqId=${(inventoryItem.locationSeqId)!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="linktext"><#if 
facilityLocation??>${facilityLocation.areaId!}:${facilityLocation.aisleId!}:${facilityLocation.sectionId!}:${facilityLocation.levelId!}:${facilityLocation.positionId!}</#if><#if
 facilityLocationTypeEnum?has_content>  [...]
+                            <td><a href="<@ofbizUrl 
controlPath="/facility/control">EditFacilityLocation?facilityId=${(inventoryItem.facilityId)!}&amp;locationSeqId=${(inventoryItem.locationSeqId)!}</@ofbizUrl>"
 class="linktext"><#if 
facilityLocation??>${facilityLocation.areaId!}:${facilityLocation.aisleId!}:${facilityLocation.sectionId!}:${facilityLocation.levelId!}:${facilityLocation.positionId!}</#if><#if
 facilityLocationTypeEnum?has_content> 
(${facilityLocationTypeEnum.get("descripti [...]
                             <td>&nbsp;${(inventoryItem.lotId)!}</td>
                             <td>&nbsp;${(inventoryItem.binNumber)!}</td>
                             <td align="right"><@ofbizCurrency 
amount=inventoryItem.unitCost isoCode=inventoryItem.currencyUomId/></td>
diff --git a/applications/product/template/returns/ReceiveReturn.ftl 
b/applications/product/template/returns/ReceiveReturn.ftl
index 201c820..43cab3e 100644
--- a/applications/product/template/returns/ReceiveReturn.ftl
+++ b/applications/product/template/returns/ReceiveReturn.ftl
@@ -23,7 +23,7 @@ under the License.
     <div class="screenlet-body">
         <#-- Receiving Results -->
         <#if receivedItems?has_content>
-          <h3>${uiLabelMap.ProductReceiptForReturn} ${uiLabelMap.CommonNbr}<a 
href="<@ofbizUrl 
controlPath="/ordermgr/control">returnMain?returnId=${returnHeader.returnId}${externalKeyParam!}</@ofbizUrl>"
 class="buttontext">${returnHeader.returnId}</a></h3>
+          <h3>${uiLabelMap.ProductReceiptForReturn} ${uiLabelMap.CommonNbr}<a 
href="<@ofbizUrl 
controlPath="/ordermgr/control">returnMain?returnId=${returnHeader.returnId}</@ofbizUrl>"
 class="buttontext">${returnHeader.returnId}</a></h3>
           <#if "RETURN_RECEIVED" == returnHeader.getString("statusId")>
             <h3>${uiLabelMap.ProductReturnCompletelyReceived}</h3>
           </#if>
@@ -71,7 +71,7 @@ under the License.
                 <tr>
                   <td>
                     <h3>
-                      ${uiLabelMap.ProductReceiveReturn} <a href="<@ofbizUrl 
controlPath="/ordermgr/control">returnMain?returnId=${returnHeader.returnId}${externalKeyParam!}</@ofbizUrl>"
 class="buttontext">#${returnHeader.returnId}</a>
+                      ${uiLabelMap.ProductReceiveReturn} <a href="<@ofbizUrl 
controlPath="/ordermgr/control">returnMain?returnId=${returnHeader.returnId}</@ofbizUrl>"
 class="buttontext">#${returnHeader.returnId}</a>
                       <#if 
parameters.shipmentId?has_content>${uiLabelMap.ProductShipmentId} <a 
href="<@ofbizUrl>ViewShipment?shipmentId=${parameters.shipmentId}</@ofbizUrl>" 
class="buttontext">${parameters.shipmentId}</a></#if>
                     </h3>
                   </td>
@@ -110,7 +110,7 @@ under the License.
                             <input type="hidden" 
name="productId_o_${rowCount}" value="${product.productId}" />
                             <td width="45%">
                               <div>
-                                ${returnItem.returnItemSeqId}:&nbsp;<a 
href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId}${externalKeyParam!}</@ofbizUrl>"
 target="catalog" 
class="buttontext">${product.productId}&nbsp;-&nbsp;${product.internalName!}</a>
 : ${product.description!}
+                                ${returnItem.returnItemSeqId}:&nbsp;<a 
href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId}</@ofbizUrl>"
 target="catalog" 
class="buttontext">${product.productId}&nbsp;-&nbsp;${product.internalName!}</a>
 : ${product.description!}
                                 <#if serializedInv?has_content><font 
color='red'>**${uiLabelMap.ProductSerializedInventoryFound}**</font></#if>
                               </div>
                             </td>
@@ -119,7 +119,7 @@ under the License.
                               <div>
                                 
${returnItem.returnItemSeqId}:&nbsp;<b>${orderItemType.get("description",locale)}</b>
 : ${orderItem.itemDescription!}&nbsp;&nbsp;
                                 <input type="text" size="12" 
name="productId_o_${rowCount}" />
-                                <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="catalog" class="buttontext">${uiLabelMap.ProductCreateProduct}</a>
+                                <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct</@ofbizUrl>" target="catalog" 
class="buttontext">${uiLabelMap.ProductCreateProduct}</a>
                               </div>
                             </td>
                           <#else>
diff --git a/applications/product/template/shipment/PackOrder.ftl 
b/applications/product/template/shipment/PackOrder.ftl
index 4e11b49..31e6110 100644
--- a/applications/product/template/shipment/PackOrder.ftl
+++ b/applications/product/template/shipment/PackOrder.ftl
@@ -58,8 +58,8 @@ under the License.
                     <ul>
                     <#list invoiceIds as invoiceId>
                       <li>
-                        ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoiceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="_blank" class="buttontext">${invoiceId}</a>
-                        (<a href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoiceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="_blank" class="buttontext">${uiLabelMap.CommonPdf}</a>)
+                        ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoiceId}</@ofbizUrl>"
 target="_blank" class="buttontext">${invoiceId}</a>
+                        (<a href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoiceId}</@ofbizUrl>"
 target="_blank" class="buttontext">${uiLabelMap.CommonPdf}</a>)
                       </li>
                     </#list>
                     </ul>
@@ -287,9 +287,9 @@ under the License.
                               </#if>
                           </td>
                           <td>
-                              <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${orderProduct.productId!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" target="_blank">${(orderProduct.internalName)!}</a>
+                              <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${orderProduct.productId!}</@ofbizUrl>"
 class="buttontext" target="_blank">${(orderProduct.internalName)!}</a>
                               <#if orderProduct.productId != product.productId>
-                                  &nbsp;[<a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" target="_blank">${(product.internalName)!}</a>]
+                                  &nbsp;[<a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId!}</@ofbizUrl>"
 class="buttontext" target="_blank">${(product.internalName)!}</a>]
                               </#if>
                           </td>
                           <td align="right">${orderItemQuantity}</td>
@@ -456,7 +456,7 @@ under the License.
                       <td>${line.getOrderItemSeqId()}</td>
                       <td>${line.getProductId()?default("N/A")}</td>
                       <td>
-                          <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${line.getProductId()!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" 
target="_blank">${product.internalName!?default("[N/A]")}</a>
+                          <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${line.getProductId()!}</@ofbizUrl>"
 class="buttontext" 
target="_blank">${product.internalName!?default("[N/A]")}</a>
                       </td>
                       <td>${line.getInventoryItemId()}</td>
                       <td align="right">${line.getQuantity()}</td>
@@ -500,7 +500,7 @@ under the License.
                       <td>${line.getOrderItemSeqId()}</td>
                       <td>${line.getProductId()?default("N/A")}</td>
                       <td>
-                          <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${line.getProductId()!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" 
target="_blank">${product.internalName!?default("[N/A]")}</a>
+                          <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${line.getProductId()!}</@ofbizUrl>"
 class="buttontext" 
target="_blank">${product.internalName!?default("[N/A]")}</a>
                       </td>
                       <td>${line.getInventoryItemId()}</td>
                       <td align="right">${line.getQuantity()}</td>
diff --git a/applications/product/template/shipment/VerifyPick.ftl 
b/applications/product/template/shipment/VerifyPick.ftl
index ded6546..dd4e1fa 100644
--- a/applications/product/template/shipment/VerifyPick.ftl
+++ b/applications/product/template/shipment/VerifyPick.ftl
@@ -39,8 +39,8 @@ under the License.
           <ul>
             <#list invoiceIds as invoiceId>
               <li>
-                ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoiceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="_blank" class="buttontext">${invoiceId}</a>
-                (<a href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoiceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="_blank" class="buttontext">${uiLabelMap.CommonPdf}</a>)
+                ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoiceId}</@ofbizUrl>"
 target="_blank" class="buttontext">${invoiceId}</a>
+                (<a href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoiceId}</@ofbizUrl>"
 target="_blank" class="buttontext">${uiLabelMap.CommonPdf}</a>)
               </li>
             </#list>
           </ul>
@@ -234,7 +234,7 @@ under the License.
                   <td>${orderItemSeqId!}</td>
                   <td>${product.productId?default("N/A")}</td>
                   <td>
-                    <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId!}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 class="buttontext" target="_blank">${(product.internalName)!}</a>
+                    <a href="<@ofbizUrl 
controlPath="/catalog/control">EditProduct?productId=${product.productId!}</@ofbizUrl>"
 class="buttontext" target="_blank">${(product.internalName)!}</a>
                   </td>
                   <td>
                     <select name="geo_${rowKey}">
diff --git a/applications/product/template/shipment/WeightPackage.ftl 
b/applications/product/template/shipment/WeightPackage.ftl
index 9eea363..868d643 100644
--- a/applications/product/template/shipment/WeightPackage.ftl
+++ b/applications/product/template/shipment/WeightPackage.ftl
@@ -38,8 +38,8 @@ under the License.
               <ul>
                 <#list invoiceIds as invoiceId>
                   <li>
-                    ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoiceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="_blank" class="buttontext">${invoiceId}</a>
-                    (<a href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoiceId}${StringUtil.wrapString(externalKeyParam)}</@ofbizUrl>"
 target="_blank" class="buttontext">${uiLabelMap.CommonPdf}</a>)
+                    ${uiLabelMap.CommonNbr}<a href="<@ofbizUrl 
controlPath="/accounting/control">invoiceOverview?invoiceId=${invoiceId}</@ofbizUrl>"
 target="_blank" class="buttontext">${invoiceId}</a>
+                    (<a href="<@ofbizUrl 
controlPath="/accounting/control">invoice.pdf?invoiceId=${invoiceId}</@ofbizUrl>"
 target="_blank" class="buttontext">${uiLabelMap.CommonPdf}</a>)
                   </li>
                 </#list>
               </ul>
diff --git 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
index bfa8e8e..e6b7333 100644
--- 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
+++ 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
@@ -18,20 +18,23 @@
  */
 package org.apache.ofbiz.webapp.control;
 
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
 import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.DelegatorFactory;
 import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.entity.util.EntityUtilProperties;
 import org.apache.ofbiz.service.LocalDispatcher;
 import org.apache.ofbiz.webapp.WebAppUtil;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
 /**
  * This class manages the single sign-on authentication through external login 
keys between OFBiz applications.
  */
@@ -41,6 +44,9 @@ public class ExternalLoginKeysManager {
     // This Map is keyed by the randomly generated externalLoginKey and the 
value is a UserLogin GenericValue object
     private static final Map<String, GenericValue> externalLoginKeys = new 
ConcurrentHashMap<>();
 
+    // This variable is set to empty so we know need to read from the 
properties file.
+    private static String isExternalLoginKeyEnabled = "";
+
     /**
      * Gets (and creates if necessary) an authentication token to be used for 
an external login parameter.
      * When a new token is created, it is persisted in the web session and in 
the web request and map entry keyed by the
@@ -165,4 +171,17 @@ public class ExternalLoginKeysManager {
        return "XMLHttpRequest".equals(request.getHeader("X-Requested-With"));
     }
 
+    /**
+     * Check if using externalLoginKey
+     * @return
+     */
+    public static boolean isExternalLoginKeyEnabled (HttpServletRequest 
request){
+        if (UtilValidate.isEmpty(isExternalLoginKeyEnabled)) {
+            isExternalLoginKeyEnabled = 
EntityUtilProperties.getPropertyValue("security",
+                    "security.login.externalLoginKey.enabled", "true",
+                    (Delegator) request.getAttribute("delegator"));
+        }
+        return "true".equals(isExternalLoginKeyEnabled);
+    }
+
 }
diff --git 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
index 6918fcc..b17a55b 100644
--- 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
+++ 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
@@ -1150,10 +1150,14 @@ public class RequestHandler {
             }
         }
 
-        String controlPath = targetControlPath;
-        if (UtilValidate.isEmpty(controlPath)){
-            // create the path to the control servlet
-            controlPath = (String) request.getAttribute("_CONTROL_PATH_");
+        boolean externalLoginKeyEnabled = 
ExternalLoginKeysManager.isExternalLoginKeyEnabled(request);
+        boolean addExternalKeyParam = false;
+
+        // create the path to the control servlet
+        String controlPath = (String) request.getAttribute("_CONTROL_PATH_");
+        if (UtilValidate.isNotEmpty(targetControlPath) && 
!controlPath.equals(targetControlPath)) {
+            controlPath = targetControlPath;
+            addExternalKeyParam = externalLoginKeyEnabled;
         }
 
         //If required by webSite parameter, surcharge control path
@@ -1189,6 +1193,14 @@ public class RequestHandler {
             }
         }
 
+        if (addExternalKeyParam) {
+            if (url.contains("?")) {
+                url += "&externalLoginKey=" + 
ExternalLoginKeysManager.getExternalLoginKey(request);;
+            } else {
+                url += "?externalLoginKey=" + 
ExternalLoginKeysManager.getExternalLoginKey(request);;
+            }
+        }
+
         // now add the actual passed url, but if it doesn't start with a / add 
one first
         if (!url.startsWith("/")) {
             newURL.append("/");
diff --git 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java
 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java
index 7148c82..874d39a 100644
--- 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java
+++ 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java
@@ -49,6 +49,7 @@ import freemarker.template.TemplateTransformModel;
  * override this argument.</li>
  * <li><b>encode</b> (true/false) - encode the URL, defaults to true. Encoding 
is UTF-8.</li>
  * <li><b>webSiteId</b> - generate a full URL using the web site settings 
found in the WebSite entity.</li>
+ * <li><b>controlPath</b> - override the default control path.</li>
  * </ul>
  * <p>In addition, this transform accepts an environment variable - 
<b>urlPrefix</b>. If the variable
  * exists, it is prepended to the contents of the transform (the part between
diff --git 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java
 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java
index ccf1ea1..6aefc47 100644
--- 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java
+++ 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java
@@ -271,7 +271,7 @@ public class ScreenRenderer {
         context.put("serverRoot", request.getAttribute("_SERVER_ROOT_URL_"));
         context.put("checkLoginUrl", LoginWorker.makeLoginUrl(request));
         String externalLoginKey = null;
-        boolean externalLoginKeyEnabled = 
"true".equals(EntityUtilProperties.getPropertyValue("security", 
"security.login.externalLoginKey.enabled", "true", (Delegator) 
request.getAttribute("delegator")));
+        boolean externalLoginKeyEnabled = 
ExternalLoginKeysManager.isExternalLoginKeyEnabled(request);
         if (externalLoginKeyEnabled) {
             externalLoginKey = 
ExternalLoginKeysManager.getExternalLoginKey(request);
         }
diff --git a/themes/bluelight/template/Header.ftl 
b/themes/bluelight/template/Header.ftl
index 3921b99..f359182 100644
--- a/themes/bluelight/template/Header.ftl
+++ b/themes/bluelight/template/Header.ftl
@@ -180,7 +180,7 @@ under the License.
                         </li>
                     </#if>
                 </#if>
-                <li class="user"><a href="<@ofbizUrl 
controlPath="/partymgr/control">viewprofile?partyId=${userLogin.partyId}${externalKeyParam!}</@ofbizUrl>">${userName}</a></li>
+                <li class="user"><a href="<@ofbizUrl 
controlPath="/partymgr/control">viewprofile?partyId=${userLogin.partyId}</@ofbizUrl>">${userName}</a></li>
               <#else>
                 <li class="user">${userName}</li>
               </#if>
diff --git a/themes/tomahawk/template/AppBarClose.ftl 
b/themes/tomahawk/template/AppBarClose.ftl
index c79b4fb..3a22bd6 100644
--- a/themes/tomahawk/template/AppBarClose.ftl
+++ b/themes/tomahawk/template/AppBarClose.ftl
@@ -85,7 +85,7 @@ under the License.
     <li <#if companyListSize?default(0) &lt;= 1>class="language"</#if>><a 
href="<@ofbizUrl>ListLocales</@ofbizUrl>">${uiLabelMap.CommonLanguageTitle}</a></li>
     <#if userLogin?exists>
       <#if userLogin.partyId?exists>
-        <li class="user"><a href="<@ofbizUrl 
controlPath="/partymgr/control">viewprofile?partyId=${userLogin.partyId}${externalKeyParam!}</@ofbizUrl>">${userName}</a>&nbsp;&nbsp;&nbsp;&nbsp;</li>
+        <li class="user"><a href="<@ofbizUrl 
controlPath="/partymgr/control">viewprofile?partyId=${userLogin.partyId}</@ofbizUrl>">${userName}</a>&nbsp;&nbsp;&nbsp;&nbsp;</li>
         <#assign size = companyListSize?default(0)>
         <#if size &gt; 1>
             <#assign currentCompany = delegator.findOne("PartyNameView", 
{"partyId" : organizationPartyId}, false)>

Reply via email to