Skip to content

Commit

Permalink
LPS-125224 Navigate to Address table after adding or editing an address
Browse files Browse the repository at this point in the history
  • Loading branch information
pei-jung committed Dec 22, 2020
1 parent f1dbd86 commit ecae56c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Expand Up @@ -25,7 +25,6 @@
import com.liferay.portal.kernel.service.ServiceContextFactory;
import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.util.Constants;
import com.liferay.portal.kernel.util.Http;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys;
Expand Down Expand Up @@ -89,20 +88,15 @@ protected void doProcessAction(

String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

String redirect = ParamUtil.getString(actionRequest, "redirect");

if (cmd.equals(Constants.ADD)) {
Address address = addAccountEntryAddress(actionRequest);

redirect = _http.setParameter(
redirect,
actionResponse.getNamespace() + "accountEntryAddressId",
address.getAddressId());
addAccountEntryAddress(actionRequest);
}
else if (cmd.equals(Constants.UPDATE)) {
updateAccountEntryAddress(actionRequest);
}

String redirect = ParamUtil.getString(actionRequest, "redirect");

if (Validator.isNotNull(redirect)) {
sendRedirect(actionRequest, actionResponse, redirect);
}
Expand Down Expand Up @@ -137,7 +131,4 @@ protected void updateAccountEntryAddress(ActionRequest actionRequest)
@Reference
private AddressLocalService _addressLocalService;

@Reference
private Http _http;

}
Expand Up @@ -37,7 +37,7 @@ renderResponse.setTitle((accountEntryAddressId == 0) ? LanguageUtil.get(request,
action="<%= editAccountEntryAddressURL %>"
>
<aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= (accountEntryAddressId == 0) ? Constants.ADD : Constants.UPDATE %>" />
<aui:input name="redirect" type="hidden" value="<%= currentURL %>" />
<aui:input name="redirect" type="hidden" value="<%= backURL %>" />
<aui:input name="accountEntryAddressId" type="hidden" value="<%= accountEntryAddressId %>" />
<aui:input name="accountEntryId" type="hidden" value="<%= accountEntryDisplay.getAccountEntryId() %>" />

Expand Down

0 comments on commit ecae56c

Please sign in to comment.