08-07-2016, 04:34 PM
Let me know how it goes.
Joe
TSolucio
TSolucio
Using the standard 'create invoice from salesorder' in workflows
|
(08-07-2016, 03:33 PM)joebordes Wrote: The missing ampersand has nothing to do with the problem. The correct way to define the task is WITH the ampersand. Thanks, I've seen abstract class definitions but never quite knew what they were. I know about interfaces (never implemented them but they're in the book I'm reading) but never knew abstract classes had similar behaviour. Anyway, the thing I am curious about is why your example does not have to implement the argument as a reference here. (08-07-2016, 03:55 PM)joebordes Wrote: Why did you change the name here: I've used this code to start: PHP Code: include_once 'include/Webservices/Revise.php'; [url=https://wiki.vtiger.com/index.php/ServerAPI_reference_manual][/url] (08-07-2016, 03:48 PM)joebordes Wrote: Next up is the default value for the due date. You should not need to setup the workflow task to get the duedate offset. This is better done using (Field) Mapping Business Mapping Thanks, I'll give that a try. But one question: would it be possible to create one workflow that sets the date of the invoice 30 days from now and create another that sets the date 60 days? So we can check certain conditions and base the invoice duedate on that? I certainly see the power of the business maps, but would it be an idea to create a dropdown in the workflow config where you can select a business map to execute or does my limited knowledge of the module make me think in the wrong direction here? About the label 'pdoInformation' to 'LineItems': even if this was wrong, the workflow still should've worked. I transfer the complete $wsso array into $data first, thereby creating a label called 'pdoInformation' in the $data array. I create the LineItems label as a copy since I thought this is what the system wanted on invoice creation through webservice. Although this worked in a separate testfile, it does not when you use it in a workflow. I wish there was a better way of debugging workflows, so I could see what's going on.. (08-07-2016, 04:33 PM)joebordes Wrote: Ok, I had a look. This is what you have to do I will test this and let you know.
08-08-2016, 10:53 AM
> Tag task was uploaded incorrectly and then fixed, note that your reference is of July 2014 and then it was fixed in Oct 2014, it is now correct in the latest version of the code
> your example code is from VT6, we implemented the lines differently
Joe
TSolucio
08-08-2016, 10:54 AM
Quote:one question: would it be possible to create one workflow that sets the date of the invoice 30 days from now and create another that sets the date 60 days? So we can check certain conditions and base the invoice duedate on that? I certainly see the power of the business maps, but would it be an idea to create a dropdown in the workflow config where you can select a business map to execute or does my limited knowledge of the module make me think in the wrong direction here? I don't think so, please open another thread with this question and give me an example of the conditions.
Joe
TSolucio
08-08-2016, 10:57 AM
Quote:About the label 'pdoInformation' to 'LineItems': even if this was wrong, the workflow still should've worked. I transfer the complete $wsso array into $data first, thereby creating a label called 'pdoInformation' in the $data array. I create the LineItems label as a copy since I thought this is what the system wanted on invoice creation through webservice. Although this worked in a separate testfile, it does not when you use it in a workflow. I wish there was a better way of debugging workflows, so I could see what's going on.. you are right, that should have worked. it is not easy to debug workflow tasks, we have created the separate background.log file, which you can write to using the global variable $logbg That may help a little as we basically use that log for background tasks like workflows.
Joe
TSolucio (08-08-2016, 10:53 AM)joebordes Wrote: > Tag task was uploaded incorrectly and then fixed, note that your reference is of July 2014 and then it was fixed in Oct 2014, it is now correct in the latest version of the code Ah, so basically I was looking at a wrong example? PHP Code: $focus = getConvertSoToInvoice($focus, $so_focus, $soid); // this will do the Mapping for the duedate and others SalesOrder2Invoice Is this native CRM code? I mean the 'getConvertSoToInvoice' function?
I don't fully understand this code:
PHP Code: $focus = CRMEntity::getInstance('Invoice'); First, we create an invoice instance. Then we get the SO's CRM id. We also create a Salesorder instance. Both instances are empty, they still have to be filled with specific data. We do that by calling 'retrieve_entity_info' which we feed the CRM id but still, one line before that we have to manually set the SO's instance with the SO ID? Then, after we've told so_focus which ID it needs to base itself on, we have to feed the soid yet again to the 'getConvertSoToInvoice' function? I am testing the instance of invoice now, after I call the getConvertSoToInvoice. It seems now I know why the native Account number and salesorder ID were never filled out on creating an invoice ffrom a sales order: this function does not fill them. I now have the following code in a test file: PHP Code: <?php The first lines are only for testing of course (the lines that get the SO crm id from the DB). It gives me: Code: Fatal error: Uncaught exception 'WebServiceException' with message 'Permission to perform the operation is denied for id' in / Wait, again the WEBSERVICE ID of course.... stupid of me.
08-08-2016, 08:47 PM
In short, the code you suggested may work if you get the WEBSERVICE id for each related ID you enter. so for account, assigned user and such: you need to overwrite it to get the webservice ID's. Your approach was to get the native invoice instance and add the product lines through webservice. I think it is best the other way around: get a webservice object and then overwrite with the native invoice object where needed.
You can use
PHP Code: DataTransform::sanitizeReferences() to accomplish this. Have a look here at how I use it to unit test the DataTransform API https://github.com/tsolucio/coreBOSTests/blob/master/include/Webservices/DataTransformTest.php#L55 basically get the webservice object for invoice and pass it into sanitizeReferences with the data array
Joe
TSolucio |
« Next Oldest | Next Newest »
|