Author: hansbak
Date: Tue Jan 4 02:01:08 2011
New Revision: 1054857
URL: http://svn.apache.org/viewvc?rev=1054857&view=rev
Log:
add billing account as a payment method in the party profile
Modified:
ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml
ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy
ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/PaymentMethods.ftl
ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodForms.xml
ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodScreens.xml
Modified:
ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml?rev=1054857&r1=1054856&r2=1054857&view=diff
==============================================================================
---
ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml
(original)
+++
ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml
Tue Jan 4 02:01:08 2011
@@ -219,4 +219,11 @@ under the License.
<call-service service-name="createPartyEmailAddress"
in-map-name="emailAddressContext"/>
</if-not-empty>
</simple-method>
+
+ <simple-method method-name="deleteBillingAccount"
short-description="delete billing account">
+ <now-timestamp field="nowTimestamp"/>
+ <set field="parameters.thruDate" from-field="nowTimestamp"/>
+ <set-service-fields service-name="updateBillingAccount"
to-map="deleteBillingAccountCtx" map="parameters"/>
+ <call-service service-name="updateBillingAccount"
in-map-name="deleteBillingAccountCtx"/>
+ </simple-method>
</simple-methods>
Modified:
ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy?rev=1054857&r1=1054856&r2=1054857&view=diff
==============================================================================
---
ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy
(original)
+++
ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy
Tue Jan 4 02:01:08 2011
@@ -18,9 +18,20 @@
*/
import org.ofbiz.accounting.payment.PaymentWorker;
+import org.ofbiz.accounting.payment.BillingAccountWorker;
+import org.ofbiz.entity.util.EntityUtil;
partyId = parameters.partyId ?: userLogin.partyId;
showOld = "true".equals(parameters.SHOW_OLD);
+
+currencyUomId = null;
+billingAccounts = [];
+if (partyId) {
+ billingAccountAndRoles = delegator.findByAnd("BillingAccountAndRole",
[partyId : partyId]);
+ if (billingAccountAndRoles) currencyUomId =
billingAccountAndRoles.first().accountCurrencyUomId;
+ if (currencyUomId) billingAccounts =
BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId,
partyId, delegator, dispatcher);
+}
+context.billingAccounts = billingAccounts;
context.showOld = showOld;
context.partyId = partyId;
context.paymentMethodValueMaps =
PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId, showOld);
Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=1054857&r1=1054856&r2=1054857&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
(original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Tue
Jan 4 02:01:08 2011
@@ -1040,6 +1040,30 @@ under the License.
<response name="success" type="request" value="json"/>
<response name="error" type="request" value="json"/>
</request-map>
+
+ <!-- Billing Account requests -->
+ <request-map uri="EditBillingAccount">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="EditBillingAccount"/>
+ </request-map>
+ <request-map uri="createBillingAccount">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="createBillingAccount"/>
+ <response name="success" type="view" value="viewprofile"/>
+ <response name="error" type="view" value="EditBillingAccount"/>
+ </request-map>
+ <request-map uri="updateBillingAccount">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="updateBillingAccount"/>
+ <response name="success" type="view" value="EditBillingAccount"/>
+ <response name="error" type="view" value="EditBillingAccount"/>
+ </request-map>
+ <request-map uri="deleteBillingAccount">
+ <security https="true" auth="true"/>
+ <event type="simple"
path="component://party/script/org/ofbiz/party/party/PartySimpleMethods.xml"
invoke="deleteBillingAccount"/>
+ <response name="success" type="view" value="viewprofile"/>
+ <response name="error" type="view" value="viewprofile"/>
+ </request-map>
<!-- Order communication event requests -->
<request-map uri="UpdateCommOrders">
@@ -1334,5 +1358,8 @@ under the License.
<view-map name="UpdateCommProducts" type="screen"
page="component://party/widget/partymgr/CommunicationEventScreens.xml#UpdateCommProducts"/>
<view-map name="ViewProductStoreRoles" type="screen"
page="component://party/widget/partymgr/PartyScreens.xml#ViewProductStoreRoles"/>
+
+ <!-- Billing Account-->
+ <view-map name="EditBillingAccount" type="screen"
page="component://party/widget/partymgr/PaymentMethodScreens.xml#EditBillingAccount"/>
<!-- end of view mappings -->
</site-conf>
Modified:
ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/PaymentMethods.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/PaymentMethods.ftl?rev=1054857&r1=1054856&r2=1054857&view=diff
==============================================================================
---
ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/PaymentMethods.ftl
(original)
+++
ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/PaymentMethods.ftl
Tue Jan 4 02:01:08 2011
@@ -42,13 +42,15 @@ under the License.
<li><a
href="<@ofbizUrl>editeftaccount?partyId=${partyId}</@ofbizUrl>">${uiLabelMap.AccountingCreateNewEftAccount}</a></li>
<li><a
href="<@ofbizUrl>editgiftcard?partyId=${partyId}</@ofbizUrl>">${uiLabelMap.AccountingCreateNewGiftCard}</a></li>
<li><a
href="<@ofbizUrl>editcreditcard?partyId=${partyId}</@ofbizUrl>">${uiLabelMap.AccountingCreateNewCreditCard}</a></li>
+ <li><a
href="<@ofbizUrl>EditBillingAccount?partyId=${partyId}</@ofbizUrl>">${uiLabelMap.AccountingCreateBillingAccount}</a></li>
</#if>
</ul>
<br class="clear" />
</div>
<div class="screenlet-body">
- <#if paymentMethodValueMaps?has_content>
+ <#if paymentMethodValueMaps?has_content || billingAccounts?has_content>
<table class="basic-table" cellspacing="0">
+ <#if paymentMethodValueMaps?has_content>
<#list paymentMethodValueMaps as paymentMethodValueMap>
<#assign paymentMethod = paymentMethodValueMap.paymentMethod/>
<tr>
@@ -149,6 +151,27 @@ under the License.
</td> <#-- closes out orphaned <td> elements inside conditionals
-->
</tr>
</#list>
+ </#if>
+ <#-- Billing list-->
+ <#if billingAccounts?has_content>
+ <#list billingAccounts as billing>
+ <tr>
+ <td class="label"
valign="top">${uiLabelMap.AccountingBilling}</td>
+ <td>
+ <#if
billing.billingAccountId?has_content>${billing.billingAccountId}</#if>
+ <#if
billing.description?has_content>(${billing.description})</#if>
+ <#if
billing.accountLimit?has_content>(${uiLabelMap.AccountingAccountLimit}
$${billing.accountLimit})</#if>
+ <#if
billing.accountBalance?has_content>(${uiLabelMap.AccountingBillingAvailableBalance}
$${billing.accountBalance})</#if>
+ <#if
billing.fromDate?has_content>(${uiLabelMap.CommonUpdated}: ${billing.fromDate?if_exists})</#if>
+ <#if
billing.thruDate?has_content><b>(${uiLabelMap.PartyContactEffectiveThru}: ${billing.thruDate.toString()}</b></#if>
+ </td>
+ <td class="button-col">
+ <a
href="<@ofbizUrl>EditBillingAccount?billingAccountId=${billing.billingAccountId}&partyId=${partyId}</@ofbizUrl>">${uiLabelMap.CommonUpdate}</a>
+ <a
href="<@ofbizUrl>deleteBillingAccount?partyId=${partyId}&billingAccountId=${billing.billingAccountId}</@ofbizUrl>">${uiLabelMap.CommonExpire}</a>
+ </td>
+ </tr>
+ </#list>
+ </#if>
</table>
<#else>
${uiLabelMap.PartyNoPaymentMethodInformation}
Modified: ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodForms.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodForms.xml?rev=1054857&r1=1054856&r2=1054857&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodForms.xml
(original)
+++ ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodForms.xml Tue
Jan 4 02:01:08 2011
@@ -28,5 +28,14 @@ under the License.
<field name="submitButton" title="[${uiLabelMap.CommonSave}]"
widget-style="smallSubmit"><submit button-type="text-link"/></field>
<field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
widget-style="smallSubmit"><hyperlink target="backHome" also-hidden="false"
description="[${uiLabelMap.CommonCancelDone}]"/></field>
</form>
-
+
+ <form name="EditBillingAccount" type="single"
target="updateBillingAccount" extends="EditBillingAccount"
extends-resource="component://accounting/widget/BillingAccountForms.xml">
+ <field name="submitButton"><hidden/></field>
+ <field name="saveButton" title="${uiLabelMap.CommonSave}"
widget-style="buttontext"><submit button-type="button"/></field>
+ <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
widget-style="buttontext">
+ <hyperlink target="viewprofile"
description="${uiLabelMap.CommonCancelDone}">
+ <parameter param-name="partyId" from-field="partyId"/>
+ </hyperlink>
+ </field>
+ </form>
</forms>
Modified:
ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodScreens.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodScreens.xml?rev=1054857&r1=1054856&r2=1054857&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodScreens.xml
(original)
+++ ofbiz/trunk/applications/party/widget/partymgr/PaymentMethodScreens.xml Tue
Jan 4 02:01:08 2011
@@ -149,4 +149,28 @@ under the License.
</widgets>
</section>
</screen>
-</screens>
+
+ <screen name="EditBillingAccount">
+ <section>
+ <actions>
+ <set field="titleProperty"
value="PageTitleEditBillingAccount"/>
+ <set field="headerItem" value="billingaccount"/>
+ <set field="tabButtonItem" value="EditBillingAccount"/>
+ <property-to-field field="defaultCurrencyUomId"
resource="general" property="currency.uom.id.default" default="USD"/>
+ <set field="billingAccountId"
from-field="parameters.billingAccountId"/>
+ <entity-one entity-name="BillingAccount"
value-field="billingAccount"/>
+ <set field="partyId" from-field="parameters.partyId"/>
+ <set field="roleTypeId" from-field="parameters.roleTypeId"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="PaymentMethodDecorator">
+ <decorator-section name="body">
+ <screenlet
title="${uiLabelMap.PageTitleEditBillingAccount}">
+ <include-form name="EditBillingAccount"
location="component://party/widget/partymgr/PaymentMethodForms.xml"/>
+ </screenlet>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+</screens>
\ No newline at end of file