svn commit: r904006 [1/2] - in /ofbiz/trunk/specialpurpose/ebay: config/ data/ data/helpdata/ entitydef/ script/org/ofbiz/ebay/ebay/ servicedef/ src/org/ofbiz/ebay/ webapp/ebay/WEB-INF/ widget/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r904006 [1/2] - in /ofbiz/trunk/specialpurpose/ebay: config/ data/ data/helpdata/ entitydef/ script/org/ofbiz/ebay/ebay/ servicedef/ src/org/ofbiz/ebay/ webapp/ebay/WEB-INF/ widget/

hansbak-2
Author: hansbak
Date: Thu Jan 28 09:13:30 2010
New Revision: 904006

URL: http://svn.apache.org/viewvc?rev=904006&view=rev
Log:

Ebay API inventory functions
- function to reserve product in ofbiz inventory when posted on Ebay
- function  load products and quantity  to ebay store inventory
- Add new EnumerationType call EBAY_INV_RESERVE for reserve product from inventory  
- help screens.

Added:
    ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ProductInventory.xml
    ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ReserveProduct.xml
    ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStoreInventoryServices.java
    ofbiz/trunk/specialpurpose/ebay/widget/EbayInventoryForms.xml
Modified:
    ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml
    ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml
    ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml
    ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml
    ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml
    ofbiz/trunk/specialpurpose/ebay/script/org/ofbiz/ebay/ebay/EbayServices.xml
    ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml
    ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/ebay/widget/EbayMenus.xml
    ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml

Modified: ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml Thu Jan 28 09:13:30 2010
@@ -712,4 +712,16 @@
     <property key="EbayBlockItemOutOfStock">
         <value xml:lang="en">Block items out of stock</value>
     </property>
+    
+    <!-- ebay inventory -->
+    <property key="EbayReserveProductFrom">
+        <value xml:lang="en">Reserve Product From</value>
+    </property>
+    <property key="EbayReserveProductInventory">
+        <value xml:lang="en">Reserve Product Inventory</value>
+    </property>
+    <property key="EbayUpdateInventory">
+        <value xml:lang="en">Update To Ebay Inventory</value>
+    </property>
+    
 </resource>

Modified: ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml Thu Jan 28 09:13:30 2010
@@ -57,6 +57,7 @@
         visualThemeId="EC_DEFAULT" prodSearchExcludeVariants="Y" autoApproveInvoice="Y" shipIfCaptureFails="Y" autoApproveOrder="Y" showOutOfStockProducts="Y"/>
     <ProductStoreRole partyId="esandbox10543" roleTypeId="EBAY_ACCOUNT" productStoreId="esandbox10543_store" fromDate="2010-01-01 16:19:47.058"/>
     <ProductStoreCatalog productStoreId="esandbox10543_store" prodCatalogId="eBayCatalog" fromDate="2010-01-01 16:19:47.058"/>
+    <ProductStoreFacility productStoreId="esandbox10543_store" facilityId="WebStoreWarehouse" fromDate="2010-01-01 16:19:47.058"/>
     
     <WebSite webSiteId="EBAY" siteName="eBay" standardContentPrefix="http://demo.ofbiz.org" productStoreId="esandbox10543_store"/>
     <EbayConfig productStoreId="esandbox10543_store" devId="f3586481-93c7-4aaf-ab87-d383d56b71b1" appId="antwebc0f-9bf9-4829-998b-e5e8fb773ac" certId="7f363bc0-11d6-489a-a54d-4a44de82f790" compatibilityLevel="643" siteId="0" xmlGatewayUri="https://api.sandbox.ebay.com/ws/api.dll"  apiServerUrl="https://api.sandbox.ebay.com/wsapi"  webSiteId="EBAY">

Modified: ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml Thu Jan 28 09:13:30 2010
@@ -87,43 +87,54 @@
     
     <DataResource dataResourceId="EBAY_ebayStores" localeString="en" dataResourceTypeId="OFBIZ_FILE"
         objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_EbayStore.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
-    <Content contentId="EBAY_ebayStores" contentTypeId="DOCUMENT" contentName="EBay store" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_ebayStores" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/>
+    <Content contentId="EBAY_ebayStores" contentTypeId="DOCUMENT" contentName="EBay store" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_ebayStores" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_ebayStores" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_ebayStores"/>
     
     <DataResource dataResourceId="EBAY_NewEbayAccount" localeString="en" dataResourceTypeId="OFBIZ_FILE"
         objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_NewEbayAccount.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
-    <Content contentId="EBAY_NewEbayAccount" contentTypeId="DOCUMENT" contentName="EBay store new ebay Account" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_NewEbayAccount" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/>
+    <Content contentId="EBAY_NewEbayAccount" contentTypeId="DOCUMENT" contentName="EBay store new ebay Account" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_NewEbayAccount" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_NewEbayAccount" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_NewEbayAccount"/>
     
     <DataResource dataResourceId="EBAY_StoreSetting" localeString="en" dataResourceTypeId="OFBIZ_FILE"
         objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_StoreSetting.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
-    <Content contentId="EBAY_StoreSetting" contentTypeId="DOCUMENT" contentName="EBay store setting" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_StoreSetting" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/>
+    <Content contentId="EBAY_StoreSetting" contentTypeId="DOCUMENT" contentName="EBay store setting" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_StoreSetting" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_StoreSetting" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_ebayStoreDetail"/>
     
     <DataResource dataResourceId="EBAY_ExpCatToEbay" localeString="en" dataResourceTypeId="OFBIZ_FILE"
         objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_ExportCategoriesToEbay.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
-    <Content contentId="EBAY_ExpCatToEbay" contentTypeId="DOCUMENT" contentName="EBay export categories to store" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_ExpCatToEbay" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/>
+    <Content contentId="EBAY_ExpCatToEbay" contentTypeId="DOCUMENT" contentName="EBay export categories to store" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_ExpCatToEbay" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_ExpCatToEbay" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_exportCategoryEbayStore"/>
     
     <!-- ebay feedback -->
     <DataResource dataResourceId="EBAY_LeaveFeedback" localeString="en" dataResourceTypeId="OFBIZ_FILE"
         objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_LeaveFeedback.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
-    <Content contentId="EBAY_LeaveFeedback" contentTypeId="DOCUMENT" contentName="EBay Leave Feedback" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_LeaveFeedback" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/>
+    <Content contentId="EBAY_LeaveFeedback" contentTypeId="DOCUMENT" contentName="EBay Leave Feedback" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_LeaveFeedback" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_LeaveFeedback" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_LeaveFeedback"/>
     
     <DataResource dataResourceId="EBAY_Feedback" localeString="en" dataResourceTypeId="OFBIZ_FILE"
         objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_Feedback.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
-    <Content contentId="EBAY_Feedback" contentTypeId="DOCUMENT" contentName="EBay Feedback" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_Feedback" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/>
+    <Content contentId="EBAY_Feedback" contentTypeId="DOCUMENT" contentName="EBay Feedback" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_Feedback" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_Feedback" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_Feedback"/>
     
     <DataResource dataResourceId="EBAY_AutoPref" localeString="en" dataResourceTypeId="OFBIZ_FILE"
         objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_AutoPref.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
-    <Content contentId="EBAY_AutoPref" contentTypeId="DOCUMENT" contentName="EBay Automation Preferences" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_AutoPref" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/>
+    <Content contentId="EBAY_AutoPref" contentTypeId="DOCUMENT" contentName="EBay Automation Preferences" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_AutoPref" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_AutoPref" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_AutomationPreferences"/>
     
     <!-- block out of stock  -->
     <DataResource dataResourceId="EBAY_BlockItem" localeString="en" dataResourceTypeId="OFBIZ_FILE"
         objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_BlockItemOutStock.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
-    <Content contentId="EBAY_BlockItem" contentTypeId="DOCUMENT" contentName="Block item that out of stock on eBay" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_BlockItem" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/>
+    <Content contentId="EBAY_BlockItem" contentTypeId="DOCUMENT" contentName="Block item that out of stock on eBay" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_BlockItem" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_BlockItem" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_blockItemOutOfStock"/>
+    
+    <!-- ebay product inventory -->
+    <DataResource dataResourceId="EBAY_ProdInventory" localeString="en" dataResourceTypeId="OFBIZ_FILE"
+        objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_ProductInventory.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
+    <Content contentId="EBAY_ProdInventory" contentTypeId="DOCUMENT" contentName="handle ebay store inventory by ofbiz inventory" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_ProdInventory" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
+    <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_ProdInventory" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_ebayStoreInventory"/>    
+    
+    <DataResource dataResourceId="EBAY_reserveProd" localeString="en" dataResourceTypeId="OFBIZ_FILE"
+        objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_ReserveProduct.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" />
+    <Content contentId="EBAY_reserveProd" contentTypeId="DOCUMENT" contentName="reserve product from ofbiz inventory" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_reserveProd" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
+    <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_reserveProd" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_reserveEbayProductInventory"/>
 </entity-engine-xml>

Modified: ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml Thu Jan 28 09:13:30 2010
@@ -29,5 +29,8 @@
     <Enumeration description="Flat Rate Shipping" enumCode="FLAT_RATE" enumId="EBAY_FLAT_RATE" sequenceId="01" enumTypeId="EBAY_SHIP_TYPE"/>
         
     <RoleType roleTypeId="COMMENTATOR" hasTable="N" description="Commentator"/>
-    <RoleType roleTypeId="EBAY_ORGANIZATION" hasTable="N" description="eBay Organization"/>
+    <RoleType roleTypeId="EBAY_ORGANIZATION" hasTable="N" description="eBay Organization"/>
+    
+    <EnumerationType description="Inventory Reservation For Ebay Store" enumTypeId="EBAY_INV_RESERVE" hasTable="N" parentTypeId=""/>
+    <Enumeration description="ebay inventory reserve" enumCode="EBAY_INV" enumId="EBAY_INV_RES" sequenceId="01" enumTypeId="EBAY_INV_RESERVE"/>
 </entity-engine-xml>

Added: ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ProductInventory.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ProductInventory.xml?rev=904006&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ProductInventory.xml (added)
+++ ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ProductInventory.xml Thu Jan 28 09:13:30 2010
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
+    xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd"
+    xmlns="http://docbook.org/ns/docbook">
+    <title>Handle Ebay Product Inventory screen.</title>
+    <para>
+This screen allows the user to manage reserve products from ofbiz inventory to their ebay store and then user can use this screen to upload that products into ebay product inventory on ebay site following an ebay account. In this screen user can manage their ebay store inventory from ofbiz, the screen will show status of product on ebay product inventory (Product Avialabel to list, active, sold, unsold and scheduled</para>
+    <section>
+ <title>This function used for : </title>
+ <orderedlist>
+    <listitem><para>Handle ofbiz inventory and ebay product inventory follow an ebay account</para></listitem>
+    <listitem><para>Reserve product from ofbiz inventory</para></listitem>
+    <listitem><para>Upload product to  ebay product inventory</para></listitem>
+    <listitem><para>Show status of product(QTY, Avialable to listing, scheduled, sold, unsold and active listing) </para></listitem>
+    <listitem><para>Show Quantity of product</para></listitem>
+ </orderedlist>
+    </section>
+    <section>
+ <title>How to go to reserve product?</title>
+ <orderedlist>
+    <listitem><para>Go to inventory Details section.</para></listitem>
+    <listitem><para>Press on "Reserve product inventory" button</para></listitem>
+    <listitem><para>The system will show reserve product screen</para></listitem>
+ </orderedlist>
+    </section>
+    <section>
+ <title>How to update inventoy and status on ebay site?</title>
+ <orderedlist>
+    <listitem><para>Go to inventory Details section.</para></listitem>
+    <listitem><para>Press on "Update to ebay inventory" button</para></listitem>
+    <listitem><para>The system will update product and qty to ebay inventory on ebay site</para></listitem>
+ </orderedlist>
+    </section>
+    <section>
+ <title>Fields Description : </title>
+ <orderedlist>
+    <listitem><para>ProductId (productId in ofbiz catalog)</para></listitem>
+    <listitem><para>ProductName (Name of product)</para></listitem>
+    <listitem><para>Qty Reserved (Quantity of product that user reserved from ofbiz inventory)  </para></listitem>
+    <listitem><para>Available To Promise Listing (Quantity of product that user can use create listing)</para></listitem>
+    <listitem><para>Ebay Product Id (this field used for keep productId from ebay inventory because  Ebay site not allow user to create productId to their system)</para></listitem>
+    <listitem><para>Active Listing (Quantity of product that user can use create listing)</para></listitem>
+            <listitem><para>sold (Quantity of product that sold)</para></listitem>
+            <listitem><para>un Sold (Quantity of product that still un sold)</para></listitem>
+            <listitem><para>reserved date</para></listitem>
+    <listitem><para>note: The user can not create ebay listing and sell product on ebay site greater than amount they made a reservation only.</para></listitem>
+ </orderedlist>
+    </section>
+    <section>
+ <title>Note : </title>
+ <orderedlist>
+    <listitem><para>Please subscribed to Selling Manager Pro before you use this function because ebay product inventory will open when you start selling manager pro on ebay site</para></listitem>
+    <listitem><para><link xl:href="http://pages.ebay.com/selling_manager_pro">To subscribe for production site </link></para></listitem>
+    <listitem><para><link xl:href="http://k2b-bulk.sandbox.ebay.com/ws/eBayISAPI.dll?MyeBaySellingPendingListings">To upgrade store level for sandbox site </link>(The normal level for sandbox store is basic, the user should upgrade to premium when you want to use inventory function with ebay sandbox.)</para></listitem>
+ <listitem><para>How to upgrade sandbox store level?</para></listitem>
+    <listitem><para>Click on the link "To upgrade store level for sandbox site"</para></listitem>
+    <listitem><para>Go to "Selling Related links" section</para></listitem>
+    <listitem><para>Click on "Edit my eBay store"</para></listitem>
+    <listitem><para>Page Manage my eBay store will show up</para></listitem>
+    <listitem><para>Go to "Store Usage Information" section</para></listitem>
+ <listitem><para>Click upgrade at "Subscription level" then select "Premium Store" and "Selling Manager Pro" submit.</para></listitem>
+ </orderedlist>
+    </section>
+</section>

Added: ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ReserveProduct.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ReserveProduct.xml?rev=904006&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ReserveProduct.xml (added)
+++ ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_ReserveProduct.xml Thu Jan 28 09:13:30 2010
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
+    xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd"
+    xmlns="http://docbook.org/ns/docbook">
+    <title>Reserve Product From Ofbiz Inventory screen.</title>
+    <para>
+This screen allows the user to reserve products from ofbiz inventory for create listing and sell on ebay site.</para>
+    <section>
+ <title>How to reserve product?</title>
+ <orderedlist>
+    <listitem><para>Go to Reserve Product section</para></listitem>
+    <listitem><para>Enter field productId (Click "look up" to find product or type in text the system will show list of product)</para></listitem>
+    <listitem><para>Enter quantity of product you want to reserve.</para></listitem>
+    <listitem><para>Press "" button</para></listitem>
+ </orderedlist>
+    </section>
+</section>

Modified: ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml Thu Jan 28 09:13:30 2010
@@ -89,5 +89,31 @@
             <key-map field-name="shipmentMethodTypeId"/>
         </relation>
     </entity>
+    
+    <entity entity-name="EbayProductStoreInventory"
+        package-name="org.ofbiz.ebay.store"
+        title="Ebay store product inventory and status of listing">
+        <field name="productStoreId" type="id-ne"></field>
+        <field name="facilityId" type="id-ne"></field>
+        <field name="productId" type="id-ne"></field>
+        <field name="folderId" type="id-ne"></field>
+        <field name="ebayProductId" type="numeric"></field>
+        <field name="quantityReserved" type="fixed-point"></field>
+        <field name="availableToPromiseListing" type="fixed-point"></field>
+        <field name="scheduled" type="fixed-point"></field>
+        <field name="activeListing" type="fixed-point"></field>
+        <field name="sold" type="fixed-point"></field>
+        <field name="unSold" type="fixed-point"></field>
+        <field name="successRatio" type="floating-point"></field>
+        <field name="avgSellingPrice" type="floating-point"></field>
+        <field name="reservedDate" type="date-time"></field>
+        <prim-key field="productStoreId"/>
+        <prim-key field="facilityId"/>
+        <prim-key field="productId"/>
+        <relation type="one" fk-name="EBYSM_PRD_STRE" rel-entity-name="ProductStore">
+            <key-map field-name="productStoreId"/>
+        </relation>
+    </entity>
+    
 </entitymodel>    
     
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/ebay/script/org/ofbiz/ebay/ebay/EbayServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/script/org/ofbiz/ebay/ebay/EbayServices.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/script/org/ofbiz/ebay/ebay/EbayServices.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/script/org/ofbiz/ebay/ebay/EbayServices.xml Thu Jan 28 09:13:30 2010
@@ -42,4 +42,413 @@
         <field-to-result field="parameters.productStoreId" result-name="productStoreId"/>
         
     </simple-method>
+    
+    <!-- Store Inventory Services -->
+    <simple-method method-name="reserveEbayStoreInventory" short-description="Reserve ofbiz Store product Inventory">
+        <entity-one entity-name="Product" value-field="product" use-cache="true"/>
+        <entity-one entity-name="ProductStore" value-field="productStore" >
+            <field-map field-name="productStoreId" from-field="parameters.productStoreId"/>
+        </entity-one>
+        <if-empty field="productStore">
+            <add-error><fail-message message="No ProductStore found with id ${parameters.productStoreId}, not reserving inventory."/></add-error>
+            <check-errors/>
+        </if-empty>
+        
+        <!-- if prodCatalog is set to not reserve inventory, break here -->
+        <if-compare value="N" operator="equals" field="productStore.reserveInventory">
+            <!-- note: if not set, defaults to yes, reserve inventory -->
+            <log level="verbose" message="ProductStore with id ${productStore.productStoreId}, is set to NOT reserve inventory, not reserving inventory"/>
+            <field-to-result field="parameters.quantity" result-name="quantityNotReserved"/>
+            <return response-code="success"/>
+        </if-compare>
+        
+        <call-simple-method method-name="isStoreInventoryRequiredInline"/>
+        
+        <set from-field="parameters.facilityId" field="facilityId"/>
+        <if-not-empty field="facilityId">
+            <entity-and entity-name="ProductStoreFacility" list="productStoreFacilities" use-cache="true">
+                <field-map from-field="productStore.productStoreId" field-name="productStoreId"/>
+                <field-map from-field="facilityId" field-name="facilityId"/>
+                <order-by field-name="sequenceNum"/>
+            </entity-and>
+            <iterate list="productStoreFacilities" entry="productStoreFacility">
+                <!-- Search Product Store Facilities to insure the facility passed in is associated to the Product Store passed in -->
+                <set field="facilityFound" from-field="productStoreFacility"/>
+                <log level="info" message="ProductStoreService:Facility Found : [${facilityFound}]"/>
+            </iterate>
+            <if-empty field="facilityFound">
+                <add-error><fail-message message="Facility with id ${parameters.facilityId} is not associated to ProductStore with id ${parameters.productStoreId}, not reserving inventory."/></add-error>
+                <check-errors/>
+            </if-empty>
+            <!-- verifly that product was store in facility -->
+            <entity-and entity-name="ProductFacility" list="productFacilityList">
+                <field-map from-field="facilityId" field-name="facilityId"/>
+                <field-map from-field="parameters.productId" field-name="productId"/>
+            </entity-and>
+            <if-empty field="productFacilityList">
+                <add-error><fail-message message="Facility with id ${parameters.facilityId} is not associated to ProductId with id ${parameters.productId}, not reserving inventory."/></add-error>
+                <check-errors/>
+            </if-empty>
+            
+            <set-service-fields map="parameters" to-map="callServiceMap" service-name="reserveEbayProductInventoryByStoreFacility"/>
+            <set from-field="facilityId" field="callServiceMap.facilityId"/>
+            <set from-field="requireInventory" field="callServiceMap.requireInventory"/>
+            <set from-field="productStore.reserveOrderEnumId" field="callServiceMap.reserveOrderEnumId"/>
+            <call-service service-name="reserveEbayProductInventoryByStoreFacility" in-map-name="callServiceMap">
+                <results-to-map map-name="resultMap"/>
+                <result-to-field result-name="quantityNotReserved" field="qtyNotReserve"/>
+                <result-to-field result-name="successMessage" field="returnSuccessMessage"/>
+            </call-service>
+            <set field="defaultReserve" default-value="0"/>
+            <!-- if quantityNotReserved greater than 0 then ATP in ofbiz stock not have, it should be return message or log warring-->
+            <if-compare-field field="qtyNotReserve" operator="equals"  type="BigDecimal" to-field="defaultReserve">
+                <call-simple-method method-name="editEbayProductStoreInventory"/>
+                <set field="successMessage" value="${returnSuccessMessage} quantity Reserved:${parameters.quantity} quantityNotReserved:${qtyNotReserve} "/>
+                <field-to-result  field="successMessage"/>
+                <set field="quantityNotReserved"  default-value="0" type="BigDecimal"/>
+                <field-to-result field="quantityNotReserved"/>
+                <else>
+                    <!-- find qty which can reserved -->
+                    <set field="requiredQty" from-field="parameters.quantity"/>
+                    <calculate field="reservedQty" type="BigDecimal" >
+                        <calcop operator="get">
+                            <calcop operator="get" field="requiredQty"/>
+                            <calcop operator="negative" field="qtyNotReserve"/>
+                        </calcop>
+                    </calculate>
+                    <set field="parameters.quantity" from-field="reservedQty"/>
+                    <if-compare-field field="reservedQty" operator="greater" to-field="defaultReserve" >
+                        <call-simple-method method-name="editEbayProductStoreInventory"/>
+                    </if-compare-field>
+                    
+                    <!-- then show only qty was already reserved and show  difference value that can not reserve -->
+                    <set field="successMessage" value="${returnSuccessMessage} Quantity Reserved : ${reservedQty} Quantity Not Reserved : ${qtyNotReserve} "/>
+                    <field-to-result  field="successMessage"/>
+                    <set field="quantityNotReserved" value="${qtyNotReserve}" default-value="0" type="BigDecimal"/>
+                    <field-to-result field="quantityNotReserved"/>
+                </else>
+            </if-compare-field>
+        </if-not-empty>
+    </simple-method>
+    
+    <simple-method method-name="editEbayProductStoreInventory" short-description="add qty reserve from ofbiz Store product Inventory and combine with ebay store inventory">
+        <entity-one entity-name="EbayProductStoreInventory" value-field="ebayProductStoreInventory" >
+            <field-map field-name="productStoreId"  from-field="parameters.productStoreId"/>
+            <field-map field-name="facilityId"  from-field="parameters.facilityId"/>
+            <field-map field-name="productId"  from-field="parameters.productId"/>
+        </entity-one>
+        <if-empty field="ebayProductStoreInventory">
+            <!-- add new reserved product  -->
+            <make-value value-field="newEbayProductStoreInven" entity-name="EbayProductStoreInventory"/>
+            <set field="newEbayProductStoreInven.productStoreId" from-field="parameters.productStoreId"/>
+            <set field="newEbayProductStoreInven.facilityId" from-field="parameters.facilityId"/>
+            <set field="newEbayProductStoreInven.productId" from-field="parameters.productId"/>
+            <set field="newEbayProductStoreInven.quantityReserved" default-value="0" from-field="parameters.quantity"/>
+            <set field="newEbayProductStoreInven.availableToPromiseListing" default-value="0" from-field="parameters.quantity"/>
+            <set field="newEbayProductStoreInven.scheduled" default-value="0" type="BigDecimal"/>
+            <set field="newEbayProductStoreInven.activeListing" default-value="0" type="BigDecimal"/>
+            <set field="newEbayProductStoreInven.sold" default-value="0" type="BigDecimal"/>
+            <set field="newEbayProductStoreInven.unSold" default-value="0" type="BigDecimal"/>
+            <now-timestamp field="newEbayProductStoreInven.reservedDate" />
+            <create-value value-field="newEbayProductStoreInven"/>
+            <else><!-- update reserved qty   -->
+                <set field="qtyNow" default-value="0" from-field="ebayProductStoreInventory.quantityReserved"/>
+                <set field="atpListingNow" default-value="0" from-field="ebayProductStoreInventory.availableToPromiseListing"/>
+                <set field="reserveQty" default-value="0" from-field="parameters.quantity"/>
+                <calculate field="sumQtyReserved" type="BigDecimal" >
+                    <calcop operator="add">
+                        <calcop operator="get" field="qtyNow"/>
+                        <calcop operator="get" field="reserveQty"/>
+                    </calcop>
+                </calculate>
+                <calculate field="sumQtyATPListing" type="BigDecimal" >
+                    <calcop operator="add">
+                        <calcop operator="get" field="atpListingNow"/>
+                        <calcop operator="get" field="reserveQty"/>
+                    </calcop>
+                </calculate>
+                <now-timestamp field="ebayProductStoreInventory.reservedDate" />
+                <set field="ebayProductStoreInventory.quantityReserved" from-field="sumQtyReserved"/>
+                <set field="ebayProductStoreInventory.availableToPromiseListing" from-field="sumQtyATPListing"/>
+                <store-value value-field="ebayProductStoreInventory"/>
+            </else>
+        </if-empty>
+    </simple-method>
+    
+    <simple-method method-name="isStoreInventoryRequiredInline" short-description="Is Store Inventory Required" login-required="false">
+        <set from-field="product.requireInventory" field="requireInventory"/>
+        <if-empty field="requireInventory">
+            <set from-field="productStore.requireInventory" field="requireInventory"/>
+        </if-empty>
+        <if-empty field="requireInventory">
+            <set value="Y" field="requireInventory"/>
+        </if-empty>
+    </simple-method>
+    
+    <simple-method method-name="reserveEbayProductInventory" short-description="Reserve Inventory for a Product">
+        
+        <now-timestamp field="nowTimestamp"/>
+        
+        <!-- check the product; make sure its a physical item -->
+        <entity-one entity-name="Product" value-field="product"/>
+        <entity-one entity-name="Facility" value-field="facility" use-cache="true"/>
+        <get-related-one value-field="product" relation-name="ProductType" to-value-field="productType"/>
+        <if-compare field="productType.isPhysical" operator="equals" value="N">
+            <set field="parameters.quantityNotReserved" value="0" type="BigDecimal"/>
+            <else>
+
+                <set value="EBAY_INV_RES" field="parameters.reserveReasonEnumId"/>
+                <set value="+datetimeReceived" field="orderByString"/>
+                <set from-field="parameters.quantity" field="parameters.quantityNotReserved"/>
+                
+                <!-- first reserve against InventoryItems in FLT_PICKLOC type locations, then FLT_BULK locations, then InventoryItems with no locations -->
+                <entity-condition entity-name="InventoryItemAndLocation" list="inventoryItemAndLocations">
+                    <condition-list combine="and">
+                        <condition-expr field-name="productId" from-field="parameters.productId"/>
+                        <condition-expr field-name="facilityId" from-field="parameters.facilityId" ignore-if-empty="true" ignore-if-null="true"/>
+                        <condition-expr field-name="containerId" from-field="parameters.containerId" ignore-if-empty="true" ignore-if-null="true"/>
+                        <condition-expr field-name="quantityOnHandTotal" operator="greater" value="0.0"/>
+                        <condition-expr field-name="locationTypeEnumId" operator="equals" value="FLT_PICKLOC"/>
+                    </condition-list>
+                    <order-by field-name="${orderByString}"/>
+                </entity-condition>
+                <iterate entry="inventoryItemAndLocation" list="inventoryItemAndLocations">
+                    <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="Double">
+                        <!-- this is a little trick to get the InventoryItem value object without doing a query, possible since all fields on InventoryItem are also on InventoryItemAndLocation with the same names -->
+                        <make-value entity-name="InventoryItem" map="inventoryItemAndLocation" value-field="inventoryItem"/>
+                        <call-simple-method method-name="reserveForInventoryItemInline"/>
+                    </if-compare>
+                </iterate>
+                <!-- still some left? try the FLT_BULK locations -->
+                <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="BigDecimal">
+                    <entity-condition entity-name="InventoryItemAndLocation" list="inventoryItemAndLocations">
+                        <condition-list combine="and">
+                            <condition-expr field-name="productId" from-field="parameters.productId"/>
+                            <condition-expr field-name="facilityId" from-field="parameters.facilityId" ignore-if-empty="true" ignore-if-null="true"/>
+                            <condition-expr field-name="containerId" from-field="parameters.containerId" ignore-if-empty="true" ignore-if-null="true"/>
+                            <condition-expr field-name="quantityOnHandTotal" operator="greater" value="0.0"/>
+                            <condition-expr field-name="locationTypeEnumId" operator="equals" value="FLT_BULK"/>
+                        </condition-list>
+                        <order-by field-name="${orderByString}"/>
+                    </entity-condition>
+                    <iterate entry="inventoryItemAndLocation" list="inventoryItemAndLocations">
+                        <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="Double">
+                            <!-- this is a little trick to get the InventoryItem value object without doing a query, possible since all fields on InventoryItem are also on InventoryItemAndLocation with the same names -->
+                            <make-value entity-name="InventoryItem" map="inventoryItemAndLocation" value-field="inventoryItem"/>
+                            <call-simple-method method-name="reserveForInventoryItemInline"/>
+                        </if-compare>
+                    </iterate>
+                </if-compare>
+                
+                <!-- last of all try reserving in InventoryItems that have no locationSeqId, ie are not in any particular location -->
+                <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="BigDecimal">
+                    <entity-condition entity-name="InventoryItem" list="inventoryItems">
+                        <condition-list combine="and">
+                            <condition-expr field-name="productId" from-field="parameters.productId"/>
+                            <condition-expr field-name="facilityId" from-field="parameters.facilityId" ignore-if-empty="true" ignore-if-null="true"/>
+                            <condition-expr field-name="containerId" from-field="parameters.containerId" ignore-if-empty="true" ignore-if-null="true"/>
+                            <condition-expr field-name="quantityOnHandTotal" operator="greater" value="0.0"/>
+                            <condition-expr field-name="locationSeqId" operator="equals" from-field="nullField"/>
+                        </condition-list>
+                        <order-by field-name="${orderByString}"/>
+                    </entity-condition>
+                    <iterate entry="inventoryItem" list="inventoryItems">
+                        <if>
+                            <condition>
+                                <and>
+                                    <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="Double"/>
+                                    <if-empty field="inventoryItem.locationSeqId"/>
+                                </and>
+                            </condition>
+                            <then>
+                                <call-simple-method method-name="reserveForInventoryItemInline"/>
+                            </then>
+                        </if>
+                    </iterate>
+                </if-compare>
+                <!--
+                    if inventory is not required for purchase and quantityNotReserved != 0:
+                    - subtract the remaining quantityNotReserved from the availableToPromise of the last non-serialized inventory item
+                    - or if none was found create a non-ser InventoryItem with availableToPromise = -quantityNotReserved
+                -->
+                <if-compare field="parameters.quantityNotReserved" operator="not-equals" value="0" type="BigDecimal">
+                    <if-compare field="parameters.requireInventory" operator="equals" value="Y">
+                        <!-- use this else pattern to accomplish the anything but Y logic, ie if not specified default to inventory NOT required -->
+                        <else>
+                            <if-not-empty field="lastNonSerInventoryItem">
+                                <!-- subtract from quantityNotReserved from the availableToPromise of existing inventory item -->
+                                <!-- instead of updating InventoryItem, add an InventoryItemDetail -->
+                                <set from-field="lastNonSerInventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/>
+                                <set from-field="parameters.reserveReasonEnumId" field="createDetailMap.reasonEnumId"/>
+                                 <calculate field="createDetailMap.availableToPromiseDiff">
+                                    <calcop field="parameters.quantityNotReserved" operator="negative"/>
+                                </calculate>
+                                <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/>
+                                <clear-field field="createDetailMap"/>
+                                
+                                <!-- get the promiseDatetime -->
+                                <get-related-one value-field="lastNonSerInventoryItem" relation-name="ProductFacility" to-value-field="productFacility"/>
+                                <clear-field field="daysToShip"/>
+                                <set field="daysToShip" from-field="productFacility.daysToShip"/>
+                                <if-empty field="daysToShip">
+                                    <!-- if the product does not have its own days to ship, use Facility.defaultDaysToShip, if not then use 30 days as a USA industry default -->
+                                    <if-not-empty field="facility.defaultDaysToShip">
+                                        <set field="daysToShip" from-field="facility.defaultDaysToShip" type="Long"/>
+                                        <else>
+                                            <set field="daysToShip" value="30" type="Long"/>
+                                        </else>
+                                    </if-not-empty>
+                                </if-empty>
+                                <!-- TODO: Convert this to a <set-calendar> operation -->
+                                <call-bsh><![CDATA[
+                            java.sql.Timestamp orderDate = orderHeader.getTimestamp("orderDate");
+                            com.ibm.icu.util.Calendar cal = com.ibm.icu.util.Calendar.getInstance();
+                            cal.setTimeInMillis(orderDate.getTime());
+                            cal.add(com.ibm.icu.util.Calendar.DAY_OF_YEAR, daysToShip.intValue());
+                            return org.ofbiz.base.util.UtilMisc.toMap("promisedDatetime", new java.sql.Timestamp(cal.getTimeInMillis()));
+                            ]]></call-bsh>
+                                
+                                <else>
+                                    <!-- no non-ser inv item, create a non-ser InventoryItem with availableToPromise = -quantityNotReserved -->
+                                    <clear-field field="createInventoryItemInMap"/>
+                                    <clear-field field="createInventoryItemOutMap"/>
+                                    <!-- the createInventoryItem service is run by the the system user here -->
+                                    <entity-one entity-name="UserLogin" value-field="permUserLogin">
+                                        <field-map field-name="userLoginId" value="system"/>
+                                    </entity-one>
+                                    <set from-field="parameters.productId" field="createInventoryItemInMap.productId"/>
+                                    <set from-field="parameters.facilityId" field="createInventoryItemInMap.facilityId"/>
+                                    <set from-field="parameters.containerId" field="createInventoryItemInMap.containerId"/>
+                                    <set value="NON_SERIAL_INV_ITEM" field="createInventoryItemInMap.inventoryItemTypeId"/>
+                                    <set from-field="permUserLogin" field="createInventoryItemInMap.userLogin"/>
+                                    <call-service service-name="createInventoryItem" in-map-name="createInventoryItemInMap" include-user-login="false">
+                                        <result-to-field result-name="inventoryItemId" field="createInventoryItemOutMap.inventoryItemId"/>
+                                    </call-service>
+                                    <entity-one entity-name="InventoryItem" value-field="newNonSerInventoryItem">
+                                        <field-map field-name="inventoryItemId" from-field="createInventoryItemOutMap.inventoryItemId"/>
+                                    </entity-one>
+                                    
+                                    <!-- also create a detail record with the quantities -->
+                                    <set from-field="newNonSerInventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/>
+                                    <set from-field="parameters.reserveReasonEnumId" field="createDetailMap.reasonEnumId"/>
+                                     <calculate field="createDetailMap.availableToPromiseDiff">
+                                        <calcop field="parameters.quantityNotReserved" operator="negative"/>
+                                    </calculate>
+                                    <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/>
+                                    <clear-field field="createDetailMap"/>
+                                    
+                                    <!-- get the promiseDatetime -->
+                                    <get-related-one value-field="newNonSerInventoryItem" relation-name="ProductFacility" to-value-field="productFacility"/>
+                                    <clear-field field="daysToShip"/>
+                                    <set field="daysToShip" from-field="productFacility.daysToShip"/>
+                                    <if-empty field="daysToShip">
+                                        <!-- if the product does not have its own days to ship, use Facility.defaultDaysToShip, if not then use 30 days as a USA industry default -->
+                                        <if-not-empty field="facility.defaultDaysToShip">
+                                            <set field="daysToShip" from-field="facility.defaultDaysToShip" type="Long"/>
+                                            <else>
+                                                <set field="daysToShip" value="30" type="Long"/>
+                                            </else>
+                                        </if-not-empty>
+                                    </if-empty>
+                                    <!-- TODO: Convert this to a <set-calendar> operation -->
+                                    <call-bsh><![CDATA[
+                            java.sql.Timestamp orderDate = orderHeader.getTimestamp("orderDate");
+                            com.ibm.icu.util.Calendar cal = com.ibm.icu.util.Calendar.getInstance();
+                            cal.setTimeInMillis(orderDate.getTime());
+                            cal.add(com.ibm.icu.util.Calendar.DAY_OF_YEAR, daysToShip.intValue());
+                            return org.ofbiz.base.util.UtilMisc.toMap("promisedDatetime", new java.sql.Timestamp(cal.getTimeInMillis()));
+                            ]]></call-bsh>
+                                    
+                                </else>
+                            </if-not-empty>
+                            
+                            <set field="parameters.quantityNotReserved" value="0" type="BigDecimal"/>
+                        </else>
+                    </if-compare>
+                </if-compare>
+            </else>
+        </if-compare>
+        
+        <field-to-result field="parameters.quantityNotReserved" result-name="quantityNotReserved"/>
+    </simple-method>
+    
+    <simple-method method-name="reserveForInventoryItemInline" short-description="Does a reservation for one InventoryItem, meant to be called in-line">
+        <!-- only do something with this inventoryItem if there is more inventory to reserve -->
+        <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="BigDecimal">
+            
+            <if-compare value="SERIALIZED_INV_ITEM" operator="equals" field="inventoryItem.inventoryItemTypeId">
+                <if-compare value="INV_AVAILABLE" operator="equals" field="inventoryItem.statusId">
+                    <!-- change status on inventoryItem -->
+                    <set value="INV_PROMISED" field="inventoryItem.statusId"/>
+                    <store-value value-field="inventoryItem"/>
+
+                    <clear-field field="reserveOisgirMap"/>
+                    
+                    <calculate field="parameters.quantityNotReserved">
+                        <calcop field="parameters.quantityNotReserved" operator="subtract"><number value="1.0"/></calcop>
+                    </calculate>
+                </if-compare>
+            </if-compare>
+            <if-compare field="inventoryItem.inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM">
+                <!-- reduce atp on inventoryItem if availableToPromise greater than 0, if not the code at the end of this method will handle it -->
+                <if>
+                    <condition>
+                        <and>
+                            <if-compare field="inventoryItem.statusId" operator="not-equals" value="ON_HOLD_NS"/>
+                            <if-compare field="inventoryItem.statusId" operator="not-equals" value="DEFECTIVE_NS"/>
+                            <not><if-empty field="inventoryItem.availableToPromiseTotal"/></not>
+                            <if-compare field="inventoryItem.availableToPromiseTotal" operator="greater" value="0" type="BigDecimal"/>
+                        </and>
+                    </condition>
+                    <then>
+                        <if-compare-field field="parameters.quantityNotReserved" to-field="inventoryItem.availableToPromiseTotal" operator="greater" type="BigDecimal">
+                            <set from-field="inventoryItem.availableToPromiseTotal" field="parameters.deductAmount"/>
+                            <else>
+                                <set from-field="parameters.quantityNotReserved" field="parameters.deductAmount"/>
+                            </else>
+                        </if-compare-field>
+
+                        <!-- instead of updating InventoryItem, add an InventoryItemDetail -->
+                        <set from-field="inventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/>
+                        <set from-field="parameters.reserveReasonEnumId" field="createDetailMap.reasonEnumId"/>
+                        <calculate field="createDetailMap.availableToPromiseDiff">
+                            <calcop field="parameters.deductAmount" operator="negative"/>
+                        </calculate>
+                        <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/>
+                        <clear-field field="createDetailMap"/>
+                        
+                        <calculate field="parameters.quantityNotReserved">
+                            <calcop operator="subtract" field="parameters.quantityNotReserved">
+                                <calcop operator="get" field="parameters.deductAmount"/>
+                            </calcop>
+                        </calculate>
+                    </then>
+                </if>
+                <!-- keep track of the last non-serialized inventory item for use if inventory is not required for purchase -->
+                <!-- use env variable named lastNonSerInventoryItem -->
+                <set from-field="inventoryItem" field="lastNonSerInventoryItem"/>
+            </if-compare>
+        </if-compare>
+    </simple-method>
+    <simple-method method-name="getPromisedDateTime" short-description="Get Inventory Promised Date/Time">
+        <!-- get the promiseDatetime -->
+        <get-related-one value-field="inventoryItem" relation-name="ProductFacility" to-value-field="productFacility"/>
+        <set field="daysToShip" from-field="productFacility.daysToShip"/>
+        <if-empty field="daysToShip">
+            <!-- if the product does not have its own days to ship, use Facility.defaultDaysToShip, if not then use 30 days as a USA industry default -->
+            <set field="daysToShip" from-field="facility.defaultDaysToShip" type="Long"/>
+        </if-empty>
+        <if-empty field="daysToShip">
+            <set field="daysToShip" value="30" type="Long"/>
+        </if-empty>
+        <!-- TODO: Convert this to a <set-calendar> operation -->
+        <call-bsh><![CDATA[
+        java.sql.Timestamp orderDate = orderHeader.getTimestamp("orderDate");
+        com.ibm.icu.util.Calendar cal = com.ibm.icu.util.Calendar.getInstance();
+        cal.setTimeInMillis(orderDate.getTime());
+        cal.add(com.ibm.icu.util.Calendar.DAY_OF_YEAR, daysToShip.intValue());
+        return org.ofbiz.base.util.UtilMisc.toMap("promisedDatetime", new java.sql.Timestamp(cal.getTimeInMillis()));
+        ]]></call-bsh>
+    </simple-method>
+    
 </simple-methods>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml Thu Jan 28 09:13:30 2010
@@ -328,4 +328,43 @@
         <attribute name="productStoreId" mode="IN" type="String" optional="false"/>
         <attribute name="itemBlocked" type="Map" mode="OUT" optional="true"/>
     </service>
+    <!-- ebay inventory -->
+    <service name="reserveEbayStoreInventory" engine="simple"
+        location="component://ebay/script/org/ofbiz/ebay/ebay/EbayServices.xml" invoke="reserveEbayStoreInventory">
+        <description>Reserve Inventory in a Product Store</description>
+        <attribute name="productStoreId" type="String" mode="IN" optional="false"></attribute>
+        <attribute name="productId" type="String" mode="IN" optional="false"></attribute>
+        <attribute name="facilityId" type="String" mode="IN" optional="false"></attribute>
+        <attribute name="quantity"  type="BigDecimal" mode="IN" optional="false"></attribute>
+        <attribute name="quantityNotReserved" type="BigDecimal" mode="OUT" optional="false"></attribute>
+    </service>
+    <service name="reserveEbayProductInventoryByStoreFacility" engine="simple"
+        location="component://ebay/script/org/ofbiz/ebay/ebay/EbayServices.xml" invoke="reserveEbayProductInventory" auth="true">
+        <description>Reserve Inventory for a Product By Facility
+            If requireInventory is Y the quantity not reserved is returned, if N then a negative
+            availableToPromise will be used to track quantity ordered beyond what is in stock.
+        </description>
+        <attribute name="productId" type="String" mode="IN" optional="false"/>
+        <attribute name="facilityId" type="String" mode="IN" optional="false"/>
+        <attribute name="quantity" type="BigDecimal" mode="IN" optional="false"/>
+        <attribute name="reservedDatetime" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="requireInventory" type="String" mode="IN" optional="false"/>
+        <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/>
+        <attribute name="sequenceId" type="Long" mode="IN" optional="true"/>
+        <attribute name="quantityNotReserved" type="BigDecimal" mode="OUT" optional="false"/>
+    </service>
+    <service name="updateEbayStoreInventory" engine="java"  transaction-timeout="3600"
+        location="org.ofbiz.ebay.EbayStoreInventoryServices" invoke="updateEbayStoreInventory" auth="true">
+        <description>update  Inventory on ebay store inventory</description>
+        <attribute name="productStoreId" type="String" mode="INOUT" optional="false"></attribute>
+        <attribute name="productId" type="String" mode="IN" optional="false"></attribute>
+        <attribute name="folderId" type="String" mode="INOUT" optional="false"></attribute>
+        <attribute name="facilityId" type="String" mode="INOUT" optional="false"></attribute>
+    </service>
+    <service name="getFolderInEbayStoreInventory" engine="java" transaction-timeout="7200"  
+        location="org.ofbiz.ebay.EbayStoreInventoryServices" invoke="getFolderInEbayStoreInventory" auth="true">
+        <description>get ebay folder in ebay store inventory</description>
+        <attribute name="productStoreId" type="String" mode="IN" optional="false"/>
+        <attribute name="folderId" type="String" mode="OUT" optional="false"></attribute>
+    </service>
 </services>
\ No newline at end of file

Added: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStoreInventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStoreInventoryServices.java?rev=904006&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStoreInventoryServices.java (added)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStoreInventoryServices.java Thu Jan 28 09:13:30 2010
@@ -0,0 +1,283 @@
+package org.ofbiz.ebay;
+
+import java.util.Locale;
+import java.util.Map;
+import javolution.util.FastMap;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.ServiceUtil;
+import com.ebay.sdk.ApiException;
+import com.ebay.sdk.SdkException;
+import com.ebay.sdk.SdkSoapException;
+import com.ebay.sdk.call.AddSellingManagerInventoryFolderCall;
+import com.ebay.sdk.call.AddSellingManagerProductCall;
+import com.ebay.sdk.call.GetSellingManagerInventoryCall;
+import com.ebay.sdk.call.GetSellingManagerInventoryFolderCall;
+import com.ebay.sdk.call.ReviseSellingManagerProductCall;
+import com.ebay.soap.eBLBaseComponents.AddSellingManagerInventoryFolderRequestType;
+import com.ebay.soap.eBLBaseComponents.AddSellingManagerInventoryFolderResponseType;
+import com.ebay.soap.eBLBaseComponents.AddSellingManagerProductRequestType;
+import com.ebay.soap.eBLBaseComponents.AddSellingManagerProductResponseType;
+import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryFolderRequestType;
+import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryFolderResponseType;
+import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryRequestType;
+import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryResponseType;
+import com.ebay.soap.eBLBaseComponents.ReviseSellingManagerProductRequestType;
+import com.ebay.soap.eBLBaseComponents.ReviseSellingManagerProductResponseType;
+import com.ebay.soap.eBLBaseComponents.SellingManagerFolderDetailsType;
+import com.ebay.soap.eBLBaseComponents.SellingManagerProductDetailsType;
+import com.ebay.soap.eBLBaseComponents.SellingManagerProductType;
+
+public class EbayStoreInventoryServices {
+ private static final String resource = "EbayUiLabels";
+ private static final String module = EbayStoreInventoryServices.class.getName();
+ private static final String defaultFolderName = "OFBizProducts";
+ private static String folderId = null;
+ public EbayStoreInventoryServices() {
+ // TODO Auto-generated constructor stub
+ }
+ /*update inventory on ebay site*/
+ public static Map<String,Object> updateEbayStoreInventory(DispatchContext dctx, Map<String,Object> context){
+ Map<String,Object> result = FastMap.newInstance();
+ Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
+ GetSellingManagerInventoryRequestType invenReq = null;
+ GetSellingManagerInventoryResponseType invenResp = null;
+ boolean checkProd = false;
+ boolean status = false;
+ try {
+ if(context.get("productStoreId") == null || context.get("productId") == null || context.get("folderId") == null){
+ result  = ServiceUtil.returnError("The process was required productStoreId, productId and ebay inventory folderId.");
+ result.put("productStoreId", context.get("productStoreId"));
+ result.put("facilityId", context.get("facilityId"));
+ result.put("folderId", context.get("folderId"));
+ return result;
+ }
+
+ String productId = (String)context.get("productId");
+ String folderId = (String)context.get("folderId");
+ // start upload/update products which selected  to an ebay inventory
+ if(folderId != null){
+ GetSellingManagerInventoryCall invenCall = new GetSellingManagerInventoryCall(EbayHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
+ invenReq = new GetSellingManagerInventoryRequestType();
+ invenResp = (GetSellingManagerInventoryResponseType) invenCall.execute(invenReq);
+ if(invenResp != null && "SUCCESS".equals(invenResp.getAck().toString())){
+ GenericValue ebayProductStoreInventory = delegator.findByPrimaryKey("EbayProductStoreInventory", UtilMisc.toMap("productId", productId,"facilityId",context.get("facilityId"),"productStoreId",context.get("productStoreId")));
+
+ SellingManagerProductType[]  sellingManagerProductTypeList = invenResp.getSellingManagerProduct();
+ for(SellingManagerProductType sellingManagerProductType : sellingManagerProductTypeList){
+ SellingManagerProductDetailsType sellingManagerProductDetailsType = sellingManagerProductType.getSellingManagerProductDetails();
+ if(String.valueOf(sellingManagerProductDetailsType.getFolderID()).equals(folderId) && String.valueOf(sellingManagerProductDetailsType.getProductID()).equals(String.valueOf(ebayProductStoreInventory.getLong("ebayProductId"))) && String.valueOf(sellingManagerProductDetailsType.getCustomLabel()).equals(productId)){
+ checkProd = true;
+ break;
+ }
+ }
+ }
+
+ // checkProduct is true then update detail  but is false do create new one.
+ if(checkProd == true){
+ status = updateProductInEbayInventoryFolder(dctx,context);
+ }else {
+ status = createNewProductInEbayInventoryFolder(dctx,context);
+ }
+ if(status == true){
+ Debug.logInfo("Done to updated product ".concat(context.get("productId").toString()), module);
+ result = ServiceUtil.returnSuccess("Updated ebay store inventory in folder "+context.get("folderId")+" success..");
+ }else{
+ result = ServiceUtil.returnError("Fail to update ebay store inventory.");
+ }
+ }
+ }catch (ApiException e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ } catch (SdkSoapException e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ } catch (SdkException e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ } catch (GenericEntityException e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ }
+ result.put("productStoreId", context.get("productStoreId"));
+ result.put("facilityId", context.get("facilityId"));
+ result.put("folderId", context.get("folderId"));
+ return result;
+ }
+
+ /* add new product and quantity to ebay inventory */
+ public static boolean createNewProductInEbayInventoryFolder(DispatchContext dctx, Map<String,Object> context){
+ Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
+ AddSellingManagerProductRequestType productReq = null;
+ AddSellingManagerProductResponseType productResp = null;
+ boolean flag = false;
+
+ try {
+ if(context.get("productStoreId") != null && context.get("productId")!=null && context.get("folderId")!=null){
+ String productId = (String)context.get("productId");
+ String folderId = (String)context.get("folderId");
+ AddSellingManagerProductCall productCall = new AddSellingManagerProductCall(EbayHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
+ productReq = new AddSellingManagerProductRequestType();
+ productReq.setFolderID(new Long(folderId));
+ SellingManagerProductDetailsType  sellingManagerProductDetailsType = new SellingManagerProductDetailsType();
+ GenericValue ebayProductStoreInventory = delegator.findByPrimaryKey("EbayProductStoreInventory", UtilMisc.toMap("productId", productId,"facilityId",context.get("facilityId"),"productStoreId",context.get("productStoreId")));
+
+ sellingManagerProductDetailsType.setProductName((delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId))).getString("internalName"));
+ //Must keep productId in SKU NUMBER because ebay allow productId field only long value.
+ sellingManagerProductDetailsType.setCustomLabel(productId);
+ if(ebayProductStoreInventory!=null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue());
+
+ productReq.setSellingManagerProductDetails(sellingManagerProductDetailsType);
+ productResp = (AddSellingManagerProductResponseType) productCall.execute(productReq);
+ if(productResp != null && "SUCCESS".equals(productResp.getAck().toString())){
+ flag = true;
+ ebayProductStoreInventory.put("ebayProductId", productResp.getSellingManagerProductDetails().getProductID());
+ ebayProductStoreInventory.put("folderId", folderId);
+ ebayProductStoreInventory.store();
+ }else{
+ Debug.logError("Fail to  create inventory product ".concat(productId).concat("in productStore ").concat(context.get("productStoreId").toString()).concat(" message from ebay : ").concat(productResp.getMessage()), module);
+ }
+ }
+ } catch (ApiException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (SdkSoapException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (SdkException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (GenericEntityException e) {
+ Debug.logError(e.getMessage(), module);
+ }
+ return flag;
+ }
+
+ /* update product and quantity to ebay inventory */
+ public static boolean updateProductInEbayInventoryFolder(DispatchContext dctx, Map<String,Object> context){
+ Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
+ ReviseSellingManagerProductRequestType req = null;
+ ReviseSellingManagerProductResponseType resp = null;
+ boolean flag = false;
+
+ try {
+ if(context.get("productStoreId") != null && context.get("productId")!=null && context.get("folderId")!=null){
+ String productId = (String)context.get("productId");
+ String folderId = (String)context.get("folderId");
+ ReviseSellingManagerProductCall call = new ReviseSellingManagerProductCall(EbayHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
+ req = new ReviseSellingManagerProductRequestType();
+ SellingManagerProductDetailsType  sellingManagerProductDetailsType = new SellingManagerProductDetailsType();
+ GenericValue ebayProductStoreInventory = delegator.findByPrimaryKey("EbayProductStoreInventory", UtilMisc.toMap("productId", productId,"facilityId",context.get("facilityId"),"productStoreId",context.get("productStoreId")));
+ Long ebayProductId = null;
+ if(ebayProductStoreInventory !=null && ebayProductStoreInventory.getLong("ebayProductId")==null){
+ Debug.logError("Can not update product "+productId+" has no ebay product Id in EbayProductStoreInventory. ", module);
+ return flag;
+ }
+ if(ebayProductStoreInventory!=null && ebayProductStoreInventory.getLong("ebayProductId")!=null){
+ ebayProductId = ebayProductStoreInventory.getLong("ebayProductId");
+ }
+ sellingManagerProductDetailsType.setProductID(ebayProductId);
+
+ sellingManagerProductDetailsType.setProductName((delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId))).getString("internalName"));
+ //Must keep productId in SKU NUMBER because ebay allow productId field only long value.
+ sellingManagerProductDetailsType.setCustomLabel(productId);
+ if(ebayProductStoreInventory!=null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue());
+
+ req.setSellingManagerProductDetails(sellingManagerProductDetailsType);
+ resp = (ReviseSellingManagerProductResponseType) call.execute(req);
+ if(resp != null && "SUCCESS".equals(resp.getAck().toString())){
+ flag = true;
+ ebayProductStoreInventory.put("ebayProductId", ebayProductId);
+ ebayProductStoreInventory.put("folderId", folderId);
+ ebayProductStoreInventory.store();
+ }else{
+ Debug.logError("Fail to  update inventory product ".concat(productId).concat("in productStore ").concat(context.get("productStoreId").toString()).concat(" message from ebay : ").concat(resp.getMessage()), module);
+ }
+ }
+ } catch (ApiException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (SdkSoapException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (SdkException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (GenericEntityException e) {
+ Debug.logError(e.getMessage(), module);
+ }
+ return flag;
+ }
+
+ public static Map<String,Object> getFolderInEbayStoreInventory(DispatchContext dctx, Map<String,Object> context){
+ Map<String,Object> result = FastMap.newInstance();
+ Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
+ GetSellingManagerInventoryFolderRequestType req = null;
+ GetSellingManagerInventoryFolderResponseType resp = null;
+ boolean flag = false;
+
+ try {
+ if(context.get("productStoreId") != null){
+ GetSellingManagerInventoryFolderCall  call = new GetSellingManagerInventoryFolderCall(EbayHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
+ req = new GetSellingManagerInventoryFolderRequestType();
+ resp = (GetSellingManagerInventoryFolderResponseType) call.execute(req);
+ if(resp != null && "SUCCESS".equals(resp.getAck().toString())){
+ SellingManagerFolderDetailsType sellingManagerFolderDetailsType = resp.getFolder();
+ if(sellingManagerFolderDetailsType!=null){
+ SellingManagerFolderDetailsType[] SellingManagerFolderDetailsTypeList = sellingManagerFolderDetailsType.getChildFolder();
+ for(SellingManagerFolderDetailsType sellingManagerFolderDetails : SellingManagerFolderDetailsTypeList){
+ Debug.logInfo("ebay inventory folders name ".concat(sellingManagerFolderDetails.getFolderName()), module);
+ if(sellingManagerFolderDetails.getFolderName().equals(defaultFolderName)){
+ folderId = String.valueOf(sellingManagerFolderDetails.getFolderID());
+ flag = true;
+ break;
+ }
+ }
+ }
+ if(flag == false){
+ folderId = createNewFolderInEbayStoreInventory(dctx,context);
+ }
+ }
+ result = ServiceUtil.returnSuccess("load ebay store folderId "+folderId+" success..");
+ }
+ } catch (ApiException e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ } catch (SdkSoapException e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ } catch (SdkException e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ }
+ if(result.get("responseMessage")!=null && result.get("responseMessage").equals("fail")) folderId = null;
+ result.put("folderId", folderId);
+ Debug.logInfo("service return result "+ result, module);
+ return result;
+ }
+
+ /*create new folder for export product into inventory.*/
+ public static String createNewFolderInEbayStoreInventory(DispatchContext dctx, Map<String,Object> context){
+ Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
+ AddSellingManagerInventoryFolderRequestType req = null;
+ AddSellingManagerInventoryFolderResponseType resp = null;
+
+ try {
+ if(context.get("productStoreId") != null){
+ AddSellingManagerInventoryFolderCall call = new AddSellingManagerInventoryFolderCall(EbayHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
+ req = new AddSellingManagerInventoryFolderRequestType();
+ req.setFolderName(defaultFolderName);//req.setComment(value);//req.setParentFolderID(value)
+ resp = (AddSellingManagerInventoryFolderResponseType) call.execute(req);
+ if(resp != null && "SUCCESS".equals(resp.getAck().toString())) {
+ folderId = String.valueOf(resp.getFolderID());
+ }else {
+ Debug.logError("The problem with create new folder on ebay site.", module);
+ return folderId;
+ }
+ }
+ } catch (ApiException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (SdkSoapException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (SdkException e) {
+ Debug.logError(e.getMessage(), module);
+ }
+ return folderId;
+ }
+}

Modified: ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml Thu Jan 28 09:13:30 2010
@@ -254,6 +254,25 @@
         <response name="success" type="view" value="blockItemOutOfStock"/>
         <response name="error" type="view" value="blockItemOutOfStock"/>
     </request-map>
+    <!-- Store inventory -->
+    <request-map uri="ebayStoreInventory">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ebayStoreInventory"/>
+    </request-map>
+    <request-map uri="reserveEbayProductInventory">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="reserveEbayProductInventory"/>
+    </request-map>
+    <request-map uri="reserveProductInventory">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="reserveEbayStoreInventory"/>
+        <response name="success" type="view" value="reserveEbayProductInventory"/>
+    </request-map>
+    <request-map uri="updateEbayStoreInventory">
+        <security https="true" auth="true"/>
+        <event type="service-multi" invoke="updateEbayStoreInventory"/>
+        <response name="success" type="view" value="ebayLoadStoreInventory"/>
+    </request-map>
     
     <!-- end of request mappings -->
     
@@ -287,5 +306,9 @@
     <view-map name="AutomationPreferences" type="screen" page="component://ebay/widget/EbayScreens.xml#EbayAutomationPreferences"/>
     <!-- block out of stock -->
     <view-map name="blockItemOutOfStock" type="screen" page="component://ebay/widget/EbayScreens.xml#blockItemOutOfStock"/>
+    <!-- store Inventory -->
+    <view-map name="ebayStoreInventory" type="screen" page="component://ebay/widget/EbayScreens.xml#ebayStoreInventory"/>
+    <view-map name="ebayLoadStoreInventory" type="screen" page="component://ebay/widget/EbayScreens.xml#ebayLoadStoreInventory"/>
+    <view-map name="reserveEbayProductInventory" type="screen" page="component://ebay/widget/EbayScreens.xml#reserveEbayProductInventory"/>
     <!-- end of view mappings -->
 </site-conf>

Added: ofbiz/trunk/specialpurpose/ebay/widget/EbayInventoryForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/widget/EbayInventoryForms.xml?rev=904006&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/widget/EbayInventoryForms.xml (added)
+++ ofbiz/trunk/specialpurpose/ebay/widget/EbayInventoryForms.xml Thu Jan 28 09:13:30 2010
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
+  
+    <form name="EbayStoreFacilityList" type="single" list-name="productStoreFacilityList"  target="ebayStoreInventory"
+        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+        <field name="productStoreId"><hidden value="${parameters.productStoreId}"/></field>
+        <field name="isFacilityId"><hidden value="Y"/></field>
+        <field name="facilityId" >
+            <drop-down current="selected" >
+                <list-options list-name="productStoreFacilityList" description="${facilityId}" key-name="facilityId"/>                
+            </drop-down>
+        </field>
+        <field name="submitButton" ><submit button-type="button"/></field>
+    </form>
+    
+    <form name="reserveEbayProductInventory" type="single" list-name=""  target="reserveProductInventory"
+        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+        <field name="productStoreId"><display description="${parameters.productStoreId}"></display></field>
+        <field name="facilityId"><display description="${parameters.facilityId}"></display></field>
+        <field name="productId"><lookup target-form-name="LookupProduct"></lookup></field>
+        <field name="quantity"><text></text></field>
+        <field name="submitButton" ><submit button-type="button"/></field>
+    </form>
+    
+    <form name="ListEbayProductInventoryDetail" type="multi" use-row-submit="true"  target="updateEbayStoreInventory" title=""  list-name="ebayProductStoreInventoryList"
+        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+        <field name="productStoreId"><hidden/></field>
+        <field name="facilityId"><hidden/></field>
+        <field name="folderId"><hidden value="${parameters.folderId}"/></field>
+        <field name="_rowSubmit" title="${uiLabelMap.CommonSelect}"><check/></field>
+        <field name="productId"><display></display></field>
+        <field name="productName" entry-name="productId">
+            <display-entity entity-name="Product" key-field-name="productId" description="${productName}"></display-entity>
+        </field>
+        <field name="quantityReserved"><display></display></field>
+        <field name="availableToPromiseListing"><display></display></field>
+        <field name="scheduled"><display></display></field>
+        <field name="ebayProductId"><display></display></field>
+        <field name="activeListing"><display></display></field>
+        <field name="sold"><display></display></field>
+        <field name="unSold"><display></display></field>
+        <field name="reservedDate"><display></display></field>
+        <field name="updateButton" title="${uiLabelMap.EbayUpdateInventory}"><submit button-type="button"/></field>
+    </form>
+</forms>

Modified: ofbiz/trunk/specialpurpose/ebay/widget/EbayMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/widget/EbayMenus.xml?rev=904006&r1=904005&r2=904006&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/widget/EbayMenus.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/widget/EbayMenus.xml Thu Jan 28 09:13:30 2010
@@ -78,6 +78,11 @@
                 <parameter param-name="productStoreId" value="${parameters.productStoreId}"/>
             </link>
         </menu-item>
+        <menu-item name="inventory" title="${uiLabelMap.ProductProduct} ${uiLabelMap.ProductInventory}">
+            <link target="ebayStoreInventory">
+                <parameter param-name="productStoreId" value="${parameters.productStoreId}"/>
+            </link>
+        </menu-item>
         <menu-item name="blockItemOutOfStock" title="${uiLabelMap.EbayBlockItemOutOfStock}">
             <link target="blockItemOutOfStock">
                 <parameter param-name="productStoreId" value="${parameters.productStoreId}"/>