You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2006/07/31 18:33:27 UTC
svn commit: r427159 - in /incubator/ofbiz/trunk/applications/accounting:
config/ script/org/ofbiz/accounting/agreement/ servicedef/
webapp/accounting/WEB-INF/ webapp/accounting/agreement/ widget/
Author: jacopoc
Date: Mon Jul 31 09:33:26 2006
New Revision: 427159
URL: http://svn.apache.org/viewvc?rev=427159&view=rev
Log:
Implemented the copy of an agreement.
Added:
incubator/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/CopyAgreement.ftl (with props)
Modified:
incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties
incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml
incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml
incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
incubator/ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml
Modified: incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties?rev=427159&r1=427158&r2=427159&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties Mon Jul 31 09:33:26 2006
@@ -107,6 +107,7 @@
AccountingCompanyNameAccount=Company Name on Account
AccountingCompanyNameCard=Company Name on Card
AccountingCompanySubtitle=Part of the Open For Business Family of Open Source Software
+AccountingCopyAgreement=Copy Agreement
AccountingCouldNotFindGlAccount=Could not find GlAccount with ID
AccountingCreateAssignment=Create Assignment
AccountingCreateBillingAccount=Create Billing Account
Modified: incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties?rev=427159&r1=427158&r2=427159&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties (original)
+++ incubator/ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties Mon Jul 31 09:33:26 2006
@@ -103,6 +103,7 @@
AccountingCompanyNameAccount=Nome Azienda sul Conto
AccountingCompanyNameCard=Nome Azienda sulla Carta
AccountingCompanySubtitle=Part of the Open For Business Family of Open Source Software
+AccountingCopyAgreement=Copia Contratto
AccountingCouldNotFindGlAccount=Non trovato Conto Gl con Codice
AccountingCreateAssignment=Creare Assegnazione
AccountingCreateBillingAccount=Creare Conto Fatturazione
Modified: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml?rev=427159&r1=427158&r2=427159&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml Mon Jul 31 09:33:26 2006
@@ -90,12 +90,17 @@
<make-value value-name="newEntity" entity-name="AgreementItem"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
- <!-- create a non existing ID -->
- <make-next-seq-id value-name="newEntity" seq-field-name="agreementItemSeqId"/>
<field-to-field field-name="parameters.agreementId" to-field-name="newEntity.agreementId"/>
- <env-to-field env-name="agreementItemSeqId" map-name="newEntity"/>
+ <!-- create a non existing ID -->
+ <if-empty field-name="parameters.agreementItemSeqId">
+ <make-next-seq-id value-name="newEntity" seq-field-name="agreementItemSeqId"/>
+ <set from-field="agreementItemSeqId" field="newEntity.agreementItemSeqId"/>
+ <else>
+ <set from-field="parameters.agreementItemSeqId" field="newEntity.agreementItemSeqId"/>
+ </else>
+ </if-empty>
<field-to-result field-name="agreementId" result-name="agreementId"/>
- <field-to-result field-name="agreementItemSeqId" result-name="agreementItemSeqId"/>
+ <field-to-result field-name="newEntity.agreementItemSeqId" result-name="agreementItemSeqId"/>
<!-- finally create the record (should not exist already)-->
<create-value value-name="newEntity"/>
@@ -301,4 +306,56 @@
<remove-value value-name="agreementPartyApplic"/>
<check-errors/>
</simple-method>
+
+ <!-- copy an existing Agreement -->
+ <simple-method method-name="copyAgreement" short-description="Copy an existing Agreement">
+ <check-permission permission="ACCOUNTING" action="_CREATE">
+ <alt-permission permission="ACCOUNTING_ROLE" action="_CREATE"/>
+ <fail-message message="Security Error: to run copyAgreement you must have the ACCOUNTING_UPDATE or ACCOUNTING_ADMIN permission, or the limited ACCOUNTING_ROLE_UPDATE permission"/>
+ </check-permission>
+ <check-errors/>
+ <entity-one entity-name="Agreement" value-name="agreement" auto-field-map="true"/>
+ <check-errors/>
+ <set-service-fields service-name="createAgreement" to-map-name="createAgreementInMap" map-name="agreement"/>
+ <call-service service-name="createAgreement" in-map-name="createAgreementInMap">
+ <result-to-field result-name="agreementId" field-name="agreementIdTo"/>
+ </call-service>
+
+ <get-related value-name="agreement" relation-name="AgreementItem" list-name="agreementItems"/>
+ <iterate list-name="agreementItems" entry-name="agreementItem">
+ <clear-field field-name="createAgreementItemInMap"/>
+ <set-service-fields service-name="createAgreementItem" to-map-name="createAgreementItemInMap" map-name="agreementItem"/>
+ <set from-field="agreementIdTo" field="createAgreementItemInMap.agreementId"/>
+ <call-service service-name="createAgreementItem" in-map-name="createAgreementItemInMap"/>
+ </iterate>
+ <if-compare field-name="parameters.copyAgreementTerms" value="Y" operator="equals">
+ <get-related value-name="agreement" relation-name="AgreementTerm" list-name="agreementTerms"/>
+ <iterate list-name="agreementTerms" entry-name="agreementTerm">
+ <clear-field field-name="createAgreementTermInMap"/>
+ <set-service-fields service-name="createAgreementTerm" to-map-name="createAgreementTermInMap" map-name="agreementTerm"/>
+ <set from-field="agreementIdTo" field="createAgreementTermInMap.agreementId"/>
+ <call-service service-name="createAgreementTerm" in-map-name="createAgreementTermInMap"/>
+ </iterate>
+ </if-compare>
+ <if-compare field-name="parameters.copyAgreementProducts" value="Y" operator="equals">
+ <get-related value-name="agreement" relation-name="AgreementProductAppl" list-name="agreementProductAppls"/>
+ <iterate list-name="agreementProductAppls" entry-name="agreementProductAppl">
+ <clear-field field-name="createAgreementProductApplInMap"/>
+ <set-service-fields service-name="createAgreementProductAppl" to-map-name="createAgreementProductApplInMap" map-name="agreementProductAppl"/>
+ <set from-field="agreementIdTo" field="createAgreementProductApplInMap.agreementId"/>
+ <call-service service-name="createAgreementProductAppl" in-map-name="createAgreementProductApplInMap"/>
+ </iterate>
+ </if-compare>
+ <if-compare field-name="parameters.copyAgreementParties" value="Y" operator="equals">
+ <get-related value-name="agreement" relation-name="AgreementPartyApplic" list-name="agreementPartyApplic"/>
+ <iterate list-name="agreementPartyApplics" entry-name="agreementPartyApplic">
+ <clear-field field-name="createAgreementPartyApplicInMap"/>
+ <set-service-fields service-name="createAgreementPartyApplic" to-map-name="createAgreementPartyApplicInMap" map-name="agreementPartyApplic"/>
+ <set from-field="agreementIdTo" field="createAgreementPartyApplicInMap.agreementId"/>
+ <call-service service-name="createAgreementPartyApplic" in-map-name="createAgreementPartyApplicInMap"/>
+ </iterate>
+ </if-compare>
+ <field-to-result field-name="agreementIdTo" result-name="agreementId"/>
+ </simple-method>
+
</simple-methods>
Modified: incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml?rev=427159&r1=427158&r2=427159&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml Mon Jul 31 09:33:26 2006
@@ -39,6 +39,16 @@
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
</service>
+ <service name="copyAgreement" default-entity-name="Agreement" engine="simple"
+ location="org/ofbiz/accounting/agreement/AgreementServices.xml" invoke="copyAgreement" auth="true">
+ <description>Copy an Agreement</description>
+ <auto-attributes include="pk" mode="INOUT" optional="false"/>
+ <attribute name="copyAgreementTerms" type="String" mode="IN" optional="true"/>
+ <attribute name="copyAgreementProducts" type="String" mode="IN" optional="true"/>
+ <attribute name="copyAgreementParties" type="String" mode="IN" optional="true"/>
+ <!--<attribute name="agreementId" type="String" mode="OUT" optional="false"/>-->
+ </service>
+
<!-- AgreementItem -->
<service name="createAgreementItem" default-entity-name="AgreementItem" engine="simple"
location="org/ofbiz/accounting/agreement/AgreementServices.xml" invoke="createAgreementItem" auth="true">
Modified: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=427159&r1=427158&r2=427159&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Mon Jul 31 09:33:26 2006
@@ -630,7 +630,13 @@
<response name="success" type="view" value="EditAgreement"/>
<response name="error" type="view" value="EditAgreement"/>
</request-map>
-
+ <request-map uri="copyAgreement">
+ <security https="true" auth="true"/>
+ <event type="service" path="" invoke="copyAgreement"/>
+ <response name="success" type="view" value="EditAgreement"/>
+ <response name="error" type="view" value="EditAgreement"/>
+ </request-map>
+
<request-map uri="ListAgreementItems"><security https="true" auth="true"/><response name="success" type="view" value="ListAgreementItems"/></request-map>
<request-map uri="removeAgreementItem">
<security https="true" auth="true"/>
@@ -730,13 +736,13 @@
<request-map uri="createAgreementItemProduct">
<security https="true" auth="true"/>
<event type="service" path="" invoke="createAgreementProductAppl"/>
- <response name="success" type="view" value="EditAgreementItemProduct"/>
+ <response name="success" type="view" value="ListAgreementItemProducts"/>
<response name="error" type="view" value="EditAgreementItemProduct"/>
</request-map>
<request-map uri="updateAgreementItemProduct">
<security https="true" auth="true"/>
<event type="service" path="" invoke="updateAgreementProductAppl"/>
- <response name="success" type="view" value="EditAgreementItemProduct"/>
+ <response name="success" type="view" value="ListAgreementItemProducts"/>
<response name="error" type="view" value="EditAgreementItemProduct"/>
</request-map>
Added: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/CopyAgreement.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/CopyAgreement.ftl?rev=427159&view=auto
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/CopyAgreement.ftl (added)
+++ incubator/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/CopyAgreement.ftl Mon Jul 31 09:33:26 2006
@@ -0,0 +1,28 @@
+<#--
+
+Copyright 2001-2006 The Apache Software Foundation
+
+Licensed 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.
+-->
+<#if agreement?exists>
+<form action="<@o...@ofbizUrl>" method="post" style="margin: 0;">
+ <input type="hidden" name="agreementId" value="${agreementId}"/>
+ <div class="tabletext">
+ <b>${uiLabelMap.AccountingCopyAgreement}:</b>
+ ${uiLabelMap.AccountingAgreementTerms} <input type="checkbox" class="checkBox" name="copyAgreementTerms" value="Y" checked/>
+ ${uiLabelMap.ProductProducts} <input type="checkbox" class="checkBox" name="copyAgreementProducts" value="Y" checked/>
+ ${uiLabelMap.Party} <input type="checkbox" class="checkBox" name="copyAgreementParties" value="Y" checked/>
+ </div>
+ <input type="submit" class="smallSubmit" value="${uiLabelMap.CommonCopy}"/>
+</form>
+</#if>
Propchange: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/CopyAgreement.ftl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/CopyAgreement.ftl
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/CopyAgreement.ftl
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml?rev=427159&r1=427158&r2=427159&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml Mon Jul 31 09:33:26 2006
@@ -88,10 +88,20 @@
<widgets>
<decorator-screen name="CommonAgreementDecorator">
<decorator-section name="body">
- <container>
- <link target="EditAgreement" text="[${uiLabelMap.AccountingNewAgreement}]" style="buttontext"/>
- </container>
+ <section>
+ <condition>
+ <not><if-empty field-name="agreement"/></not>
+ </condition>
+ <widgets>
+ <container>
+ <link target="EditAgreement" text="${uiLabelMap.AccountingNewAgreement}" style="buttontext"/>
+ </container>
+ </widgets>
+ </section>
<include-form name="EditAgreement" location="component://accounting/webapp/accounting/agreement/AgreementForms.xml"/>
+ <platform-specific>
+ <html><html-template location="component://accounting/webapp/accounting/agreement/CopyAgreement.ftl"/></html>
+ </platform-specific>
</decorator-section>
</decorator-screen>
</widgets>