In v2 of QBO we had an ability to pass the Class (e.g. string name of a class) to any of the entities (Customer, Invoice, Payment etc). To be able to sort/group them by the classes. The question is: how to do the same in v3?
Tried to send some Class entities to QBO - they are being created, but never assigned to any of entities. If you give, for example, a Class Reference to an Invoice (setClassRef()) - it won't populate the Class field of Invoice in QBO. And what is more interesting - if you give an existing Class (created via Classes menu of QBO - https://qbo.intuit.com/app/class) to an Invoice in QBO (populate Class field) and then fetch this invoice's entity - it WON'T contain any Class reference information. Which is strange.
Any help will be appreciated.
Please check if you have enabled Class tracking from Preference Tab
Here is one example where class is being referenced from Invoice.
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-03-03T09:14:13.444-08:00">
<QueryResponse startPosition="1" maxResults="1" totalCount="1">
<Invoice domain="QBO" sparse="false">
<Id>1</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-03-03T09:13:52-08:00</CreateTime>
<LastUpdatedTime>2014-03-03T09:13:52-08:00</LastUpdatedTime>
</MetaData>
<DocNumber>1001</DocNumber>
<TxnDate>2014-03-03</TxnDate>
<CurrencyRef name="United States Dollar">USD</CurrencyRef>
<Line>
<Id>1</Id>
<LineNum>1</LineNum>
<Description>Test product desc</Description>
<Amount>0</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="Hours">2</ItemRef>
<UnitPrice>0</UnitPrice>
<Qty>1</Qty>
<TaxCodeRef>NON</TaxCodeRef>
</SalesItemLineDetail>
</Line>
<Line>
<Amount>0</Amount>
<DetailType>SubTotalLineDetail</DetailType>
<SubTotalLineDetail />
</Line>
<CustomerRef name="Customer123">2</CustomerRef>
<BillAddr>
<Id>2</Id>
<Line1>Customer123</Line1>
<Lat>32.8856854</Lat>
<Long>-96.9343488</Long>
</BillAddr>
<ClassRef name="CLASS-1">3000000000000199718</ClassRef>
<SalesTermRef>3</SalesTermRef>
<DueDate>2014-04-02</DueDate>
<TotalAmt>0</TotalAmt>
<ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>
<PrintStatus>NotSet</PrintStatus>
<EmailStatus>NotSet</EmailStatus>
<Balance>0</Balance>
<Deposit>0</Deposit>
<AllowIPNPayment>false</AllowIPNPayment>
<AllowOnlinePayment>false</AllowOnlinePayment>
<AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment>
<AllowOnlineACHPayment>false</AllowOnlineACHPayment>
</Invoice>
</QueryResponse>
</IntuitResponse>
UI snapshot
Thanks
Related
I am looking for an example for simple use of single_media_upload in SULU AdminUI.
I have a player form, and it has single_media_selection type of field, and it works OK.
Now, how can I use single_media_upload, because, when I replace it instead of single_media_selection, it shows not picture in form after save (but it saves image).
<property name="photo" type="single_media_selection" colspan="4" >
<meta>
<title>playerinfo.playerimage</title>
</meta>
<params>
<param name="types" value="image"/>
</params>
</property>
I replace with
<property name="photo" type="single_media_upload" colspan="4" spaceAfter="2">
<params>
<param name="upload_text">
<meta>
<info_text>app.player_info_upload</info_text>
</meta>
</param>
<param name="skin" value="default"/>
<param name="empty_icon" value="su-user"/>
<param
name="collection_id"
type="expression"
value="service('sulu_media.system_collections.manager').getSystemCollection('sulu_media')"
/>
</params>
</property>
In Entity itself, field is MediaInterface type.
The single_media_upload field-type is not interchangeable with the single_media_selection type. It was implemented for managing the avatar/logo of the built-in contact/account entity and was not optimized for other usecases yet. At the moment, the single_media_upload creates a new media version for the selected media entity rather than creating a separate media entity when uploading a file. This behaviour differs substantially from the single_media_selection and might not fit your usecase. This is also the reason why the field-type is not listed in the Sulu documentation yet.
That said, the reason for your problem is likely that the single_media_upload field-type uses a different data format than the single_media_selection. In general, the field-types of the Sulu form view expect that your API returns the data in the same format as it is sent to the server when submitting the form (see the Form configuration section in the Sulu documentation). You can see the data that is sent to the server by inspecting the request that is made when pressing the save button in the network panel development tools of your browser.
In the case of the single_media_upload field-type, the data that is sent to the server looks like this:
{
"id": 33,
"url": "/media/33/download/photo-1535683939029-0030b4de2382.jpeg?v=1",
"thumbnails": {
"sulu-400x400": "/uploads/media/sulu-400x400/03/33-photo-1535683939029-0030b4de2382.jpg?v=1-0",
...
}
}
If you want to use the field-type in the form of your custom entity, you need to adjust your controller (or the serialization of your entity) to match this format.
I have an issue with build-in (non accessible) webMethods Integration Server soapClient service. Somehow it changes the request it should send while processing it, renaming parameter items to item.
what is send to the method:
<request>
<t1>1</t1>
<operation>op</operation>
<service>1</service>
<params>
<count>1</count>
<items>
<key>12</key>
<value>12</value>
</items>
</params>
</request>
what request webmethods sends:
<request>
<t1>1</t1>
<operation>op</operation>
<service>1</service>
<params>
<count>1</count>
<item>
<key>12</key>
<value>12</value>
</item>
</params>
</request>
I'd be grateful for any workaround/idea for a solution.
I see in your example code that you first create an document named "items", then you map this document to a document list named "items". This is not valid. Please note that the pipeline in IntegrationServer is nothing but a key-value map, and the keys must be unique. That is the reason why you still have a single document named "items" instead of a document list. Rename your document to something like "item", and then use appendToDocumentList to add it to the "items" doc list.
Currently using:
base install of sylius-standard, for an ecommerce website.
Here is what I would like to accomplish :
Basically we know there is an User Entity which resides in
vendor/sylius/sylius/src/Sylius/Component/Core/Model/User.php
This Entity is actually extending the FOS\UserBundle\Model\User and it also has a linked UserInterface which is implementing FOS\UserBundle\Model\UserInterface.
My goal is to create another entity UserData which can be linked via the Doctrine OneToMany field relation to the above sylius User Entity which is basically the table sylius_user.
So effectively User Entity linked to UserData Entity via oneToMany ( For each user there can be multiple UserData entity instances.)
Sylius documentation (http://sylius.readthedocs.org) does not have anything related to adding an entity - If I am mistaken, please guide me to the correct links.
I have read overriding models at - > sylius models override also have gone through another sort of related question on stackoverflow How to create a new model with Sylius via SyliusResourceBundle but it is not clear as he is using the SyliusResourceBundle while I want to extend the SyliusCoreBundle (not sure if we can extend it in the first place or not)
How do I achieve this in the sylius framework ?
I solved the problems by reading segregated posts, so putting in here the solution for the community (please let me know if this is not the recommended way and the correct way if not):
My goal was to create a oneToMany doctrine relationship between
Sylius\Component\Core\Model\User
And
Acme\Bundle\Entity\UserData
which I had created. Basically for every user there could be multiple userdata instances pointing back to that user.
To do this, at first I followed the docs at sylius documentation
to override the sylius user class which is infact an extended class of fosuserbundle.
At some stage I kept getting the error [Doctrine\DBAL\Schema\SchemaException]
The table with name 'astrohealing_dev.sylius_user' already exists.
Based on Winzou's suggestion : To fix this error I changed the user class locations in sylius.yml (Sylius/Bundle/CoreBundle/Resources/config/app/sylius.yml) which is part of the core bundle and declared my own class as the user model like this :
This resolved the sylius_user table exists error
But then I got another error :
[Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException]
Configuration path "sylius_core.driver" cannot be overwritten. You have to define all options for this path, and any of its sub
-paths in one configuration section.
Next I commented out drive : doctrine/orm line for the relevant entry in
app/config/config.yml
sylius_core:
# driver: doctrine/orm
classes:
user:
model: Acme\Bundle\Entity\User
sylius_resource:
resources:
sylius.userdata:
driver: doctrine/orm
classes:
model: Acme\Bundle\Entity\UserData
The above few lines also show :
The override for sylius_core with my new User class
The new resource - which is bascially just the userdata class
Now for the Doctrine Mapping (User.orm.xml):
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Acme\Bundle\Entity\User" table="sylius_user">
<one-to-many
field="userdata"
target-entity="Acme\Bundle\Entity\UserData"
mapped-by="userid" />
</entity>
</doctrine-mapping>
And the mapping for UserData (UserData.orm.xml)
<?xml version="1.0" encoding="UTF-8" ?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Acme\Bundle\Entity\UserData" table="sylius_userdata">
<id name="id" type="integer">
<generator strategy="AUTO" />
</id>
<many-to-one
field="userid"
target-entity="Acme\Bundle\Entity\User"
inversed-by="userdata"
join-column="userid">
<join-column name="user_id" referenced-column-name="id" nullable="false" />
</many-to-one>
<field name="name" type="string" length="150" />
<field name="datetime" type="datetime" />
</entity>
</doctrine-mapping>
We want to manually adjust/update the Inventory of an Item using QBO V3 API.
But, the QtyOnHand did not get updated on QBO properly. We re-checked using QBO browser app too.
First Request : Create a product of type "Inventory" on QBO with "QtyOnHand" set to 100.
a. The response appropriately mentioned that the product is created.
Second Request : Update the above product with "QtyOnHand" set to 200.
b. The response still contains the older QtyOnHand (100). It didn't reflect that new QtyOnHand.
How can we manually adjust / update QtyOnHand using QBO V3 API?
For reference, our update request is:
<IntuitBatchRequest xmlns="http://schema.intuit.com/finance/v3">
<BatchItemRequest operation="update" bId="0">
<Item>
<Id>2091</Id>
<SyncToken>0</SyncToken>
<Name>Product 26--var 2</Name>
<Description>false</Description>
<Taxable>true</Taxable>
<UnitPrice>1000.00</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef>62</IncomeAccountRef>
<ExpenseAccountRef>111</ExpenseAccountRef>
<AssetAccountRef>112</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>200</QtyOnHand>
<InvStartDate>2014-01-21</InvStartDate>
</Item>
</BatchItemRequest>
</IntuitBatchRequest>
Our response XML is:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-01-20T23:21:44.559-08:00">
<BatchItemResponse bId="0">
<Item domain="QBO" sparse="false">
<Id>2091</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-01-20T22:44:10-08:00</CreateTime>
<LastUpdatedTime>2014-01-20T22:44:10-08:00</LastUpdatedTime>
</MetaData>
<Name>Product 26--var 2</Name>
<Description>false</Description>
<Active>true</Active>
<FullyQualifiedName>Product 26--var 2</FullyQualifiedName>
<Taxable>true</Taxable>
<UnitPrice>1000</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef name="Sales">62</IncomeAccountRef>
<PurchaseCost>0</PurchaseCost>
<ExpenseAccountRef name="Cost of Goods Sold">111</ExpenseAccountRef>
<AssetAccountRef name="Inventory Asset">112</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>100</QtyOnHand>
<InvStartDate>2014-01-21</InvStartDate>
</Item>
</BatchItemResponse>
</IntuitResponse>
The QtyOnHand field is not an update-able field.
Inventory adjustments are made when:
You create a transaction that uses up inventory (Sales Receipts, Invoices, etc.)
You create a transaction that returns inventory (Credit Memos)
You issue an Inventory Adjustment (unfortunately, Intuit's API does not support this yet)
Given that the API does not support inventory adjustments yet, I don't think you'll be able to do what you're trying to do.
My script for automatically generating invoices using the V2 api has stopped working even though my code is unchanged. The problem seems to be related to my use of the AUTO_GENERATE flag for the DocNumber field. I need QBO to auto-generate a DocNumber and this method was working fine for me up until today. I tried removing DocNumber completely, which created an invoice, however that invoice had no DocNumber id associated with it which I require. Please let me know if there is a workaround of if something was changed on QBO's side which could be fixed.
Also, please don't ask me to just upgrade to the V3 API, eventually I would like to but this is not feasible right now.
MY HTTP request:
POST /qbo30/resource/invoice/v2/<MY_REALM_ID>
...oauth headers...
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2">
<Header>
<DocNumber>AUTO_GENERATE</DocNumber>
<CustomerId>399</CustomerId>
<SalesTermId>12</SalesTermId>
<Msg/>
<Note>Nov 2013</Note>
</Header>
<Line>
<ItemId>5</ItemId>
<Desc>Clickthrough Advertising</Desc>
<Qty>125</Qty>
<UnitPrice>0.25</UnitPrice>
<Amount>31.25</Amount>
</Line>
<Line>
<ItemId>17</ItemId>
<Desc>Minimum Monthly Charge</Desc>
<Qty>1</Qty>
<UnitPrice>68.75</UnitPrice>
<Amount>68.75</Amount>
</Line>
</Invoice>
QBO's response:
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Date: Mon, 02 Dec 2013 21:19:39 GMT
header: Server: Apache
header: Content-Length: 283
header: Vary: Accept-Encoding
header: Connection: close
header: Content-Type: application/xml
<FaultInfo xmlns="http://www.intuit.com/sb/cdm/baseexceptionmodel/xsd">
<Message>You must specify a different number. This number has already been used.</Message>
<ErrorCode>BAD_REQUEST</ErrorCode>
<Cause>-13006</Cause>
</FaultInfo>
It turns out I had two invoices in our system with the same invoice number. I had to change the number on the offending invoice, then create a new dummy invoice with a higher number which seems to have incremented the auto-increment value appropriately.
Thanks for the comments and the assistance!
Just now, I've tried this. It is working fine for me. PFB details.
Please check if you are missing something.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:ns2="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:ns3="http://www.intuit.com/sb/cdm/qbo">
<Header>
<DocNumber>AUTO_GENERATE</DocNumber>
<TxnDate>2013-12-02-08:00</TxnDate>
<CustomerId idDomain="QBO">1</CustomerId>
<SubTotalAmt>100.00</SubTotalAmt>
<TotalAmt>100123.00</TotalAmt>
<ToBePrinted>true</ToBePrinted>
<ToBeEmailed>false</ToBeEmailed>
<SalesTermId idDomain="QBO">3</SalesTermId>
<DueDate>2014-01-01-08:00</DueDate>
<ShipMethodId idDomain="QBO" />
<Balance>100321.00</Balance>
<DiscountTaxable>true</DiscountTaxable>
</Header>
<Line>
<Desc>Test</Desc>
<Amount>100.00</Amount>
<Taxable>false</Taxable>
<ItemId idDomain="QBO">2</ItemId>
</Line>
</Invoice>
Response
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">9</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-12-02T23:17:49-08:00</CreateTime>
<LastUpdatedTime>2013-12-02T23:17:49-08:00</LastUpdatedTime>
</MetaData>
<Header>
<DocNumber>1003</DocNumber>
<TxnDate>2013-12-02-08:00</TxnDate>
<CustomerId idDomain="QBO">1</CustomerId>
<SubTotalAmt>100.00</SubTotalAmt>
<TotalAmt>100.00</TotalAmt>
<ToBePrinted>true</ToBePrinted>
<ToBeEmailed>false</ToBeEmailed>
<SalesTermId idDomain="QBO">3</SalesTermId>
<DueDate>2014-01-01-08:00</DueDate>
<ShipMethodId idDomain="QBO" />
<Balance>100.00</Balance>
<DiscountTaxable>true</DiscountTaxable>
</Header>
<Line>
<Desc>Test</Desc>
<Amount>100.00</Amount>
<Taxable>false</Taxable>
<ItemId idDomain="QBO">2</ItemId>
</Line>
</Invoice>
It could be a bug or there could be some issues in your QBO account. Please raise a support ticket for this.
Thanks