Create s/o from quote using IM_ImportQueue?  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Create s/o from quote using IM_ImportQueue?

Postby pricerc » Fri Sep 02, 2022 2:20 pm

Customer has some PHP code lurking from Jiwa 6 days that is writing 'shopping cart' orders as XML to IM_ImportQueue.

There was some limitation (too lazy to look it up) that prevented them doing the same when the orders were being converted from a quote.

We're now reviewing if this is still a problem.

I guess my main question is: can I just add the SourceQuoteNo, SourceQuoteID, and/or SourceQuoteHistoryID to the XML?

Or is there something else that I need to do?

A related question would be: If we converted to using the REST API (which I'd like to do), will we be able to use the same call to create both 'shopping cart' and 'from quote' sales orders?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Create s/o from quote using IM_ImportQueue?  Topic is solved

Postby Mike.Sheen » Fri Sep 02, 2022 2:55 pm

pricerc wrote:Customer has some PHP code lurking from Jiwa 6 days that is writing 'shopping cart' orders as XML to IM_ImportQueue.

There was some limitation (too lazy to look it up) that prevented them doing the same when the orders were being converted from a quote.

We're now reviewing if this is still a problem.

I guess my main question is: can I just add the SourceQuoteNo, SourceQuoteID, and/or SourceQuoteHistoryID to the XML?

Or is there something else that I need to do?


I don't think we have a way of importing a sales order and making it appear that it was created from a quote. Exporting the XSD's (from the sales order form - utilities tab) and I can see that there is no fields for the source quote, so you certainly can't do this by importing sales order XML right now - not even if you added SourceQuoteNo, SourceQuoteID, and/or SourceQuoteHistoryID to the XML. If we wanted to do that, what you propose is backwards to what normally happens - we start from a quote and make that a sales order and set the sourcequote fields in the order for you.

The crux of the problem is that the XML imports were for importing documents, and what you want sounds like a process - converting a sales order into a quote.

pricerc wrote:A related question would be: If we converted to using the REST API (which I'd like to do), will we be able to use the same call to create both 'shopping cart' and 'from quote' sales orders?


a POST to /SalesQuotes/{QuoteID}/MakeOrder makes a sales order from a quote,
a POST to /SalesOrders creates a sales order

You can't do it from the same route out of the box, but you can easily add your own route which branches off based on a field in the body to call one of the two standard services. Our standard DTO we have for sales orders doesn't have the SourceQuote fields - but that's as easy as inherit from our sales order DTO, add your own field(s) and your new POST route + service accepts your new extended DTO, looks at the new field and then either calls our standard sales order POST to create a sales order, or the POST to /SalesQuotes/{QuoteID}/MakeOrder to make the sales order from the quote.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Create s/o from quote using IM_ImportQueue?

Postby pricerc » Fri Sep 02, 2022 3:01 pm

Thanks Mike.

a POST to /SalesQuotes/{QuoteID}/MakeOrder makes a sales order from a quote,
a POST to /SalesOrders creates a sales order


That would be fine - the PHP currently has two paths anyway (well technically, just one - it writes to the queue if it is not from a quote, and does nothing otherwise).

I now just have to digest 1500 lines of PHP that I've never seen before to work out what's going on.

Most importantly, I need to confirm that they aren't doing something like 'accepting' a quote and then adding stuff to it.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Create s/o from quote using IM_ImportQueue?

Postby pricerc » Mon Sep 05, 2022 7:37 pm

If I have code generating valid XML for creating sales orders via the import queue, would it be safe to assume that the XML is likely valid input for POSTing to /SalesOrders ?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Create s/o from quote using IM_ImportQueue?

Postby Mike.Sheen » Mon Sep 05, 2022 7:39 pm

pricerc wrote:If I have code generating valid XML for creating sales orders via the import queue, would it be safe to assume that the XML is likely valid input for POSTing to /SalesOrders ?


No.

We went with new DTO's for the REST API. JSON is the preferred format, but XML is there as well - but it's not the same XML format as what we used for the "legacy" import and export.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 29 guests