Author: hansbak Date: Mon Sep 23 03:13:04 2013 New Revision: 1525495 URL: http://svn.apache.org/r1525495 Log: add entity and services to be able to add content to payments
Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=1525495&r1=1525494&r2=1525495&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Mon Sep 23 03:13:04 2013 @@ -3085,6 +3085,72 @@ under the License. <key-map field-name="paymentId"/> </relation> </entity> + <entity entity-name="PaymentContent" + package-name="org.ofbiz.accounting.payment" + title="Payment Content Entity"> + <field name="paymentId" type="id-ne"></field> + <field name="paymentContentTypeId" type="id-ne"></field> + <field name="contentId" type="id-ne"></field> + <field name="fromDate" type="date-time"></field> + <field name="thruDate" type="date-time"></field> + <prim-key field="contentId"/> + <prim-key field="paymentId"/> + <prim-key field="paymentContentTypeId"/> + <prim-key field="fromDate"/> + <relation type="one" fk-name="PAYMENT_CNT_PROD" rel-entity-name="Payment"> + <key-map field-name="paymentId"/> + </relation> + <relation type="one" fk-name="PAYMENT_CNT_CNT" rel-entity-name="Content"> + <key-map field-name="contentId"/> + </relation> + <relation type="one" fk-name="PAYMENT_CNT_TYPE" rel-entity-name="PaymentContentType"> + <key-map field-name="paymentContentTypeId"/> + </relation> + </entity> + <entity entity-name="PaymentContentType" + package-name="org.ofbiz.accounting.payment" + title="Payment Content Type Entity"> + <field name="paymentContentTypeId" type="id-ne"></field> + <field name="parentTypeId" type="id"></field> + <field name="hasTable" type="indicator"></field> + <field name="description" type="description"></field> + <prim-key field="paymentContentTypeId"/> + <relation type="one" fk-name="PAYCT_TYP_PARENT" title="Parent" rel-entity-name="PaymentContentType"> + <key-map field-name="parentTypeId" rel-field-name="paymentContentTypeId"/> + </relation> + </entity> + <view-entity entity-name="PaymentContentAndInfo" + package-name="org.ofbiz.accounting.payment" + title="PaymentContent Content and DataResource View Entity"> + <member-entity entity-alias="PAYC" entity-name="PaymentContent"/> + <member-entity entity-alias="CO" entity-name="Content"/> + <member-entity entity-alias="DR" entity-name="DataResource"/> + <alias-all entity-alias="PAYC"/> + <alias-all entity-alias="CO"/> + <alias-all entity-alias="DR" prefix="dr"/> + <view-link entity-alias="PAYC" rel-entity-alias="CO"> + <key-map field-name="contentId"/> + </view-link> + <view-link entity-alias="CO" rel-entity-alias="DR"> + <key-map field-name="dataResourceId"/> + </view-link> + <relation type="one-nofk" rel-entity-name="ElectronicText"> + <key-map field-name="dataResourceId"/> + </relation> + <relation type="one-nofk" rel-entity-name="ImageDataResource"> + <key-map field-name="dataResourceId"/> + </relation> + <relation type="one-nofk" rel-entity-name="OtherDataResource"> + <key-map field-name="dataResourceId"/> + </relation> + <relation type="many" rel-entity-name="ContentAssocDataResourceViewFrom"> + <key-map field-name="contentId" rel-field-name="contentIdStart"/> + </relation> + <relation type="many" rel-entity-name="ContentAssocDataResourceViewTo"> + <key-map field-name="contentId" rel-field-name="contentIdStart"/> + </relation> + </view-entity> + <entity entity-name="PaymentMethod" package-name="org.ofbiz.accounting.payment" title="Payment Method Entity"> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=1525495&r1=1525494&r2=1525495&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Mon Sep 23 03:13:04 2013 @@ -1151,4 +1151,40 @@ under the License. </if-not-empty> </simple-method> + <!-- PaymentContent --> + <simple-method method-name="createPaymentContent" short-description="Create Content For Payment"> + <make-value value-field="newEntity" entity-name="PaymentContent"/> + <set-pk-fields map="parameters" value-field="newEntity"/> + <set-nonpk-fields map="parameters" value-field="newEntity"/> + + <if-empty field="newEntity.fromDate"> + <now-timestamp field="nowTimestamp"/> + <set field="newEntity.fromDate" from-field="nowTimestamp"/> + </if-empty> + + <create-value value-field="newEntity"/> + + <set-service-fields service-name="updateContent" map="parameters" to-map="updateContent"/> + <call-service service-name="updateContent" in-map-name="updateContent"/> + + <field-to-result field="newEntity.contentId" result-name="contentId"/> + <field-to-result field="newEntity.paymentId" result-name="paymentId"/> + <field-to-result field="newEntity.paymentContentTypeId" result-name="paymentContentTypeId"/> + </simple-method> + <simple-method method-name="updatePaymentContent" short-description="Update Content For Payment"> + <make-value value-field="lookupPKMap" entity-name="PaymentContent"/> + <set-pk-fields map="parameters" value-field="lookupPKMap"/> + <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/> + <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> + <store-value value-field="lookedUpValue"/> + + <set-service-fields service-name="updateContent" map="parameters" to-map="updateContent"/> + <call-service service-name="updateContent" in-map-name="updateContent"/> + </simple-method> + <simple-method method-name="removePaymentContent" short-description="Remove Content From Payment"> + <make-value value-field="lookupPKMap" entity-name="PaymentContent"/> + <set-pk-fields map="parameters" value-field="lookupPKMap"/> + <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/> + <remove-value value-field="lookedUpValue"/> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/services_payment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_payment.xml?rev=1525495&r1=1525494&r2=1525495&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Mon Sep 23 03:13:04 2013 @@ -250,4 +250,27 @@ under the License. <attribute name="paymentId" type="String" mode="IN" optional="true"/> <attribute name="invoiceId" type="String" mode="IN" optional="true"/> </service> + + <!-- Payment content services --> + <service name="createPaymentContent" default-entity-name="PaymentContent" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentContent" auth="true"> + <description>Add Content To Payment</description> + <auto-attributes include="pk" mode="INOUT" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes entity-name="Content" include="nonpk" mode="IN" optional="true"/> + <override name="fromDate" optional="true"/> + </service> + <service name="updatePaymentContent" default-entity-name="PaymentContent" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="updatePaymentContent" auth="true"> + <description>Update Content To Payment</description> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes entity-name="Content" include="nonpk" mode="IN" optional="true"/> + </service> + <service name="removePaymentContent" default-entity-name="PaymentContent" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="removePaymentContent" auth="true"> + <description>Remove Content From Payment</description> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> </services>