Author: hansbak
Date: Wed Aug 27 23:49:16 2008 New Revision: 689735 URL: http://svn.apache.org/viewvc?rev=689735&view=rev Log: show customer list of invoices send to him Added: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh (with props) Modified: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml Added: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh?rev=689735&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh (added) +++ ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh Wed Aug 27 23:49:16 2008 @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.ofbiz.base.util.*; +import org.ofbiz.entity.util.EntityUtil; + +if (userLogin != null) { + companies = delegator.findByAnd("PartyRelationship", UtilMisc.toMap( + "partyIdTo", userLogin.getString("partyId"), + "roleTypeIdTo", "CONTACT", + "roleTypeIdFrom", "ACCOUNT" + )); + if (UtilValidate.isNotEmpty(companies)) { + company = companies.get(0); + context.put("myCompanyId", company.getString("partyIdFrom")); + } else { + context.put("myCompanyId", userLogin.getString("partyId")); + } +} \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml?rev=689735&r1=689734&r2=689735&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml Wed Aug 27 23:49:16 2008 @@ -200,7 +200,10 @@ <response name="success" type="view" value="main"/> <response name="error" type="view" value="main"/> </request-map> - + <request-map uri="listInvoices"> + <security https="true" auth="true"/> + <response name="success" type="view" value="ListInvoices"/> + </request-map> <view-map name="main" type="screen" page="component://mypage/widget/CommonScreens.xml#main"/> <view-map name="preferences" type="screen" page="component://mypage/widget/CommonScreens.xml#preferences"/> @@ -213,4 +216,5 @@ <view-map name="ViewCommunicationEvent" type="screen" page="component://mypage/widget/MyPageScreens.xml#ViewCommunicationEvent"/> <view-map name="ViewRequest" type="screen" page="component://projectmgr/widget/RequestScreens.xml#ViewRequest"/> <view-map name="EditRequest" type="screen" page="component://mypage/widget/MyPageScreens.xml#EditRequest"/> + <view-map name="ListInvoices" type="screen" page="component://mypage/widget/MyPageScreens.xml#ListInvoices"/> </site-conf> Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml?rev=689735&r1=689734&r2=689735&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml (original) +++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml Wed Aug 27 23:49:16 2008 @@ -78,6 +78,15 @@ </condition> <link target="myTasks?donePage=myTasks"/> </menu-item> + <menu-item name="invoices" title="${uiLabelMap.AccountingInvoicesMenu}"> + <condition> + <and> + <not><if-empty field-name="userLogin"/></not> + <if-has-permission permission="MYPAGE_CUSTOMER"/> + </and> + </condition> + <link target="listInvoices"/> + </menu-item> <menu-item name="help" title="${uiLabelMap.CommonHelp}" align-style="opposed"> <condition><not><if-empty field-name="userLogin"/></not></condition> <link target="http://docs.ofbiz.org/display/OFBENDUSER/My+Page?decorator=printable" url-mode="plain" target-window="new"/> Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml?rev=689735&r1=689734&r2=689735&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml (original) +++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml Wed Aug 27 23:49:16 2008 @@ -180,7 +180,7 @@ <section> <actions> <set field="partyId" from-field="userLogin.partyId" /> - <set field="donePage" value="myCommunications"/> + <set field="donePage" value="myCommunications"/> </actions> <widgets> <include-screen name="Communications"/> @@ -459,4 +459,26 @@ </widgets> </section> </screen> + <screen name="ListInvoices"> + <section> + <actions> + <set field="headerItem" value="invoices"/> + <script location="component://mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh"/> + <set field="parameters.partyId" from-field="myCompanyId"/> + </actions> + <widgets> + <section> + <widgets> + <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <screenlet title="${uiLabelMap.PageTitleListInvoices}" navigation-form-name="ListInvoices"> + <include-form name="ListInvoices" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> + </screenlet> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </widgets> + </section> + </screen> </screens> |
Free forum by Nabble | Edit this page |