You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Rajesh Mallah <ma...@gmail.com> on 2018/04/16 18:12:02 UTC

help with updateProductPrice

Hi ,

I am calling

https://demo-stable.ofbiz.apache.org/webtools/control/ServiceList?sel_service_name=updateProductPrice

with ARGS

{
    currencyUomId           "INR",
    fromDate                "2018-04-16 17:39:52",
    price                   150,
    productId               "PROD_SW52D5H3EN",
    productPricePurposeId   "PURCHASE",
    productPriceTypeId      "DEFAULT_PRICE",
    productStoreGroupId     "_NA_",
    taxInPrice              "Y",
    termUomId               "WT_kg"
}


I am getting error:


faultString:Error running the simple-method: Entity value not found with
name: lookedUpValue Method = updateProductPrice, File =
file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/minilang/product/price/PriceServices.xml,
Element = <set-nonpk-fields>, Line 69null


the minilang def is reproduced here for convinience:

 <simple-method method-name="updateProductPrice" short-description="Update
an ProductPrice">
        <set field="callingMethodName" value="updateProductPrice"/>
        <set field="checkAction" value="UPDATE"/>
        <call-simple-method method-name="checkProductRelatedPermission"
xml-resource="component://product/minilang/product/product/ProductServices.xml"/>
        <check-permission permission="CATALOG_PRICE_MAINT">
            <fail-property resource="ProductUiLabels"
property="ProductPriceMaintPermissionError"/>
        </check-permission>
        <check-errors/>

        <call-simple-method method-name="inlineHandlePriceWithTaxIncluded"/>

        <entity-one entity-name="ProductPrice" value-field="lookedUpValue"/>

        <!-- grab the old price value before setting nonpk parameter fields
-->
        <field-to-result field="lookedUpValue.price"
result-name="oldPrice"/>

        <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>

        <now-timestamp field="nowTimestamp"/>
        <set field="lookedUpValue.lastModifiedDate"
from-field="nowTimestamp"/>
        <set field="lookedUpValue.lastModifiedByUserLogin"
from-field="userLogin.userLoginId"/>

        <store-value value-field="lookedUpValue"/>
 </simple-method>

The productID does exists in Entity ProductPrice
Where am I going wrong ?

thanks & regds
Rajesh Mallah.

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Thanks .

This is possibly the reason , shall check and confirm.
However it is difficult to match datetime fields *exactly*
when integrating external systems .

regds
mallah.

On Tue, Apr 17, 2018 at 10:25 AM, Akash Jain <ak...@hotwaxsystems.com>
wrote:

> Hello Mallah,
>
> As you want to update product price then all primary key (productId,
> fromDate, currencyUomId, productPricePurposeId, productPriceTypeId and
> productStoreGroupId) of ProductPrice should be matched (A ProductPrice
> record should exist with all matching primary key you passed).
> lookedUpValue will always be null at Line 64 if any primary key of
> ProductPrice not matched.
>
> Thanks and Regards
> --
> Akash Jain
>
> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > Hi ,
> >
> > I am calling
> >
> > https://demo-stable.ofbiz.apache.org/webtools/control/Servic
> > eList?sel_service_name=updateProductPrice
> >
> > with ARGS
> >
> > {
> >     currencyUomId           "INR",
> >     fromDate                "2018-04-16 17:39:52",
> >     price                   150,
> >     productId               "PROD_SW52D5H3EN",
> >     productPricePurposeId   "PURCHASE",
> >     productPriceTypeId      "DEFAULT_PRICE",
> >     productStoreGroupId     "_NA_",
> >     taxInPrice              "Y",
> >     termUomId               "WT_kg"
> > }
> >
> >
> > I am getting error:
> >
> >
> > faultString:Error running the simple-method: Entity value not found with
> > name: lookedUpValue Method = updateProductPrice, File =
> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/m
> > inilang/product/price/PriceServices.xml,
> > Element = <set-nonpk-fields>, Line 69null
> >
> >
> > the minilang def is reproduced here for convinience:
> >
> >  <simple-method method-name="updateProductPrice"
> short-description="Update
> > an ProductPrice">
> >         <set field="callingMethodName" value="updateProductPrice"/>
> >         <set field="checkAction" value="UPDATE"/>
> >         <call-simple-method method-name="checkProductRelatedPermission"
> > xml-resource="component://product/minilang/product/product/
> > ProductServices.xml"/>
> >         <check-permission permission="CATALOG_PRICE_MAINT">
> >             <fail-property resource="ProductUiLabels"
> > property="ProductPriceMaintPermissionError"/>
> >         </check-permission>
> >         <check-errors/>
> >
> >         <call-simple-method method-name="inlineHandlePrice
> > WithTaxIncluded"/>
> >
> >         <entity-one entity-name="ProductPrice"
> > value-field="lookedUpValue"/>
> >
> >         <!-- grab the old price value before setting nonpk parameter
> fields
> > -->
> >         <field-to-result field="lookedUpValue.price"
> > result-name="oldPrice"/>
> >
> >         <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
> >
> >         <now-timestamp field="nowTimestamp"/>
> >         <set field="lookedUpValue.lastModifiedDate"
> > from-field="nowTimestamp"/>
> >         <set field="lookedUpValue.lastModifiedByUserLogin"
> > from-field="userLogin.userLoginId"/>
> >
> >         <store-value value-field="lookedUpValue"/>
> >  </simple-method>
> >
> > The productID does exists in Entity ProductPrice
> > Where am I going wrong ?
> >
> > thanks & regds
> > Rajesh Mallah.
> >
>

Re: help with updateProductPrice

Posted by Akash Jain <ak...@hotwaxsystems.com>.
Hello Mallah,

As you want to update product price then all primary key (productId,
fromDate, currencyUomId, productPricePurposeId, productPriceTypeId and
productStoreGroupId) of ProductPrice should be matched (A ProductPrice
record should exist with all matching primary key you passed).
lookedUpValue will always be null at Line 64 if any primary key of
ProductPrice not matched.

Thanks and Regards
--
Akash Jain

On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

> Hi ,
>
> I am calling
>
> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
> eList?sel_service_name=updateProductPrice
>
> with ARGS
>
> {
>     currencyUomId           "INR",
>     fromDate                "2018-04-16 17:39:52",
>     price                   150,
>     productId               "PROD_SW52D5H3EN",
>     productPricePurposeId   "PURCHASE",
>     productPriceTypeId      "DEFAULT_PRICE",
>     productStoreGroupId     "_NA_",
>     taxInPrice              "Y",
>     termUomId               "WT_kg"
> }
>
>
> I am getting error:
>
>
> faultString:Error running the simple-method: Entity value not found with
> name: lookedUpValue Method = updateProductPrice, File =
> file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/m
> inilang/product/price/PriceServices.xml,
> Element = <set-nonpk-fields>, Line 69null
>
>
> the minilang def is reproduced here for convinience:
>
>  <simple-method method-name="updateProductPrice" short-description="Update
> an ProductPrice">
>         <set field="callingMethodName" value="updateProductPrice"/>
>         <set field="checkAction" value="UPDATE"/>
>         <call-simple-method method-name="checkProductRelatedPermission"
> xml-resource="component://product/minilang/product/product/
> ProductServices.xml"/>
>         <check-permission permission="CATALOG_PRICE_MAINT">
>             <fail-property resource="ProductUiLabels"
> property="ProductPriceMaintPermissionError"/>
>         </check-permission>
>         <check-errors/>
>
>         <call-simple-method method-name="inlineHandlePrice
> WithTaxIncluded"/>
>
>         <entity-one entity-name="ProductPrice"
> value-field="lookedUpValue"/>
>
>         <!-- grab the old price value before setting nonpk parameter fields
> -->
>         <field-to-result field="lookedUpValue.price"
> result-name="oldPrice"/>
>
>         <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
>
>         <now-timestamp field="nowTimestamp"/>
>         <set field="lookedUpValue.lastModifiedDate"
> from-field="nowTimestamp"/>
>         <set field="lookedUpValue.lastModifiedByUserLogin"
> from-field="userLogin.userLoginId"/>
>
>         <store-value value-field="lookedUpValue"/>
>  </simple-method>
>
> The productID does exists in Entity ProductPrice
> Where am I going wrong ?
>
> thanks & regds
> Rajesh Mallah.
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Hi Mike ,

I concur with you.

In fact i am already taking such an  approach of directly connecting to DB
.
Instead of XML RPC its JSON in my case. So my client software
 connects to a non-OfBiz App server.

The Appserver tries to accomplish the task using a documented WebService
interface   using XML/RPC or connects to DB directly and emulates part
of the logic of OFBiz (in case XML/RPC Webservice) is
insufficient/infeasible.

thanks for the tip regarding Invalidating the caches. Is there any variant
of the
same to clear caches of a set of particular entities?

regds
mallah.



On Wed, Apr 18, 2018 at 11:04 AM, Mike <mz...@gmail.com> wrote:

> Just make your DB updates, then make an API call or use wget to clear the
> cache.  For instance:
>
> wget --no-check-certificate -T 360
> https://IP_ADDRESS/webtools/control/FindUtilCacheClearAll?
> USERNAME=admin&PASSWORD=xxxxxxx&JavaScriptEnabled=N
>
> Here's the thing.. Eventually, you're going to make hacks to satisfy
> various problems that come up.  Making your own, custom xmlrpc/SOAP/REST is
> well within the norm.  If you make one (hack), like to make an easy fast
> price updater, you'll start to use the same technique to solve another
> problem.  It's great to be a purist (if you can), but you have to have a
> way of working around bugs.  Just MHO.
>
> On Tue, Apr 17, 2018 at 10:14 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > Hi Mike  ,
> >
> > moreover there is the factor of Caching at various levels . If you
> > directly interact with DB , i feel the caches may become stale .
> >
> > regds
> > Mallah.
> >
> > On Tue, Apr 17, 2018 at 9:17 PM, Mike <mz...@gmail.com> wrote:
> >
> > > Why not just write your own custom xmlrpc server (perl/python/java)
> that
> > > accepts just the P/N and new price, searches for the current record,
> and
> > > performs a SQL call to update the DB.
> > >
> > > On Tue, Apr 17, 2018 at 8:12 AM, Rajesh Mallah <
> mallah.rajesh@gmail.com>
> > > wrote:
> > >
> > > > ERRATA: I meant "There is no parameter" in lieu of "There is
> parameter"
> > > >
> > > > On Tue, Apr 17, 2018 at 8:09 PM, Rajesh Mallah <
> > mallah.rajesh@gmail.com>
> > > > wrote:
> > > >
> > > > >
> > > > > Hi Rishi ,
> > > > >
> > > > > I am using XML RPC with OFBiz so my capabilities are limited to
> > > > > what the interface provides. There is  parameter that allows me
> > > > > to specify the data format/pattern .
> > > > >
> > > > > At this moment i have solved my problem temporarily by appending
> > > > > .001 after the second part in HH:MM:SS and i am only using
> > > > > createProductPrice instead of updateProductPrice . As creating new
> > > > > prices allows to have a history/audit of prices. I feel
> > > > updateProductPrice
> > > > > is really overwriting the values and trail is lost.
> > > > >
> > > > > regds
> > > > > mallah.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Tue, Apr 17, 2018 at 6:49 PM, Rishi Solanki <
> > > rishisolankii@gmail.com>
> > > > > wrote:
> > > > >
> > > > >> Idea of utility class is, use the format you would like and pass
> the
> > > > >> value.
> > > > >> It will convert into timestamp used in the table. In case you
> could
> > > not
> > > > >> get
> > > > >> the desired format in the utility class then the class uses the
> > > > >> java.text.SimpleDateFormat class to resolve its purpose.
> > > > >>
> > > > >> Please take a look at toTimestamp() method variations and format
> you
> > > are
> > > > >> receiving in the xml. Once you have the format with you, it can be
> > > > easily
> > > > >> converted into timestamp. Also if utility class does not support
> > then
> > > go
> > > > >> to
> > > > >> core class for same i.e java.text.SimpleDateFormat and look for
> the
> > > > >> supporting format.
> > > > >>
> > > > >> HTH!
> > > > >>
> > > > >>
> > > > >> Rishi Solanki
> > > > >> Sr Manager, Enterprise Software Development
> > > > >> HotWax Systems Pvt. Ltd.
> > > > >> Direct: +91-9893287847
> > > > >> http://www.hotwaxsystems.com
> > > > >> www.hotwax.co
> > > > >>
> > > > >> On Tue, Apr 17, 2018 at 3:02 PM, Rajesh Mallah <
> > > mallah.rajesh@gmail.com
> > > > >
> > > > >> wrote:
> > > > >>
> > > > >> > Further Info:
> > > > >> >
> > > > >> >   <member>
> > > > >> >             <name>fromDate</name>
> > > > >> >             <value>
> > > > >> >               <string><![CDATA[2018-04-17 14:59:34.001
> > > > +0530]]></string>
> > > > >> >             </value>
> > > > >> >    </member>
> > > > >> >
> > > > >> > In XML results in
> > > > >> >
> > > > >> > from_date                   | 2018-04-17 14:59:34.001+05:30
> > > > >> >
> > > > >> > in DB. looks like the parser is kind enough to consider TZ
> > > > >> > spec without colons.
> > > > >> >
> > > > >> >
> > > > >> > regds
> > > > >> > mallah.
> > > > >> >
> > > > >> >
> > > > >> > On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <
> > > > mallah.rajesh@gmail.com
> > > > >> >
> > > > >> > wrote:
> > > > >> >
> > > > >> > >
> > > > >> > > Its PostgreSQL
> > > > >> > > regds
> > > > >> > >
> > > > >> > >
> > > > >> > >  below is a sample data :
> > > > >> > >
> > > > >> > > SQL> select * from  ofbiz.product_price  where
> > > > >> > > product_id='PROD_SW52D5H3EN' order by created_date desc limit
> 1;
> > > > >> > >
> > > > >> > > -[ RECORD 1 ]---------------+------------------------------
> > > > >> > > product_id                  | PROD_SW52D5H3EN
> > > > >> > > product_price_type_id       | DEFAULT_PRICE
> > > > >> > > product_price_purpose_id    | PURCHASE
> > > > >> > > currency_uom_id             | INR
> > > > >> > > product_store_group_id      | _NA_
> > > > >> > > from_date                   | 2018-04-17 12:49:20+05:30
> <----
> > > > This
> > > > >> has
> > > > >> > > been put by me.
> > > > >> > > thru_date                   |
> > > > >> > > price                       | 121.000
> > > > >> > > term_uom_id                 | WT_kg
> > > > >> > > custom_price_calc_service   |
> > > > >> > > price_without_tax           |
> > > > >> > > price_with_tax              |
> > > > >> > > tax_amount                  |
> > > > >> > > tax_percentage              |
> > > > >> > > tax_auth_party_id           |
> > > > >> > > tax_auth_geo_id             |
> > > > >> > > tax_in_price                | Y
> > > > >> > > created_date                | 2018-04-17 12:49:20.416+05:30
> > > > >> > > created_by_user_login       | admin
> > > > >> > > last_modified_date          | 2018-04-17 12:49:20.416+05:30
> > > > >> > > last_modified_by_user_login | admin
> > > > >> > > last_updated_stamp          | 2018-04-17 12:49:20.416+05:30
> > <----
> > > > >> > > Generated by defaults.
> > > > >> > > last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
> > > > >> > > created_stamp               | 2018-04-17 12:49:20.416+05:30
> > > > >> > > created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
> > > > >> > >
> > > > >> > >
> > > > >> > > On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit
> > > > >> > <deepak.dixit@hotwaxsystems.
> > > > >> > > com> wrote:
> > > > >> > >
> > > > >> > >> Hi Rajesh,
> > > > >> > >>
> > > > >> > >> Could you please share which database you are using?
> > > > >> > >>
> > > > >> > >>
> > > > >> > >> Thanks & Regards
> > > > >> > >> --
> > > > >> > >> Deepak Dixit
> > > > >> > >> www.hotwax.co
> > > > >> > >>
> > > > >> > >> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <
> > > > >> mallah.rajesh@gmail.com
> > > > >> > >
> > > > >> > >> wrote:
> > > > >> > >>
> > > > >> > >> >  Hi ,
> > > > >> > >> >
> > > > >> > >> >
> > > > >> > >> > it was in conversion/DateTimeConverters.java that was
> > > appending
> > > > >> '.0'
> > > > >> > to
> > > > >> > >> > the
> > > > >> > >> > end of
> > > > >> > >> > string if the string did not contain any  decimals. So i
> have
> > > now
> > > > >> > >> started
> > > > >> > >> > sending
> > > > >> > >> > the fractional seconds. And things are better (if not
> > perfect).
> > > > >> > >> >
> > > > >> > >> >
> > > > >> > >> >
> > > > >> > >> > public java.sql.Timestamp convert(String obj, Locale
> locale,
> > > > >> TimeZone
> > > > >> > >> > timeZone, String formatString) throws ConversionException {
> > > > >> > >> >             String str = obj.trim();
> > > > >> > >> >             if (str.length() == 0) {
> > > > >> > >> >                 return null;
> > > > >> > >> >             }
> > > > >> > >> >             DateFormat df = null;
> > > > >> > >> >             if (UtilValidate.isEmpty(formatString)) {
> > > > >> > >> >                 // These hacks are a bad idea, but they are
> > > > >> included
> > > > >> > >> >                 // for backward compatibility.
> > > > >> > >> >                 if (str.length() > 0 &&
> !str.contains(":")) {
> > > > >> > >> >                     str = str + " 00:00:00.00";
> > > > >> > >> >                 }
> > > > >> > >> >                 // hack to mimic Timestamp.valueOf() method
> > > > >> > >> >                 if (str.length() > 0 &&
> !str.contains(".")) {
> > > > >> > >> >                     str = str + ".0";
> > > > >> > >> >                 } else {
> > > > >> > >> >                     // DateFormat has a funny way of
> parsing
> > > > >> > >> milliseconds:
> > > > >> > >> >                     // 00:00:00.2 parses to 00:00:00.002
> > > > >> > >> >                     // so we'll add zeros to the end to get
> > > > >> > 00:00:00.200
> > > > >> > >> >                     String[] timeSplit = str.split("[.]");
> > > > >> > >> >                     if (timeSplit.length > 1 &&
> > > > >> timeSplit[1].length()
> > > > >> > <
> > > > >> > >> 3)
> > > > >> > >> > {
> > > > >> > >> >                         str = str +
> > > "000".substring(timeSplit[1].
> > > > >> > >> > length());
> > > > >> > >> >                     }
> > > > >> > >> >                 }
> > > > >> > >> >                 df =
> > > > >> > >> > UtilDateTime.toDateTimeFormat(UtilDateTime.
> > > getDateTimeFormat(),
> > > > >> > >> timeZone,
> > > > >> > >> > locale);
> > > > >> > >> >             } else {
> > > > >> > >> >                 df = UtilDateTime.toDateTimeFormat(
> > > formatString,
> > > > >> > >> timeZone,
> > > > >> > >> > locale);
> > > > >> > >> >             }
> > > > >> > >> >             try {
> > > > >> > >> >                 return new java.sql.Timestamp(df.parse(
> > > > >> > str).getTime());
> > > > >> > >> >             } catch (ParseException e) {
> > > > >> > >> >
> > > > >> > >> >
> > > > >> > >> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <
> > > > >> > mallah.rajesh@gmail.com
> > > > >> > >> >
> > > > >> > >> > wrote:
> > > > >> > >> >
> > > > >> > >> > > Thanks Rishi.
> > > > >> > >> > >
> > > > >> > >> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
> > > > >> > >> rishisolankii@gmail.com>
> > > > >> > >> > > wrote:
> > > > >> > >> > >
> > > > >> > >> > >> UtilDateTime is the utility class, add the time format
> > > support
> > > > >> you
> > > > >> > >> want
> > > > >> > >> > >> and
> > > > >> > >> > >> use it. Most format supported by this utility class
> OFBiz
> > > > have.
> > > > >> > >> > >>
> > > > >> > >> > >> Rishi Solanki
> > > > >> > >> > >> Sr Manager, Enterprise Software Development
> > > > >> > >> > >> HotWax Systems Pvt. Ltd.
> > > > >> > >> > >> Direct: +91-9893287847
> > > > >> > >> > >> http://www.hotwaxsystems.com
> > > > >> > >> > >> www.hotwax.co
> > > > >> > >> > >>
> > > > >> > >> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> > > > >> > >> > mallah.rajesh@gmail.com>
> > > > >> > >> > >> wrote:
> > > > >> > >> > >>
> > > > >> > >> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as
> > fromDate
> > > ,
> > > > >> > >> > >> > Which is the value picked up from the DB column.
> > > > >> > >> > >> >
> > > > >> > >> > >> > Even at XML level the string is preserved , but at
> some
> > > > stage
> > > > >> > after
> > > > >> > >> > >> > hitting tomcat it becomes: "2018-04-17
> 12:09:17+05:30.0"
> > > > >> > >> > >> >
> > > > >> > >> > >> > which is not parseable.
> > > > >> > >> > >> >
> > > > >> > >> > >> >  |W| [ModelService.makeValid] : Type conversion of
> field
> > > > >> > >> [fromDate] to
> > > > >> > >> > >> type
> > > > >> > >> > >> > [java.sql.Timestamp] failed f
> > > > >> > >> > >> > or value "2018-04-17 12:09:17+05:30":
> > > > >> > >> > >> > org.apache.ofbiz.base.util.GeneralException:
> > > > >> > >> > java.text.ParseException:
> > > > >> > >> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> > > > >> > >> > (java.text.ParseExceptio
> > > > >> > >> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> > > > >> > >> > >> >
> > > > >> > >> > >> >
> > > > >> > >> > >> > <!--- snippet from the XML-RPC -->
> > > > >> > >> > >> >
> > > > >> > >> > >> >           <member>
> > > > >> > >> > >> >             <name>fromDate</name>
> > > > >> > >> > >> >             <value>
> > > > >> > >> > >> >               <string><![CDATA[2018-04-17
> > > > >> > >> 12:09:17+05:30]]></string>
> > > > >> > >> > >> >             </value>
> > > > >> > >> > >> >           </member>
> > > > >> > >> > >> >
> > > > >> > >> > >> > <!-- end of snippet -->
> > > > >> > >> > >> >
> > > > >> > >> > >> >
> > > > >> > >> > >> >
> > > > >> > >> > >> >
> > > > >> > >> > >> > regds
> > > > >> > >> > >> > mallah.
> > > > >> > >> > >> >
> > > > >> > >> > >> >
> > > > >> > >> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> > > > >> > >> > >> mallah.rajesh@gmail.com>
> > > > >> > >> > >> > wrote:
> > > > >> > >> > >> >
> > > > >> > >> > >> > > Hello Mr Deepak ,
> > > > >> > >> > >> > >
> > > > >> > >> > >> > > Thanks for the response . The record does exists
> but i
> > > > guess
> > > > >> > >> > >> > > i am not specifying the params good enough to hit
> the
> > > > record
> > > > >> > >> > >> > > by pkey.
> > > > >> > >> > >> > >
> > > > >> > >> > >> > > I wish there were a "product_price_id" in
> ProductPrice
> > > > >> entity.
> > > > >> > >> :-)
> > > > >> > >> > >> > >
> > > > >> > >> > >> > > regds
> > > > >> > >> > >> > > mallah.
> > > > >> > >> > >> > >
> > > > >> > >> > >> > >
> > > > >> > >> > >> > >
> > > > >> > >> > >> > >
> > > > >> > >> > >> > >
> > > > >> > >> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> > > > >> > >> > deepak.dixit@hotwax.co
> > > > >> > >> > >> >
> > > > >> > >> > >> > > wrote:
> > > > >> > >> > >> > >
> > > > >> > >> > >> > >> Hi Rajesh,
> > > > >> > >> > >> > >>
> > > > >> > >> > >> > >> If you want to create product price you should use
> > > > >> > >> > createProductPrice
> > > > >> > >> > >> > >> service,
> > > > >> > >> > >> > >> https://demo-stable.ofbiz.apac
> > > > >> he.org/webtools/control/Servic
> > > > >> > >> > >> > >> eList?sel_service_name=createProductPrice
> > > > >> > >> > >> > >>
> > > > >> > >> > >> > >> If productPrice record already exists you should
> use
> > > > >> > >> > >> updateProductPrice,
> > > > >> > >> > >> > >>
> > > > >> > >> > >> > >> Thanks & Regards
> > > > >> > >> > >> > >> --
> > > > >> > >> > >> > >> Deepak Dixit
> > > > >> > >> > >> > >> Director of Product Engineering
> > > > >> > >> > >> > >> HotWax Commerce <https://hotwax.co/>
> > > > >> > >> > >> > >>
> > > > >> > >> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> > > > >> > >> > >> > mallah.rajesh@gmail.com>
> > > > >> > >> > >> > >> wrote:
> > > > >> > >> > >> > >>
> > > > >> > >> > >> > >> > Hi ,
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > I am calling
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > https://demo-stable.ofbiz.
> > > apache.org/webtools/control/
> > > > >> > >> > >> > >> > ServiceList?sel_service_name=updateProductPrice
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > with ARGS
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > {
> > > > >> > >> > >> > >> >     currencyUomId           "INR",
> > > > >> > >> > >> > >> >     fromDate                "2018-04-16
> 17:39:52",
> > > > >> > >> > >> > >> >     price                   150,
> > > > >> > >> > >> > >> >     productId               "PROD_SW52D5H3EN",
> > > > >> > >> > >> > >> >     productPricePurposeId   "PURCHASE",
> > > > >> > >> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> > > > >> > >> > >> > >> >     productStoreGroupId     "_NA_",
> > > > >> > >> > >> > >> >     taxInPrice              "Y",
> > > > >> > >> > >> > >> >     termUomId               "WT_kg"
> > > > >> > >> > >> > >> > }
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > I am getting error:
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > faultString:Error running the simple-method:
> Entity
> > > > value
> > > > >> > not
> > > > >> > >> > found
> > > > >> > >> > >> > with
> > > > >> > >> > >> > >> > name: lookedUpValue Method = updateProductPrice,
> > > File =
> > > > >> > >> > >> > >> > file:/opt/ofbiz/apache-ofbiz-1
> > > > >> 6.11.04/applications/product/
> > > > >> > >> > >> > >> > minilang/product/price/PriceServices.xml,
> > > > >> > >> > >> > >> > Element = <set-nonpk-fields>, Line 69null
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > the minilang def is reproduced here for
> > convinience:
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >  <simple-method method-name="updateProductPrice"
> > > > >> > >> > >> > >> short-description="Update
> > > > >> > >> > >> > >> > an ProductPrice">
> > > > >> > >> > >> > >> >         <set field="callingMethodName"
> > > > >> > >> > value="updateProductPrice"/>
> > > > >> > >> > >> > >> >         <set field="checkAction" value="UPDATE"/>
> > > > >> > >> > >> > >> >         <call-simple-method method-name="
> > > > >> > >> > >> > checkProductRelatedPermission"
> > > > >> > >> > >> > >> > xml-resource="component://
> > product/minilang/product/
> > > > >> > >> > >> > >> > product/ProductServices.xml"/>
> > > > >> > >> > >> > >> >         <check-permission
> > > > permission="CATALOG_PRICE_MAIN
> > > > >> T">
> > > > >> > >> > >> > >> >             <fail-property
> > resource="ProductUiLabels"
> > > > >> > >> > >> > >> > property="ProductPriceMaintPermissionError"/>
> > > > >> > >> > >> > >> >         </check-permission>
> > > > >> > >> > >> > >> >         <check-errors/>
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >         <call-simple-method method-name="
> > > > >> > >> > >> > inlineHandlePriceWithTaxInclud
> > > > >> > >> > >> > >> > ed"/>
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >         <entity-one entity-name="ProductPrice"
> > > > >> > >> > >> > >> > value-field="lookedUpValue"/>
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >         <!-- grab the old price value before
> > setting
> > > > >> nonpk
> > > > >> > >> > >> parameter
> > > > >> > >> > >> > >> fields
> > > > >> > >> > >> > >> > -->
> > > > >> > >> > >> > >> >         <field-to-result
> > field="lookedUpValue.price"
> > > > >> > >> > >> > >> > result-name="oldPrice"/>
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >         <set-nonpk-fields map="parameters"
> > > > >> > >> > >> > value-field="lookedUpValue"/>
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >         <now-timestamp field="nowTimestamp"/>
> > > > >> > >> > >> > >> >         <set field="lookedUpValue.
> > lastModifiedDate"
> > > > >> > >> > >> > >> > from-field="nowTimestamp"/>
> > > > >> > >> > >> > >> >         <set field="lookedUpValue.lastModif
> > > > >> iedByUserLogin"
> > > > >> > >> > >> > >> > from-field="userLogin.userLoginId"/>
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> >         <store-value
> value-field="lookedUpValue"/>
> > > > >> > >> > >> > >> >  </simple-method>
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > The productID does exists in Entity ProductPrice
> > > > >> > >> > >> > >> > Where am I going wrong ?
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >> > thanks & regds
> > > > >> > >> > >> > >> > Rajesh Mallah.
> > > > >> > >> > >> > >> >
> > > > >> > >> > >> > >>
> > > > >> > >> > >> > >
> > > > >> > >> > >> > >
> > > > >> > >> > >> >
> > > > >> > >> > >>
> > > > >> > >> > >
> > > > >> > >> > >
> > > > >> > >> >
> > > > >> > >>
> > > > >> > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: help with updateProductPrice

Posted by Mike <mz...@gmail.com>.
Just make your DB updates, then make an API call or use wget to clear the
cache.  For instance:

wget --no-check-certificate -T 360
https://IP_ADDRESS/webtools/control/FindUtilCacheClearAll?USERNAME=admin&PASSWORD=xxxxxxx&JavaScriptEnabled=N

Here's the thing.. Eventually, you're going to make hacks to satisfy
various problems that come up.  Making your own, custom xmlrpc/SOAP/REST is
well within the norm.  If you make one (hack), like to make an easy fast
price updater, you'll start to use the same technique to solve another
problem.  It's great to be a purist (if you can), but you have to have a
way of working around bugs.  Just MHO.

On Tue, Apr 17, 2018 at 10:14 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

> Hi Mike  ,
>
> moreover there is the factor of Caching at various levels . If you
> directly interact with DB , i feel the caches may become stale .
>
> regds
> Mallah.
>
> On Tue, Apr 17, 2018 at 9:17 PM, Mike <mz...@gmail.com> wrote:
>
> > Why not just write your own custom xmlrpc server (perl/python/java) that
> > accepts just the P/N and new price, searches for the current record, and
> > performs a SQL call to update the DB.
> >
> > On Tue, Apr 17, 2018 at 8:12 AM, Rajesh Mallah <ma...@gmail.com>
> > wrote:
> >
> > > ERRATA: I meant "There is no parameter" in lieu of "There is parameter"
> > >
> > > On Tue, Apr 17, 2018 at 8:09 PM, Rajesh Mallah <
> mallah.rajesh@gmail.com>
> > > wrote:
> > >
> > > >
> > > > Hi Rishi ,
> > > >
> > > > I am using XML RPC with OFBiz so my capabilities are limited to
> > > > what the interface provides. There is  parameter that allows me
> > > > to specify the data format/pattern .
> > > >
> > > > At this moment i have solved my problem temporarily by appending
> > > > .001 after the second part in HH:MM:SS and i am only using
> > > > createProductPrice instead of updateProductPrice . As creating new
> > > > prices allows to have a history/audit of prices. I feel
> > > updateProductPrice
> > > > is really overwriting the values and trail is lost.
> > > >
> > > > regds
> > > > mallah.
> > > >
> > > >
> > > >
> > > >
> > > > On Tue, Apr 17, 2018 at 6:49 PM, Rishi Solanki <
> > rishisolankii@gmail.com>
> > > > wrote:
> > > >
> > > >> Idea of utility class is, use the format you would like and pass the
> > > >> value.
> > > >> It will convert into timestamp used in the table. In case you could
> > not
> > > >> get
> > > >> the desired format in the utility class then the class uses the
> > > >> java.text.SimpleDateFormat class to resolve its purpose.
> > > >>
> > > >> Please take a look at toTimestamp() method variations and format you
> > are
> > > >> receiving in the xml. Once you have the format with you, it can be
> > > easily
> > > >> converted into timestamp. Also if utility class does not support
> then
> > go
> > > >> to
> > > >> core class for same i.e java.text.SimpleDateFormat and look for the
> > > >> supporting format.
> > > >>
> > > >> HTH!
> > > >>
> > > >>
> > > >> Rishi Solanki
> > > >> Sr Manager, Enterprise Software Development
> > > >> HotWax Systems Pvt. Ltd.
> > > >> Direct: +91-9893287847
> > > >> http://www.hotwaxsystems.com
> > > >> www.hotwax.co
> > > >>
> > > >> On Tue, Apr 17, 2018 at 3:02 PM, Rajesh Mallah <
> > mallah.rajesh@gmail.com
> > > >
> > > >> wrote:
> > > >>
> > > >> > Further Info:
> > > >> >
> > > >> >   <member>
> > > >> >             <name>fromDate</name>
> > > >> >             <value>
> > > >> >               <string><![CDATA[2018-04-17 14:59:34.001
> > > +0530]]></string>
> > > >> >             </value>
> > > >> >    </member>
> > > >> >
> > > >> > In XML results in
> > > >> >
> > > >> > from_date                   | 2018-04-17 14:59:34.001+05:30
> > > >> >
> > > >> > in DB. looks like the parser is kind enough to consider TZ
> > > >> > spec without colons.
> > > >> >
> > > >> >
> > > >> > regds
> > > >> > mallah.
> > > >> >
> > > >> >
> > > >> > On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <
> > > mallah.rajesh@gmail.com
> > > >> >
> > > >> > wrote:
> > > >> >
> > > >> > >
> > > >> > > Its PostgreSQL
> > > >> > > regds
> > > >> > >
> > > >> > >
> > > >> > >  below is a sample data :
> > > >> > >
> > > >> > > SQL> select * from  ofbiz.product_price  where
> > > >> > > product_id='PROD_SW52D5H3EN' order by created_date desc limit 1;
> > > >> > >
> > > >> > > -[ RECORD 1 ]---------------+------------------------------
> > > >> > > product_id                  | PROD_SW52D5H3EN
> > > >> > > product_price_type_id       | DEFAULT_PRICE
> > > >> > > product_price_purpose_id    | PURCHASE
> > > >> > > currency_uom_id             | INR
> > > >> > > product_store_group_id      | _NA_
> > > >> > > from_date                   | 2018-04-17 12:49:20+05:30    <----
> > > This
> > > >> has
> > > >> > > been put by me.
> > > >> > > thru_date                   |
> > > >> > > price                       | 121.000
> > > >> > > term_uom_id                 | WT_kg
> > > >> > > custom_price_calc_service   |
> > > >> > > price_without_tax           |
> > > >> > > price_with_tax              |
> > > >> > > tax_amount                  |
> > > >> > > tax_percentage              |
> > > >> > > tax_auth_party_id           |
> > > >> > > tax_auth_geo_id             |
> > > >> > > tax_in_price                | Y
> > > >> > > created_date                | 2018-04-17 12:49:20.416+05:30
> > > >> > > created_by_user_login       | admin
> > > >> > > last_modified_date          | 2018-04-17 12:49:20.416+05:30
> > > >> > > last_modified_by_user_login | admin
> > > >> > > last_updated_stamp          | 2018-04-17 12:49:20.416+05:30
> <----
> > > >> > > Generated by defaults.
> > > >> > > last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
> > > >> > > created_stamp               | 2018-04-17 12:49:20.416+05:30
> > > >> > > created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
> > > >> > >
> > > >> > >
> > > >> > > On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit
> > > >> > <deepak.dixit@hotwaxsystems.
> > > >> > > com> wrote:
> > > >> > >
> > > >> > >> Hi Rajesh,
> > > >> > >>
> > > >> > >> Could you please share which database you are using?
> > > >> > >>
> > > >> > >>
> > > >> > >> Thanks & Regards
> > > >> > >> --
> > > >> > >> Deepak Dixit
> > > >> > >> www.hotwax.co
> > > >> > >>
> > > >> > >> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <
> > > >> mallah.rajesh@gmail.com
> > > >> > >
> > > >> > >> wrote:
> > > >> > >>
> > > >> > >> >  Hi ,
> > > >> > >> >
> > > >> > >> >
> > > >> > >> > it was in conversion/DateTimeConverters.java that was
> > appending
> > > >> '.0'
> > > >> > to
> > > >> > >> > the
> > > >> > >> > end of
> > > >> > >> > string if the string did not contain any  decimals. So i have
> > now
> > > >> > >> started
> > > >> > >> > sending
> > > >> > >> > the fractional seconds. And things are better (if not
> perfect).
> > > >> > >> >
> > > >> > >> >
> > > >> > >> >
> > > >> > >> > public java.sql.Timestamp convert(String obj, Locale locale,
> > > >> TimeZone
> > > >> > >> > timeZone, String formatString) throws ConversionException {
> > > >> > >> >             String str = obj.trim();
> > > >> > >> >             if (str.length() == 0) {
> > > >> > >> >                 return null;
> > > >> > >> >             }
> > > >> > >> >             DateFormat df = null;
> > > >> > >> >             if (UtilValidate.isEmpty(formatString)) {
> > > >> > >> >                 // These hacks are a bad idea, but they are
> > > >> included
> > > >> > >> >                 // for backward compatibility.
> > > >> > >> >                 if (str.length() > 0 && !str.contains(":")) {
> > > >> > >> >                     str = str + " 00:00:00.00";
> > > >> > >> >                 }
> > > >> > >> >                 // hack to mimic Timestamp.valueOf() method
> > > >> > >> >                 if (str.length() > 0 && !str.contains(".")) {
> > > >> > >> >                     str = str + ".0";
> > > >> > >> >                 } else {
> > > >> > >> >                     // DateFormat has a funny way of parsing
> > > >> > >> milliseconds:
> > > >> > >> >                     // 00:00:00.2 parses to 00:00:00.002
> > > >> > >> >                     // so we'll add zeros to the end to get
> > > >> > 00:00:00.200
> > > >> > >> >                     String[] timeSplit = str.split("[.]");
> > > >> > >> >                     if (timeSplit.length > 1 &&
> > > >> timeSplit[1].length()
> > > >> > <
> > > >> > >> 3)
> > > >> > >> > {
> > > >> > >> >                         str = str +
> > "000".substring(timeSplit[1].
> > > >> > >> > length());
> > > >> > >> >                     }
> > > >> > >> >                 }
> > > >> > >> >                 df =
> > > >> > >> > UtilDateTime.toDateTimeFormat(UtilDateTime.
> > getDateTimeFormat(),
> > > >> > >> timeZone,
> > > >> > >> > locale);
> > > >> > >> >             } else {
> > > >> > >> >                 df = UtilDateTime.toDateTimeFormat(
> > formatString,
> > > >> > >> timeZone,
> > > >> > >> > locale);
> > > >> > >> >             }
> > > >> > >> >             try {
> > > >> > >> >                 return new java.sql.Timestamp(df.parse(
> > > >> > str).getTime());
> > > >> > >> >             } catch (ParseException e) {
> > > >> > >> >
> > > >> > >> >
> > > >> > >> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <
> > > >> > mallah.rajesh@gmail.com
> > > >> > >> >
> > > >> > >> > wrote:
> > > >> > >> >
> > > >> > >> > > Thanks Rishi.
> > > >> > >> > >
> > > >> > >> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
> > > >> > >> rishisolankii@gmail.com>
> > > >> > >> > > wrote:
> > > >> > >> > >
> > > >> > >> > >> UtilDateTime is the utility class, add the time format
> > support
> > > >> you
> > > >> > >> want
> > > >> > >> > >> and
> > > >> > >> > >> use it. Most format supported by this utility class OFBiz
> > > have.
> > > >> > >> > >>
> > > >> > >> > >> Rishi Solanki
> > > >> > >> > >> Sr Manager, Enterprise Software Development
> > > >> > >> > >> HotWax Systems Pvt. Ltd.
> > > >> > >> > >> Direct: +91-9893287847
> > > >> > >> > >> http://www.hotwaxsystems.com
> > > >> > >> > >> www.hotwax.co
> > > >> > >> > >>
> > > >> > >> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> > > >> > >> > mallah.rajesh@gmail.com>
> > > >> > >> > >> wrote:
> > > >> > >> > >>
> > > >> > >> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as
> fromDate
> > ,
> > > >> > >> > >> > Which is the value picked up from the DB column.
> > > >> > >> > >> >
> > > >> > >> > >> > Even at XML level the string is preserved , but at some
> > > stage
> > > >> > after
> > > >> > >> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> > > >> > >> > >> >
> > > >> > >> > >> > which is not parseable.
> > > >> > >> > >> >
> > > >> > >> > >> >  |W| [ModelService.makeValid] : Type conversion of field
> > > >> > >> [fromDate] to
> > > >> > >> > >> type
> > > >> > >> > >> > [java.sql.Timestamp] failed f
> > > >> > >> > >> > or value "2018-04-17 12:09:17+05:30":
> > > >> > >> > >> > org.apache.ofbiz.base.util.GeneralException:
> > > >> > >> > java.text.ParseException:
> > > >> > >> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> > > >> > >> > (java.text.ParseExceptio
> > > >> > >> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> > > >> > >> > >> >
> > > >> > >> > >> >
> > > >> > >> > >> > <!--- snippet from the XML-RPC -->
> > > >> > >> > >> >
> > > >> > >> > >> >           <member>
> > > >> > >> > >> >             <name>fromDate</name>
> > > >> > >> > >> >             <value>
> > > >> > >> > >> >               <string><![CDATA[2018-04-17
> > > >> > >> 12:09:17+05:30]]></string>
> > > >> > >> > >> >             </value>
> > > >> > >> > >> >           </member>
> > > >> > >> > >> >
> > > >> > >> > >> > <!-- end of snippet -->
> > > >> > >> > >> >
> > > >> > >> > >> >
> > > >> > >> > >> >
> > > >> > >> > >> >
> > > >> > >> > >> > regds
> > > >> > >> > >> > mallah.
> > > >> > >> > >> >
> > > >> > >> > >> >
> > > >> > >> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> > > >> > >> > >> mallah.rajesh@gmail.com>
> > > >> > >> > >> > wrote:
> > > >> > >> > >> >
> > > >> > >> > >> > > Hello Mr Deepak ,
> > > >> > >> > >> > >
> > > >> > >> > >> > > Thanks for the response . The record does exists but i
> > > guess
> > > >> > >> > >> > > i am not specifying the params good enough to hit the
> > > record
> > > >> > >> > >> > > by pkey.
> > > >> > >> > >> > >
> > > >> > >> > >> > > I wish there were a "product_price_id" in ProductPrice
> > > >> entity.
> > > >> > >> :-)
> > > >> > >> > >> > >
> > > >> > >> > >> > > regds
> > > >> > >> > >> > > mallah.
> > > >> > >> > >> > >
> > > >> > >> > >> > >
> > > >> > >> > >> > >
> > > >> > >> > >> > >
> > > >> > >> > >> > >
> > > >> > >> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> > > >> > >> > deepak.dixit@hotwax.co
> > > >> > >> > >> >
> > > >> > >> > >> > > wrote:
> > > >> > >> > >> > >
> > > >> > >> > >> > >> Hi Rajesh,
> > > >> > >> > >> > >>
> > > >> > >> > >> > >> If you want to create product price you should use
> > > >> > >> > createProductPrice
> > > >> > >> > >> > >> service,
> > > >> > >> > >> > >> https://demo-stable.ofbiz.apac
> > > >> he.org/webtools/control/Servic
> > > >> > >> > >> > >> eList?sel_service_name=createProductPrice
> > > >> > >> > >> > >>
> > > >> > >> > >> > >> If productPrice record already exists you should use
> > > >> > >> > >> updateProductPrice,
> > > >> > >> > >> > >>
> > > >> > >> > >> > >> Thanks & Regards
> > > >> > >> > >> > >> --
> > > >> > >> > >> > >> Deepak Dixit
> > > >> > >> > >> > >> Director of Product Engineering
> > > >> > >> > >> > >> HotWax Commerce <https://hotwax.co/>
> > > >> > >> > >> > >>
> > > >> > >> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> > > >> > >> > >> > mallah.rajesh@gmail.com>
> > > >> > >> > >> > >> wrote:
> > > >> > >> > >> > >>
> > > >> > >> > >> > >> > Hi ,
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > I am calling
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > https://demo-stable.ofbiz.
> > apache.org/webtools/control/
> > > >> > >> > >> > >> > ServiceList?sel_service_name=updateProductPrice
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > with ARGS
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > {
> > > >> > >> > >> > >> >     currencyUomId           "INR",
> > > >> > >> > >> > >> >     fromDate                "2018-04-16 17:39:52",
> > > >> > >> > >> > >> >     price                   150,
> > > >> > >> > >> > >> >     productId               "PROD_SW52D5H3EN",
> > > >> > >> > >> > >> >     productPricePurposeId   "PURCHASE",
> > > >> > >> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> > > >> > >> > >> > >> >     productStoreGroupId     "_NA_",
> > > >> > >> > >> > >> >     taxInPrice              "Y",
> > > >> > >> > >> > >> >     termUomId               "WT_kg"
> > > >> > >> > >> > >> > }
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > I am getting error:
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > faultString:Error running the simple-method: Entity
> > > value
> > > >> > not
> > > >> > >> > found
> > > >> > >> > >> > with
> > > >> > >> > >> > >> > name: lookedUpValue Method = updateProductPrice,
> > File =
> > > >> > >> > >> > >> > file:/opt/ofbiz/apache-ofbiz-1
> > > >> 6.11.04/applications/product/
> > > >> > >> > >> > >> > minilang/product/price/PriceServices.xml,
> > > >> > >> > >> > >> > Element = <set-nonpk-fields>, Line 69null
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > the minilang def is reproduced here for
> convinience:
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >  <simple-method method-name="updateProductPrice"
> > > >> > >> > >> > >> short-description="Update
> > > >> > >> > >> > >> > an ProductPrice">
> > > >> > >> > >> > >> >         <set field="callingMethodName"
> > > >> > >> > value="updateProductPrice"/>
> > > >> > >> > >> > >> >         <set field="checkAction" value="UPDATE"/>
> > > >> > >> > >> > >> >         <call-simple-method method-name="
> > > >> > >> > >> > checkProductRelatedPermission"
> > > >> > >> > >> > >> > xml-resource="component://
> product/minilang/product/
> > > >> > >> > >> > >> > product/ProductServices.xml"/>
> > > >> > >> > >> > >> >         <check-permission
> > > permission="CATALOG_PRICE_MAIN
> > > >> T">
> > > >> > >> > >> > >> >             <fail-property
> resource="ProductUiLabels"
> > > >> > >> > >> > >> > property="ProductPriceMaintPermissionError"/>
> > > >> > >> > >> > >> >         </check-permission>
> > > >> > >> > >> > >> >         <check-errors/>
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >         <call-simple-method method-name="
> > > >> > >> > >> > inlineHandlePriceWithTaxInclud
> > > >> > >> > >> > >> > ed"/>
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >         <entity-one entity-name="ProductPrice"
> > > >> > >> > >> > >> > value-field="lookedUpValue"/>
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >         <!-- grab the old price value before
> setting
> > > >> nonpk
> > > >> > >> > >> parameter
> > > >> > >> > >> > >> fields
> > > >> > >> > >> > >> > -->
> > > >> > >> > >> > >> >         <field-to-result
> field="lookedUpValue.price"
> > > >> > >> > >> > >> > result-name="oldPrice"/>
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >         <set-nonpk-fields map="parameters"
> > > >> > >> > >> > value-field="lookedUpValue"/>
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >         <now-timestamp field="nowTimestamp"/>
> > > >> > >> > >> > >> >         <set field="lookedUpValue.
> lastModifiedDate"
> > > >> > >> > >> > >> > from-field="nowTimestamp"/>
> > > >> > >> > >> > >> >         <set field="lookedUpValue.lastModif
> > > >> iedByUserLogin"
> > > >> > >> > >> > >> > from-field="userLogin.userLoginId"/>
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> >         <store-value value-field="lookedUpValue"/>
> > > >> > >> > >> > >> >  </simple-method>
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > The productID does exists in Entity ProductPrice
> > > >> > >> > >> > >> > Where am I going wrong ?
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >> > thanks & regds
> > > >> > >> > >> > >> > Rajesh Mallah.
> > > >> > >> > >> > >> >
> > > >> > >> > >> > >>
> > > >> > >> > >> > >
> > > >> > >> > >> > >
> > > >> > >> > >> >
> > > >> > >> > >>
> > > >> > >> > >
> > > >> > >> > >
> > > >> > >> >
> > > >> > >>
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > > >
> > > >
> > >
> >
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Hi Mike  ,

moreover there is the factor of Caching at various levels . If you
directly interact with DB , i feel the caches may become stale .

regds
Mallah.

On Tue, Apr 17, 2018 at 9:17 PM, Mike <mz...@gmail.com> wrote:

> Why not just write your own custom xmlrpc server (perl/python/java) that
> accepts just the P/N and new price, searches for the current record, and
> performs a SQL call to update the DB.
>
> On Tue, Apr 17, 2018 at 8:12 AM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > ERRATA: I meant "There is no parameter" in lieu of "There is parameter"
> >
> > On Tue, Apr 17, 2018 at 8:09 PM, Rajesh Mallah <ma...@gmail.com>
> > wrote:
> >
> > >
> > > Hi Rishi ,
> > >
> > > I am using XML RPC with OFBiz so my capabilities are limited to
> > > what the interface provides. There is  parameter that allows me
> > > to specify the data format/pattern .
> > >
> > > At this moment i have solved my problem temporarily by appending
> > > .001 after the second part in HH:MM:SS and i am only using
> > > createProductPrice instead of updateProductPrice . As creating new
> > > prices allows to have a history/audit of prices. I feel
> > updateProductPrice
> > > is really overwriting the values and trail is lost.
> > >
> > > regds
> > > mallah.
> > >
> > >
> > >
> > >
> > > On Tue, Apr 17, 2018 at 6:49 PM, Rishi Solanki <
> rishisolankii@gmail.com>
> > > wrote:
> > >
> > >> Idea of utility class is, use the format you would like and pass the
> > >> value.
> > >> It will convert into timestamp used in the table. In case you could
> not
> > >> get
> > >> the desired format in the utility class then the class uses the
> > >> java.text.SimpleDateFormat class to resolve its purpose.
> > >>
> > >> Please take a look at toTimestamp() method variations and format you
> are
> > >> receiving in the xml. Once you have the format with you, it can be
> > easily
> > >> converted into timestamp. Also if utility class does not support then
> go
> > >> to
> > >> core class for same i.e java.text.SimpleDateFormat and look for the
> > >> supporting format.
> > >>
> > >> HTH!
> > >>
> > >>
> > >> Rishi Solanki
> > >> Sr Manager, Enterprise Software Development
> > >> HotWax Systems Pvt. Ltd.
> > >> Direct: +91-9893287847
> > >> http://www.hotwaxsystems.com
> > >> www.hotwax.co
> > >>
> > >> On Tue, Apr 17, 2018 at 3:02 PM, Rajesh Mallah <
> mallah.rajesh@gmail.com
> > >
> > >> wrote:
> > >>
> > >> > Further Info:
> > >> >
> > >> >   <member>
> > >> >             <name>fromDate</name>
> > >> >             <value>
> > >> >               <string><![CDATA[2018-04-17 14:59:34.001
> > +0530]]></string>
> > >> >             </value>
> > >> >    </member>
> > >> >
> > >> > In XML results in
> > >> >
> > >> > from_date                   | 2018-04-17 14:59:34.001+05:30
> > >> >
> > >> > in DB. looks like the parser is kind enough to consider TZ
> > >> > spec without colons.
> > >> >
> > >> >
> > >> > regds
> > >> > mallah.
> > >> >
> > >> >
> > >> > On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <
> > mallah.rajesh@gmail.com
> > >> >
> > >> > wrote:
> > >> >
> > >> > >
> > >> > > Its PostgreSQL
> > >> > > regds
> > >> > >
> > >> > >
> > >> > >  below is a sample data :
> > >> > >
> > >> > > SQL> select * from  ofbiz.product_price  where
> > >> > > product_id='PROD_SW52D5H3EN' order by created_date desc limit 1;
> > >> > >
> > >> > > -[ RECORD 1 ]---------------+------------------------------
> > >> > > product_id                  | PROD_SW52D5H3EN
> > >> > > product_price_type_id       | DEFAULT_PRICE
> > >> > > product_price_purpose_id    | PURCHASE
> > >> > > currency_uom_id             | INR
> > >> > > product_store_group_id      | _NA_
> > >> > > from_date                   | 2018-04-17 12:49:20+05:30    <----
> > This
> > >> has
> > >> > > been put by me.
> > >> > > thru_date                   |
> > >> > > price                       | 121.000
> > >> > > term_uom_id                 | WT_kg
> > >> > > custom_price_calc_service   |
> > >> > > price_without_tax           |
> > >> > > price_with_tax              |
> > >> > > tax_amount                  |
> > >> > > tax_percentage              |
> > >> > > tax_auth_party_id           |
> > >> > > tax_auth_geo_id             |
> > >> > > tax_in_price                | Y
> > >> > > created_date                | 2018-04-17 12:49:20.416+05:30
> > >> > > created_by_user_login       | admin
> > >> > > last_modified_date          | 2018-04-17 12:49:20.416+05:30
> > >> > > last_modified_by_user_login | admin
> > >> > > last_updated_stamp          | 2018-04-17 12:49:20.416+05:30  <----
> > >> > > Generated by defaults.
> > >> > > last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
> > >> > > created_stamp               | 2018-04-17 12:49:20.416+05:30
> > >> > > created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
> > >> > >
> > >> > >
> > >> > > On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit
> > >> > <deepak.dixit@hotwaxsystems.
> > >> > > com> wrote:
> > >> > >
> > >> > >> Hi Rajesh,
> > >> > >>
> > >> > >> Could you please share which database you are using?
> > >> > >>
> > >> > >>
> > >> > >> Thanks & Regards
> > >> > >> --
> > >> > >> Deepak Dixit
> > >> > >> www.hotwax.co
> > >> > >>
> > >> > >> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <
> > >> mallah.rajesh@gmail.com
> > >> > >
> > >> > >> wrote:
> > >> > >>
> > >> > >> >  Hi ,
> > >> > >> >
> > >> > >> >
> > >> > >> > it was in conversion/DateTimeConverters.java that was
> appending
> > >> '.0'
> > >> > to
> > >> > >> > the
> > >> > >> > end of
> > >> > >> > string if the string did not contain any  decimals. So i have
> now
> > >> > >> started
> > >> > >> > sending
> > >> > >> > the fractional seconds. And things are better (if not perfect).
> > >> > >> >
> > >> > >> >
> > >> > >> >
> > >> > >> > public java.sql.Timestamp convert(String obj, Locale locale,
> > >> TimeZone
> > >> > >> > timeZone, String formatString) throws ConversionException {
> > >> > >> >             String str = obj.trim();
> > >> > >> >             if (str.length() == 0) {
> > >> > >> >                 return null;
> > >> > >> >             }
> > >> > >> >             DateFormat df = null;
> > >> > >> >             if (UtilValidate.isEmpty(formatString)) {
> > >> > >> >                 // These hacks are a bad idea, but they are
> > >> included
> > >> > >> >                 // for backward compatibility.
> > >> > >> >                 if (str.length() > 0 && !str.contains(":")) {
> > >> > >> >                     str = str + " 00:00:00.00";
> > >> > >> >                 }
> > >> > >> >                 // hack to mimic Timestamp.valueOf() method
> > >> > >> >                 if (str.length() > 0 && !str.contains(".")) {
> > >> > >> >                     str = str + ".0";
> > >> > >> >                 } else {
> > >> > >> >                     // DateFormat has a funny way of parsing
> > >> > >> milliseconds:
> > >> > >> >                     // 00:00:00.2 parses to 00:00:00.002
> > >> > >> >                     // so we'll add zeros to the end to get
> > >> > 00:00:00.200
> > >> > >> >                     String[] timeSplit = str.split("[.]");
> > >> > >> >                     if (timeSplit.length > 1 &&
> > >> timeSplit[1].length()
> > >> > <
> > >> > >> 3)
> > >> > >> > {
> > >> > >> >                         str = str +
> "000".substring(timeSplit[1].
> > >> > >> > length());
> > >> > >> >                     }
> > >> > >> >                 }
> > >> > >> >                 df =
> > >> > >> > UtilDateTime.toDateTimeFormat(UtilDateTime.
> getDateTimeFormat(),
> > >> > >> timeZone,
> > >> > >> > locale);
> > >> > >> >             } else {
> > >> > >> >                 df = UtilDateTime.toDateTimeFormat(
> formatString,
> > >> > >> timeZone,
> > >> > >> > locale);
> > >> > >> >             }
> > >> > >> >             try {
> > >> > >> >                 return new java.sql.Timestamp(df.parse(
> > >> > str).getTime());
> > >> > >> >             } catch (ParseException e) {
> > >> > >> >
> > >> > >> >
> > >> > >> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <
> > >> > mallah.rajesh@gmail.com
> > >> > >> >
> > >> > >> > wrote:
> > >> > >> >
> > >> > >> > > Thanks Rishi.
> > >> > >> > >
> > >> > >> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
> > >> > >> rishisolankii@gmail.com>
> > >> > >> > > wrote:
> > >> > >> > >
> > >> > >> > >> UtilDateTime is the utility class, add the time format
> support
> > >> you
> > >> > >> want
> > >> > >> > >> and
> > >> > >> > >> use it. Most format supported by this utility class OFBiz
> > have.
> > >> > >> > >>
> > >> > >> > >> Rishi Solanki
> > >> > >> > >> Sr Manager, Enterprise Software Development
> > >> > >> > >> HotWax Systems Pvt. Ltd.
> > >> > >> > >> Direct: +91-9893287847
> > >> > >> > >> http://www.hotwaxsystems.com
> > >> > >> > >> www.hotwax.co
> > >> > >> > >>
> > >> > >> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> > >> > >> > mallah.rajesh@gmail.com>
> > >> > >> > >> wrote:
> > >> > >> > >>
> > >> > >> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate
> ,
> > >> > >> > >> > Which is the value picked up from the DB column.
> > >> > >> > >> >
> > >> > >> > >> > Even at XML level the string is preserved , but at some
> > stage
> > >> > after
> > >> > >> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> > >> > >> > >> >
> > >> > >> > >> > which is not parseable.
> > >> > >> > >> >
> > >> > >> > >> >  |W| [ModelService.makeValid] : Type conversion of field
> > >> > >> [fromDate] to
> > >> > >> > >> type
> > >> > >> > >> > [java.sql.Timestamp] failed f
> > >> > >> > >> > or value "2018-04-17 12:09:17+05:30":
> > >> > >> > >> > org.apache.ofbiz.base.util.GeneralException:
> > >> > >> > java.text.ParseException:
> > >> > >> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> > >> > >> > (java.text.ParseExceptio
> > >> > >> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > <!--- snippet from the XML-RPC -->
> > >> > >> > >> >
> > >> > >> > >> >           <member>
> > >> > >> > >> >             <name>fromDate</name>
> > >> > >> > >> >             <value>
> > >> > >> > >> >               <string><![CDATA[2018-04-17
> > >> > >> 12:09:17+05:30]]></string>
> > >> > >> > >> >             </value>
> > >> > >> > >> >           </member>
> > >> > >> > >> >
> > >> > >> > >> > <!-- end of snippet -->
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > regds
> > >> > >> > >> > mallah.
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> > >> > >> > >> mallah.rajesh@gmail.com>
> > >> > >> > >> > wrote:
> > >> > >> > >> >
> > >> > >> > >> > > Hello Mr Deepak ,
> > >> > >> > >> > >
> > >> > >> > >> > > Thanks for the response . The record does exists but i
> > guess
> > >> > >> > >> > > i am not specifying the params good enough to hit the
> > record
> > >> > >> > >> > > by pkey.
> > >> > >> > >> > >
> > >> > >> > >> > > I wish there were a "product_price_id" in ProductPrice
> > >> entity.
> > >> > >> :-)
> > >> > >> > >> > >
> > >> > >> > >> > > regds
> > >> > >> > >> > > mallah.
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> > >> > >> > deepak.dixit@hotwax.co
> > >> > >> > >> >
> > >> > >> > >> > > wrote:
> > >> > >> > >> > >
> > >> > >> > >> > >> Hi Rajesh,
> > >> > >> > >> > >>
> > >> > >> > >> > >> If you want to create product price you should use
> > >> > >> > createProductPrice
> > >> > >> > >> > >> service,
> > >> > >> > >> > >> https://demo-stable.ofbiz.apac
> > >> he.org/webtools/control/Servic
> > >> > >> > >> > >> eList?sel_service_name=createProductPrice
> > >> > >> > >> > >>
> > >> > >> > >> > >> If productPrice record already exists you should use
> > >> > >> > >> updateProductPrice,
> > >> > >> > >> > >>
> > >> > >> > >> > >> Thanks & Regards
> > >> > >> > >> > >> --
> > >> > >> > >> > >> Deepak Dixit
> > >> > >> > >> > >> Director of Product Engineering
> > >> > >> > >> > >> HotWax Commerce <https://hotwax.co/>
> > >> > >> > >> > >>
> > >> > >> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> > >> > >> > >> > mallah.rajesh@gmail.com>
> > >> > >> > >> > >> wrote:
> > >> > >> > >> > >>
> > >> > >> > >> > >> > Hi ,
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > I am calling
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > https://demo-stable.ofbiz.
> apache.org/webtools/control/
> > >> > >> > >> > >> > ServiceList?sel_service_name=updateProductPrice
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > with ARGS
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > {
> > >> > >> > >> > >> >     currencyUomId           "INR",
> > >> > >> > >> > >> >     fromDate                "2018-04-16 17:39:52",
> > >> > >> > >> > >> >     price                   150,
> > >> > >> > >> > >> >     productId               "PROD_SW52D5H3EN",
> > >> > >> > >> > >> >     productPricePurposeId   "PURCHASE",
> > >> > >> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> > >> > >> > >> > >> >     productStoreGroupId     "_NA_",
> > >> > >> > >> > >> >     taxInPrice              "Y",
> > >> > >> > >> > >> >     termUomId               "WT_kg"
> > >> > >> > >> > >> > }
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > I am getting error:
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > faultString:Error running the simple-method: Entity
> > value
> > >> > not
> > >> > >> > found
> > >> > >> > >> > with
> > >> > >> > >> > >> > name: lookedUpValue Method = updateProductPrice,
> File =
> > >> > >> > >> > >> > file:/opt/ofbiz/apache-ofbiz-1
> > >> 6.11.04/applications/product/
> > >> > >> > >> > >> > minilang/product/price/PriceServices.xml,
> > >> > >> > >> > >> > Element = <set-nonpk-fields>, Line 69null
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > the minilang def is reproduced here for convinience:
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >  <simple-method method-name="updateProductPrice"
> > >> > >> > >> > >> short-description="Update
> > >> > >> > >> > >> > an ProductPrice">
> > >> > >> > >> > >> >         <set field="callingMethodName"
> > >> > >> > value="updateProductPrice"/>
> > >> > >> > >> > >> >         <set field="checkAction" value="UPDATE"/>
> > >> > >> > >> > >> >         <call-simple-method method-name="
> > >> > >> > >> > checkProductRelatedPermission"
> > >> > >> > >> > >> > xml-resource="component://product/minilang/product/
> > >> > >> > >> > >> > product/ProductServices.xml"/>
> > >> > >> > >> > >> >         <check-permission
> > permission="CATALOG_PRICE_MAIN
> > >> T">
> > >> > >> > >> > >> >             <fail-property resource="ProductUiLabels"
> > >> > >> > >> > >> > property="ProductPriceMaintPermissionError"/>
> > >> > >> > >> > >> >         </check-permission>
> > >> > >> > >> > >> >         <check-errors/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <call-simple-method method-name="
> > >> > >> > >> > inlineHandlePriceWithTaxInclud
> > >> > >> > >> > >> > ed"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <entity-one entity-name="ProductPrice"
> > >> > >> > >> > >> > value-field="lookedUpValue"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <!-- grab the old price value before setting
> > >> nonpk
> > >> > >> > >> parameter
> > >> > >> > >> > >> fields
> > >> > >> > >> > >> > -->
> > >> > >> > >> > >> >         <field-to-result field="lookedUpValue.price"
> > >> > >> > >> > >> > result-name="oldPrice"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <set-nonpk-fields map="parameters"
> > >> > >> > >> > value-field="lookedUpValue"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <now-timestamp field="nowTimestamp"/>
> > >> > >> > >> > >> >         <set field="lookedUpValue.lastModifiedDate"
> > >> > >> > >> > >> > from-field="nowTimestamp"/>
> > >> > >> > >> > >> >         <set field="lookedUpValue.lastModif
> > >> iedByUserLogin"
> > >> > >> > >> > >> > from-field="userLogin.userLoginId"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <store-value value-field="lookedUpValue"/>
> > >> > >> > >> > >> >  </simple-method>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > The productID does exists in Entity ProductPrice
> > >> > >> > >> > >> > Where am I going wrong ?
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > thanks & regds
> > >> > >> > >> > >> > Rajesh Mallah.
> > >> > >> > >> > >> >
> > >> > >> > >> > >>
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> >
> > >> > >> > >>
> > >> > >> > >
> > >> > >> > >
> > >> > >> >
> > >> > >>
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Its always not that straightforward. I tend to use webservices  as it
provides
consistent results and you do not have to "reverse engineer" . Moreover
things
should work as advertised (documented) !


On Tue, Apr 17, 2018 at 9:17 PM, Mike <mz...@gmail.com> wrote:

> Why not just write your own custom xmlrpc server (perl/python/java) that
> accepts just the P/N and new price, searches for the current record, and
> performs a SQL call to update the DB.
>
> On Tue, Apr 17, 2018 at 8:12 AM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > ERRATA: I meant "There is no parameter" in lieu of "There is parameter"
> >
> > On Tue, Apr 17, 2018 at 8:09 PM, Rajesh Mallah <ma...@gmail.com>
> > wrote:
> >
> > >
> > > Hi Rishi ,
> > >
> > > I am using XML RPC with OFBiz so my capabilities are limited to
> > > what the interface provides. There is  parameter that allows me
> > > to specify the data format/pattern .
> > >
> > > At this moment i have solved my problem temporarily by appending
> > > .001 after the second part in HH:MM:SS and i am only using
> > > createProductPrice instead of updateProductPrice . As creating new
> > > prices allows to have a history/audit of prices. I feel
> > updateProductPrice
> > > is really overwriting the values and trail is lost.
> > >
> > > regds
> > > mallah.
> > >
> > >
> > >
> > >
> > > On Tue, Apr 17, 2018 at 6:49 PM, Rishi Solanki <
> rishisolankii@gmail.com>
> > > wrote:
> > >
> > >> Idea of utility class is, use the format you would like and pass the
> > >> value.
> > >> It will convert into timestamp used in the table. In case you could
> not
> > >> get
> > >> the desired format in the utility class then the class uses the
> > >> java.text.SimpleDateFormat class to resolve its purpose.
> > >>
> > >> Please take a look at toTimestamp() method variations and format you
> are
> > >> receiving in the xml. Once you have the format with you, it can be
> > easily
> > >> converted into timestamp. Also if utility class does not support then
> go
> > >> to
> > >> core class for same i.e java.text.SimpleDateFormat and look for the
> > >> supporting format.
> > >>
> > >> HTH!
> > >>
> > >>
> > >> Rishi Solanki
> > >> Sr Manager, Enterprise Software Development
> > >> HotWax Systems Pvt. Ltd.
> > >> Direct: +91-9893287847
> > >> http://www.hotwaxsystems.com
> > >> www.hotwax.co
> > >>
> > >> On Tue, Apr 17, 2018 at 3:02 PM, Rajesh Mallah <
> mallah.rajesh@gmail.com
> > >
> > >> wrote:
> > >>
> > >> > Further Info:
> > >> >
> > >> >   <member>
> > >> >             <name>fromDate</name>
> > >> >             <value>
> > >> >               <string><![CDATA[2018-04-17 14:59:34.001
> > +0530]]></string>
> > >> >             </value>
> > >> >    </member>
> > >> >
> > >> > In XML results in
> > >> >
> > >> > from_date                   | 2018-04-17 14:59:34.001+05:30
> > >> >
> > >> > in DB. looks like the parser is kind enough to consider TZ
> > >> > spec without colons.
> > >> >
> > >> >
> > >> > regds
> > >> > mallah.
> > >> >
> > >> >
> > >> > On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <
> > mallah.rajesh@gmail.com
> > >> >
> > >> > wrote:
> > >> >
> > >> > >
> > >> > > Its PostgreSQL
> > >> > > regds
> > >> > >
> > >> > >
> > >> > >  below is a sample data :
> > >> > >
> > >> > > SQL> select * from  ofbiz.product_price  where
> > >> > > product_id='PROD_SW52D5H3EN' order by created_date desc limit 1;
> > >> > >
> > >> > > -[ RECORD 1 ]---------------+------------------------------
> > >> > > product_id                  | PROD_SW52D5H3EN
> > >> > > product_price_type_id       | DEFAULT_PRICE
> > >> > > product_price_purpose_id    | PURCHASE
> > >> > > currency_uom_id             | INR
> > >> > > product_store_group_id      | _NA_
> > >> > > from_date                   | 2018-04-17 12:49:20+05:30    <----
> > This
> > >> has
> > >> > > been put by me.
> > >> > > thru_date                   |
> > >> > > price                       | 121.000
> > >> > > term_uom_id                 | WT_kg
> > >> > > custom_price_calc_service   |
> > >> > > price_without_tax           |
> > >> > > price_with_tax              |
> > >> > > tax_amount                  |
> > >> > > tax_percentage              |
> > >> > > tax_auth_party_id           |
> > >> > > tax_auth_geo_id             |
> > >> > > tax_in_price                | Y
> > >> > > created_date                | 2018-04-17 12:49:20.416+05:30
> > >> > > created_by_user_login       | admin
> > >> > > last_modified_date          | 2018-04-17 12:49:20.416+05:30
> > >> > > last_modified_by_user_login | admin
> > >> > > last_updated_stamp          | 2018-04-17 12:49:20.416+05:30  <----
> > >> > > Generated by defaults.
> > >> > > last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
> > >> > > created_stamp               | 2018-04-17 12:49:20.416+05:30
> > >> > > created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
> > >> > >
> > >> > >
> > >> > > On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit
> > >> > <deepak.dixit@hotwaxsystems.
> > >> > > com> wrote:
> > >> > >
> > >> > >> Hi Rajesh,
> > >> > >>
> > >> > >> Could you please share which database you are using?
> > >> > >>
> > >> > >>
> > >> > >> Thanks & Regards
> > >> > >> --
> > >> > >> Deepak Dixit
> > >> > >> www.hotwax.co
> > >> > >>
> > >> > >> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <
> > >> mallah.rajesh@gmail.com
> > >> > >
> > >> > >> wrote:
> > >> > >>
> > >> > >> >  Hi ,
> > >> > >> >
> > >> > >> >
> > >> > >> > it was in conversion/DateTimeConverters.java that was
> appending
> > >> '.0'
> > >> > to
> > >> > >> > the
> > >> > >> > end of
> > >> > >> > string if the string did not contain any  decimals. So i have
> now
> > >> > >> started
> > >> > >> > sending
> > >> > >> > the fractional seconds. And things are better (if not perfect).
> > >> > >> >
> > >> > >> >
> > >> > >> >
> > >> > >> > public java.sql.Timestamp convert(String obj, Locale locale,
> > >> TimeZone
> > >> > >> > timeZone, String formatString) throws ConversionException {
> > >> > >> >             String str = obj.trim();
> > >> > >> >             if (str.length() == 0) {
> > >> > >> >                 return null;
> > >> > >> >             }
> > >> > >> >             DateFormat df = null;
> > >> > >> >             if (UtilValidate.isEmpty(formatString)) {
> > >> > >> >                 // These hacks are a bad idea, but they are
> > >> included
> > >> > >> >                 // for backward compatibility.
> > >> > >> >                 if (str.length() > 0 && !str.contains(":")) {
> > >> > >> >                     str = str + " 00:00:00.00";
> > >> > >> >                 }
> > >> > >> >                 // hack to mimic Timestamp.valueOf() method
> > >> > >> >                 if (str.length() > 0 && !str.contains(".")) {
> > >> > >> >                     str = str + ".0";
> > >> > >> >                 } else {
> > >> > >> >                     // DateFormat has a funny way of parsing
> > >> > >> milliseconds:
> > >> > >> >                     // 00:00:00.2 parses to 00:00:00.002
> > >> > >> >                     // so we'll add zeros to the end to get
> > >> > 00:00:00.200
> > >> > >> >                     String[] timeSplit = str.split("[.]");
> > >> > >> >                     if (timeSplit.length > 1 &&
> > >> timeSplit[1].length()
> > >> > <
> > >> > >> 3)
> > >> > >> > {
> > >> > >> >                         str = str +
> "000".substring(timeSplit[1].
> > >> > >> > length());
> > >> > >> >                     }
> > >> > >> >                 }
> > >> > >> >                 df =
> > >> > >> > UtilDateTime.toDateTimeFormat(UtilDateTime.
> getDateTimeFormat(),
> > >> > >> timeZone,
> > >> > >> > locale);
> > >> > >> >             } else {
> > >> > >> >                 df = UtilDateTime.toDateTimeFormat(
> formatString,
> > >> > >> timeZone,
> > >> > >> > locale);
> > >> > >> >             }
> > >> > >> >             try {
> > >> > >> >                 return new java.sql.Timestamp(df.parse(
> > >> > str).getTime());
> > >> > >> >             } catch (ParseException e) {
> > >> > >> >
> > >> > >> >
> > >> > >> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <
> > >> > mallah.rajesh@gmail.com
> > >> > >> >
> > >> > >> > wrote:
> > >> > >> >
> > >> > >> > > Thanks Rishi.
> > >> > >> > >
> > >> > >> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
> > >> > >> rishisolankii@gmail.com>
> > >> > >> > > wrote:
> > >> > >> > >
> > >> > >> > >> UtilDateTime is the utility class, add the time format
> support
> > >> you
> > >> > >> want
> > >> > >> > >> and
> > >> > >> > >> use it. Most format supported by this utility class OFBiz
> > have.
> > >> > >> > >>
> > >> > >> > >> Rishi Solanki
> > >> > >> > >> Sr Manager, Enterprise Software Development
> > >> > >> > >> HotWax Systems Pvt. Ltd.
> > >> > >> > >> Direct: +91-9893287847
> > >> > >> > >> http://www.hotwaxsystems.com
> > >> > >> > >> www.hotwax.co
> > >> > >> > >>
> > >> > >> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> > >> > >> > mallah.rajesh@gmail.com>
> > >> > >> > >> wrote:
> > >> > >> > >>
> > >> > >> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate
> ,
> > >> > >> > >> > Which is the value picked up from the DB column.
> > >> > >> > >> >
> > >> > >> > >> > Even at XML level the string is preserved , but at some
> > stage
> > >> > after
> > >> > >> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> > >> > >> > >> >
> > >> > >> > >> > which is not parseable.
> > >> > >> > >> >
> > >> > >> > >> >  |W| [ModelService.makeValid] : Type conversion of field
> > >> > >> [fromDate] to
> > >> > >> > >> type
> > >> > >> > >> > [java.sql.Timestamp] failed f
> > >> > >> > >> > or value "2018-04-17 12:09:17+05:30":
> > >> > >> > >> > org.apache.ofbiz.base.util.GeneralException:
> > >> > >> > java.text.ParseException:
> > >> > >> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> > >> > >> > (java.text.ParseExceptio
> > >> > >> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > <!--- snippet from the XML-RPC -->
> > >> > >> > >> >
> > >> > >> > >> >           <member>
> > >> > >> > >> >             <name>fromDate</name>
> > >> > >> > >> >             <value>
> > >> > >> > >> >               <string><![CDATA[2018-04-17
> > >> > >> 12:09:17+05:30]]></string>
> > >> > >> > >> >             </value>
> > >> > >> > >> >           </member>
> > >> > >> > >> >
> > >> > >> > >> > <!-- end of snippet -->
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > regds
> > >> > >> > >> > mallah.
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> > >> > >> > >> mallah.rajesh@gmail.com>
> > >> > >> > >> > wrote:
> > >> > >> > >> >
> > >> > >> > >> > > Hello Mr Deepak ,
> > >> > >> > >> > >
> > >> > >> > >> > > Thanks for the response . The record does exists but i
> > guess
> > >> > >> > >> > > i am not specifying the params good enough to hit the
> > record
> > >> > >> > >> > > by pkey.
> > >> > >> > >> > >
> > >> > >> > >> > > I wish there were a "product_price_id" in ProductPrice
> > >> entity.
> > >> > >> :-)
> > >> > >> > >> > >
> > >> > >> > >> > > regds
> > >> > >> > >> > > mallah.
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> > >> > >> > deepak.dixit@hotwax.co
> > >> > >> > >> >
> > >> > >> > >> > > wrote:
> > >> > >> > >> > >
> > >> > >> > >> > >> Hi Rajesh,
> > >> > >> > >> > >>
> > >> > >> > >> > >> If you want to create product price you should use
> > >> > >> > createProductPrice
> > >> > >> > >> > >> service,
> > >> > >> > >> > >> https://demo-stable.ofbiz.apac
> > >> he.org/webtools/control/Servic
> > >> > >> > >> > >> eList?sel_service_name=createProductPrice
> > >> > >> > >> > >>
> > >> > >> > >> > >> If productPrice record already exists you should use
> > >> > >> > >> updateProductPrice,
> > >> > >> > >> > >>
> > >> > >> > >> > >> Thanks & Regards
> > >> > >> > >> > >> --
> > >> > >> > >> > >> Deepak Dixit
> > >> > >> > >> > >> Director of Product Engineering
> > >> > >> > >> > >> HotWax Commerce <https://hotwax.co/>
> > >> > >> > >> > >>
> > >> > >> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> > >> > >> > >> > mallah.rajesh@gmail.com>
> > >> > >> > >> > >> wrote:
> > >> > >> > >> > >>
> > >> > >> > >> > >> > Hi ,
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > I am calling
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > https://demo-stable.ofbiz.
> apache.org/webtools/control/
> > >> > >> > >> > >> > ServiceList?sel_service_name=updateProductPrice
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > with ARGS
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > {
> > >> > >> > >> > >> >     currencyUomId           "INR",
> > >> > >> > >> > >> >     fromDate                "2018-04-16 17:39:52",
> > >> > >> > >> > >> >     price                   150,
> > >> > >> > >> > >> >     productId               "PROD_SW52D5H3EN",
> > >> > >> > >> > >> >     productPricePurposeId   "PURCHASE",
> > >> > >> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> > >> > >> > >> > >> >     productStoreGroupId     "_NA_",
> > >> > >> > >> > >> >     taxInPrice              "Y",
> > >> > >> > >> > >> >     termUomId               "WT_kg"
> > >> > >> > >> > >> > }
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > I am getting error:
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > faultString:Error running the simple-method: Entity
> > value
> > >> > not
> > >> > >> > found
> > >> > >> > >> > with
> > >> > >> > >> > >> > name: lookedUpValue Method = updateProductPrice,
> File =
> > >> > >> > >> > >> > file:/opt/ofbiz/apache-ofbiz-1
> > >> 6.11.04/applications/product/
> > >> > >> > >> > >> > minilang/product/price/PriceServices.xml,
> > >> > >> > >> > >> > Element = <set-nonpk-fields>, Line 69null
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > the minilang def is reproduced here for convinience:
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >  <simple-method method-name="updateProductPrice"
> > >> > >> > >> > >> short-description="Update
> > >> > >> > >> > >> > an ProductPrice">
> > >> > >> > >> > >> >         <set field="callingMethodName"
> > >> > >> > value="updateProductPrice"/>
> > >> > >> > >> > >> >         <set field="checkAction" value="UPDATE"/>
> > >> > >> > >> > >> >         <call-simple-method method-name="
> > >> > >> > >> > checkProductRelatedPermission"
> > >> > >> > >> > >> > xml-resource="component://product/minilang/product/
> > >> > >> > >> > >> > product/ProductServices.xml"/>
> > >> > >> > >> > >> >         <check-permission
> > permission="CATALOG_PRICE_MAIN
> > >> T">
> > >> > >> > >> > >> >             <fail-property resource="ProductUiLabels"
> > >> > >> > >> > >> > property="ProductPriceMaintPermissionError"/>
> > >> > >> > >> > >> >         </check-permission>
> > >> > >> > >> > >> >         <check-errors/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <call-simple-method method-name="
> > >> > >> > >> > inlineHandlePriceWithTaxInclud
> > >> > >> > >> > >> > ed"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <entity-one entity-name="ProductPrice"
> > >> > >> > >> > >> > value-field="lookedUpValue"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <!-- grab the old price value before setting
> > >> nonpk
> > >> > >> > >> parameter
> > >> > >> > >> > >> fields
> > >> > >> > >> > >> > -->
> > >> > >> > >> > >> >         <field-to-result field="lookedUpValue.price"
> > >> > >> > >> > >> > result-name="oldPrice"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <set-nonpk-fields map="parameters"
> > >> > >> > >> > value-field="lookedUpValue"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <now-timestamp field="nowTimestamp"/>
> > >> > >> > >> > >> >         <set field="lookedUpValue.lastModifiedDate"
> > >> > >> > >> > >> > from-field="nowTimestamp"/>
> > >> > >> > >> > >> >         <set field="lookedUpValue.lastModif
> > >> iedByUserLogin"
> > >> > >> > >> > >> > from-field="userLogin.userLoginId"/>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> >         <store-value value-field="lookedUpValue"/>
> > >> > >> > >> > >> >  </simple-method>
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > The productID does exists in Entity ProductPrice
> > >> > >> > >> > >> > Where am I going wrong ?
> > >> > >> > >> > >> >
> > >> > >> > >> > >> > thanks & regds
> > >> > >> > >> > >> > Rajesh Mallah.
> > >> > >> > >> > >> >
> > >> > >> > >> > >>
> > >> > >> > >> > >
> > >> > >> > >> > >
> > >> > >> > >> >
> > >> > >> > >>
> > >> > >> > >
> > >> > >> > >
> > >> > >> >
> > >> > >>
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: help with updateProductPrice

Posted by Mike <mz...@gmail.com>.
Why not just write your own custom xmlrpc server (perl/python/java) that
accepts just the P/N and new price, searches for the current record, and
performs a SQL call to update the DB.

On Tue, Apr 17, 2018 at 8:12 AM, Rajesh Mallah <ma...@gmail.com>
wrote:

> ERRATA: I meant "There is no parameter" in lieu of "There is parameter"
>
> On Tue, Apr 17, 2018 at 8:09 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> >
> > Hi Rishi ,
> >
> > I am using XML RPC with OFBiz so my capabilities are limited to
> > what the interface provides. There is  parameter that allows me
> > to specify the data format/pattern .
> >
> > At this moment i have solved my problem temporarily by appending
> > .001 after the second part in HH:MM:SS and i am only using
> > createProductPrice instead of updateProductPrice . As creating new
> > prices allows to have a history/audit of prices. I feel
> updateProductPrice
> > is really overwriting the values and trail is lost.
> >
> > regds
> > mallah.
> >
> >
> >
> >
> > On Tue, Apr 17, 2018 at 6:49 PM, Rishi Solanki <ri...@gmail.com>
> > wrote:
> >
> >> Idea of utility class is, use the format you would like and pass the
> >> value.
> >> It will convert into timestamp used in the table. In case you could not
> >> get
> >> the desired format in the utility class then the class uses the
> >> java.text.SimpleDateFormat class to resolve its purpose.
> >>
> >> Please take a look at toTimestamp() method variations and format you are
> >> receiving in the xml. Once you have the format with you, it can be
> easily
> >> converted into timestamp. Also if utility class does not support then go
> >> to
> >> core class for same i.e java.text.SimpleDateFormat and look for the
> >> supporting format.
> >>
> >> HTH!
> >>
> >>
> >> Rishi Solanki
> >> Sr Manager, Enterprise Software Development
> >> HotWax Systems Pvt. Ltd.
> >> Direct: +91-9893287847
> >> http://www.hotwaxsystems.com
> >> www.hotwax.co
> >>
> >> On Tue, Apr 17, 2018 at 3:02 PM, Rajesh Mallah <mallah.rajesh@gmail.com
> >
> >> wrote:
> >>
> >> > Further Info:
> >> >
> >> >   <member>
> >> >             <name>fromDate</name>
> >> >             <value>
> >> >               <string><![CDATA[2018-04-17 14:59:34.001
> +0530]]></string>
> >> >             </value>
> >> >    </member>
> >> >
> >> > In XML results in
> >> >
> >> > from_date                   | 2018-04-17 14:59:34.001+05:30
> >> >
> >> > in DB. looks like the parser is kind enough to consider TZ
> >> > spec without colons.
> >> >
> >> >
> >> > regds
> >> > mallah.
> >> >
> >> >
> >> > On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <
> mallah.rajesh@gmail.com
> >> >
> >> > wrote:
> >> >
> >> > >
> >> > > Its PostgreSQL
> >> > > regds
> >> > >
> >> > >
> >> > >  below is a sample data :
> >> > >
> >> > > SQL> select * from  ofbiz.product_price  where
> >> > > product_id='PROD_SW52D5H3EN' order by created_date desc limit 1;
> >> > >
> >> > > -[ RECORD 1 ]---------------+------------------------------
> >> > > product_id                  | PROD_SW52D5H3EN
> >> > > product_price_type_id       | DEFAULT_PRICE
> >> > > product_price_purpose_id    | PURCHASE
> >> > > currency_uom_id             | INR
> >> > > product_store_group_id      | _NA_
> >> > > from_date                   | 2018-04-17 12:49:20+05:30    <----
> This
> >> has
> >> > > been put by me.
> >> > > thru_date                   |
> >> > > price                       | 121.000
> >> > > term_uom_id                 | WT_kg
> >> > > custom_price_calc_service   |
> >> > > price_without_tax           |
> >> > > price_with_tax              |
> >> > > tax_amount                  |
> >> > > tax_percentage              |
> >> > > tax_auth_party_id           |
> >> > > tax_auth_geo_id             |
> >> > > tax_in_price                | Y
> >> > > created_date                | 2018-04-17 12:49:20.416+05:30
> >> > > created_by_user_login       | admin
> >> > > last_modified_date          | 2018-04-17 12:49:20.416+05:30
> >> > > last_modified_by_user_login | admin
> >> > > last_updated_stamp          | 2018-04-17 12:49:20.416+05:30  <----
> >> > > Generated by defaults.
> >> > > last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
> >> > > created_stamp               | 2018-04-17 12:49:20.416+05:30
> >> > > created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
> >> > >
> >> > >
> >> > > On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit
> >> > <deepak.dixit@hotwaxsystems.
> >> > > com> wrote:
> >> > >
> >> > >> Hi Rajesh,
> >> > >>
> >> > >> Could you please share which database you are using?
> >> > >>
> >> > >>
> >> > >> Thanks & Regards
> >> > >> --
> >> > >> Deepak Dixit
> >> > >> www.hotwax.co
> >> > >>
> >> > >> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <
> >> mallah.rajesh@gmail.com
> >> > >
> >> > >> wrote:
> >> > >>
> >> > >> >  Hi ,
> >> > >> >
> >> > >> >
> >> > >> > it was in conversion/DateTimeConverters.java that was appending
> >> '.0'
> >> > to
> >> > >> > the
> >> > >> > end of
> >> > >> > string if the string did not contain any  decimals. So i have now
> >> > >> started
> >> > >> > sending
> >> > >> > the fractional seconds. And things are better (if not perfect).
> >> > >> >
> >> > >> >
> >> > >> >
> >> > >> > public java.sql.Timestamp convert(String obj, Locale locale,
> >> TimeZone
> >> > >> > timeZone, String formatString) throws ConversionException {
> >> > >> >             String str = obj.trim();
> >> > >> >             if (str.length() == 0) {
> >> > >> >                 return null;
> >> > >> >             }
> >> > >> >             DateFormat df = null;
> >> > >> >             if (UtilValidate.isEmpty(formatString)) {
> >> > >> >                 // These hacks are a bad idea, but they are
> >> included
> >> > >> >                 // for backward compatibility.
> >> > >> >                 if (str.length() > 0 && !str.contains(":")) {
> >> > >> >                     str = str + " 00:00:00.00";
> >> > >> >                 }
> >> > >> >                 // hack to mimic Timestamp.valueOf() method
> >> > >> >                 if (str.length() > 0 && !str.contains(".")) {
> >> > >> >                     str = str + ".0";
> >> > >> >                 } else {
> >> > >> >                     // DateFormat has a funny way of parsing
> >> > >> milliseconds:
> >> > >> >                     // 00:00:00.2 parses to 00:00:00.002
> >> > >> >                     // so we'll add zeros to the end to get
> >> > 00:00:00.200
> >> > >> >                     String[] timeSplit = str.split("[.]");
> >> > >> >                     if (timeSplit.length > 1 &&
> >> timeSplit[1].length()
> >> > <
> >> > >> 3)
> >> > >> > {
> >> > >> >                         str = str + "000".substring(timeSplit[1].
> >> > >> > length());
> >> > >> >                     }
> >> > >> >                 }
> >> > >> >                 df =
> >> > >> > UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(),
> >> > >> timeZone,
> >> > >> > locale);
> >> > >> >             } else {
> >> > >> >                 df = UtilDateTime.toDateTimeFormat(formatString,
> >> > >> timeZone,
> >> > >> > locale);
> >> > >> >             }
> >> > >> >             try {
> >> > >> >                 return new java.sql.Timestamp(df.parse(
> >> > str).getTime());
> >> > >> >             } catch (ParseException e) {
> >> > >> >
> >> > >> >
> >> > >> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <
> >> > mallah.rajesh@gmail.com
> >> > >> >
> >> > >> > wrote:
> >> > >> >
> >> > >> > > Thanks Rishi.
> >> > >> > >
> >> > >> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
> >> > >> rishisolankii@gmail.com>
> >> > >> > > wrote:
> >> > >> > >
> >> > >> > >> UtilDateTime is the utility class, add the time format support
> >> you
> >> > >> want
> >> > >> > >> and
> >> > >> > >> use it. Most format supported by this utility class OFBiz
> have.
> >> > >> > >>
> >> > >> > >> Rishi Solanki
> >> > >> > >> Sr Manager, Enterprise Software Development
> >> > >> > >> HotWax Systems Pvt. Ltd.
> >> > >> > >> Direct: +91-9893287847
> >> > >> > >> http://www.hotwaxsystems.com
> >> > >> > >> www.hotwax.co
> >> > >> > >>
> >> > >> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> >> > >> > mallah.rajesh@gmail.com>
> >> > >> > >> wrote:
> >> > >> > >>
> >> > >> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
> >> > >> > >> > Which is the value picked up from the DB column.
> >> > >> > >> >
> >> > >> > >> > Even at XML level the string is preserved , but at some
> stage
> >> > after
> >> > >> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> >> > >> > >> >
> >> > >> > >> > which is not parseable.
> >> > >> > >> >
> >> > >> > >> >  |W| [ModelService.makeValid] : Type conversion of field
> >> > >> [fromDate] to
> >> > >> > >> type
> >> > >> > >> > [java.sql.Timestamp] failed f
> >> > >> > >> > or value "2018-04-17 12:09:17+05:30":
> >> > >> > >> > org.apache.ofbiz.base.util.GeneralException:
> >> > >> > java.text.ParseException:
> >> > >> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> >> > >> > (java.text.ParseExceptio
> >> > >> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> > <!--- snippet from the XML-RPC -->
> >> > >> > >> >
> >> > >> > >> >           <member>
> >> > >> > >> >             <name>fromDate</name>
> >> > >> > >> >             <value>
> >> > >> > >> >               <string><![CDATA[2018-04-17
> >> > >> 12:09:17+05:30]]></string>
> >> > >> > >> >             </value>
> >> > >> > >> >           </member>
> >> > >> > >> >
> >> > >> > >> > <!-- end of snippet -->
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> > regds
> >> > >> > >> > mallah.
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> >> > >> > >> mallah.rajesh@gmail.com>
> >> > >> > >> > wrote:
> >> > >> > >> >
> >> > >> > >> > > Hello Mr Deepak ,
> >> > >> > >> > >
> >> > >> > >> > > Thanks for the response . The record does exists but i
> guess
> >> > >> > >> > > i am not specifying the params good enough to hit the
> record
> >> > >> > >> > > by pkey.
> >> > >> > >> > >
> >> > >> > >> > > I wish there were a "product_price_id" in ProductPrice
> >> entity.
> >> > >> :-)
> >> > >> > >> > >
> >> > >> > >> > > regds
> >> > >> > >> > > mallah.
> >> > >> > >> > >
> >> > >> > >> > >
> >> > >> > >> > >
> >> > >> > >> > >
> >> > >> > >> > >
> >> > >> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> >> > >> > deepak.dixit@hotwax.co
> >> > >> > >> >
> >> > >> > >> > > wrote:
> >> > >> > >> > >
> >> > >> > >> > >> Hi Rajesh,
> >> > >> > >> > >>
> >> > >> > >> > >> If you want to create product price you should use
> >> > >> > createProductPrice
> >> > >> > >> > >> service,
> >> > >> > >> > >> https://demo-stable.ofbiz.apac
> >> he.org/webtools/control/Servic
> >> > >> > >> > >> eList?sel_service_name=createProductPrice
> >> > >> > >> > >>
> >> > >> > >> > >> If productPrice record already exists you should use
> >> > >> > >> updateProductPrice,
> >> > >> > >> > >>
> >> > >> > >> > >> Thanks & Regards
> >> > >> > >> > >> --
> >> > >> > >> > >> Deepak Dixit
> >> > >> > >> > >> Director of Product Engineering
> >> > >> > >> > >> HotWax Commerce <https://hotwax.co/>
> >> > >> > >> > >>
> >> > >> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> >> > >> > >> > mallah.rajesh@gmail.com>
> >> > >> > >> > >> wrote:
> >> > >> > >> > >>
> >> > >> > >> > >> > Hi ,
> >> > >> > >> > >> >
> >> > >> > >> > >> > I am calling
> >> > >> > >> > >> >
> >> > >> > >> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
> >> > >> > >> > >> > ServiceList?sel_service_name=updateProductPrice
> >> > >> > >> > >> >
> >> > >> > >> > >> > with ARGS
> >> > >> > >> > >> >
> >> > >> > >> > >> > {
> >> > >> > >> > >> >     currencyUomId           "INR",
> >> > >> > >> > >> >     fromDate                "2018-04-16 17:39:52",
> >> > >> > >> > >> >     price                   150,
> >> > >> > >> > >> >     productId               "PROD_SW52D5H3EN",
> >> > >> > >> > >> >     productPricePurposeId   "PURCHASE",
> >> > >> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> >> > >> > >> > >> >     productStoreGroupId     "_NA_",
> >> > >> > >> > >> >     taxInPrice              "Y",
> >> > >> > >> > >> >     termUomId               "WT_kg"
> >> > >> > >> > >> > }
> >> > >> > >> > >> >
> >> > >> > >> > >> >
> >> > >> > >> > >> > I am getting error:
> >> > >> > >> > >> >
> >> > >> > >> > >> >
> >> > >> > >> > >> > faultString:Error running the simple-method: Entity
> value
> >> > not
> >> > >> > found
> >> > >> > >> > with
> >> > >> > >> > >> > name: lookedUpValue Method = updateProductPrice, File =
> >> > >> > >> > >> > file:/opt/ofbiz/apache-ofbiz-1
> >> 6.11.04/applications/product/
> >> > >> > >> > >> > minilang/product/price/PriceServices.xml,
> >> > >> > >> > >> > Element = <set-nonpk-fields>, Line 69null
> >> > >> > >> > >> >
> >> > >> > >> > >> >
> >> > >> > >> > >> > the minilang def is reproduced here for convinience:
> >> > >> > >> > >> >
> >> > >> > >> > >> >  <simple-method method-name="updateProductPrice"
> >> > >> > >> > >> short-description="Update
> >> > >> > >> > >> > an ProductPrice">
> >> > >> > >> > >> >         <set field="callingMethodName"
> >> > >> > value="updateProductPrice"/>
> >> > >> > >> > >> >         <set field="checkAction" value="UPDATE"/>
> >> > >> > >> > >> >         <call-simple-method method-name="
> >> > >> > >> > checkProductRelatedPermission"
> >> > >> > >> > >> > xml-resource="component://product/minilang/product/
> >> > >> > >> > >> > product/ProductServices.xml"/>
> >> > >> > >> > >> >         <check-permission
> permission="CATALOG_PRICE_MAIN
> >> T">
> >> > >> > >> > >> >             <fail-property resource="ProductUiLabels"
> >> > >> > >> > >> > property="ProductPriceMaintPermissionError"/>
> >> > >> > >> > >> >         </check-permission>
> >> > >> > >> > >> >         <check-errors/>
> >> > >> > >> > >> >
> >> > >> > >> > >> >         <call-simple-method method-name="
> >> > >> > >> > inlineHandlePriceWithTaxInclud
> >> > >> > >> > >> > ed"/>
> >> > >> > >> > >> >
> >> > >> > >> > >> >         <entity-one entity-name="ProductPrice"
> >> > >> > >> > >> > value-field="lookedUpValue"/>
> >> > >> > >> > >> >
> >> > >> > >> > >> >         <!-- grab the old price value before setting
> >> nonpk
> >> > >> > >> parameter
> >> > >> > >> > >> fields
> >> > >> > >> > >> > -->
> >> > >> > >> > >> >         <field-to-result field="lookedUpValue.price"
> >> > >> > >> > >> > result-name="oldPrice"/>
> >> > >> > >> > >> >
> >> > >> > >> > >> >         <set-nonpk-fields map="parameters"
> >> > >> > >> > value-field="lookedUpValue"/>
> >> > >> > >> > >> >
> >> > >> > >> > >> >         <now-timestamp field="nowTimestamp"/>
> >> > >> > >> > >> >         <set field="lookedUpValue.lastModifiedDate"
> >> > >> > >> > >> > from-field="nowTimestamp"/>
> >> > >> > >> > >> >         <set field="lookedUpValue.lastModif
> >> iedByUserLogin"
> >> > >> > >> > >> > from-field="userLogin.userLoginId"/>
> >> > >> > >> > >> >
> >> > >> > >> > >> >         <store-value value-field="lookedUpValue"/>
> >> > >> > >> > >> >  </simple-method>
> >> > >> > >> > >> >
> >> > >> > >> > >> > The productID does exists in Entity ProductPrice
> >> > >> > >> > >> > Where am I going wrong ?
> >> > >> > >> > >> >
> >> > >> > >> > >> > thanks & regds
> >> > >> > >> > >> > Rajesh Mallah.
> >> > >> > >> > >> >
> >> > >> > >> > >>
> >> > >> > >> > >
> >> > >> > >> > >
> >> > >> > >> >
> >> > >> > >>
> >> > >> > >
> >> > >> > >
> >> > >> >
> >> > >>
> >> > >
> >> > >
> >> >
> >>
> >
> >
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
ERRATA: I meant "There is no parameter" in lieu of "There is parameter"

On Tue, Apr 17, 2018 at 8:09 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

>
> Hi Rishi ,
>
> I am using XML RPC with OFBiz so my capabilities are limited to
> what the interface provides. There is  parameter that allows me
> to specify the data format/pattern .
>
> At this moment i have solved my problem temporarily by appending
> .001 after the second part in HH:MM:SS and i am only using
> createProductPrice instead of updateProductPrice . As creating new
> prices allows to have a history/audit of prices. I feel updateProductPrice
> is really overwriting the values and trail is lost.
>
> regds
> mallah.
>
>
>
>
> On Tue, Apr 17, 2018 at 6:49 PM, Rishi Solanki <ri...@gmail.com>
> wrote:
>
>> Idea of utility class is, use the format you would like and pass the
>> value.
>> It will convert into timestamp used in the table. In case you could not
>> get
>> the desired format in the utility class then the class uses the
>> java.text.SimpleDateFormat class to resolve its purpose.
>>
>> Please take a look at toTimestamp() method variations and format you are
>> receiving in the xml. Once you have the format with you, it can be easily
>> converted into timestamp. Also if utility class does not support then go
>> to
>> core class for same i.e java.text.SimpleDateFormat and look for the
>> supporting format.
>>
>> HTH!
>>
>>
>> Rishi Solanki
>> Sr Manager, Enterprise Software Development
>> HotWax Systems Pvt. Ltd.
>> Direct: +91-9893287847
>> http://www.hotwaxsystems.com
>> www.hotwax.co
>>
>> On Tue, Apr 17, 2018 at 3:02 PM, Rajesh Mallah <ma...@gmail.com>
>> wrote:
>>
>> > Further Info:
>> >
>> >   <member>
>> >             <name>fromDate</name>
>> >             <value>
>> >               <string><![CDATA[2018-04-17 14:59:34.001 +0530]]></string>
>> >             </value>
>> >    </member>
>> >
>> > In XML results in
>> >
>> > from_date                   | 2018-04-17 14:59:34.001+05:30
>> >
>> > in DB. looks like the parser is kind enough to consider TZ
>> > spec without colons.
>> >
>> >
>> > regds
>> > mallah.
>> >
>> >
>> > On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <mallah.rajesh@gmail.com
>> >
>> > wrote:
>> >
>> > >
>> > > Its PostgreSQL
>> > > regds
>> > >
>> > >
>> > >  below is a sample data :
>> > >
>> > > SQL> select * from  ofbiz.product_price  where
>> > > product_id='PROD_SW52D5H3EN' order by created_date desc limit 1;
>> > >
>> > > -[ RECORD 1 ]---------------+------------------------------
>> > > product_id                  | PROD_SW52D5H3EN
>> > > product_price_type_id       | DEFAULT_PRICE
>> > > product_price_purpose_id    | PURCHASE
>> > > currency_uom_id             | INR
>> > > product_store_group_id      | _NA_
>> > > from_date                   | 2018-04-17 12:49:20+05:30    <---- This
>> has
>> > > been put by me.
>> > > thru_date                   |
>> > > price                       | 121.000
>> > > term_uom_id                 | WT_kg
>> > > custom_price_calc_service   |
>> > > price_without_tax           |
>> > > price_with_tax              |
>> > > tax_amount                  |
>> > > tax_percentage              |
>> > > tax_auth_party_id           |
>> > > tax_auth_geo_id             |
>> > > tax_in_price                | Y
>> > > created_date                | 2018-04-17 12:49:20.416+05:30
>> > > created_by_user_login       | admin
>> > > last_modified_date          | 2018-04-17 12:49:20.416+05:30
>> > > last_modified_by_user_login | admin
>> > > last_updated_stamp          | 2018-04-17 12:49:20.416+05:30  <----
>> > > Generated by defaults.
>> > > last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
>> > > created_stamp               | 2018-04-17 12:49:20.416+05:30
>> > > created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
>> > >
>> > >
>> > > On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit
>> > <deepak.dixit@hotwaxsystems.
>> > > com> wrote:
>> > >
>> > >> Hi Rajesh,
>> > >>
>> > >> Could you please share which database you are using?
>> > >>
>> > >>
>> > >> Thanks & Regards
>> > >> --
>> > >> Deepak Dixit
>> > >> www.hotwax.co
>> > >>
>> > >> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <
>> mallah.rajesh@gmail.com
>> > >
>> > >> wrote:
>> > >>
>> > >> >  Hi ,
>> > >> >
>> > >> >
>> > >> > it was in conversion/DateTimeConverters.java that was appending
>> '.0'
>> > to
>> > >> > the
>> > >> > end of
>> > >> > string if the string did not contain any  decimals. So i have now
>> > >> started
>> > >> > sending
>> > >> > the fractional seconds. And things are better (if not perfect).
>> > >> >
>> > >> >
>> > >> >
>> > >> > public java.sql.Timestamp convert(String obj, Locale locale,
>> TimeZone
>> > >> > timeZone, String formatString) throws ConversionException {
>> > >> >             String str = obj.trim();
>> > >> >             if (str.length() == 0) {
>> > >> >                 return null;
>> > >> >             }
>> > >> >             DateFormat df = null;
>> > >> >             if (UtilValidate.isEmpty(formatString)) {
>> > >> >                 // These hacks are a bad idea, but they are
>> included
>> > >> >                 // for backward compatibility.
>> > >> >                 if (str.length() > 0 && !str.contains(":")) {
>> > >> >                     str = str + " 00:00:00.00";
>> > >> >                 }
>> > >> >                 // hack to mimic Timestamp.valueOf() method
>> > >> >                 if (str.length() > 0 && !str.contains(".")) {
>> > >> >                     str = str + ".0";
>> > >> >                 } else {
>> > >> >                     // DateFormat has a funny way of parsing
>> > >> milliseconds:
>> > >> >                     // 00:00:00.2 parses to 00:00:00.002
>> > >> >                     // so we'll add zeros to the end to get
>> > 00:00:00.200
>> > >> >                     String[] timeSplit = str.split("[.]");
>> > >> >                     if (timeSplit.length > 1 &&
>> timeSplit[1].length()
>> > <
>> > >> 3)
>> > >> > {
>> > >> >                         str = str + "000".substring(timeSplit[1].
>> > >> > length());
>> > >> >                     }
>> > >> >                 }
>> > >> >                 df =
>> > >> > UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(),
>> > >> timeZone,
>> > >> > locale);
>> > >> >             } else {
>> > >> >                 df = UtilDateTime.toDateTimeFormat(formatString,
>> > >> timeZone,
>> > >> > locale);
>> > >> >             }
>> > >> >             try {
>> > >> >                 return new java.sql.Timestamp(df.parse(
>> > str).getTime());
>> > >> >             } catch (ParseException e) {
>> > >> >
>> > >> >
>> > >> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <
>> > mallah.rajesh@gmail.com
>> > >> >
>> > >> > wrote:
>> > >> >
>> > >> > > Thanks Rishi.
>> > >> > >
>> > >> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
>> > >> rishisolankii@gmail.com>
>> > >> > > wrote:
>> > >> > >
>> > >> > >> UtilDateTime is the utility class, add the time format support
>> you
>> > >> want
>> > >> > >> and
>> > >> > >> use it. Most format supported by this utility class OFBiz have.
>> > >> > >>
>> > >> > >> Rishi Solanki
>> > >> > >> Sr Manager, Enterprise Software Development
>> > >> > >> HotWax Systems Pvt. Ltd.
>> > >> > >> Direct: +91-9893287847
>> > >> > >> http://www.hotwaxsystems.com
>> > >> > >> www.hotwax.co
>> > >> > >>
>> > >> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
>> > >> > mallah.rajesh@gmail.com>
>> > >> > >> wrote:
>> > >> > >>
>> > >> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
>> > >> > >> > Which is the value picked up from the DB column.
>> > >> > >> >
>> > >> > >> > Even at XML level the string is preserved , but at some stage
>> > after
>> > >> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
>> > >> > >> >
>> > >> > >> > which is not parseable.
>> > >> > >> >
>> > >> > >> >  |W| [ModelService.makeValid] : Type conversion of field
>> > >> [fromDate] to
>> > >> > >> type
>> > >> > >> > [java.sql.Timestamp] failed f
>> > >> > >> > or value "2018-04-17 12:09:17+05:30":
>> > >> > >> > org.apache.ofbiz.base.util.GeneralException:
>> > >> > java.text.ParseException:
>> > >> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
>> > >> > (java.text.ParseExceptio
>> > >> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
>> > >> > >> >
>> > >> > >> >
>> > >> > >> > <!--- snippet from the XML-RPC -->
>> > >> > >> >
>> > >> > >> >           <member>
>> > >> > >> >             <name>fromDate</name>
>> > >> > >> >             <value>
>> > >> > >> >               <string><![CDATA[2018-04-17
>> > >> 12:09:17+05:30]]></string>
>> > >> > >> >             </value>
>> > >> > >> >           </member>
>> > >> > >> >
>> > >> > >> > <!-- end of snippet -->
>> > >> > >> >
>> > >> > >> >
>> > >> > >> >
>> > >> > >> >
>> > >> > >> > regds
>> > >> > >> > mallah.
>> > >> > >> >
>> > >> > >> >
>> > >> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
>> > >> > >> mallah.rajesh@gmail.com>
>> > >> > >> > wrote:
>> > >> > >> >
>> > >> > >> > > Hello Mr Deepak ,
>> > >> > >> > >
>> > >> > >> > > Thanks for the response . The record does exists but i guess
>> > >> > >> > > i am not specifying the params good enough to hit the record
>> > >> > >> > > by pkey.
>> > >> > >> > >
>> > >> > >> > > I wish there were a "product_price_id" in ProductPrice
>> entity.
>> > >> :-)
>> > >> > >> > >
>> > >> > >> > > regds
>> > >> > >> > > mallah.
>> > >> > >> > >
>> > >> > >> > >
>> > >> > >> > >
>> > >> > >> > >
>> > >> > >> > >
>> > >> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
>> > >> > deepak.dixit@hotwax.co
>> > >> > >> >
>> > >> > >> > > wrote:
>> > >> > >> > >
>> > >> > >> > >> Hi Rajesh,
>> > >> > >> > >>
>> > >> > >> > >> If you want to create product price you should use
>> > >> > createProductPrice
>> > >> > >> > >> service,
>> > >> > >> > >> https://demo-stable.ofbiz.apac
>> he.org/webtools/control/Servic
>> > >> > >> > >> eList?sel_service_name=createProductPrice
>> > >> > >> > >>
>> > >> > >> > >> If productPrice record already exists you should use
>> > >> > >> updateProductPrice,
>> > >> > >> > >>
>> > >> > >> > >> Thanks & Regards
>> > >> > >> > >> --
>> > >> > >> > >> Deepak Dixit
>> > >> > >> > >> Director of Product Engineering
>> > >> > >> > >> HotWax Commerce <https://hotwax.co/>
>> > >> > >> > >>
>> > >> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
>> > >> > >> > mallah.rajesh@gmail.com>
>> > >> > >> > >> wrote:
>> > >> > >> > >>
>> > >> > >> > >> > Hi ,
>> > >> > >> > >> >
>> > >> > >> > >> > I am calling
>> > >> > >> > >> >
>> > >> > >> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
>> > >> > >> > >> > ServiceList?sel_service_name=updateProductPrice
>> > >> > >> > >> >
>> > >> > >> > >> > with ARGS
>> > >> > >> > >> >
>> > >> > >> > >> > {
>> > >> > >> > >> >     currencyUomId           "INR",
>> > >> > >> > >> >     fromDate                "2018-04-16 17:39:52",
>> > >> > >> > >> >     price                   150,
>> > >> > >> > >> >     productId               "PROD_SW52D5H3EN",
>> > >> > >> > >> >     productPricePurposeId   "PURCHASE",
>> > >> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
>> > >> > >> > >> >     productStoreGroupId     "_NA_",
>> > >> > >> > >> >     taxInPrice              "Y",
>> > >> > >> > >> >     termUomId               "WT_kg"
>> > >> > >> > >> > }
>> > >> > >> > >> >
>> > >> > >> > >> >
>> > >> > >> > >> > I am getting error:
>> > >> > >> > >> >
>> > >> > >> > >> >
>> > >> > >> > >> > faultString:Error running the simple-method: Entity value
>> > not
>> > >> > found
>> > >> > >> > with
>> > >> > >> > >> > name: lookedUpValue Method = updateProductPrice, File =
>> > >> > >> > >> > file:/opt/ofbiz/apache-ofbiz-1
>> 6.11.04/applications/product/
>> > >> > >> > >> > minilang/product/price/PriceServices.xml,
>> > >> > >> > >> > Element = <set-nonpk-fields>, Line 69null
>> > >> > >> > >> >
>> > >> > >> > >> >
>> > >> > >> > >> > the minilang def is reproduced here for convinience:
>> > >> > >> > >> >
>> > >> > >> > >> >  <simple-method method-name="updateProductPrice"
>> > >> > >> > >> short-description="Update
>> > >> > >> > >> > an ProductPrice">
>> > >> > >> > >> >         <set field="callingMethodName"
>> > >> > value="updateProductPrice"/>
>> > >> > >> > >> >         <set field="checkAction" value="UPDATE"/>
>> > >> > >> > >> >         <call-simple-method method-name="
>> > >> > >> > checkProductRelatedPermission"
>> > >> > >> > >> > xml-resource="component://product/minilang/product/
>> > >> > >> > >> > product/ProductServices.xml"/>
>> > >> > >> > >> >         <check-permission permission="CATALOG_PRICE_MAIN
>> T">
>> > >> > >> > >> >             <fail-property resource="ProductUiLabels"
>> > >> > >> > >> > property="ProductPriceMaintPermissionError"/>
>> > >> > >> > >> >         </check-permission>
>> > >> > >> > >> >         <check-errors/>
>> > >> > >> > >> >
>> > >> > >> > >> >         <call-simple-method method-name="
>> > >> > >> > inlineHandlePriceWithTaxInclud
>> > >> > >> > >> > ed"/>
>> > >> > >> > >> >
>> > >> > >> > >> >         <entity-one entity-name="ProductPrice"
>> > >> > >> > >> > value-field="lookedUpValue"/>
>> > >> > >> > >> >
>> > >> > >> > >> >         <!-- grab the old price value before setting
>> nonpk
>> > >> > >> parameter
>> > >> > >> > >> fields
>> > >> > >> > >> > -->
>> > >> > >> > >> >         <field-to-result field="lookedUpValue.price"
>> > >> > >> > >> > result-name="oldPrice"/>
>> > >> > >> > >> >
>> > >> > >> > >> >         <set-nonpk-fields map="parameters"
>> > >> > >> > value-field="lookedUpValue"/>
>> > >> > >> > >> >
>> > >> > >> > >> >         <now-timestamp field="nowTimestamp"/>
>> > >> > >> > >> >         <set field="lookedUpValue.lastModifiedDate"
>> > >> > >> > >> > from-field="nowTimestamp"/>
>> > >> > >> > >> >         <set field="lookedUpValue.lastModif
>> iedByUserLogin"
>> > >> > >> > >> > from-field="userLogin.userLoginId"/>
>> > >> > >> > >> >
>> > >> > >> > >> >         <store-value value-field="lookedUpValue"/>
>> > >> > >> > >> >  </simple-method>
>> > >> > >> > >> >
>> > >> > >> > >> > The productID does exists in Entity ProductPrice
>> > >> > >> > >> > Where am I going wrong ?
>> > >> > >> > >> >
>> > >> > >> > >> > thanks & regds
>> > >> > >> > >> > Rajesh Mallah.
>> > >> > >> > >> >
>> > >> > >> > >>
>> > >> > >> > >
>> > >> > >> > >
>> > >> > >> >
>> > >> > >>
>> > >> > >
>> > >> > >
>> > >> >
>> > >>
>> > >
>> > >
>> >
>>
>
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Hi Rishi ,

I am using XML RPC with OFBiz so my capabilities are limited to
what the interface provides. There is  parameter that allows me
to specify the data format/pattern .

At this moment i have solved my problem temporarily by appending
.001 after the second part in HH:MM:SS and i am only using
createProductPrice instead of updateProductPrice . As creating new
prices allows to have a history/audit of prices. I feel updateProductPrice
is really overwriting the values and trail is lost.

regds
mallah.




On Tue, Apr 17, 2018 at 6:49 PM, Rishi Solanki <ri...@gmail.com>
wrote:

> Idea of utility class is, use the format you would like and pass the value.
> It will convert into timestamp used in the table. In case you could not get
> the desired format in the utility class then the class uses the
> java.text.SimpleDateFormat class to resolve its purpose.
>
> Please take a look at toTimestamp() method variations and format you are
> receiving in the xml. Once you have the format with you, it can be easily
> converted into timestamp. Also if utility class does not support then go to
> core class for same i.e java.text.SimpleDateFormat and look for the
> supporting format.
>
> HTH!
>
>
> Rishi Solanki
> Sr Manager, Enterprise Software Development
> HotWax Systems Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxsystems.com
> www.hotwax.co
>
> On Tue, Apr 17, 2018 at 3:02 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > Further Info:
> >
> >   <member>
> >             <name>fromDate</name>
> >             <value>
> >               <string><![CDATA[2018-04-17 14:59:34.001 +0530]]></string>
> >             </value>
> >    </member>
> >
> > In XML results in
> >
> > from_date                   | 2018-04-17 14:59:34.001+05:30
> >
> > in DB. looks like the parser is kind enough to consider TZ
> > spec without colons.
> >
> >
> > regds
> > mallah.
> >
> >
> > On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <ma...@gmail.com>
> > wrote:
> >
> > >
> > > Its PostgreSQL
> > > regds
> > >
> > >
> > >  below is a sample data :
> > >
> > > SQL> select * from  ofbiz.product_price  where
> > > product_id='PROD_SW52D5H3EN' order by created_date desc limit 1;
> > >
> > > -[ RECORD 1 ]---------------+------------------------------
> > > product_id                  | PROD_SW52D5H3EN
> > > product_price_type_id       | DEFAULT_PRICE
> > > product_price_purpose_id    | PURCHASE
> > > currency_uom_id             | INR
> > > product_store_group_id      | _NA_
> > > from_date                   | 2018-04-17 12:49:20+05:30    <---- This
> has
> > > been put by me.
> > > thru_date                   |
> > > price                       | 121.000
> > > term_uom_id                 | WT_kg
> > > custom_price_calc_service   |
> > > price_without_tax           |
> > > price_with_tax              |
> > > tax_amount                  |
> > > tax_percentage              |
> > > tax_auth_party_id           |
> > > tax_auth_geo_id             |
> > > tax_in_price                | Y
> > > created_date                | 2018-04-17 12:49:20.416+05:30
> > > created_by_user_login       | admin
> > > last_modified_date          | 2018-04-17 12:49:20.416+05:30
> > > last_modified_by_user_login | admin
> > > last_updated_stamp          | 2018-04-17 12:49:20.416+05:30  <----
> > > Generated by defaults.
> > > last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
> > > created_stamp               | 2018-04-17 12:49:20.416+05:30
> > > created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
> > >
> > >
> > > On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit
> > <deepak.dixit@hotwaxsystems.
> > > com> wrote:
> > >
> > >> Hi Rajesh,
> > >>
> > >> Could you please share which database you are using?
> > >>
> > >>
> > >> Thanks & Regards
> > >> --
> > >> Deepak Dixit
> > >> www.hotwax.co
> > >>
> > >> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <
> mallah.rajesh@gmail.com
> > >
> > >> wrote:
> > >>
> > >> >  Hi ,
> > >> >
> > >> >
> > >> > it was in conversion/DateTimeConverters.java that was appending
> '.0'
> > to
> > >> > the
> > >> > end of
> > >> > string if the string did not contain any  decimals. So i have now
> > >> started
> > >> > sending
> > >> > the fractional seconds. And things are better (if not perfect).
> > >> >
> > >> >
> > >> >
> > >> > public java.sql.Timestamp convert(String obj, Locale locale,
> TimeZone
> > >> > timeZone, String formatString) throws ConversionException {
> > >> >             String str = obj.trim();
> > >> >             if (str.length() == 0) {
> > >> >                 return null;
> > >> >             }
> > >> >             DateFormat df = null;
> > >> >             if (UtilValidate.isEmpty(formatString)) {
> > >> >                 // These hacks are a bad idea, but they are included
> > >> >                 // for backward compatibility.
> > >> >                 if (str.length() > 0 && !str.contains(":")) {
> > >> >                     str = str + " 00:00:00.00";
> > >> >                 }
> > >> >                 // hack to mimic Timestamp.valueOf() method
> > >> >                 if (str.length() > 0 && !str.contains(".")) {
> > >> >                     str = str + ".0";
> > >> >                 } else {
> > >> >                     // DateFormat has a funny way of parsing
> > >> milliseconds:
> > >> >                     // 00:00:00.2 parses to 00:00:00.002
> > >> >                     // so we'll add zeros to the end to get
> > 00:00:00.200
> > >> >                     String[] timeSplit = str.split("[.]");
> > >> >                     if (timeSplit.length > 1 &&
> timeSplit[1].length()
> > <
> > >> 3)
> > >> > {
> > >> >                         str = str + "000".substring(timeSplit[1].
> > >> > length());
> > >> >                     }
> > >> >                 }
> > >> >                 df =
> > >> > UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(),
> > >> timeZone,
> > >> > locale);
> > >> >             } else {
> > >> >                 df = UtilDateTime.toDateTimeFormat(formatString,
> > >> timeZone,
> > >> > locale);
> > >> >             }
> > >> >             try {
> > >> >                 return new java.sql.Timestamp(df.parse(
> > str).getTime());
> > >> >             } catch (ParseException e) {
> > >> >
> > >> >
> > >> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <
> > mallah.rajesh@gmail.com
> > >> >
> > >> > wrote:
> > >> >
> > >> > > Thanks Rishi.
> > >> > >
> > >> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
> > >> rishisolankii@gmail.com>
> > >> > > wrote:
> > >> > >
> > >> > >> UtilDateTime is the utility class, add the time format support
> you
> > >> want
> > >> > >> and
> > >> > >> use it. Most format supported by this utility class OFBiz have.
> > >> > >>
> > >> > >> Rishi Solanki
> > >> > >> Sr Manager, Enterprise Software Development
> > >> > >> HotWax Systems Pvt. Ltd.
> > >> > >> Direct: +91-9893287847
> > >> > >> http://www.hotwaxsystems.com
> > >> > >> www.hotwax.co
> > >> > >>
> > >> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> > >> > mallah.rajesh@gmail.com>
> > >> > >> wrote:
> > >> > >>
> > >> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
> > >> > >> > Which is the value picked up from the DB column.
> > >> > >> >
> > >> > >> > Even at XML level the string is preserved , but at some stage
> > after
> > >> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> > >> > >> >
> > >> > >> > which is not parseable.
> > >> > >> >
> > >> > >> >  |W| [ModelService.makeValid] : Type conversion of field
> > >> [fromDate] to
> > >> > >> type
> > >> > >> > [java.sql.Timestamp] failed f
> > >> > >> > or value "2018-04-17 12:09:17+05:30":
> > >> > >> > org.apache.ofbiz.base.util.GeneralException:
> > >> > java.text.ParseException:
> > >> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> > >> > (java.text.ParseExceptio
> > >> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> > >> > >> >
> > >> > >> >
> > >> > >> > <!--- snippet from the XML-RPC -->
> > >> > >> >
> > >> > >> >           <member>
> > >> > >> >             <name>fromDate</name>
> > >> > >> >             <value>
> > >> > >> >               <string><![CDATA[2018-04-17
> > >> 12:09:17+05:30]]></string>
> > >> > >> >             </value>
> > >> > >> >           </member>
> > >> > >> >
> > >> > >> > <!-- end of snippet -->
> > >> > >> >
> > >> > >> >
> > >> > >> >
> > >> > >> >
> > >> > >> > regds
> > >> > >> > mallah.
> > >> > >> >
> > >> > >> >
> > >> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> > >> > >> mallah.rajesh@gmail.com>
> > >> > >> > wrote:
> > >> > >> >
> > >> > >> > > Hello Mr Deepak ,
> > >> > >> > >
> > >> > >> > > Thanks for the response . The record does exists but i guess
> > >> > >> > > i am not specifying the params good enough to hit the record
> > >> > >> > > by pkey.
> > >> > >> > >
> > >> > >> > > I wish there were a "product_price_id" in ProductPrice
> entity.
> > >> :-)
> > >> > >> > >
> > >> > >> > > regds
> > >> > >> > > mallah.
> > >> > >> > >
> > >> > >> > >
> > >> > >> > >
> > >> > >> > >
> > >> > >> > >
> > >> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> > >> > deepak.dixit@hotwax.co
> > >> > >> >
> > >> > >> > > wrote:
> > >> > >> > >
> > >> > >> > >> Hi Rajesh,
> > >> > >> > >>
> > >> > >> > >> If you want to create product price you should use
> > >> > createProductPrice
> > >> > >> > >> service,
> > >> > >> > >> https://demo-stable.ofbiz.apache.org/webtools/control/
> Servic
> > >> > >> > >> eList?sel_service_name=createProductPrice
> > >> > >> > >>
> > >> > >> > >> If productPrice record already exists you should use
> > >> > >> updateProductPrice,
> > >> > >> > >>
> > >> > >> > >> Thanks & Regards
> > >> > >> > >> --
> > >> > >> > >> Deepak Dixit
> > >> > >> > >> Director of Product Engineering
> > >> > >> > >> HotWax Commerce <https://hotwax.co/>
> > >> > >> > >>
> > >> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> > >> > >> > mallah.rajesh@gmail.com>
> > >> > >> > >> wrote:
> > >> > >> > >>
> > >> > >> > >> > Hi ,
> > >> > >> > >> >
> > >> > >> > >> > I am calling
> > >> > >> > >> >
> > >> > >> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
> > >> > >> > >> > ServiceList?sel_service_name=updateProductPrice
> > >> > >> > >> >
> > >> > >> > >> > with ARGS
> > >> > >> > >> >
> > >> > >> > >> > {
> > >> > >> > >> >     currencyUomId           "INR",
> > >> > >> > >> >     fromDate                "2018-04-16 17:39:52",
> > >> > >> > >> >     price                   150,
> > >> > >> > >> >     productId               "PROD_SW52D5H3EN",
> > >> > >> > >> >     productPricePurposeId   "PURCHASE",
> > >> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> > >> > >> > >> >     productStoreGroupId     "_NA_",
> > >> > >> > >> >     taxInPrice              "Y",
> > >> > >> > >> >     termUomId               "WT_kg"
> > >> > >> > >> > }
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > I am getting error:
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > faultString:Error running the simple-method: Entity value
> > not
> > >> > found
> > >> > >> > with
> > >> > >> > >> > name: lookedUpValue Method = updateProductPrice, File =
> > >> > >> > >> > file:/opt/ofbiz/apache-ofbiz-
> 16.11.04/applications/product/
> > >> > >> > >> > minilang/product/price/PriceServices.xml,
> > >> > >> > >> > Element = <set-nonpk-fields>, Line 69null
> > >> > >> > >> >
> > >> > >> > >> >
> > >> > >> > >> > the minilang def is reproduced here for convinience:
> > >> > >> > >> >
> > >> > >> > >> >  <simple-method method-name="updateProductPrice"
> > >> > >> > >> short-description="Update
> > >> > >> > >> > an ProductPrice">
> > >> > >> > >> >         <set field="callingMethodName"
> > >> > value="updateProductPrice"/>
> > >> > >> > >> >         <set field="checkAction" value="UPDATE"/>
> > >> > >> > >> >         <call-simple-method method-name="
> > >> > >> > checkProductRelatedPermission"
> > >> > >> > >> > xml-resource="component://product/minilang/product/
> > >> > >> > >> > product/ProductServices.xml"/>
> > >> > >> > >> >         <check-permission permission="CATALOG_PRICE_
> MAINT">
> > >> > >> > >> >             <fail-property resource="ProductUiLabels"
> > >> > >> > >> > property="ProductPriceMaintPermissionError"/>
> > >> > >> > >> >         </check-permission>
> > >> > >> > >> >         <check-errors/>
> > >> > >> > >> >
> > >> > >> > >> >         <call-simple-method method-name="
> > >> > >> > inlineHandlePriceWithTaxInclud
> > >> > >> > >> > ed"/>
> > >> > >> > >> >
> > >> > >> > >> >         <entity-one entity-name="ProductPrice"
> > >> > >> > >> > value-field="lookedUpValue"/>
> > >> > >> > >> >
> > >> > >> > >> >         <!-- grab the old price value before setting nonpk
> > >> > >> parameter
> > >> > >> > >> fields
> > >> > >> > >> > -->
> > >> > >> > >> >         <field-to-result field="lookedUpValue.price"
> > >> > >> > >> > result-name="oldPrice"/>
> > >> > >> > >> >
> > >> > >> > >> >         <set-nonpk-fields map="parameters"
> > >> > >> > value-field="lookedUpValue"/>
> > >> > >> > >> >
> > >> > >> > >> >         <now-timestamp field="nowTimestamp"/>
> > >> > >> > >> >         <set field="lookedUpValue.lastModifiedDate"
> > >> > >> > >> > from-field="nowTimestamp"/>
> > >> > >> > >> >         <set field="lookedUpValue.
> lastModifiedByUserLogin"
> > >> > >> > >> > from-field="userLogin.userLoginId"/>
> > >> > >> > >> >
> > >> > >> > >> >         <store-value value-field="lookedUpValue"/>
> > >> > >> > >> >  </simple-method>
> > >> > >> > >> >
> > >> > >> > >> > The productID does exists in Entity ProductPrice
> > >> > >> > >> > Where am I going wrong ?
> > >> > >> > >> >
> > >> > >> > >> > thanks & regds
> > >> > >> > >> > Rajesh Mallah.
> > >> > >> > >> >
> > >> > >> > >>
> > >> > >> > >
> > >> > >> > >
> > >> > >> >
> > >> > >>
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: help with updateProductPrice

Posted by Rishi Solanki <ri...@gmail.com>.
Idea of utility class is, use the format you would like and pass the value.
It will convert into timestamp used in the table. In case you could not get
the desired format in the utility class then the class uses the
java.text.SimpleDateFormat class to resolve its purpose.

Please take a look at toTimestamp() method variations and format you are
receiving in the xml. Once you have the format with you, it can be easily
converted into timestamp. Also if utility class does not support then go to
core class for same i.e java.text.SimpleDateFormat and look for the
supporting format.

HTH!


Rishi Solanki
Sr Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com
www.hotwax.co

On Tue, Apr 17, 2018 at 3:02 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

> Further Info:
>
>   <member>
>             <name>fromDate</name>
>             <value>
>               <string><![CDATA[2018-04-17 14:59:34.001 +0530]]></string>
>             </value>
>    </member>
>
> In XML results in
>
> from_date                   | 2018-04-17 14:59:34.001+05:30
>
> in DB. looks like the parser is kind enough to consider TZ
> spec without colons.
>
>
> regds
> mallah.
>
>
> On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> >
> > Its PostgreSQL
> > regds
> >
> >
> >  below is a sample data :
> >
> > SQL> select * from  ofbiz.product_price  where
> > product_id='PROD_SW52D5H3EN' order by created_date desc limit 1;
> >
> > -[ RECORD 1 ]---------------+------------------------------
> > product_id                  | PROD_SW52D5H3EN
> > product_price_type_id       | DEFAULT_PRICE
> > product_price_purpose_id    | PURCHASE
> > currency_uom_id             | INR
> > product_store_group_id      | _NA_
> > from_date                   | 2018-04-17 12:49:20+05:30    <---- This has
> > been put by me.
> > thru_date                   |
> > price                       | 121.000
> > term_uom_id                 | WT_kg
> > custom_price_calc_service   |
> > price_without_tax           |
> > price_with_tax              |
> > tax_amount                  |
> > tax_percentage              |
> > tax_auth_party_id           |
> > tax_auth_geo_id             |
> > tax_in_price                | Y
> > created_date                | 2018-04-17 12:49:20.416+05:30
> > created_by_user_login       | admin
> > last_modified_date          | 2018-04-17 12:49:20.416+05:30
> > last_modified_by_user_login | admin
> > last_updated_stamp          | 2018-04-17 12:49:20.416+05:30  <----
> > Generated by defaults.
> > last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
> > created_stamp               | 2018-04-17 12:49:20.416+05:30
> > created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
> >
> >
> > On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit
> <deepak.dixit@hotwaxsystems.
> > com> wrote:
> >
> >> Hi Rajesh,
> >>
> >> Could you please share which database you are using?
> >>
> >>
> >> Thanks & Regards
> >> --
> >> Deepak Dixit
> >> www.hotwax.co
> >>
> >> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <mallah.rajesh@gmail.com
> >
> >> wrote:
> >>
> >> >  Hi ,
> >> >
> >> >
> >> > it was in conversion/DateTimeConverters.java that was appending '.0'
> to
> >> > the
> >> > end of
> >> > string if the string did not contain any  decimals. So i have now
> >> started
> >> > sending
> >> > the fractional seconds. And things are better (if not perfect).
> >> >
> >> >
> >> >
> >> > public java.sql.Timestamp convert(String obj, Locale locale, TimeZone
> >> > timeZone, String formatString) throws ConversionException {
> >> >             String str = obj.trim();
> >> >             if (str.length() == 0) {
> >> >                 return null;
> >> >             }
> >> >             DateFormat df = null;
> >> >             if (UtilValidate.isEmpty(formatString)) {
> >> >                 // These hacks are a bad idea, but they are included
> >> >                 // for backward compatibility.
> >> >                 if (str.length() > 0 && !str.contains(":")) {
> >> >                     str = str + " 00:00:00.00";
> >> >                 }
> >> >                 // hack to mimic Timestamp.valueOf() method
> >> >                 if (str.length() > 0 && !str.contains(".")) {
> >> >                     str = str + ".0";
> >> >                 } else {
> >> >                     // DateFormat has a funny way of parsing
> >> milliseconds:
> >> >                     // 00:00:00.2 parses to 00:00:00.002
> >> >                     // so we'll add zeros to the end to get
> 00:00:00.200
> >> >                     String[] timeSplit = str.split("[.]");
> >> >                     if (timeSplit.length > 1 && timeSplit[1].length()
> <
> >> 3)
> >> > {
> >> >                         str = str + "000".substring(timeSplit[1].
> >> > length());
> >> >                     }
> >> >                 }
> >> >                 df =
> >> > UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(),
> >> timeZone,
> >> > locale);
> >> >             } else {
> >> >                 df = UtilDateTime.toDateTimeFormat(formatString,
> >> timeZone,
> >> > locale);
> >> >             }
> >> >             try {
> >> >                 return new java.sql.Timestamp(df.parse(
> str).getTime());
> >> >             } catch (ParseException e) {
> >> >
> >> >
> >> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <
> mallah.rajesh@gmail.com
> >> >
> >> > wrote:
> >> >
> >> > > Thanks Rishi.
> >> > >
> >> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
> >> rishisolankii@gmail.com>
> >> > > wrote:
> >> > >
> >> > >> UtilDateTime is the utility class, add the time format support you
> >> want
> >> > >> and
> >> > >> use it. Most format supported by this utility class OFBiz have.
> >> > >>
> >> > >> Rishi Solanki
> >> > >> Sr Manager, Enterprise Software Development
> >> > >> HotWax Systems Pvt. Ltd.
> >> > >> Direct: +91-9893287847
> >> > >> http://www.hotwaxsystems.com
> >> > >> www.hotwax.co
> >> > >>
> >> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> >> > mallah.rajesh@gmail.com>
> >> > >> wrote:
> >> > >>
> >> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
> >> > >> > Which is the value picked up from the DB column.
> >> > >> >
> >> > >> > Even at XML level the string is preserved , but at some stage
> after
> >> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> >> > >> >
> >> > >> > which is not parseable.
> >> > >> >
> >> > >> >  |W| [ModelService.makeValid] : Type conversion of field
> >> [fromDate] to
> >> > >> type
> >> > >> > [java.sql.Timestamp] failed f
> >> > >> > or value "2018-04-17 12:09:17+05:30":
> >> > >> > org.apache.ofbiz.base.util.GeneralException:
> >> > java.text.ParseException:
> >> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> >> > (java.text.ParseExceptio
> >> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> >> > >> >
> >> > >> >
> >> > >> > <!--- snippet from the XML-RPC -->
> >> > >> >
> >> > >> >           <member>
> >> > >> >             <name>fromDate</name>
> >> > >> >             <value>
> >> > >> >               <string><![CDATA[2018-04-17
> >> 12:09:17+05:30]]></string>
> >> > >> >             </value>
> >> > >> >           </member>
> >> > >> >
> >> > >> > <!-- end of snippet -->
> >> > >> >
> >> > >> >
> >> > >> >
> >> > >> >
> >> > >> > regds
> >> > >> > mallah.
> >> > >> >
> >> > >> >
> >> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> >> > >> mallah.rajesh@gmail.com>
> >> > >> > wrote:
> >> > >> >
> >> > >> > > Hello Mr Deepak ,
> >> > >> > >
> >> > >> > > Thanks for the response . The record does exists but i guess
> >> > >> > > i am not specifying the params good enough to hit the record
> >> > >> > > by pkey.
> >> > >> > >
> >> > >> > > I wish there were a "product_price_id" in ProductPrice entity.
> >> :-)
> >> > >> > >
> >> > >> > > regds
> >> > >> > > mallah.
> >> > >> > >
> >> > >> > >
> >> > >> > >
> >> > >> > >
> >> > >> > >
> >> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> >> > deepak.dixit@hotwax.co
> >> > >> >
> >> > >> > > wrote:
> >> > >> > >
> >> > >> > >> Hi Rajesh,
> >> > >> > >>
> >> > >> > >> If you want to create product price you should use
> >> > createProductPrice
> >> > >> > >> service,
> >> > >> > >> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
> >> > >> > >> eList?sel_service_name=createProductPrice
> >> > >> > >>
> >> > >> > >> If productPrice record already exists you should use
> >> > >> updateProductPrice,
> >> > >> > >>
> >> > >> > >> Thanks & Regards
> >> > >> > >> --
> >> > >> > >> Deepak Dixit
> >> > >> > >> Director of Product Engineering
> >> > >> > >> HotWax Commerce <https://hotwax.co/>
> >> > >> > >>
> >> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> >> > >> > mallah.rajesh@gmail.com>
> >> > >> > >> wrote:
> >> > >> > >>
> >> > >> > >> > Hi ,
> >> > >> > >> >
> >> > >> > >> > I am calling
> >> > >> > >> >
> >> > >> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
> >> > >> > >> > ServiceList?sel_service_name=updateProductPrice
> >> > >> > >> >
> >> > >> > >> > with ARGS
> >> > >> > >> >
> >> > >> > >> > {
> >> > >> > >> >     currencyUomId           "INR",
> >> > >> > >> >     fromDate                "2018-04-16 17:39:52",
> >> > >> > >> >     price                   150,
> >> > >> > >> >     productId               "PROD_SW52D5H3EN",
> >> > >> > >> >     productPricePurposeId   "PURCHASE",
> >> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> >> > >> > >> >     productStoreGroupId     "_NA_",
> >> > >> > >> >     taxInPrice              "Y",
> >> > >> > >> >     termUomId               "WT_kg"
> >> > >> > >> > }
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> > I am getting error:
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> > faultString:Error running the simple-method: Entity value
> not
> >> > found
> >> > >> > with
> >> > >> > >> > name: lookedUpValue Method = updateProductPrice, File =
> >> > >> > >> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
> >> > >> > >> > minilang/product/price/PriceServices.xml,
> >> > >> > >> > Element = <set-nonpk-fields>, Line 69null
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> > the minilang def is reproduced here for convinience:
> >> > >> > >> >
> >> > >> > >> >  <simple-method method-name="updateProductPrice"
> >> > >> > >> short-description="Update
> >> > >> > >> > an ProductPrice">
> >> > >> > >> >         <set field="callingMethodName"
> >> > value="updateProductPrice"/>
> >> > >> > >> >         <set field="checkAction" value="UPDATE"/>
> >> > >> > >> >         <call-simple-method method-name="
> >> > >> > checkProductRelatedPermission"
> >> > >> > >> > xml-resource="component://product/minilang/product/
> >> > >> > >> > product/ProductServices.xml"/>
> >> > >> > >> >         <check-permission permission="CATALOG_PRICE_MAINT">
> >> > >> > >> >             <fail-property resource="ProductUiLabels"
> >> > >> > >> > property="ProductPriceMaintPermissionError"/>
> >> > >> > >> >         </check-permission>
> >> > >> > >> >         <check-errors/>
> >> > >> > >> >
> >> > >> > >> >         <call-simple-method method-name="
> >> > >> > inlineHandlePriceWithTaxInclud
> >> > >> > >> > ed"/>
> >> > >> > >> >
> >> > >> > >> >         <entity-one entity-name="ProductPrice"
> >> > >> > >> > value-field="lookedUpValue"/>
> >> > >> > >> >
> >> > >> > >> >         <!-- grab the old price value before setting nonpk
> >> > >> parameter
> >> > >> > >> fields
> >> > >> > >> > -->
> >> > >> > >> >         <field-to-result field="lookedUpValue.price"
> >> > >> > >> > result-name="oldPrice"/>
> >> > >> > >> >
> >> > >> > >> >         <set-nonpk-fields map="parameters"
> >> > >> > value-field="lookedUpValue"/>
> >> > >> > >> >
> >> > >> > >> >         <now-timestamp field="nowTimestamp"/>
> >> > >> > >> >         <set field="lookedUpValue.lastModifiedDate"
> >> > >> > >> > from-field="nowTimestamp"/>
> >> > >> > >> >         <set field="lookedUpValue.lastModifiedByUserLogin"
> >> > >> > >> > from-field="userLogin.userLoginId"/>
> >> > >> > >> >
> >> > >> > >> >         <store-value value-field="lookedUpValue"/>
> >> > >> > >> >  </simple-method>
> >> > >> > >> >
> >> > >> > >> > The productID does exists in Entity ProductPrice
> >> > >> > >> > Where am I going wrong ?
> >> > >> > >> >
> >> > >> > >> > thanks & regds
> >> > >> > >> > Rajesh Mallah.
> >> > >> > >> >
> >> > >> > >>
> >> > >> > >
> >> > >> > >
> >> > >> >
> >> > >>
> >> > >
> >> > >
> >> >
> >>
> >
> >
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Further Info:

  <member>
            <name>fromDate</name>
            <value>
              <string><![CDATA[2018-04-17 14:59:34.001 +0530]]></string>
            </value>
   </member>

In XML results in

from_date                   | 2018-04-17 14:59:34.001+05:30

in DB. looks like the parser is kind enough to consider TZ
spec without colons.


regds
mallah.


On Tue, Apr 17, 2018 at 2:42 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

>
> Its PostgreSQL
> regds
>
>
>  below is a sample data :
>
> SQL> select * from  ofbiz.product_price  where
> product_id='PROD_SW52D5H3EN' order by created_date desc limit 1;
>
> -[ RECORD 1 ]---------------+------------------------------
> product_id                  | PROD_SW52D5H3EN
> product_price_type_id       | DEFAULT_PRICE
> product_price_purpose_id    | PURCHASE
> currency_uom_id             | INR
> product_store_group_id      | _NA_
> from_date                   | 2018-04-17 12:49:20+05:30    <---- This has
> been put by me.
> thru_date                   |
> price                       | 121.000
> term_uom_id                 | WT_kg
> custom_price_calc_service   |
> price_without_tax           |
> price_with_tax              |
> tax_amount                  |
> tax_percentage              |
> tax_auth_party_id           |
> tax_auth_geo_id             |
> tax_in_price                | Y
> created_date                | 2018-04-17 12:49:20.416+05:30
> created_by_user_login       | admin
> last_modified_date          | 2018-04-17 12:49:20.416+05:30
> last_modified_by_user_login | admin
> last_updated_stamp          | 2018-04-17 12:49:20.416+05:30  <----
> Generated by defaults.
> last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
> created_stamp               | 2018-04-17 12:49:20.416+05:30
> created_tx_stamp            | 2018-04-17 12:49:20.357+05:30
>
>
> On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit <deepak.dixit@hotwaxsystems.
> com> wrote:
>
>> Hi Rajesh,
>>
>> Could you please share which database you are using?
>>
>>
>> Thanks & Regards
>> --
>> Deepak Dixit
>> www.hotwax.co
>>
>> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <ma...@gmail.com>
>> wrote:
>>
>> >  Hi ,
>> >
>> >
>> > it was in conversion/DateTimeConverters.java that was appending '.0' to
>> > the
>> > end of
>> > string if the string did not contain any  decimals. So i have now
>> started
>> > sending
>> > the fractional seconds. And things are better (if not perfect).
>> >
>> >
>> >
>> > public java.sql.Timestamp convert(String obj, Locale locale, TimeZone
>> > timeZone, String formatString) throws ConversionException {
>> >             String str = obj.trim();
>> >             if (str.length() == 0) {
>> >                 return null;
>> >             }
>> >             DateFormat df = null;
>> >             if (UtilValidate.isEmpty(formatString)) {
>> >                 // These hacks are a bad idea, but they are included
>> >                 // for backward compatibility.
>> >                 if (str.length() > 0 && !str.contains(":")) {
>> >                     str = str + " 00:00:00.00";
>> >                 }
>> >                 // hack to mimic Timestamp.valueOf() method
>> >                 if (str.length() > 0 && !str.contains(".")) {
>> >                     str = str + ".0";
>> >                 } else {
>> >                     // DateFormat has a funny way of parsing
>> milliseconds:
>> >                     // 00:00:00.2 parses to 00:00:00.002
>> >                     // so we'll add zeros to the end to get 00:00:00.200
>> >                     String[] timeSplit = str.split("[.]");
>> >                     if (timeSplit.length > 1 && timeSplit[1].length() <
>> 3)
>> > {
>> >                         str = str + "000".substring(timeSplit[1].
>> > length());
>> >                     }
>> >                 }
>> >                 df =
>> > UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(),
>> timeZone,
>> > locale);
>> >             } else {
>> >                 df = UtilDateTime.toDateTimeFormat(formatString,
>> timeZone,
>> > locale);
>> >             }
>> >             try {
>> >                 return new java.sql.Timestamp(df.parse(str).getTime());
>> >             } catch (ParseException e) {
>> >
>> >
>> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <mallah.rajesh@gmail.com
>> >
>> > wrote:
>> >
>> > > Thanks Rishi.
>> > >
>> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
>> rishisolankii@gmail.com>
>> > > wrote:
>> > >
>> > >> UtilDateTime is the utility class, add the time format support you
>> want
>> > >> and
>> > >> use it. Most format supported by this utility class OFBiz have.
>> > >>
>> > >> Rishi Solanki
>> > >> Sr Manager, Enterprise Software Development
>> > >> HotWax Systems Pvt. Ltd.
>> > >> Direct: +91-9893287847
>> > >> http://www.hotwaxsystems.com
>> > >> www.hotwax.co
>> > >>
>> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
>> > mallah.rajesh@gmail.com>
>> > >> wrote:
>> > >>
>> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
>> > >> > Which is the value picked up from the DB column.
>> > >> >
>> > >> > Even at XML level the string is preserved , but at some stage after
>> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
>> > >> >
>> > >> > which is not parseable.
>> > >> >
>> > >> >  |W| [ModelService.makeValid] : Type conversion of field
>> [fromDate] to
>> > >> type
>> > >> > [java.sql.Timestamp] failed f
>> > >> > or value "2018-04-17 12:09:17+05:30":
>> > >> > org.apache.ofbiz.base.util.GeneralException:
>> > java.text.ParseException:
>> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
>> > (java.text.ParseExceptio
>> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
>> > >> >
>> > >> >
>> > >> > <!--- snippet from the XML-RPC -->
>> > >> >
>> > >> >           <member>
>> > >> >             <name>fromDate</name>
>> > >> >             <value>
>> > >> >               <string><![CDATA[2018-04-17
>> 12:09:17+05:30]]></string>
>> > >> >             </value>
>> > >> >           </member>
>> > >> >
>> > >> > <!-- end of snippet -->
>> > >> >
>> > >> >
>> > >> >
>> > >> >
>> > >> > regds
>> > >> > mallah.
>> > >> >
>> > >> >
>> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
>> > >> mallah.rajesh@gmail.com>
>> > >> > wrote:
>> > >> >
>> > >> > > Hello Mr Deepak ,
>> > >> > >
>> > >> > > Thanks for the response . The record does exists but i guess
>> > >> > > i am not specifying the params good enough to hit the record
>> > >> > > by pkey.
>> > >> > >
>> > >> > > I wish there were a "product_price_id" in ProductPrice entity.
>> :-)
>> > >> > >
>> > >> > > regds
>> > >> > > mallah.
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
>> > deepak.dixit@hotwax.co
>> > >> >
>> > >> > > wrote:
>> > >> > >
>> > >> > >> Hi Rajesh,
>> > >> > >>
>> > >> > >> If you want to create product price you should use
>> > createProductPrice
>> > >> > >> service,
>> > >> > >> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
>> > >> > >> eList?sel_service_name=createProductPrice
>> > >> > >>
>> > >> > >> If productPrice record already exists you should use
>> > >> updateProductPrice,
>> > >> > >>
>> > >> > >> Thanks & Regards
>> > >> > >> --
>> > >> > >> Deepak Dixit
>> > >> > >> Director of Product Engineering
>> > >> > >> HotWax Commerce <https://hotwax.co/>
>> > >> > >>
>> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
>> > >> > mallah.rajesh@gmail.com>
>> > >> > >> wrote:
>> > >> > >>
>> > >> > >> > Hi ,
>> > >> > >> >
>> > >> > >> > I am calling
>> > >> > >> >
>> > >> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
>> > >> > >> > ServiceList?sel_service_name=updateProductPrice
>> > >> > >> >
>> > >> > >> > with ARGS
>> > >> > >> >
>> > >> > >> > {
>> > >> > >> >     currencyUomId           "INR",
>> > >> > >> >     fromDate                "2018-04-16 17:39:52",
>> > >> > >> >     price                   150,
>> > >> > >> >     productId               "PROD_SW52D5H3EN",
>> > >> > >> >     productPricePurposeId   "PURCHASE",
>> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
>> > >> > >> >     productStoreGroupId     "_NA_",
>> > >> > >> >     taxInPrice              "Y",
>> > >> > >> >     termUomId               "WT_kg"
>> > >> > >> > }
>> > >> > >> >
>> > >> > >> >
>> > >> > >> > I am getting error:
>> > >> > >> >
>> > >> > >> >
>> > >> > >> > faultString:Error running the simple-method: Entity value not
>> > found
>> > >> > with
>> > >> > >> > name: lookedUpValue Method = updateProductPrice, File =
>> > >> > >> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
>> > >> > >> > minilang/product/price/PriceServices.xml,
>> > >> > >> > Element = <set-nonpk-fields>, Line 69null
>> > >> > >> >
>> > >> > >> >
>> > >> > >> > the minilang def is reproduced here for convinience:
>> > >> > >> >
>> > >> > >> >  <simple-method method-name="updateProductPrice"
>> > >> > >> short-description="Update
>> > >> > >> > an ProductPrice">
>> > >> > >> >         <set field="callingMethodName"
>> > value="updateProductPrice"/>
>> > >> > >> >         <set field="checkAction" value="UPDATE"/>
>> > >> > >> >         <call-simple-method method-name="
>> > >> > checkProductRelatedPermission"
>> > >> > >> > xml-resource="component://product/minilang/product/
>> > >> > >> > product/ProductServices.xml"/>
>> > >> > >> >         <check-permission permission="CATALOG_PRICE_MAINT">
>> > >> > >> >             <fail-property resource="ProductUiLabels"
>> > >> > >> > property="ProductPriceMaintPermissionError"/>
>> > >> > >> >         </check-permission>
>> > >> > >> >         <check-errors/>
>> > >> > >> >
>> > >> > >> >         <call-simple-method method-name="
>> > >> > inlineHandlePriceWithTaxInclud
>> > >> > >> > ed"/>
>> > >> > >> >
>> > >> > >> >         <entity-one entity-name="ProductPrice"
>> > >> > >> > value-field="lookedUpValue"/>
>> > >> > >> >
>> > >> > >> >         <!-- grab the old price value before setting nonpk
>> > >> parameter
>> > >> > >> fields
>> > >> > >> > -->
>> > >> > >> >         <field-to-result field="lookedUpValue.price"
>> > >> > >> > result-name="oldPrice"/>
>> > >> > >> >
>> > >> > >> >         <set-nonpk-fields map="parameters"
>> > >> > value-field="lookedUpValue"/>
>> > >> > >> >
>> > >> > >> >         <now-timestamp field="nowTimestamp"/>
>> > >> > >> >         <set field="lookedUpValue.lastModifiedDate"
>> > >> > >> > from-field="nowTimestamp"/>
>> > >> > >> >         <set field="lookedUpValue.lastModifiedByUserLogin"
>> > >> > >> > from-field="userLogin.userLoginId"/>
>> > >> > >> >
>> > >> > >> >         <store-value value-field="lookedUpValue"/>
>> > >> > >> >  </simple-method>
>> > >> > >> >
>> > >> > >> > The productID does exists in Entity ProductPrice
>> > >> > >> > Where am I going wrong ?
>> > >> > >> >
>> > >> > >> > thanks & regds
>> > >> > >> > Rajesh Mallah.
>> > >> > >> >
>> > >> > >>
>> > >> > >
>> > >> > >
>> > >> >
>> > >>
>> > >
>> > >
>> >
>>
>
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Its PostgreSQL
regds


 below is a sample data :

SQL> select * from  ofbiz.product_price  where product_id='PROD_SW52D5H3EN'
order by created_date desc limit 1;

-[ RECORD 1 ]---------------+------------------------------
product_id                  | PROD_SW52D5H3EN
product_price_type_id       | DEFAULT_PRICE
product_price_purpose_id    | PURCHASE
currency_uom_id             | INR
product_store_group_id      | _NA_
from_date                   | 2018-04-17 12:49:20+05:30    <---- This has
been put by me.
thru_date                   |
price                       | 121.000
term_uom_id                 | WT_kg
custom_price_calc_service   |
price_without_tax           |
price_with_tax              |
tax_amount                  |
tax_percentage              |
tax_auth_party_id           |
tax_auth_geo_id             |
tax_in_price                | Y
created_date                | 2018-04-17 12:49:20.416+05:30
created_by_user_login       | admin
last_modified_date          | 2018-04-17 12:49:20.416+05:30
last_modified_by_user_login | admin
last_updated_stamp          | 2018-04-17 12:49:20.416+05:30  <----
Generated by defaults.
last_updated_tx_stamp       | 2018-04-17 12:49:20.357+05:30
created_stamp               | 2018-04-17 12:49:20.416+05:30
created_tx_stamp            | 2018-04-17 12:49:20.357+05:30


On Tue, Apr 17, 2018 at 2:39 PM, Deepak Dixit <
deepak.dixit@hotwaxsystems.com> wrote:

> Hi Rajesh,
>
> Could you please share which database you are using?
>
>
> Thanks & Regards
> --
> Deepak Dixit
> www.hotwax.co
>
> On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> >  Hi ,
> >
> >
> > it was in conversion/DateTimeConverters.java that was appending '.0' to
> > the
> > end of
> > string if the string did not contain any  decimals. So i have now started
> > sending
> > the fractional seconds. And things are better (if not perfect).
> >
> >
> >
> > public java.sql.Timestamp convert(String obj, Locale locale, TimeZone
> > timeZone, String formatString) throws ConversionException {
> >             String str = obj.trim();
> >             if (str.length() == 0) {
> >                 return null;
> >             }
> >             DateFormat df = null;
> >             if (UtilValidate.isEmpty(formatString)) {
> >                 // These hacks are a bad idea, but they are included
> >                 // for backward compatibility.
> >                 if (str.length() > 0 && !str.contains(":")) {
> >                     str = str + " 00:00:00.00";
> >                 }
> >                 // hack to mimic Timestamp.valueOf() method
> >                 if (str.length() > 0 && !str.contains(".")) {
> >                     str = str + ".0";
> >                 } else {
> >                     // DateFormat has a funny way of parsing
> milliseconds:
> >                     // 00:00:00.2 parses to 00:00:00.002
> >                     // so we'll add zeros to the end to get 00:00:00.200
> >                     String[] timeSplit = str.split("[.]");
> >                     if (timeSplit.length > 1 && timeSplit[1].length() <
> 3)
> > {
> >                         str = str + "000".substring(timeSplit[1].
> > length());
> >                     }
> >                 }
> >                 df =
> > UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(),
> timeZone,
> > locale);
> >             } else {
> >                 df = UtilDateTime.toDateTimeFormat(formatString,
> timeZone,
> > locale);
> >             }
> >             try {
> >                 return new java.sql.Timestamp(df.parse(str).getTime());
> >             } catch (ParseException e) {
> >
> >
> > On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <ma...@gmail.com>
> > wrote:
> >
> > > Thanks Rishi.
> > >
> > > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <
> rishisolankii@gmail.com>
> > > wrote:
> > >
> > >> UtilDateTime is the utility class, add the time format support you
> want
> > >> and
> > >> use it. Most format supported by this utility class OFBiz have.
> > >>
> > >> Rishi Solanki
> > >> Sr Manager, Enterprise Software Development
> > >> HotWax Systems Pvt. Ltd.
> > >> Direct: +91-9893287847
> > >> http://www.hotwaxsystems.com
> > >> www.hotwax.co
> > >>
> > >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> > mallah.rajesh@gmail.com>
> > >> wrote:
> > >>
> > >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
> > >> > Which is the value picked up from the DB column.
> > >> >
> > >> > Even at XML level the string is preserved , but at some stage after
> > >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> > >> >
> > >> > which is not parseable.
> > >> >
> > >> >  |W| [ModelService.makeValid] : Type conversion of field [fromDate]
> to
> > >> type
> > >> > [java.sql.Timestamp] failed f
> > >> > or value "2018-04-17 12:09:17+05:30":
> > >> > org.apache.ofbiz.base.util.GeneralException:
> > java.text.ParseException:
> > >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> > (java.text.ParseExceptio
> > >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> > >> >
> > >> >
> > >> > <!--- snippet from the XML-RPC -->
> > >> >
> > >> >           <member>
> > >> >             <name>fromDate</name>
> > >> >             <value>
> > >> >               <string><![CDATA[2018-04-17 12:09:17+05:30]]></string>
> > >> >             </value>
> > >> >           </member>
> > >> >
> > >> > <!-- end of snippet -->
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > regds
> > >> > mallah.
> > >> >
> > >> >
> > >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> > >> mallah.rajesh@gmail.com>
> > >> > wrote:
> > >> >
> > >> > > Hello Mr Deepak ,
> > >> > >
> > >> > > Thanks for the response . The record does exists but i guess
> > >> > > i am not specifying the params good enough to hit the record
> > >> > > by pkey.
> > >> > >
> > >> > > I wish there were a "product_price_id" in ProductPrice entity. :-)
> > >> > >
> > >> > > regds
> > >> > > mallah.
> > >> > >
> > >> > >
> > >> > >
> > >> > >
> > >> > >
> > >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> > deepak.dixit@hotwax.co
> > >> >
> > >> > > wrote:
> > >> > >
> > >> > >> Hi Rajesh,
> > >> > >>
> > >> > >> If you want to create product price you should use
> > createProductPrice
> > >> > >> service,
> > >> > >> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
> > >> > >> eList?sel_service_name=createProductPrice
> > >> > >>
> > >> > >> If productPrice record already exists you should use
> > >> updateProductPrice,
> > >> > >>
> > >> > >> Thanks & Regards
> > >> > >> --
> > >> > >> Deepak Dixit
> > >> > >> Director of Product Engineering
> > >> > >> HotWax Commerce <https://hotwax.co/>
> > >> > >>
> > >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> > >> > mallah.rajesh@gmail.com>
> > >> > >> wrote:
> > >> > >>
> > >> > >> > Hi ,
> > >> > >> >
> > >> > >> > I am calling
> > >> > >> >
> > >> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
> > >> > >> > ServiceList?sel_service_name=updateProductPrice
> > >> > >> >
> > >> > >> > with ARGS
> > >> > >> >
> > >> > >> > {
> > >> > >> >     currencyUomId           "INR",
> > >> > >> >     fromDate                "2018-04-16 17:39:52",
> > >> > >> >     price                   150,
> > >> > >> >     productId               "PROD_SW52D5H3EN",
> > >> > >> >     productPricePurposeId   "PURCHASE",
> > >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> > >> > >> >     productStoreGroupId     "_NA_",
> > >> > >> >     taxInPrice              "Y",
> > >> > >> >     termUomId               "WT_kg"
> > >> > >> > }
> > >> > >> >
> > >> > >> >
> > >> > >> > I am getting error:
> > >> > >> >
> > >> > >> >
> > >> > >> > faultString:Error running the simple-method: Entity value not
> > found
> > >> > with
> > >> > >> > name: lookedUpValue Method = updateProductPrice, File =
> > >> > >> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
> > >> > >> > minilang/product/price/PriceServices.xml,
> > >> > >> > Element = <set-nonpk-fields>, Line 69null
> > >> > >> >
> > >> > >> >
> > >> > >> > the minilang def is reproduced here for convinience:
> > >> > >> >
> > >> > >> >  <simple-method method-name="updateProductPrice"
> > >> > >> short-description="Update
> > >> > >> > an ProductPrice">
> > >> > >> >         <set field="callingMethodName"
> > value="updateProductPrice"/>
> > >> > >> >         <set field="checkAction" value="UPDATE"/>
> > >> > >> >         <call-simple-method method-name="
> > >> > checkProductRelatedPermission"
> > >> > >> > xml-resource="component://product/minilang/product/
> > >> > >> > product/ProductServices.xml"/>
> > >> > >> >         <check-permission permission="CATALOG_PRICE_MAINT">
> > >> > >> >             <fail-property resource="ProductUiLabels"
> > >> > >> > property="ProductPriceMaintPermissionError"/>
> > >> > >> >         </check-permission>
> > >> > >> >         <check-errors/>
> > >> > >> >
> > >> > >> >         <call-simple-method method-name="
> > >> > inlineHandlePriceWithTaxInclud
> > >> > >> > ed"/>
> > >> > >> >
> > >> > >> >         <entity-one entity-name="ProductPrice"
> > >> > >> > value-field="lookedUpValue"/>
> > >> > >> >
> > >> > >> >         <!-- grab the old price value before setting nonpk
> > >> parameter
> > >> > >> fields
> > >> > >> > -->
> > >> > >> >         <field-to-result field="lookedUpValue.price"
> > >> > >> > result-name="oldPrice"/>
> > >> > >> >
> > >> > >> >         <set-nonpk-fields map="parameters"
> > >> > value-field="lookedUpValue"/>
> > >> > >> >
> > >> > >> >         <now-timestamp field="nowTimestamp"/>
> > >> > >> >         <set field="lookedUpValue.lastModifiedDate"
> > >> > >> > from-field="nowTimestamp"/>
> > >> > >> >         <set field="lookedUpValue.lastModifiedByUserLogin"
> > >> > >> > from-field="userLogin.userLoginId"/>
> > >> > >> >
> > >> > >> >         <store-value value-field="lookedUpValue"/>
> > >> > >> >  </simple-method>
> > >> > >> >
> > >> > >> > The productID does exists in Entity ProductPrice
> > >> > >> > Where am I going wrong ?
> > >> > >> >
> > >> > >> > thanks & regds
> > >> > >> > Rajesh Mallah.
> > >> > >> >
> > >> > >>
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: help with updateProductPrice

Posted by Deepak Dixit <de...@hotwaxsystems.com>.
Hi Rajesh,

Could you please share which database you are using?


Thanks & Regards
--
Deepak Dixit
www.hotwax.co

On Tue, Apr 17, 2018 at 2:36 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

>  Hi ,
>
>
> it was in conversion/DateTimeConverters.java that was appending '.0' to
> the
> end of
> string if the string did not contain any  decimals. So i have now started
> sending
> the fractional seconds. And things are better (if not perfect).
>
>
>
> public java.sql.Timestamp convert(String obj, Locale locale, TimeZone
> timeZone, String formatString) throws ConversionException {
>             String str = obj.trim();
>             if (str.length() == 0) {
>                 return null;
>             }
>             DateFormat df = null;
>             if (UtilValidate.isEmpty(formatString)) {
>                 // These hacks are a bad idea, but they are included
>                 // for backward compatibility.
>                 if (str.length() > 0 && !str.contains(":")) {
>                     str = str + " 00:00:00.00";
>                 }
>                 // hack to mimic Timestamp.valueOf() method
>                 if (str.length() > 0 && !str.contains(".")) {
>                     str = str + ".0";
>                 } else {
>                     // DateFormat has a funny way of parsing milliseconds:
>                     // 00:00:00.2 parses to 00:00:00.002
>                     // so we'll add zeros to the end to get 00:00:00.200
>                     String[] timeSplit = str.split("[.]");
>                     if (timeSplit.length > 1 && timeSplit[1].length() < 3)
> {
>                         str = str + "000".substring(timeSplit[1].
> length());
>                     }
>                 }
>                 df =
> UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(), timeZone,
> locale);
>             } else {
>                 df = UtilDateTime.toDateTimeFormat(formatString, timeZone,
> locale);
>             }
>             try {
>                 return new java.sql.Timestamp(df.parse(str).getTime());
>             } catch (ParseException e) {
>
>
> On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > Thanks Rishi.
> >
> > On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <ri...@gmail.com>
> > wrote:
> >
> >> UtilDateTime is the utility class, add the time format support you want
> >> and
> >> use it. Most format supported by this utility class OFBiz have.
> >>
> >> Rishi Solanki
> >> Sr Manager, Enterprise Software Development
> >> HotWax Systems Pvt. Ltd.
> >> Direct: +91-9893287847
> >> http://www.hotwaxsystems.com
> >> www.hotwax.co
> >>
> >> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <
> mallah.rajesh@gmail.com>
> >> wrote:
> >>
> >> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
> >> > Which is the value picked up from the DB column.
> >> >
> >> > Even at XML level the string is preserved , but at some stage after
> >> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> >> >
> >> > which is not parseable.
> >> >
> >> >  |W| [ModelService.makeValid] : Type conversion of field [fromDate] to
> >> type
> >> > [java.sql.Timestamp] failed f
> >> > or value "2018-04-17 12:09:17+05:30":
> >> > org.apache.ofbiz.base.util.GeneralException:
> java.text.ParseException:
> >> > Unparseable date: "2018-04-17 12:09:17+05:30.0"
> (java.text.ParseExceptio
> >> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> >> >
> >> >
> >> > <!--- snippet from the XML-RPC -->
> >> >
> >> >           <member>
> >> >             <name>fromDate</name>
> >> >             <value>
> >> >               <string><![CDATA[2018-04-17 12:09:17+05:30]]></string>
> >> >             </value>
> >> >           </member>
> >> >
> >> > <!-- end of snippet -->
> >> >
> >> >
> >> >
> >> >
> >> > regds
> >> > mallah.
> >> >
> >> >
> >> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
> >> mallah.rajesh@gmail.com>
> >> > wrote:
> >> >
> >> > > Hello Mr Deepak ,
> >> > >
> >> > > Thanks for the response . The record does exists but i guess
> >> > > i am not specifying the params good enough to hit the record
> >> > > by pkey.
> >> > >
> >> > > I wish there were a "product_price_id" in ProductPrice entity. :-)
> >> > >
> >> > > regds
> >> > > mallah.
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <
> deepak.dixit@hotwax.co
> >> >
> >> > > wrote:
> >> > >
> >> > >> Hi Rajesh,
> >> > >>
> >> > >> If you want to create product price you should use
> createProductPrice
> >> > >> service,
> >> > >> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
> >> > >> eList?sel_service_name=createProductPrice
> >> > >>
> >> > >> If productPrice record already exists you should use
> >> updateProductPrice,
> >> > >>
> >> > >> Thanks & Regards
> >> > >> --
> >> > >> Deepak Dixit
> >> > >> Director of Product Engineering
> >> > >> HotWax Commerce <https://hotwax.co/>
> >> > >>
> >> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> >> > mallah.rajesh@gmail.com>
> >> > >> wrote:
> >> > >>
> >> > >> > Hi ,
> >> > >> >
> >> > >> > I am calling
> >> > >> >
> >> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
> >> > >> > ServiceList?sel_service_name=updateProductPrice
> >> > >> >
> >> > >> > with ARGS
> >> > >> >
> >> > >> > {
> >> > >> >     currencyUomId           "INR",
> >> > >> >     fromDate                "2018-04-16 17:39:52",
> >> > >> >     price                   150,
> >> > >> >     productId               "PROD_SW52D5H3EN",
> >> > >> >     productPricePurposeId   "PURCHASE",
> >> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> >> > >> >     productStoreGroupId     "_NA_",
> >> > >> >     taxInPrice              "Y",
> >> > >> >     termUomId               "WT_kg"
> >> > >> > }
> >> > >> >
> >> > >> >
> >> > >> > I am getting error:
> >> > >> >
> >> > >> >
> >> > >> > faultString:Error running the simple-method: Entity value not
> found
> >> > with
> >> > >> > name: lookedUpValue Method = updateProductPrice, File =
> >> > >> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
> >> > >> > minilang/product/price/PriceServices.xml,
> >> > >> > Element = <set-nonpk-fields>, Line 69null
> >> > >> >
> >> > >> >
> >> > >> > the minilang def is reproduced here for convinience:
> >> > >> >
> >> > >> >  <simple-method method-name="updateProductPrice"
> >> > >> short-description="Update
> >> > >> > an ProductPrice">
> >> > >> >         <set field="callingMethodName"
> value="updateProductPrice"/>
> >> > >> >         <set field="checkAction" value="UPDATE"/>
> >> > >> >         <call-simple-method method-name="
> >> > checkProductRelatedPermission"
> >> > >> > xml-resource="component://product/minilang/product/
> >> > >> > product/ProductServices.xml"/>
> >> > >> >         <check-permission permission="CATALOG_PRICE_MAINT">
> >> > >> >             <fail-property resource="ProductUiLabels"
> >> > >> > property="ProductPriceMaintPermissionError"/>
> >> > >> >         </check-permission>
> >> > >> >         <check-errors/>
> >> > >> >
> >> > >> >         <call-simple-method method-name="
> >> > inlineHandlePriceWithTaxInclud
> >> > >> > ed"/>
> >> > >> >
> >> > >> >         <entity-one entity-name="ProductPrice"
> >> > >> > value-field="lookedUpValue"/>
> >> > >> >
> >> > >> >         <!-- grab the old price value before setting nonpk
> >> parameter
> >> > >> fields
> >> > >> > -->
> >> > >> >         <field-to-result field="lookedUpValue.price"
> >> > >> > result-name="oldPrice"/>
> >> > >> >
> >> > >> >         <set-nonpk-fields map="parameters"
> >> > value-field="lookedUpValue"/>
> >> > >> >
> >> > >> >         <now-timestamp field="nowTimestamp"/>
> >> > >> >         <set field="lookedUpValue.lastModifiedDate"
> >> > >> > from-field="nowTimestamp"/>
> >> > >> >         <set field="lookedUpValue.lastModifiedByUserLogin"
> >> > >> > from-field="userLogin.userLoginId"/>
> >> > >> >
> >> > >> >         <store-value value-field="lookedUpValue"/>
> >> > >> >  </simple-method>
> >> > >> >
> >> > >> > The productID does exists in Entity ProductPrice
> >> > >> > Where am I going wrong ?
> >> > >> >
> >> > >> > thanks & regds
> >> > >> > Rajesh Mallah.
> >> > >> >
> >> > >>
> >> > >
> >> > >
> >> >
> >>
> >
> >
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
 Hi ,


it was in conversion/DateTimeConverters.java that was appending '.0' to the
end of
string if the string did not contain any  decimals. So i have now started
sending
the fractional seconds. And things are better (if not perfect).



public java.sql.Timestamp convert(String obj, Locale locale, TimeZone
timeZone, String formatString) throws ConversionException {
            String str = obj.trim();
            if (str.length() == 0) {
                return null;
            }
            DateFormat df = null;
            if (UtilValidate.isEmpty(formatString)) {
                // These hacks are a bad idea, but they are included
                // for backward compatibility.
                if (str.length() > 0 && !str.contains(":")) {
                    str = str + " 00:00:00.00";
                }
                // hack to mimic Timestamp.valueOf() method
                if (str.length() > 0 && !str.contains(".")) {
                    str = str + ".0";
                } else {
                    // DateFormat has a funny way of parsing milliseconds:
                    // 00:00:00.2 parses to 00:00:00.002
                    // so we'll add zeros to the end to get 00:00:00.200
                    String[] timeSplit = str.split("[.]");
                    if (timeSplit.length > 1 && timeSplit[1].length() < 3) {
                        str = str + "000".substring(timeSplit[1].length());
                    }
                }
                df =
UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(), timeZone,
locale);
            } else {
                df = UtilDateTime.toDateTimeFormat(formatString, timeZone,
locale);
            }
            try {
                return new java.sql.Timestamp(df.parse(str).getTime());
            } catch (ParseException e) {


On Tue, Apr 17, 2018 at 2:19 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

> Thanks Rishi.
>
> On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <ri...@gmail.com>
> wrote:
>
>> UtilDateTime is the utility class, add the time format support you want
>> and
>> use it. Most format supported by this utility class OFBiz have.
>>
>> Rishi Solanki
>> Sr Manager, Enterprise Software Development
>> HotWax Systems Pvt. Ltd.
>> Direct: +91-9893287847
>> http://www.hotwaxsystems.com
>> www.hotwax.co
>>
>> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <ma...@gmail.com>
>> wrote:
>>
>> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
>> > Which is the value picked up from the DB column.
>> >
>> > Even at XML level the string is preserved , but at some stage after
>> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
>> >
>> > which is not parseable.
>> >
>> >  |W| [ModelService.makeValid] : Type conversion of field [fromDate] to
>> type
>> > [java.sql.Timestamp] failed f
>> > or value "2018-04-17 12:09:17+05:30":
>> > org.apache.ofbiz.base.util.GeneralException: java.text.ParseException:
>> > Unparseable date: "2018-04-17 12:09:17+05:30.0" (java.text.ParseExceptio
>> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
>> >
>> >
>> > <!--- snippet from the XML-RPC -->
>> >
>> >           <member>
>> >             <name>fromDate</name>
>> >             <value>
>> >               <string><![CDATA[2018-04-17 12:09:17+05:30]]></string>
>> >             </value>
>> >           </member>
>> >
>> > <!-- end of snippet -->
>> >
>> >
>> >
>> >
>> > regds
>> > mallah.
>> >
>> >
>> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <
>> mallah.rajesh@gmail.com>
>> > wrote:
>> >
>> > > Hello Mr Deepak ,
>> > >
>> > > Thanks for the response . The record does exists but i guess
>> > > i am not specifying the params good enough to hit the record
>> > > by pkey.
>> > >
>> > > I wish there were a "product_price_id" in ProductPrice entity. :-)
>> > >
>> > > regds
>> > > mallah.
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <deepak.dixit@hotwax.co
>> >
>> > > wrote:
>> > >
>> > >> Hi Rajesh,
>> > >>
>> > >> If you want to create product price you should use createProductPrice
>> > >> service,
>> > >> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
>> > >> eList?sel_service_name=createProductPrice
>> > >>
>> > >> If productPrice record already exists you should use
>> updateProductPrice,
>> > >>
>> > >> Thanks & Regards
>> > >> --
>> > >> Deepak Dixit
>> > >> Director of Product Engineering
>> > >> HotWax Commerce <https://hotwax.co/>
>> > >>
>> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
>> > mallah.rajesh@gmail.com>
>> > >> wrote:
>> > >>
>> > >> > Hi ,
>> > >> >
>> > >> > I am calling
>> > >> >
>> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
>> > >> > ServiceList?sel_service_name=updateProductPrice
>> > >> >
>> > >> > with ARGS
>> > >> >
>> > >> > {
>> > >> >     currencyUomId           "INR",
>> > >> >     fromDate                "2018-04-16 17:39:52",
>> > >> >     price                   150,
>> > >> >     productId               "PROD_SW52D5H3EN",
>> > >> >     productPricePurposeId   "PURCHASE",
>> > >> >     productPriceTypeId      "DEFAULT_PRICE",
>> > >> >     productStoreGroupId     "_NA_",
>> > >> >     taxInPrice              "Y",
>> > >> >     termUomId               "WT_kg"
>> > >> > }
>> > >> >
>> > >> >
>> > >> > I am getting error:
>> > >> >
>> > >> >
>> > >> > faultString:Error running the simple-method: Entity value not found
>> > with
>> > >> > name: lookedUpValue Method = updateProductPrice, File =
>> > >> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
>> > >> > minilang/product/price/PriceServices.xml,
>> > >> > Element = <set-nonpk-fields>, Line 69null
>> > >> >
>> > >> >
>> > >> > the minilang def is reproduced here for convinience:
>> > >> >
>> > >> >  <simple-method method-name="updateProductPrice"
>> > >> short-description="Update
>> > >> > an ProductPrice">
>> > >> >         <set field="callingMethodName" value="updateProductPrice"/>
>> > >> >         <set field="checkAction" value="UPDATE"/>
>> > >> >         <call-simple-method method-name="
>> > checkProductRelatedPermission"
>> > >> > xml-resource="component://product/minilang/product/
>> > >> > product/ProductServices.xml"/>
>> > >> >         <check-permission permission="CATALOG_PRICE_MAINT">
>> > >> >             <fail-property resource="ProductUiLabels"
>> > >> > property="ProductPriceMaintPermissionError"/>
>> > >> >         </check-permission>
>> > >> >         <check-errors/>
>> > >> >
>> > >> >         <call-simple-method method-name="
>> > inlineHandlePriceWithTaxInclud
>> > >> > ed"/>
>> > >> >
>> > >> >         <entity-one entity-name="ProductPrice"
>> > >> > value-field="lookedUpValue"/>
>> > >> >
>> > >> >         <!-- grab the old price value before setting nonpk
>> parameter
>> > >> fields
>> > >> > -->
>> > >> >         <field-to-result field="lookedUpValue.price"
>> > >> > result-name="oldPrice"/>
>> > >> >
>> > >> >         <set-nonpk-fields map="parameters"
>> > value-field="lookedUpValue"/>
>> > >> >
>> > >> >         <now-timestamp field="nowTimestamp"/>
>> > >> >         <set field="lookedUpValue.lastModifiedDate"
>> > >> > from-field="nowTimestamp"/>
>> > >> >         <set field="lookedUpValue.lastModifiedByUserLogin"
>> > >> > from-field="userLogin.userLoginId"/>
>> > >> >
>> > >> >         <store-value value-field="lookedUpValue"/>
>> > >> >  </simple-method>
>> > >> >
>> > >> > The productID does exists in Entity ProductPrice
>> > >> > Where am I going wrong ?
>> > >> >
>> > >> > thanks & regds
>> > >> > Rajesh Mallah.
>> > >> >
>> > >>
>> > >
>> > >
>> >
>>
>
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Thanks Rishi.

On Tue, Apr 17, 2018 at 2:08 PM, Rishi Solanki <ri...@gmail.com>
wrote:

> UtilDateTime is the utility class, add the time format support you want and
> use it. Most format supported by this utility class OFBiz have.
>
> Rishi Solanki
> Sr Manager, Enterprise Software Development
> HotWax Systems Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxsystems.com
> www.hotwax.co
>
> On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
> > Which is the value picked up from the DB column.
> >
> > Even at XML level the string is preserved , but at some stage after
> > hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
> >
> > which is not parseable.
> >
> >  |W| [ModelService.makeValid] : Type conversion of field [fromDate] to
> type
> > [java.sql.Timestamp] failed f
> > or value "2018-04-17 12:09:17+05:30":
> > org.apache.ofbiz.base.util.GeneralException: java.text.ParseException:
> > Unparseable date: "2018-04-17 12:09:17+05:30.0" (java.text.ParseExceptio
> > n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
> >
> >
> > <!--- snippet from the XML-RPC -->
> >
> >           <member>
> >             <name>fromDate</name>
> >             <value>
> >               <string><![CDATA[2018-04-17 12:09:17+05:30]]></string>
> >             </value>
> >           </member>
> >
> > <!-- end of snippet -->
> >
> >
> >
> >
> > regds
> > mallah.
> >
> >
> > On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <mallah.rajesh@gmail.com
> >
> > wrote:
> >
> > > Hello Mr Deepak ,
> > >
> > > Thanks for the response . The record does exists but i guess
> > > i am not specifying the params good enough to hit the record
> > > by pkey.
> > >
> > > I wish there were a "product_price_id" in ProductPrice entity. :-)
> > >
> > > regds
> > > mallah.
> > >
> > >
> > >
> > >
> > >
> > > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <de...@hotwax.co>
> > > wrote:
> > >
> > >> Hi Rajesh,
> > >>
> > >> If you want to create product price you should use createProductPrice
> > >> service,
> > >> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
> > >> eList?sel_service_name=createProductPrice
> > >>
> > >> If productPrice record already exists you should use
> updateProductPrice,
> > >>
> > >> Thanks & Regards
> > >> --
> > >> Deepak Dixit
> > >> Director of Product Engineering
> > >> HotWax Commerce <https://hotwax.co/>
> > >>
> > >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> > mallah.rajesh@gmail.com>
> > >> wrote:
> > >>
> > >> > Hi ,
> > >> >
> > >> > I am calling
> > >> >
> > >> > https://demo-stable.ofbiz.apache.org/webtools/control/
> > >> > ServiceList?sel_service_name=updateProductPrice
> > >> >
> > >> > with ARGS
> > >> >
> > >> > {
> > >> >     currencyUomId           "INR",
> > >> >     fromDate                "2018-04-16 17:39:52",
> > >> >     price                   150,
> > >> >     productId               "PROD_SW52D5H3EN",
> > >> >     productPricePurposeId   "PURCHASE",
> > >> >     productPriceTypeId      "DEFAULT_PRICE",
> > >> >     productStoreGroupId     "_NA_",
> > >> >     taxInPrice              "Y",
> > >> >     termUomId               "WT_kg"
> > >> > }
> > >> >
> > >> >
> > >> > I am getting error:
> > >> >
> > >> >
> > >> > faultString:Error running the simple-method: Entity value not found
> > with
> > >> > name: lookedUpValue Method = updateProductPrice, File =
> > >> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
> > >> > minilang/product/price/PriceServices.xml,
> > >> > Element = <set-nonpk-fields>, Line 69null
> > >> >
> > >> >
> > >> > the minilang def is reproduced here for convinience:
> > >> >
> > >> >  <simple-method method-name="updateProductPrice"
> > >> short-description="Update
> > >> > an ProductPrice">
> > >> >         <set field="callingMethodName" value="updateProductPrice"/>
> > >> >         <set field="checkAction" value="UPDATE"/>
> > >> >         <call-simple-method method-name="
> > checkProductRelatedPermission"
> > >> > xml-resource="component://product/minilang/product/
> > >> > product/ProductServices.xml"/>
> > >> >         <check-permission permission="CATALOG_PRICE_MAINT">
> > >> >             <fail-property resource="ProductUiLabels"
> > >> > property="ProductPriceMaintPermissionError"/>
> > >> >         </check-permission>
> > >> >         <check-errors/>
> > >> >
> > >> >         <call-simple-method method-name="
> > inlineHandlePriceWithTaxInclud
> > >> > ed"/>
> > >> >
> > >> >         <entity-one entity-name="ProductPrice"
> > >> > value-field="lookedUpValue"/>
> > >> >
> > >> >         <!-- grab the old price value before setting nonpk parameter
> > >> fields
> > >> > -->
> > >> >         <field-to-result field="lookedUpValue.price"
> > >> > result-name="oldPrice"/>
> > >> >
> > >> >         <set-nonpk-fields map="parameters"
> > value-field="lookedUpValue"/>
> > >> >
> > >> >         <now-timestamp field="nowTimestamp"/>
> > >> >         <set field="lookedUpValue.lastModifiedDate"
> > >> > from-field="nowTimestamp"/>
> > >> >         <set field="lookedUpValue.lastModifiedByUserLogin"
> > >> > from-field="userLogin.userLoginId"/>
> > >> >
> > >> >         <store-value value-field="lookedUpValue"/>
> > >> >  </simple-method>
> > >> >
> > >> > The productID does exists in Entity ProductPrice
> > >> > Where am I going wrong ?
> > >> >
> > >> > thanks & regds
> > >> > Rajesh Mallah.
> > >> >
> > >>
> > >
> > >
> >
>

Re: help with updateProductPrice

Posted by Rishi Solanki <ri...@gmail.com>.
UtilDateTime is the utility class, add the time format support you want and
use it. Most format supported by this utility class OFBiz have.

Rishi Solanki
Sr Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com
www.hotwax.co

On Tue, Apr 17, 2018 at 12:27 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

> Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
> Which is the value picked up from the DB column.
>
> Even at XML level the string is preserved , but at some stage after
> hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"
>
> which is not parseable.
>
>  |W| [ModelService.makeValid] : Type conversion of field [fromDate] to type
> [java.sql.Timestamp] failed f
> or value "2018-04-17 12:09:17+05:30":
> org.apache.ofbiz.base.util.GeneralException: java.text.ParseException:
> Unparseable date: "2018-04-17 12:09:17+05:30.0" (java.text.ParseExceptio
> n: Unparseable date: "2018-04-17 12:09:17+05:30.0")
>
>
> <!--- snippet from the XML-RPC -->
>
>           <member>
>             <name>fromDate</name>
>             <value>
>               <string><![CDATA[2018-04-17 12:09:17+05:30]]></string>
>             </value>
>           </member>
>
> <!-- end of snippet -->
>
>
>
>
> regds
> mallah.
>
>
> On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > Hello Mr Deepak ,
> >
> > Thanks for the response . The record does exists but i guess
> > i am not specifying the params good enough to hit the record
> > by pkey.
> >
> > I wish there were a "product_price_id" in ProductPrice entity. :-)
> >
> > regds
> > mallah.
> >
> >
> >
> >
> >
> > On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <de...@hotwax.co>
> > wrote:
> >
> >> Hi Rajesh,
> >>
> >> If you want to create product price you should use createProductPrice
> >> service,
> >> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
> >> eList?sel_service_name=createProductPrice
> >>
> >> If productPrice record already exists you should use updateProductPrice,
> >>
> >> Thanks & Regards
> >> --
> >> Deepak Dixit
> >> Director of Product Engineering
> >> HotWax Commerce <https://hotwax.co/>
> >>
> >> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <
> mallah.rajesh@gmail.com>
> >> wrote:
> >>
> >> > Hi ,
> >> >
> >> > I am calling
> >> >
> >> > https://demo-stable.ofbiz.apache.org/webtools/control/
> >> > ServiceList?sel_service_name=updateProductPrice
> >> >
> >> > with ARGS
> >> >
> >> > {
> >> >     currencyUomId           "INR",
> >> >     fromDate                "2018-04-16 17:39:52",
> >> >     price                   150,
> >> >     productId               "PROD_SW52D5H3EN",
> >> >     productPricePurposeId   "PURCHASE",
> >> >     productPriceTypeId      "DEFAULT_PRICE",
> >> >     productStoreGroupId     "_NA_",
> >> >     taxInPrice              "Y",
> >> >     termUomId               "WT_kg"
> >> > }
> >> >
> >> >
> >> > I am getting error:
> >> >
> >> >
> >> > faultString:Error running the simple-method: Entity value not found
> with
> >> > name: lookedUpValue Method = updateProductPrice, File =
> >> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
> >> > minilang/product/price/PriceServices.xml,
> >> > Element = <set-nonpk-fields>, Line 69null
> >> >
> >> >
> >> > the minilang def is reproduced here for convinience:
> >> >
> >> >  <simple-method method-name="updateProductPrice"
> >> short-description="Update
> >> > an ProductPrice">
> >> >         <set field="callingMethodName" value="updateProductPrice"/>
> >> >         <set field="checkAction" value="UPDATE"/>
> >> >         <call-simple-method method-name="
> checkProductRelatedPermission"
> >> > xml-resource="component://product/minilang/product/
> >> > product/ProductServices.xml"/>
> >> >         <check-permission permission="CATALOG_PRICE_MAINT">
> >> >             <fail-property resource="ProductUiLabels"
> >> > property="ProductPriceMaintPermissionError"/>
> >> >         </check-permission>
> >> >         <check-errors/>
> >> >
> >> >         <call-simple-method method-name="
> inlineHandlePriceWithTaxInclud
> >> > ed"/>
> >> >
> >> >         <entity-one entity-name="ProductPrice"
> >> > value-field="lookedUpValue"/>
> >> >
> >> >         <!-- grab the old price value before setting nonpk parameter
> >> fields
> >> > -->
> >> >         <field-to-result field="lookedUpValue.price"
> >> > result-name="oldPrice"/>
> >> >
> >> >         <set-nonpk-fields map="parameters"
> value-field="lookedUpValue"/>
> >> >
> >> >         <now-timestamp field="nowTimestamp"/>
> >> >         <set field="lookedUpValue.lastModifiedDate"
> >> > from-field="nowTimestamp"/>
> >> >         <set field="lookedUpValue.lastModifiedByUserLogin"
> >> > from-field="userLogin.userLoginId"/>
> >> >
> >> >         <store-value value-field="lookedUpValue"/>
> >> >  </simple-method>
> >> >
> >> > The productID does exists in Entity ProductPrice
> >> > Where am I going wrong ?
> >> >
> >> > thanks & regds
> >> > Rajesh Mallah.
> >> >
> >>
> >
> >
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Now I am passing  "2018-04-17 12:09:17+05:30" as fromDate ,
Which is the value picked up from the DB column.

Even at XML level the string is preserved , but at some stage after
hitting tomcat it becomes: "2018-04-17 12:09:17+05:30.0"

which is not parseable.

 |W| [ModelService.makeValid] : Type conversion of field [fromDate] to type
[java.sql.Timestamp] failed f
or value "2018-04-17 12:09:17+05:30":
org.apache.ofbiz.base.util.GeneralException: java.text.ParseException:
Unparseable date: "2018-04-17 12:09:17+05:30.0" (java.text.ParseExceptio
n: Unparseable date: "2018-04-17 12:09:17+05:30.0")


<!--- snippet from the XML-RPC -->

          <member>
            <name>fromDate</name>
            <value>
              <string><![CDATA[2018-04-17 12:09:17+05:30]]></string>
            </value>
          </member>

<!-- end of snippet -->




regds
mallah.


On Tue, Apr 17, 2018 at 11:08 AM, Rajesh Mallah <ma...@gmail.com>
wrote:

> Hello Mr Deepak ,
>
> Thanks for the response . The record does exists but i guess
> i am not specifying the params good enough to hit the record
> by pkey.
>
> I wish there were a "product_price_id" in ProductPrice entity. :-)
>
> regds
> mallah.
>
>
>
>
>
> On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <de...@hotwax.co>
> wrote:
>
>> Hi Rajesh,
>>
>> If you want to create product price you should use createProductPrice
>> service,
>> https://demo-stable.ofbiz.apache.org/webtools/control/Servic
>> eList?sel_service_name=createProductPrice
>>
>> If productPrice record already exists you should use updateProductPrice,
>>
>> Thanks & Regards
>> --
>> Deepak Dixit
>> Director of Product Engineering
>> HotWax Commerce <https://hotwax.co/>
>>
>> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <ma...@gmail.com>
>> wrote:
>>
>> > Hi ,
>> >
>> > I am calling
>> >
>> > https://demo-stable.ofbiz.apache.org/webtools/control/
>> > ServiceList?sel_service_name=updateProductPrice
>> >
>> > with ARGS
>> >
>> > {
>> >     currencyUomId           "INR",
>> >     fromDate                "2018-04-16 17:39:52",
>> >     price                   150,
>> >     productId               "PROD_SW52D5H3EN",
>> >     productPricePurposeId   "PURCHASE",
>> >     productPriceTypeId      "DEFAULT_PRICE",
>> >     productStoreGroupId     "_NA_",
>> >     taxInPrice              "Y",
>> >     termUomId               "WT_kg"
>> > }
>> >
>> >
>> > I am getting error:
>> >
>> >
>> > faultString:Error running the simple-method: Entity value not found with
>> > name: lookedUpValue Method = updateProductPrice, File =
>> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
>> > minilang/product/price/PriceServices.xml,
>> > Element = <set-nonpk-fields>, Line 69null
>> >
>> >
>> > the minilang def is reproduced here for convinience:
>> >
>> >  <simple-method method-name="updateProductPrice"
>> short-description="Update
>> > an ProductPrice">
>> >         <set field="callingMethodName" value="updateProductPrice"/>
>> >         <set field="checkAction" value="UPDATE"/>
>> >         <call-simple-method method-name="checkProductRelatedPermission"
>> > xml-resource="component://product/minilang/product/
>> > product/ProductServices.xml"/>
>> >         <check-permission permission="CATALOG_PRICE_MAINT">
>> >             <fail-property resource="ProductUiLabels"
>> > property="ProductPriceMaintPermissionError"/>
>> >         </check-permission>
>> >         <check-errors/>
>> >
>> >         <call-simple-method method-name="inlineHandlePriceWithTaxInclud
>> > ed"/>
>> >
>> >         <entity-one entity-name="ProductPrice"
>> > value-field="lookedUpValue"/>
>> >
>> >         <!-- grab the old price value before setting nonpk parameter
>> fields
>> > -->
>> >         <field-to-result field="lookedUpValue.price"
>> > result-name="oldPrice"/>
>> >
>> >         <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
>> >
>> >         <now-timestamp field="nowTimestamp"/>
>> >         <set field="lookedUpValue.lastModifiedDate"
>> > from-field="nowTimestamp"/>
>> >         <set field="lookedUpValue.lastModifiedByUserLogin"
>> > from-field="userLogin.userLoginId"/>
>> >
>> >         <store-value value-field="lookedUpValue"/>
>> >  </simple-method>
>> >
>> > The productID does exists in Entity ProductPrice
>> > Where am I going wrong ?
>> >
>> > thanks & regds
>> > Rajesh Mallah.
>> >
>>
>
>

Re: help with updateProductPrice

Posted by Rajesh Mallah <ma...@gmail.com>.
Hello Mr Deepak ,

Thanks for the response . The record does exists but i guess
i am not specifying the params good enough to hit the record
by pkey.

I wish there were a "product_price_id" in ProductPrice entity. :-)

regds
mallah.





On Tue, Apr 17, 2018 at 9:58 AM, Deepak Dixit <de...@hotwax.co>
wrote:

> Hi Rajesh,
>
> If you want to create product price you should use createProductPrice
> service,
> https://demo-stable.ofbiz.apache.org/webtools/control/
> ServiceList?sel_service_name=createProductPrice
>
> If productPrice record already exists you should use updateProductPrice,
>
> Thanks & Regards
> --
> Deepak Dixit
> Director of Product Engineering
> HotWax Commerce <https://hotwax.co/>
>
> On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>
> > Hi ,
> >
> > I am calling
> >
> > https://demo-stable.ofbiz.apache.org/webtools/control/
> > ServiceList?sel_service_name=updateProductPrice
> >
> > with ARGS
> >
> > {
> >     currencyUomId           "INR",
> >     fromDate                "2018-04-16 17:39:52",
> >     price                   150,
> >     productId               "PROD_SW52D5H3EN",
> >     productPricePurposeId   "PURCHASE",
> >     productPriceTypeId      "DEFAULT_PRICE",
> >     productStoreGroupId     "_NA_",
> >     taxInPrice              "Y",
> >     termUomId               "WT_kg"
> > }
> >
> >
> > I am getting error:
> >
> >
> > faultString:Error running the simple-method: Entity value not found with
> > name: lookedUpValue Method = updateProductPrice, File =
> > file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
> > minilang/product/price/PriceServices.xml,
> > Element = <set-nonpk-fields>, Line 69null
> >
> >
> > the minilang def is reproduced here for convinience:
> >
> >  <simple-method method-name="updateProductPrice"
> short-description="Update
> > an ProductPrice">
> >         <set field="callingMethodName" value="updateProductPrice"/>
> >         <set field="checkAction" value="UPDATE"/>
> >         <call-simple-method method-name="checkProductRelatedPermission"
> > xml-resource="component://product/minilang/product/
> > product/ProductServices.xml"/>
> >         <check-permission permission="CATALOG_PRICE_MAINT">
> >             <fail-property resource="ProductUiLabels"
> > property="ProductPriceMaintPermissionError"/>
> >         </check-permission>
> >         <check-errors/>
> >
> >         <call-simple-method method-name="inlineHandlePriceWithTaxInclud
> > ed"/>
> >
> >         <entity-one entity-name="ProductPrice"
> > value-field="lookedUpValue"/>
> >
> >         <!-- grab the old price value before setting nonpk parameter
> fields
> > -->
> >         <field-to-result field="lookedUpValue.price"
> > result-name="oldPrice"/>
> >
> >         <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
> >
> >         <now-timestamp field="nowTimestamp"/>
> >         <set field="lookedUpValue.lastModifiedDate"
> > from-field="nowTimestamp"/>
> >         <set field="lookedUpValue.lastModifiedByUserLogin"
> > from-field="userLogin.userLoginId"/>
> >
> >         <store-value value-field="lookedUpValue"/>
> >  </simple-method>
> >
> > The productID does exists in Entity ProductPrice
> > Where am I going wrong ?
> >
> > thanks & regds
> > Rajesh Mallah.
> >
>

Re: help with updateProductPrice

Posted by Deepak Dixit <de...@hotwax.co>.
Hi Rajesh,

If you want to create product price you should use createProductPrice
service,
https://demo-stable.ofbiz.apache.org/webtools/control/ServiceList?sel_service_name=createProductPrice

If productPrice record already exists you should use updateProductPrice,

Thanks & Regards
--
Deepak Dixit
Director of Product Engineering
HotWax Commerce <https://hotwax.co/>

On Mon, Apr 16, 2018 at 11:42 PM, Rajesh Mallah <ma...@gmail.com>
wrote:

> Hi ,
>
> I am calling
>
> https://demo-stable.ofbiz.apache.org/webtools/control/
> ServiceList?sel_service_name=updateProductPrice
>
> with ARGS
>
> {
>     currencyUomId           "INR",
>     fromDate                "2018-04-16 17:39:52",
>     price                   150,
>     productId               "PROD_SW52D5H3EN",
>     productPricePurposeId   "PURCHASE",
>     productPriceTypeId      "DEFAULT_PRICE",
>     productStoreGroupId     "_NA_",
>     taxInPrice              "Y",
>     termUomId               "WT_kg"
> }
>
>
> I am getting error:
>
>
> faultString:Error running the simple-method: Entity value not found with
> name: lookedUpValue Method = updateProductPrice, File =
> file:/opt/ofbiz/apache-ofbiz-16.11.04/applications/product/
> minilang/product/price/PriceServices.xml,
> Element = <set-nonpk-fields>, Line 69null
>
>
> the minilang def is reproduced here for convinience:
>
>  <simple-method method-name="updateProductPrice" short-description="Update
> an ProductPrice">
>         <set field="callingMethodName" value="updateProductPrice"/>
>         <set field="checkAction" value="UPDATE"/>
>         <call-simple-method method-name="checkProductRelatedPermission"
> xml-resource="component://product/minilang/product/
> product/ProductServices.xml"/>
>         <check-permission permission="CATALOG_PRICE_MAINT">
>             <fail-property resource="ProductUiLabels"
> property="ProductPriceMaintPermissionError"/>
>         </check-permission>
>         <check-errors/>
>
>         <call-simple-method method-name="inlineHandlePriceWithTaxInclud
> ed"/>
>
>         <entity-one entity-name="ProductPrice"
> value-field="lookedUpValue"/>
>
>         <!-- grab the old price value before setting nonpk parameter fields
> -->
>         <field-to-result field="lookedUpValue.price"
> result-name="oldPrice"/>
>
>         <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
>
>         <now-timestamp field="nowTimestamp"/>
>         <set field="lookedUpValue.lastModifiedDate"
> from-field="nowTimestamp"/>
>         <set field="lookedUpValue.lastModifiedByUserLogin"
> from-field="userLogin.userLoginId"/>
>
>         <store-value value-field="lookedUpValue"/>
>  </simple-method>
>
> The productID does exists in Entity ProductPrice
> Where am I going wrong ?
>
> thanks & regds
> Rajesh Mallah.
>